query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
If there are two or more words that are the same length, return the first word from the string with that length. Ignore punctuation and assume sen will not be empty.
def longest_word(sen) tmp_arr = sen.split(" ") tmp_longest = 0 tmp_arr.each do |i| tmp_longest = i.size if i.size > tmp_longest end tmp_arr.select { |i| i.size == tmp_longest }.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 LongestWord(sen)\n\tarr = sen.gsub(/[^a-zA-Z]+/m, ' ').strip.split(\" \")\n\tcounter = \"\" \n\t\tarr.each do |word|\n\t\t\tif word.length >= counter.length \n\t\t\t\tcounter = word \n\t\t\tend\n\t\tend\n\t\tcounter\nend", "def LongestWord(sen)\n longest = \"\"\n sen.scan(/\\w+/) do |word|\n if word.length > longest.length\n longest = word\n end\n end\n \n return longest\nend", "def get_the_shortest_word(str)\n str.split(\" \").sort! {|s, l| s.length <=> l.length}[0]\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 find_short(s)\n return s.split(' ').min_by{|word| word.length}.length\nend", "def find_short(s)\n l = s.split(\" \").min_by { |x| x.length}.length\n return l #l: length of the shortest word\nend", "def longest_word (sen)\n i = 0\n while i < sen.length do\n # negated regex boolean\n if sen[i] !~ /[a-z]|\\s/\n sen.slice!(i)\n else\n sen[i]\n i += 1\n end\n end\n return sen.split(\" \").max_by(&:length).length\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 shortest_string(list_of_words)\n return nil if no_string?(list_of_words)\n return list_of_words[0] if one_string?(list_of_words)\n \telse\n \t\tfirst_word = list_of_words[0]\n \t\tx = 1\n \t\twhile x < list_of_words.length\n \t\t\tif first_word.length > list_of_words[x].length\n \t\t\t\tfirst_word = list_of_words[x]\n \t\t\tend\n \t\t\tx += 1\n \t\tend\n \t\treturn first_word\nend", "def LongestWord(sen)\n arr = sen.split(\" \")\n arr.sort! { |a, b| b.length <=> a.length }\n arr[0]\n\nend", "def find_short(s)\n return s.split(\" \").map { |word| word.length }.min\nend", "def first_word(sentence)\n\tsentence.split(\" \").first\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 shortest_string(list_of_words)\n if list_of_words == []\n \treturn nil\n else\n \tcounter = 0\n \tshortest_word = ''\n \tshorest_word_length = list_of_words[0].length\n \twhile counter < list_of_words.length\n \t\tif shorest_word_length >= list_of_words[counter].length\n \t\t\tshortest_word = list_of_words[counter]\n \t\tend\n \tcounter += 1\n \tend\n end\n return shortest_word\nend", "def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest_length = list_of_words.first.length\n shortest_word = ''\n list_of_words.each do |word|\n if word.length <= shortest_length\n shortest_length = word.length\n shortest_word = word\n else\n shortest_word = shortest_word\n end\n end\n return shortest_word\n end\nend", "def first_word(str); str.split.first end", "def first_word string\n string.split(' ')[0]\nend", "def find_short(s)\n # your code here\n the_1st_array = s.split(\" \")\n this_counts = []\n i = 0\n while i < the_1st_array.count\n this_counts.push(the_1st_array[i].length)\n i+=1\n end\n l = this_counts.min\n return l # l: length of the shortest word\nend", "def shortest_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.min == string.length\n\t\t\t\treturn string\n\t\t\tend\n\t\tend\n\n\tend\n\nend", "def start_of_word word, length\n word.chars.take(length).join\nend", "def first_word(s)\n\ta = s.split()\n\treturn a[0]\nend", "def first_word(string)\n\tstring.split(\" \")[0]\nend", "def LongestWord(str)\n words = str.split.map { |s| s.gsub(/\\W/, '') }\n longest = words [0]\n words.each { |word| longest = word if word.length > longest.length }\n longest\nend", "def get_the_shortest_word(str)\n words = str.split()\n return words.max\nend", "def first_word(sentence)\n\t\tsentence.split[0]\nend", "def first_word(string)\n\treturn string.split.first \nend", "def first_word(words)\n\twords.split(\" \")[0]\nend", "def shortest_word(words)\n words.inject { |memo, word| memo.length < word.length ? memo : word}\nend", "def get_the_longest_word(str)\n str.split(\" \").sort! {|s, l| l.length <=> s.length}[0]\nend", "def shortest_string(list_of_words)\n if list_of_words.empty? == true\n return nil\n end\n word = 1\n list_of_words.each do |x|\n if x.length <= word.to_s.length\n word = x\n end\n end\n p word\nend", "def find_short(s)\n s.split(' ').map{|e|e.length}.min\nend", "def shortest_string(list_of_words)\n if list_of_words == []\n return nil\n end\n i = 0\n array_length = array_size(list_of_words)\n smallest_index = 0\n for i in 0..array_length - 1\n if string_length(list_of_words[smallest_index]) > string_length(list_of_words[i])\n smallest_index = i\n end\n end\n return list_of_words[smallest_index]\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 first_word(string)\n\twords = string.split(\" \")\n\treturn words[0]\nend", "def shortest_string(list_of_words)\n if list_of_words.empty? \n return nil\n end\n \n short=list_of_words[0]\n list_of_words.each { |str| \n if str.length < short.length\n short=str\n end \n }\n return short\nend", "def middle_word(string)\n words = string.split(' ')\n size = words.size\n if size == 0\n \"Invalid input! Empty string!\"\n elsif size.even?\n \"Invalid input! Even number of words in sentance!\"\n elsif size == 1\n \"Invalid input! Only one word in the string!\"\n else\n words[-(size/2)-1]\n end\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_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 trim_to_word( max_length )\n string = self\n if string.length > max_length\n string = string[0..max_length-4]\n while string[-1,1] =~ /[\\w]/ && string.length > 1\n string = string[0..string.length-2]\n end\n string += \"...\"\n end\n string\n end", "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 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 first_word(text)\n text.split.first\nend", "def shortest_string(list_of_words)\n if list_of_words.length == 0\n nil\n else\n index = 0\n shortest_word = list_of_words[0]\n while index < list_of_words.length do\n if list_of_words[index].length <= shortest_word.length\n shortest_word = list_of_words[index]\n end\n index+=1\n end\n shortest_word\n end\n end", "def first_word(input)\n # Split string into array of words and select first entry\n input.split(\" \")[0]\nend", "def first_word(text)\n first_word = ''\n for num in 0...text.length\n break if text[num] === ' '\n first_word << text[num]\n end\n first_word\nend", "def first_word(text)\n\treturn text.split.first\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 first_word (phrase)\n morceaux = phrase.split\n return morceaux[0]\nend", "def first_word(str)\n\treturn str.split[0]\nend", "def first_word(str)\n str.split[0]\nend", "def shortest_string(list_of_words)\n shortest = list_of_words[0]\n\n list_of_words.each do |word|\n if word.length < shortest.length\n shortest = word\n end\nend\n\nreturn shortest\nend", "def first_word str\n arr = str.split(' ')\n arr[0]\nend", "def words_of_same_length(word)\n\treturn $words[word.length]\nend", "def first_word (s)\n # On mets tout les mots dans un tableau et on revoie le contenue le la première case du tableau\n s.split.first\nend", "def start_of_word(str, l); l == 1 ? str[0] : str[0...l] end", "def shortest_string(list_of_words)\n list_of_words.min_by(&:length)\nend", "def shortest_string(list_of_words)\n list_of_words.min_by(&:length)\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 shortest_string(list_of_words)\n shortest = list_of_words[0]\n for word in 1...list_of_words.length\n if shortest.length > list_of_words[word].length then\n shortest = list_of_words[word]\n end\n end\n return shortest\nend", "def middle_word(text)\n words = text.split\n return '' if words.size <= 1\n\n words[words.size / 2]\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 shortest_string(list_of_words)\n\tif list_of_words==[]\n\t\treturn nil\n\telse\n\t\tshort_string=list_of_words[0]\n \t\tlist_of_words.each do |x|\n \t\t\tif x.length < short_string.length\n \t\t\t\tshort_string = x\n\t\t\tend\t\t\n\t\tend\n \t\treturn short_string\n \tend\nend", "def shortest_string(list_of_words)\n\treturn list_of_words.min_by {|x| x.length }\nend", "def first_word(word)\n\treturn word.split[0]\nend", "def first_word(word)\n words = word.split(\" \")\n words[0]\nend", "def first_word (a)\n\t return a.split[0]\nend", "def find_short(sentence)\n word_array = sentence.split\n\n word_array.sort! do |word_a, word_b|\n word_a.length <=> word_b.length\n end\n\n return word_array.first.length\nend", "def find_longest_word(string)\n sentence = string.split\n longest_word = \"\"\n sentence.each do |word|\n word.gsub!(/\\W/, \"\") # filters out non alphanumeric\n longest_word = word if word.length >= longest_word.length\n end\n longest_word\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 middle_word(string)\n words = string.split\n word_count = words.length\n mid_index = word_count / 2\n if word_count == 0\n ''\n elsif word_count.even?\n # if even number of words, return the two words across the middle.\n \"#{words[mid_index - 1]} #{words[mid_index]}\"\n else\n words[mid_index]\n end\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 find_longest_word(input)\n array = input.split(\" \")\n array.sort! { |x, y| y.length <=> x.length }\n array[0]\nend", "def first_word\r\n text =~ /^.*?\\S.*?/\r\n $&\r\n end", "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 shortest_string(list_of_words)\n list_of_words = list_of_words.sort_by {|x| x.length}\n short_string = list_of_words[0]\n return short_string\nend", "def shortest_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 first_word(word)\n\treturn \"#{word}\".split.first ###### divise le premier element du reste de la chaine\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_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 middle_word(str)\n words = str.split(\" \")\n middle_word = words[words.size/2]\nend", "def shortest_string(list_of_words)\n \n array = []\n\n list_of_words.each {|value|\n \tarray << value.length\n }\n\n if array.empty?\n \tnil\n else\n return list_of_words[array.index(array.min)]\n end\n\nend", "def find_longest_word(sentence)\n # removes special characters | sorts by length | reverses to start with the longest\n longest = sentence.split(/\\W+/).sort_by { |word| word.length }.reverse!\n longest[0]\nend", "def shortest_string(list_of_words)\n # Your code goes here!\n shortest = list_of_words[0]\n\n list_of_words.each { |word| \n if word.length < shortest.length\n shortest = word\n end\n }\n\n return shortest\nend", "def start_of_word(a)\n return a.chars.first.join\nend", "def shortest_string(list_of_words)\n length_of_words = {}\n list_of_words.each do |word|\n word_length = word.length\n length_of_words[word] = word_length\n end\n answer = length_of_words.min_by{|k,v| v}\n if answer == nil\n return nil\n else\n answer.first\n end\nend", "def shortest_string(list_of_words)\n\tif list_of_words.length == 0\n\t\treturn nil\n\tend\n\tlist_of_words.sort_by! {|i| i.length}\n\treturn list_of_words[0]\nend", "def longest_two_words(string)\n string.gsub(/[[:punct:]]/, '').split.sort_by(&:length)[-2..-1]\nend", "def shortest_string(list_of_words)\n if list_of_words.empty?\n return nil\n else\n shortest = list_of_words[0]\n list_of_words.each.to_s do |x|\n if list_of_words.length < shortest\n shortest = x\n end\n end\n end\n return shortest\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 shortest_string(list_of_words)\n if list_of_words.length == 0\n \treturn nil\n end\n shortest_str = list_of_words[0]\n list_of_words.each do |str| \n \tif str.size < shortest_str.size\n \t\tshortest_str = str\n \tend\n end\n shortest_str\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 shortest_string(list_of_words)\n \n short_string = list_of_words[0]\n \n i = 0\n while i < list_of_words.length\n current_item = list_of_words[i]\n if current_item.length < short_string.length\n short_string = current_item\n end\n i = i + 1\n\n end\n short_string\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 shortest_string(list_of_words)\n shortest = list_of_words[0]\n array_number = 1\n while array_number < list_of_words.length\n \tif list_of_words[array_number].length < shortest.length\n \t\tshortest = list_of_words[array_number]\n \tend\n \tarray_number += 1\n end\n return shortest\nend", "def shortest_string(list_of_words)\n # Your code goes here!\n if list_of_words.empty?\n return nil\n end\n shortest_word = list_of_words[0]\n for word in list_of_words\n if word.length < shortest_word.length\n shortest_word = word\n end\n end\n return shortest_word\n\nend", "def shortest_string(list_of_words)\n\n#If presented with an array of mixed objects, maybe not all strings\n# strings = []\n# list_of_words.each do |i|\n# if i.is_a? String\n# strings.push(i)\n# end\n# end\n\n\n\n if list_of_words.length ==0\n return nil\n else\n i=0\n shorty = list_of_words[0]\n while i<list_of_words.length do\n if list_of_words[i].length <= shorty.length\n shorty = list_of_words[i]\n end\n i += 1\n end\n return shorty\n end\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_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 shortest_string(list_of_words)\n\treturn list_of_words.min{|a,b| a.size <=> b.size}\nend" ]
[ "0.781355", "0.758387", "0.74880713", "0.74303347", "0.73972505", "0.7377614", "0.7355616", "0.7231046", "0.7179081", "0.7120521", "0.70515186", "0.7044977", "0.7025602", "0.7022134", "0.7019273", "0.6981005", "0.6978153", "0.69676393", "0.69303095", "0.6930229", "0.6918541", "0.6913213", "0.6890667", "0.6867375", "0.6864495", "0.6836116", "0.6828815", "0.6782521", "0.67589414", "0.6757986", "0.6752001", "0.6713143", "0.67060137", "0.6700114", "0.66906154", "0.668472", "0.66836524", "0.6683358", "0.66768336", "0.6671723", "0.6659513", "0.66574734", "0.6643902", "0.662719", "0.6626571", "0.66213727", "0.660991", "0.6609507", "0.6606227", "0.6606132", "0.6600773", "0.6594053", "0.65930873", "0.6589846", "0.6584737", "0.65789527", "0.65768224", "0.65768224", "0.657359", "0.6567339", "0.65660006", "0.6565872", "0.6560191", "0.65580463", "0.6552885", "0.65478724", "0.65369403", "0.6517868", "0.6516508", "0.6502217", "0.64977", "0.6494581", "0.6493246", "0.64826584", "0.6479429", "0.64586246", "0.64548343", "0.6433684", "0.6419109", "0.6417301", "0.6392552", "0.6392305", "0.6388806", "0.63806164", "0.6374807", "0.63706887", "0.6369439", "0.6364969", "0.63585275", "0.6357744", "0.6356799", "0.63525504", "0.6349405", "0.63452613", "0.6337842", "0.63329166", "0.632315", "0.6317218", "0.63111717", "0.63091224" ]
0.6989949
15
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.welcome_email.subject
def product_email(product, user) @greeting = 'Hi' @product = product mail to: user.email end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = \"#{I18n.t(\"#{recipient_type.to_s}_subject_#{alert_name.to_s}\", subject_variables)}\"\n subject\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def message_subject=(value)\n @message_subject = value\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def set_EmailSubject(value)\n set_input(\"EmailSubject\", value)\n end", "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:devise, :mailer, key],\n :default => [:subject, key.to_s.humanize])\n end", "def subject\n @mail.subject\n end", "def subject\n @subject ||= Envelope::MessageTools.normalize(message.subject || '')\n end", "def subject\n self['subject'] || msg['subject']\n end", "def get_email_subject(email_type)\n email_subject = email_type\n case(email_type)\n when \"welcome\"\n email_subject = \"Welcome to Aspera Files\"\n when \"reset\"\n email_subject = \"Password Reset\"\n end\n return email_subject\n end", "def subject_for(template, attributes = {})\n subject = EmailTemplate.subject_for(template)\n subject = I18n.t(\"email_templates.#{template}.default_subject\") if subject.nil?\n subject = \"No Subject\" if subject.nil?\n Florrick.convert(subject, add_default_attributes(attributes))\n end", "def welcome_email(user)\n @user = user\n mail(to: @user.email, subject: t(\"users.email.welcome.subject\"))\n end", "def subject\n @subject ||= \"(sans sujet)\"\n if @no_header_subject.nil?\n \"#{header_subject}#{@subject}\"\n else\n @subject\n end\n end", "def subject() self.headers[\"Subject\"] || \"[NO SUBJECT]\" end", "def welcome_email\n NotifierMailer.welcome_email User.take\n end", "def welcome_email(resource)\n \n @resource = resource\n\n mail :to => @resource.email, :from => \"email@domain.com\", :subject => \"Subject line\"\n \n end", "def subject=(subject); @message_impl.setSubject subject; end", "def welcome_email\n UserMailer.welcome_email\n end", "def welcome_email\n UserMailer.welcome_email\n end", "def translate(mapping, key)\n I18n.t(:\"notifications_subject\", :scope => [:eventifier, :notifications, key],\n :default => [:subject, key.to_s.humanize])\n end", "def send_welcome_email(user)\n mail to: user.email, subject: \"Sign Up Confirmation - Welcome to NetworkMill\"\n Email.create(:user_id => user.id, :sent_to => user.email, :title => \"welcome_email\")\n end", "def welcome_email(user)\n \t@user = user\n\n \tmail :to\t\t=> user.email,\n \t\t :subject\t=> \"Welcome to Project Help!\"\n end", "def subject\n @options.fetch(:subject) { \"Invitation\" }\n end", "def subject=(string)\n set('Subject', string)\n end", "def welcome_email(user_info)\n @email = user_info[:mail]\n @name = user_info[:name]\n mail(:to => @email, :subject => \"تم تأكيد تسجيلك في !\")\n end", "def deliver_invitation(options = {})\n super(options.merge(subject: _('A Data Management Plan in %{application_name} has been shared with you') % {application_name: Rails.configuration.branding[:application][:name]}))\n end", "def email_subject(&blk)\n @email_subject_block = blk if blk\n @email_subject_block\n end", "def subject_name=(value)\n @subject_name = value\n end", "def email_subject(form)\n \"#{form.type_of_enquiry} - #{reference}\"\n end", "def welcome_mail(user)\n mail to: user.email,\n subject: \"Welcome to Startglory\"\n\n end", "def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def setSubject(subject)\n @fields['subject'] = subject\n self\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def set_Subject(value)\n set_input(\"Subject\", value)\n end", "def welcome(organisation)\n @organisation = organisation\n\n if !@organisation.email.nil? and ['en', 'fr'].include? @organisation.locale\n I18n.with_locale(@organisation.locale) do\n mail(to: @organisation.email, subject: t('emails.welcome.subject')) do |format|\n format.html { render layout: 'email_simple.html.erb' }\n format.text\n end\n end\n end\n end", "def welcome_user_email(user)\n @user = user\n @url = login_url\n mail(\n :subject => \"Welcome to StudyHall\",\n :from => \"noreply@studyhall.com\",\n :to => @user.email\n )\n end", "def welcome_email(person, options = {})\n @person = person\n @host = ENV['HOST_NAME'] || \"localhost:3000\"\n\n mail(:to => [@person.personal_email],\n :subject => options[:subject] || \"Welcome to Carnegie Mellon University Silicon Valley (\" + @person.email + \")\",\n :date => Time.now)\n\n end", "def group_welcome_email\n NotifierMailer.group_welcome_email Group.take\n end", "def welcome_email(user)\n @user = user\n mail( to: user.email,\n subject: 'Thanks for signing up for Shiftable!',\n sent_on: Time.now )\n end", "def custom_mail( user, subject, title, contents )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @contents = contents\n @title = title\n #subject: \"[#{ GogglesCore::AppConstants::WEB_APP_NAME }@#{ @host }] #{ subject }\",\n mail(\n subject: \"#{ subject } [#{GogglesCore::AppConstants::WEB_APP_NAME}]\",\n to: user.email,\n date: Time.now\n )\n end", "def setup_email(user)\n @recipients = user.email\n @body[:user] = user\n @from = FROM_EMAIL\n @subject = case ENV['RAILS_ENV'] \n when 'development': \"[YourApp Development] \"\n when 'staging': \"[YourApp Staging] \"\n else \"[YourApp] \"\n end\n @sent_on = Time.now\n headers \"Reply-to\" => FROM_EMAIL\n end", "def send_welcome\n UserMailer.welcome_email(self).deliver\n end", "def welcome_email(user)\n @user = user\n\n mail to: user.email, subject: 'Welcome to Alumni Connection!', from: 'WebMaster@AlumniConnection.com'\n end", "def subject_name\n return @subject_name\n end", "def welcome_email(user)\n @user = user\n mail to: @user.email, subject: 'Welcome to Our Jungle Store'\n end", "def welcome_email(user)\n @user = user\n @subject = \"Welcome to Rays Cruiser, home of customized cruisers\"\n result = mail(:to => @user.email, :subject => @subject)\n # puts \"+++++++ Notification Email status: -> \" + result.to_s\n end", "def set_title\n @title = t(:message_2, :scope => [:controller, :exams])\n end", "def getEmailDefaults(subject, toEmail, ccEmail = nil)\n if Rails.env.eql? 'development'\n subject = \"[BASL-DEV] #{subject}\"\n toEmail = 'paigepon@gmail.com'\n ccEmail = toEmail\n else\n subject = \"[BASL] #{subject}\"\n end\n mailInfo = {\n :to => toEmail,\n :subject => subject,\n :cc => ccEmail\n }\n mailInfo\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def send_welcome\n UserMailer.welcome_email(self).deliver!\n end", "def welcome_email\n # NewsletterMailer.welcome_email.deliver\n mail(:to => \"rajakuraemas@gmail.com\", :subject => \"Welcome to My Awesome Site\")\n end", "def send_welcome_email\n UserMailer.welcome(self).deliver_now\n end", "def welcome_email(user, currenthost)\n\t @user = user\n\t @currenthost = currenthost\n\n\t mail(to: @user.email, subject: 'Welcome to Changefindr').deliver()\n\tend", "def welcome_email(user)\n\t\t@user = user\n\t\tmail(to: user.email.to_s, subject: \"Welcome to Interest Points\")\t\n\tend", "def welcome_email(user)\n @user = user\n @url = 'http://example.com/login' #\n mail(to: @user.email, subject: 'Welcome to My Awesome Site') #gets user email address and supplies a generic subject line\n end", "def user_added_email(user)\n ActsAsTenant.without_tenant do\n @course = user.course\n end\n @recipient = user.user\n\n I18n.with_locale(@recipient.locale) do\n mail(to: @recipient.email, subject: t('.subject', course: @course.title))\n end\n end", "def get_subject_name\n subject_name = subject_header.text.sub! 'Subject:', ''\n subject_name = subject_name.strip!\n subject_name\n end", "def user_welcome_notice(user)\n @user = user\n mail(:to => @user.email, :subject => \"Welcome to SocialStreet\") unless @user.email.blank?\n end", "def send_welcome(user)\n @user = user\n mail(:to => user.email, :subject => \"Welcome to My Awesome Site\", :content_type => 'text/html', :template_name => 'send_welcome.html')\n end", "def subject_titles\n @subject_titles ||= sw_subject_titles\n end", "def subject_name\n subject_full_name\n end", "def welcome_signup_email(signup)\n @signup = signup\n mail(\n :subject => \"We will be coming to your school soon!\",\n :from => \"noreply@studyhall.com\",\n :to => @signup.email\n )\n end", "def headers\n { subject: \"#{I18n.t('cms.contact_form.subject_prefix')}: #{reason}: #{subject}\",\n to: Account.current.preferred_support_email,\n from: Account.current.preferred_support_email,\n reply_to: %(\"#{name}\" <#{email}>) }\n end", "def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end", "def welcome_email(user)\n @greeting = \"Hi\"\n\n mail to: user.email\n end", "def choose_subject(action, params = {})\n scope = [:mailers, mailer_name, action]\n key = :subject\n experiment_name = \"#{mailer_name}_mailer_#{action}_subject\".to_sym\n if experiment_active?(experiment_name)\n scope << key\n key = ab_test(experiment_name)\n end\n params.merge!(scope: scope)\n I18n.t(key, params)\n end", "def send_welcome_mail\n UserMailer.welcome(self).deliver_now\n end", "def message_subject\n return @message_subject\n end", "def welcome_email email_address\n @greeting = \"Hi\"\n @user_name = UserInfo.last.user\n\n mail to: email_address\n end", "def welcome_email(user)\n\n @user = user\n Rails.logger.info 'hello'\n emails = ['leolopelofranco@gmail.com', 'leo@palmsolutions.co']\n\n mail(to: user[\"to\"], subject: user[\"subject\"])\n\n end", "def welcome_email\n UserMailer.with(user: @user).welcome_email.deliver_later\n end", "def send_welcome_email\n UserMailer.welcome_message(self).deliver_later\n end", "def newcompany_email(company)\n @company = company\n @message = t('mailers.company.created')\n \n emails = AdminUser.all.collect(&:email).join(\",\")\n\n mail(:to => emails, :subject => \"#{t('site_title')}: #{@message}\")\n \n end", "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def reminder_email(user)\n @user = user\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end", "def subject_alternative_name\n extensions[R509::Cert::Extensions::SubjectAlternativeName]\n end", "def subject\n self['subject']\n end", "def subject\n message.subject\n end", "def default_sender_address\n address = Mail::Address.new(Gitlab.config.gitlab.email_from)\n address.display_name = \"GitLab\"\n address\n end", "def welcome(user)\n @appname = \"Oasis Books\"\n mail( :to => user.email,\n :subject => \"Welcome to #{@appname}!\")\n end", "def set_subject(subject)\n\t\tend", "def newsletter(user, subject, text)\n @user = user\n @text = text\n\n mail(to: user.email, subject: subject)\n end", "def setup_email(user)\n @recipients = \"#{user.email}\"\n @from = AppConfig.app_email\n @subject = \"[#{AppConfig.app_name}] \"\n @sent_on = Time.now\n @body[:user] = user\n end", "def alert_preamble\n text = user ? user.email : ''\n text += \" [#{company.name}]\" if company\n text\n end", "def headers\n { subject: \"#{site_name} contact form\", to: site_email, from: email }\n end", "def headers\n {\n subject: \"[#{Setting.site_name}] Neue Quelle eingesendet\",\n to: Setting.email,\n reply_to: email,\n from: Setting.get('from'),\n }\n end", "def welcome(user)\n @name = user.email.split(\"@\").first\n @name = @name.titleize\n @greeting = \"Hi\"\n\n mail to: \"#{@name} <user.email>\"\n end", "def welcome(email)\n @greeting = \"Hi\"\n\n mail to: email, subject: \"Email template\"\n end", "def welcome(user)\n @user = user\n mail :to => user.email, :subject => \"vm2014.ifkff.org - Välkommen!\"\n end", "def subject\n title \n end" ]
[ "0.6765104", "0.6726595", "0.67247695", "0.67163604", "0.67111814", "0.67100495", "0.6694839", "0.6693109", "0.6671716", "0.6627427", "0.6599362", "0.65409476", "0.6539258", "0.65040624", "0.64823294", "0.64546007", "0.6429769", "0.6403822", "0.6354559", "0.6319615", "0.6319615", "0.62802696", "0.62658256", "0.6239452", "0.62319535", "0.62114763", "0.6156722", "0.61546624", "0.61331713", "0.61200047", "0.6114654", "0.61121917", "0.6087684", "0.6081847", "0.6081847", "0.6081847", "0.6081847", "0.6077619", "0.6077619", "0.6077619", "0.6077619", "0.6077619", "0.6077619", "0.6077619", "0.6077619", "0.6072605", "0.60657924", "0.60589385", "0.6049369", "0.6046061", "0.60459036", "0.60423553", "0.60347223", "0.6028135", "0.60243154", "0.6024258", "0.6017076", "0.6016118", "0.6003834", "0.59990084", "0.5993068", "0.598231", "0.59817725", "0.59785104", "0.59694135", "0.59605527", "0.5957238", "0.5953056", "0.59450346", "0.5944203", "0.5943193", "0.5933614", "0.59270024", "0.59128004", "0.5911129", "0.5908231", "0.59021664", "0.5894119", "0.5885052", "0.5882026", "0.5881592", "0.5868445", "0.5862252", "0.58309126", "0.5828483", "0.5806986", "0.5805586", "0.5797181", "0.57932055", "0.5777705", "0.577642", "0.5768358", "0.57640666", "0.5758628", "0.5747379", "0.5737509", "0.57281804", "0.572308", "0.5718437", "0.5708765", "0.57079816" ]
0.0
-1
a single dash before and after each odd digit. There is one exception: don't start or end the string with a dash. You may wish to use the `%` modulo operation; you can see if a number is even if it has zero remainder when divided by two. Difficulty: medium.
def dasherize_number(num) str = "" arr = num.to_s.split('') i = 0 while i<arr.count if is_odd?(arr[i].to_f) if i>0 && !(str[-1]=='-') str += '-' end str += arr[i] if i<arr.count-1 str += '-' end else str += arr[i] end i+=1 end return str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dasherize_number(num)\n\n index = 0\n \n num_string = num.to_s\n new_string = ''\n \n while index < num_string.length\n # Simplify your checks for odd and evenness here. \n # You are checking for so many things which makes the code messy.\n # Just divide the number using modulo you don't need to check for index\n \n if num_string[index].to_i.even? \n new_string += num_string[index].to_s \n elsif num_string[index].to_i.odd? \n new_string = \"-\" + num_string[index].to_s + \"-\"\n end\n \n index = index + 1\n end\n puts new_string\nend", "def dasherize_number(num)\n\tnum_string = num.to_s\n\tidx = 0\n\n\twhile idx < num_string.length-1\n\t\tif num_string[idx].to_i % 2 != 0\n\t\t\tnum_string.insert(idx+1, \"-\")\n\t\tend\n\t\tidx += 1\n\tend\n\n\twhile num_string[idx] != \"-\"\n\t\tif num_string[idx2].to_i % 2 == 0 && num_string[idx2+1] != \"-\"\n\t\t\tputs \"#{num_string[idx2]} qualifies\"\n\t\tend\n\t\tidx2 += 1\n\tend\n\treturn num_string\nend", "def dasherize_number(num)\n i=1\n num = num.to_s\n new_str = num[0]\n\n while (i>0 && i<num.length)\n if (num[i].to_i%2==1 || num[i-1].to_i%2==1)\n new_str = new_str + \"-\" + num[i].to_s\n else\n new_str = new_str + num[i].to_s\n end\n i+=1\n end\n return new_str\nend", "def dasherizer(integer)\n array = integer.to_s.chars.map(&:to_i)\n new_string = \"\"\n size = array.size - 1\n\n array.each_with_index do |int, index|\n if index == size\n new_string << int.to_s\n elsif int.odd? && array[index + 1].odd?\n new_string << int.to_s + \"-\"\n else\n new_string << int.to_s\n end\n end\n\n new_string\nend", "def dasherize_number(num)\n num = num.to_s\n result = ''\n\n idx = 0\n while idx < num.length\n # No dash to be added: all even digits\n if num[idx].to_i % 2 == 0\n result += num[idx]\n \n # Is first\n elsif idx == 0\n result += num[idx] + '-'\n\n # Is last\n elsif idx == num.length-1\n result += '-' unless result[-1] == '-'\n result += num[idx] \n \n # All others\n else\n result += '-' unless result[-1] == '-'\n result += num[idx] \n result += '-'\n end \n\n #puts result #debug\n idx += 1\n end\n\n #puts result #debug\n return result\nend", "def dasherize_number(num)\n arr = num.to_s.split(\"\")\n idx = 0\n while idx < arr.length\n if arr[idx].to_i % 2 == 0\n idx += 1\n elsif idx == 0 && arr[idx].to_i % 2 != 0\n arr[idx] = \"#{arr[idx]}-\"\n elsif arr[idx].to_i % 2 != 0 && arr[idx - 1].length > 1\n arr[idx] = \"#{arr[idx]}-\"\n else\n arr[idx] = \"-#{arr[idx]}-\"\n end\n idx += 1\n end\n return final = arr.join(\"\").split(\"\")\n if final[-1] == \"-\"\n final.pop\n end\n return final.join(\"\")\nend", "def dasherize_number(num)\n\n arr = num.to_s.split(\"\")\n arr.each do |x|\n if x[0].to_i.odd?\n puts x[0] + \"-\"\n end\nend\n\n # if arr[0].to_i.odd?\n # puts arr[0] + \"-\"\n # elsif arr[arr.length-1].to_i.odd?\n # puts \"-\" + arr[arr.length-1]\n # # elsif x.to_i % 2 != 0 && x.to_i == arr[arr.length-1]\n # # puts \"-\" + x\n # # elsif x.to_i % 2 != 0 && x.to_i == arr[0]\n # # puts x + \"-\"\n # # else\n # # return nil\n # # end\n # end\n # end\nend", "def dasherize_number(num)\n\tstr_num = num.to_s\n\tnew_str = \"\"\n\ti = 0\n\twhile i < str_num.length\n\t\tif (str_num[i].to_i % 2 == 1) || (str_num[i - 1].to_i % 2 == 1)\n\t\t\tnew_str += '-'\n\t\tend\n\t\tnew_str += str_num[i]\n\t\ti += 1\n\tend\n\n\tif(new_str[0] =='-')\n\t\tnew_str[0] = ''\n\tend\n\t\n\t#if(new_str[(new_str.length - 1)] == '-')\n\t#\tnew_str[(new_str.length - 1)] = ''\n\t#end\n\t\n\tputs new_str\n\tnew_str\nend", "def dasherize_number(num)\n number_string = num.to_s\n i = 0\n result = []\n while i < number_string.length\n if number_string[i].to_i % 2 == 1 && number_string[i + 1].to_i % 2 == 1\n letter = \"-\" + number_string[i]\n else\n leter = number_string[i]\n end\n result.push(letter)\n i += 1\n end\n result.join(\"\")\nend", "def dasherize_number(num)\n i = 1\n answer = [num[0]]\n while i < num.to_s.length\n if num[i].to_i % 2 == 1 || num[i-1].to_i % 2 == 1\n answer << \"-\"\n end\n answer << num\n i += 1\n end\n return answer.join(\"\")\nend", "def dasherize_number(num)\n \n idx = 0\n string = num.to_s.split(\"\")\n arr = \"\"\n \n while idx < string.length\n \n if string[idx].to_i % 2 != 0 \n string[idx] = \"-\" , \"#{string[idx]}\" , \"-\"\n end\n \n idx += 1\n \n end\n\t\n arr = string.join.to_s\n\tarr.split(\"\")\n\t\n\tif arr[-1] == \"-\"\n\t\tarr[-1] = \"\"\n\tend\n\t\n\tif arr[0] == \"-\"\n\t\tarr[0] = \"\"\n\tend\n\t\n\tarr.gsub! \"--\", \"-\"\n\treturn arr\n \nend", "def insert_dash(num)\n string_split = num.to_s.split(\"\")\n \n string_split.each_with_index do |num, i|\n if string_split[i].to_i.odd? == true && string_split[i+1].to_i.odd? == true\n string_split.insert(i+1, \"-\")\n i+=2\n end \n end\n return string_split.join\n \nend", "def DashInsert(str)\n \n i = 0\n while i < str.length - 1\n if str[i].to_i % 2 != 0 && str[i+1].to_i % 2 != 0 && str[i].to_i != 0 \n \t str[i] = str[i] + \"-\"\n end\n i += 1\n end\n \n str\n \nend", "def dasherize_number(num)\n #split number into an array\n array = num.to_s.chars.map(&:to_i)\n i = 0\n #iterate over array to find odd numbers\n while i < array.length\n if !(array[i] % 2 == 0)\n #if it is the first number, only put a dash on the right side\n if i == 0\n array[0] = [array[i], \"-\"].join\n puts \"first number: #{array[0]}\"\n #if it is the last number, only put a dash on the left side\n elsif i == array.length-1\n array[array.length-1] = [\"-\", array[array.length-1]].join\n puts \"last number: #{array[array.length-1]}\"\n #else put a dash on both sides\n else\n if (i-1 == 0 && i+1 == array.length-1)\n array[i] = array[i]\n elsif i-1 == 0\n array[i] = [array[i], \"-\"].join\n elsif i+1 == array.length-1\n array[i] = [\"-\", array[i]].join\n else\n array[i] = [\"-\", array[i], \"-\"].join\n end \n end \n end \n i += 1\n end \n #return dashedString\n array = array.join\n puts array\n return array\nend", "def dasherize_number(num)\n#my counter variable\n i = 1\n# Convert numbers to a string \n number_string = num.to_s\n# Create result variable to add in the numbers after they've been 'dashed'\n result= \"#{number_string[0]}\"\n\n while i < number_string.length\n #need to convert number_string to variables because \"1\" != 1\n current_num = number_string[i].to_i\n # if there isnt a remainder after i divide by two add current_num to result \n if(current_num % 2 == 0) \n result += \"#{current_num.to_s}\"\n #if there is a remainder after i divide by 2 add current_num to result with a dash in front of current_num\n elsif (current_num % 2 == 1) \n result += \"-#{current_num.to_s}\"\n end\n i += 1\n end\n puts result\n return result\nend", "def dasherize_number(num)\n num = num.to_s\n new = []\n \n if num[0].to_i % 2 == 1\n new.push(num[0])\n new.push('-')\n else\n new.push(num[0])\n end\n \n i = 1\n while i < num.size - 1\n if num[i].to_i% 2 == 1\n if (new[new.length-1] != '-')\n new.push(\"-\")\n end\n new.push(num[i])\n new.push(\"-\")\n else \n new.push(num[i])\n end\n i += 1\n end\n if num[num.size-1].to_i % 2 ==1 && new[new.length-1] != '-'\n new.push('-')\n end\n new.push(num[num.length-1])\n print new.join\n return new.join\n \nend", "def dashing_odds(num)\n\n # convert integer to string\n int_to_string = num.to_s()\n\n\n # checking the type of int_string\n #\n #\n\n # p num.instance_of? Integer # Fixnum is deprecated and replaced by Integer\n # p int_to_string.instance_of? String\n #\n # puts int_to_string.respond_to?(:to_s)\n\n # all 3 prints true !\n #\n # end of checking type of int_string\n # https://stackoverflow.com/questions/15769739/determining-type-of-an-object-in-ruby\n\n\n i = 0\n\n dashified = \"\"\n\n # treat string as an array\n while( int_to_string.length() > i )\n\n # p \"int_to_string[i].to_i #{int_to_string[i].to_i} % 2 = #{int_to_string[i].to_i % 2}\"\n\n # checks if number is odd\n if( int_to_string[i].to_i % 2 == 0 )\n\n if( int_to_string[i-1].to_i % 2 == 1 )\n\n dashified += \"-\"\n end\n\n dashified += int_to_string[i]\n\n\n else\n\n dashified += \"-\"\n dashified += int_to_string[i]\n # dashified += \"-\"\n\n end # if\n\n i += 1\n end # while\n\n # p dashified\n\n # remove leading dashes\n # treating string as array\n # p \"dashified[0] #{dashified[0]}\"\n\n if( dashified[0] == \"-\" )\n\n dashified = dashified.slice( 1, dashified.length() )\n\n end # if\n\n # remove trailing dashes\n # treating string as array\n\n # p dashified\n\n # p \"dashified[ dashified.length() - 1 ] #{dashified[ dashified.length() - 1 ]}\"\n\n if( dashified[ dashified.length() - 1 ] == \"-\" )\n\n dashified = dashified.slice( 0, dashified.length() - 1 )\n\n end # if\n\n p dashified\n\n\n # IMPROVEMENT !!!! \n #\n # remove repeating dashes e.g. 3--3--3\n # treating string as array\n\n # maybe best to have own method !\n\n # End of:\n # remove repeating dashes e.g. 3--3--3\n # treating string as array\n\n\n p dashified\n return dashified\n\nend", "def dasherize_number(num)\n number = num.to_s\n dashed = \"\"\n\n dashed = number[0]\n if number[0].to_i % 2 == 1\n dashed += \"-\"\n end\n\n number[1..-1].each_char do |n|\n\n if n.to_i % 2 == 1\n if dashed[-1] != \"-\"\n dashed = dashed + \"-\" + n + \"-\"\n else\n dashed += n\n end\n else\n dashed += n\n end\n end\n\n if dashed[-1] == \"-\"\n return dashed[0...-1]\n end\n\n dashed\nend", "def dasherize_num(num)\n\n num_s = num.to_s\n\n result = \"\"\n\n i = 0\n\n while num_s.length > i\n\n digit = num_s[i].to_i\n\n if (i > 0) # only if the it's not the leading digit\n\n prev_digit = num_s[i - 1].to_i\n\n if (prev_digit % 2 == 1) || (digit % 2 == 1)\n result += \"-\"\n\n end\n\n end\n\n result += num_s[i]\n\n i += 1\n end\n\n return result\nend", "def dash_insert_ii(str)\n result = ''\n str.each_char.with_index do |char, idx|\n result << char\n next if char == '0' || idx >= str.size - 1 || str[idx + 1] == '0'\n if char.to_i.even? && str[idx + 1].to_i.even?\n result << '*'\n elsif char.to_i.odd? && str[idx + 1].to_i.odd?\n result << '-'\n end\n end\n result\nend", "def dasherize_number(num)\n num_s = num.to_s\n\n result = \"\"\n\n idx = 0\n while idx < num_s.length\n digit = num_s[idx].to_i\n\n if (idx > 0)\n prev_digit = num_s[idx - 1].to_i\n if (prev_digit % 2 == 1) || (digit % 2 == 1)\n result += \"-\"\n end\n end\n result += num_s[idx]\n\n idx += 1\n end\n\n return result\nend", "def dasherize_number(num)\r\n nums = num.to_s.split('') #turns argument into a string and splits it into an array of single numbers. NOTE: '2' != 2\r\n nums.map! do |i| #Loop through nums .map! so you can change the orginal array\r\n if i.to_i.odd? == true # convert each iteration from string to integer, if its odd...\r\n i = \"-\"+ i # add a \"-\" before the number\r\n end\r\n i.to_s #leave it alone if its not odd and convert it back a string\r\n end#^^^\r\n\r\n if nums[0].to_i.odd? #this is to compensate for odd numbers at the beginning. \r\n nums[0].reverse! #example: [\"-3\",\"0\", \"-3\"] >> [\"3-\",\"0\", \"-3\"] \r\n end\r\n\r\nnums = nums.join('').split('') #converts [\"-3\",\"0\", \"-3\"] >> [\"3\", \"-\", \"0\", \"-\", \"3\"].\r\nnums.map! do |k| #loop through nums\r\n index = nums.index(k) #set index\r\n if nums[index] == \"-\" && nums[index+1] == \"-\" # checks to see if a dash is next to a dash\r\n nums.delete_at(index) #if so, delete it\r\n end\r\n k = k # otherwise leave k alone\r\n end\r\nreturn nums.join('') #return as a single string\r\nend", "def DashInsert(str)\n str = str.split(\"\")\n odd = \"13579\"\n i = 0\n new = \"\"\n\n while i < str.length\n new += str[i]\n if odd.index(str[i]) && str[i+1] && odd.index(str[i + 1])\n new += \"-\"\n end\ni+= 1\n end\n # code goes here\n return new\n\nend", "def dasherize_number(num)\n\tanswer = ''\n\tnum.to_s.each_char do |x|\n\t\tif x.to_i.odd? \n\t\t\tif answer.match(/-$/)\n\t\t\t\tanswer += x + '-' \n\t\t\telse\n\t\t\t\tanswer += '-' + x + '-'\n\t\t\tend\n\t\telse\n\t\t\tanswer += x\n\t\tend\n\n\tend\n\tanswer.reverse.chomp('-').reverse.chomp('-')\nend", "def dasherize_number(num)\n\t num_s = num.to_s\n\t\n\tresult = \"\"\n\t\n\ti = 0\n\twhile i < num_s.length\n\tdigit = num_s[i].to_i\n\t\n\tif (i > 0)\n\tprev_digit = num_s[i - 1].to_i\n\tif (prev_digit % 2 == 1) || (digit % 2 == 1)\n\tresult += \"-\"\n\tend\n\tend\n\tresult += num_s[i]\n\t\n\ti += 1\n\tend\n\t\n\treturn result\nend", "def dasherize_number(num)\n result = String.new \n \n while num > 0 do\n digit = num % 10\n if digit % 2 != 0\n result = \"-\" + digit.to_s + \"-\" + result\n else\n result = digit.to_s + result\n end\n num = num / 10\n end\n # puts result\n result = result.gsub(\"--\", \"-\")\n# puts result\n \n \n \n if result[0] == \"-\" || result[len-1] == \"-\"\n len = result.length\n if result[0] == \"-\" \n result = result[1..len-1]\n end\n len = result.length\n if result[len-1] == \"-\"\n result = result[0..len-2]\n end\n end\n # puts result\n return result \nend", "def DashInsert(num)\n\n # step1: convert the integer to a string\n # step2: determine whether a number is odd or not and grab index \n # step3: insert a dash after it \n\n num.scan(/[13597]{2}|.+/).join(\"-\")\n # num_arr = num.to_s\n # num_arr.each_char do |n|\n # \tif n % 3 = 0 \n # \t\tstr.insert(i+1, '-')\n # \tend\n # end\n # code goes here \n \nend", "def dasherize_number(num)\n\nnumx = num.to_s\nlength = numx.length\n\nidx = 0\n\nif numx[1] == nil\n\treturn numx[0]\nend\n\n\nwhile idx < length\nstring = ''\n\tif numx[idx] == 0\n\t\tstring = string + 0\n\t\tidx += 1\n\telsif num[idx] == nil\n\t\treturn string\t\n\telsif (numx[0] % 2) == 0\n\t\tstring = string + numx[0]\n\t\tidx += 1\n\telsif (numx[0] % 2 != 0)\n\t\tstring = string + numx[0] + '-'\n\t\tidx += 1\n\telsif ((numx[idx] % 2) != 0) && (((numx[idx - 1] % 2) == 0) && (numx[idx + 1] % 2) == 0)\n\t\tstring = string + '-' + numx[idx] + '-'\n\t\tidx += 1\n\telsif ((numx[idx] % 2) != 0) && (((numx[idx - 1] % 2) == 0) && (numx[idx + 1] % 2) != 0)\n\t\tstring = string + '-' + numx[idx]\n\t\tidx += 1\n\telsif ((numx[idx] % 2) != 0) && (((numx[idx - 1] % 2) != 0) && (numx[idx + 1] % 2) == 0)\n\t\tstring = string + numx[idx] + '-'\n\t\tidx += 1\n\telsif ((numx[idx] % 2) != 0) && (((numx[idx - 1] % 2) != 0) && (numx[idx + 1] % 2) != 0)\n\t\tstring = '-' + numx[idx] + '-'\n\t\tidx += 1\n\telse\n\t\tstring = string + numx[idx]\n\t\tidx += 1\n\tend\t\nend\n\nreturn string\n\nend", "def dasherize_number(num)\n\tnum_arr = []\n\toutput_arr = []\n\tevens = ''\n\twhile num > 0\n\t\tnum_arr.unshift(num % 10)\n\t\tnum /= 10\n\tend\n\ti = 0\n\twhile i < num_arr.size\n\t\tif num_arr[i] % 2 != 0\n\t\t\toutput_arr.push(evens) if evens != ''\n\t\t\tevens = ''\n\t\t\toutput_arr.push(num_arr[i].to_s)\n\t\telse\n\t\t\tevens += num_arr[i].to_s\n\t\tend\n\t\ti += 1\n\tend\n\toutput_arr.join('-')\n\nend", "def DashInsert(str)\n str.chars\n .each_cons(2)\n .map { |i,j| (i.to_i.odd? && j.to_i.odd?) ? i+'-' : i }\n .join + str[-1]\nend", "def dashatize(n)\n n ? n.to_s.scan(/[02468]+|[13579]/).join(\"-\") : \"nil\"\nend", "def dashatize(num)\n return 'nil' if num == nil\n str = num.to_s.each_char.map do |char|\n char.to_i.odd? ? char = \"-#{char}-\" : char\n end\n\n str = str.join.squeeze('-')\n str.slice!(0,1) if str[0] == '-'\n str.slice!(-1,1) if str[-1] == '-'\n str\nend", "def dashatize(num)\n num ? num.to_s.scan(/[02468]+|[13579]/).join(\"-\") : \"nil\"\nend", "def dasherize_number(num)\n arr = num.to_s.chars\n arr.each { |char| char.gsub!(char, \"-#{char}-\") if char.to_i.odd? }\n string = arr.join\n string.chop! if string[-1] == '-'\n string[0] = '' if string[0] == '-'\n string.squeeze('-')\nend", "def dashatize(num)\n return \"nil\" if num.nil?\n s = ''\n num = num.abs\n num.digits.reverse.each_with_index do |digit,index|\n if digit.odd?\n s += \"-#{digit}-\"\n else\n s += \"#{digit}\"\n end\n end\n s = s.gsub(\"--\",\"-\")\n if s[0] == \"-\"\n s = s.reverse.chop.reverse\n end\n if s[-1] == \"-\"\n s.chop!\n end\n return s\nend", "def dasherize(str)\n (str.length > 1 ? \"--\" : \"-\") + str\n end", "def insert_dash(num)\n num.to_s.gsub(/(?<=[13579])([13579])/, '-\\1')\nend", "def DashInsertII(num)\n\n # code goes here\n str = num.to_s.chars.to_a\n str.each_index do |i|\n next if i == 0\n if str[i] && str[i-1] =~ /\\d+/\n if str[i-1].to_i.even? && str[i].to_i.even?\n str.insert(i,'*')\n elsif str[i-1].to_i.odd? && str[i].to_i.odd?\n str.insert(i,'-')\n end\n end\n end\n return str.join\n \nend", "def DashInsert(num)\n\n num.to_s.gsub(/[13579]{2,}/){|x| x.split('').join(\"-\")}\n \nend", "def dashatize(num)\n # scan(pattern) -> [String] | [[String]]\n # self に対して pattern を繰り返しマッチし、 マッチした部分文字列の配列を返します。\n # pattern が正規表現で括弧を含む場合は、 括弧で括られたパターンにマッチした部分文字列の配列の配列を返します。\n num ? num.to_s.scan(/[02468]+|[13579]/).join(\"-\") : \"nil\"\nend", "def seperation\n puts \"-\" * 10\n end", "def fix_dash_dash(text); end", "def DashInsert(str)\n str.to_s.gsub(/([13579])(?=[13579])/, '\\1-')\nend", "def num_to_dashes(num)\n\treturn '-'*num\nend", "def dasherize(word)\n word.gsub(/_/,'-')\nend", "def stringy_hightech(num, zero_start=1)\n half, remainder = num.divmod 2\n\n case zero_start\n when 0 then '01' * half + '0' * remainder\n when 1 then '10' * half + '1' * remainder\n end\nend", "def _n(str)\n str.gsub(/(-)(.*)/, '\\2')\n end", "def divider(char=\"-\")\n char * 80\nend", "def odd(str)\n result = ''\n is_odd_idx = false\n space_just_added = false\n last_letter_idx = nil\n last_space_idx = nil\n str.each_char do |char|\n if char == ' '\n next if space_just_added\n result << ' '\n space_just_added = true\n last_space_idx = result.size\n is_odd_idx = !is_odd_idx\n elsif char.match?(/[a-z]/i)\n is_odd_idx ? result.insert(last_space_idx, char) : result << char\n last_letter_idx = result.size - 1\n raise ArgumentError if last_letter_idx - last_space_idx.to_i >= 20\n space_just_added = false\n elsif char == '.'\n break\n else\n raise ArgumentError, 'invalid input'\n end\n end\n last_letter_idx ? result[0..last_letter_idx] + '.' : result\nend", "def odds_and_evens(string, return_odds)\n newstring = \"\"\n n = 1 if return_odds\n n = 0 if !return_odds\n # n = return_odds ? 1 : 0\n\n for index in 0..(string.length-1)\n if index % 2 == n\n newstring = newstring + string[index]\n end\n end\n return newstring\nend", "def odds_and_evens(string, return_odds)\nif return_odds == false\n return string.gsub(/(.)./, '\\1')\n\nelse return_odds == true\n if string.length.odd?\n return string.gsub(/.(.)/, '\\1')[0...-1]\n else \n return string.gsub(/.(.)/, '\\1')\n end\nend\nend", "def odds_and_evens(string, return_odds)\n new_string = ''\n\n if return_odds\n string.length.times {|num| new_string << string[num] if num.odd?}\n\n elsif\n string.length.times {|num| new_string << string[num] if num.even?}\n\n end\n\n new_string\n\nend", "def odds_and_evens(string, return_odds)\n return_odds ? odd_string = '' : even_string = ''\n if return_odds\n string.chars.each_with_index {|char, index| odd_string += char if index.odd?}\n odd_string\n\t else\n\t\t string.chars.each_with_index {|char, index| even_string += char if index.even?}\n even_string\n\t end\n\nend", "def reverse_odds(string)\n result = arr = string.chars\n arr.each_with_index do |letter, i|\n if i.odd?\n result[i] = arr[- 1 - i]\n result[-1 - i] = letter\n else\n letter\n end\n return result.join('') if i >= (arr.length / 2)\n end\nend", "def dasherize\n\t\treturn self.split.join('-')\n\tend", "def stringy(int)\n (int/2).times { print 10 }\n 1 if int.odd?\nend", "def to_dash(s)\n s.gsub(/\\.|\\_/, '--')\n end", "def odds_and_evens(string, return_odds)\n stringy = \"\"\n string.chars.each_with_index do |char, i|\n stringy += char if i.odd? == return_odds\n end\n stringy\nend", "def as(besar)\n\tbesar = besar.to_i\n\tstr = \"\"\n\tcount = 1\n\t# besar.odd? ? mid = besar + 1 : mid = besar\n\tbesar.odd? ? mid = besar - 1 : mid = besar\n\tx = (mid/2).ceil + 1\n\n\tfor i in 1..mid do\n \n\t\tfor j in i...mid do\n\t\t\tstr += \"-\"\n\t\tend\n\n\t\tif i != x\n\t\t\tfor j in 1..count do\n\t\t\t j > 1 && j < count ?\tstr += \"-\" : str += \"A\"\n\t\t\tend\n\t\telse\n\t\t\tfor j in 1..count\n\t\t\t\tj.odd? ? str += \"A\" : str += \"-\"\n\t\t\tend\n\t\tend\n\n\t\tstr += \"\\n\"\n\t\tcount += 2\n\tend\n\n\tprint str\nend", "def alternate string, num\n range = ('a'..'z').to_a.rotate(num)\n working = string.split(//)\n working.map! do |x|\n x = range[('a'..'z').to_a.index(x)]\n end.join\n \n \n\nend", "def evenator(s)\n s.delete(\".,?!_\").split(\" \").map do |word|\n word.length % 2 == 1? word << word[-1] : word\n end.join(\" \")\nend", "def even_or_odd(number)\n if number % 2 == 0\n \"Even\"\n else\n \"Odd\"\n end\n end", "def stringy(int)\n new_string = \"\"\n (int / 2).times { new_string << \"10\" }\n new_string << \"1\" if int.odd? \n new_string\nend", "def oddness(count)\n count.odd? ? \"odd\" : \"even\"\n end", "def all_digits_odd?\n self.to_s.split('').inject(0) { |memo, s| memo + ( s.to_i%2==0 ? 1 : 0 ) } == 0\n end", "def odds_and_evens(string, return_odds)\n\nindex = 1\n\n (string.length/2).times do\n string.slice(index)\n index += 1\n string\n end\n\n\n#return string.chars.select.each_with_index{|x, y| y.odd?}.join if return_odds == true\n#return string.chars.select.each_with_index{|x, y| y.even?}.join if return_odds == false\n\nend", "def dashify\n strip.gsub(/[ \\/_~]/, '-').squeeze('-')\n end", "def add_dashes(uuid)\n return uuid if uuid =~ /\\-/\n [uuid[0..7], uuid[8..11], uuid[12..15], uuid[16..19], uuid[20..-1]].join(\"-\")\n end", "def stringy(num, start=1)\n string = '10' * (num/2)\n if start == 1\n num.even? ? string : string + '1'\n else\n num.even? ? string.reverse : string.reverse + '0'\n end\nend", "def twice(num)\n number = num.to_s\n length = number.length\n\n case\n when length.odd?\n return num * 2\n when length.even?\n left = number.slice(0, number.length / 2)\n right = number.slice((number.length / 2)..-1)\n left == right ? num : num * 2\n end\nend", "def dash_separator\n 60.times { @results += '-' }\n newline\n end", "def undasherize(str)\n str.sub(/^-{1,2}/, '')\n end", "def twice(number)\n string_number = number.to_s\n center = string_number.size / 2\n left_side = center.zero? ? '': string_number[0..center - 1]\n right_side = string_number[center..-1]\n\n return number if left_side == right_side\n return number * 2\nend", "def twice(number)\n string_number = number.to_s\n center = string_number.size / 2\n left_side = center.zero? ? '' : string_number[0..center - 1]\n right_side = string_number[center..-1]\n\n return number if left_side == right_side\n return number * 2\nend", "def odds_and_evens(string, return_odds)\n chars = string.chars\n for i in 0..(chars.length-1)\n (chars[i] = '') if (return_odds ? i.even? : i.odd?)\n end\n chars.join\nend", "def stringy(number)\n digits = []\n counter = 0\n while counter < number do\n digits[counter] = counter.odd? ? 0 : 1\n counter += 1\n end\n digits.join\nend", "def staircase(n)\r\n # Write your code here\r\n empty = \" \"\r\n value = \"#\"\r\n n.times do |num|\r\n \tnumber = num + 1\r\n first = empty*(n-number).abs\r\n second = value*number\r\n puts first+second\r\n end\r\nend", "def is_odd?\n return TRUE if get_dash_version.match(/^\\d+\\.(\\d+)\\.\\d+/)[1].to_i.odd?\n return FALSE\n end", "def stringy(int)\n str = ''\n int.times { |i| str += ((i + 1) % 2).to_s }\n str\nend", "def odds_and_evens(string, return_odds)\n range = 0..string.length-1\n new_string = String.new\n range.step(2) {|x| string[x+1] && new_string << string[x+1]} if return_odds\n range.step(2) {|x| new_string << string[x]} if !return_odds\n new_string\nend", "def odd_or_even (number)\n if number % 2 == 0\n \"even\"\n elsif number % 2 == 1\n \"odd\"\n end\nend", "def hide_last_four(string)\n string.gsub!(/-\\d{4}/,\"-****\")\nend", "def dasherize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"-\").downcase)\n end", "def is_odd?(integer)\r\n !(integer.abs.remainder(2) == 0)\r\nend", "def oddify(string)\n words = string.split(/[ .]+/)\n\n words.map.with_index do |word, idx|\n idx.odd? ? word.reverse : word\n end.join(' ') << '.'\nend", "def odds_and_evens(string, return_odds)\n\n even = []\n odd = []\n arr = string.each_char.to_a\n arr.each_index{|index| index % 2 == 0 ? even << arr[index] : odd << arr[index]}\n if return_odds == true\n return odd.join('')\n else\n return even.join('')\n end\n\n\n\n\nend", "def show_game_title(title)\n formatted_title = '| ' + title + ' |'\n dashes = '-' * formatted_title.length\n puts dashes\n puts formatted_title\n puts dashes\nend", "def show_game_title(title)\n formatted_title = '| ' + title + ' |'\n dashes = '-' * formatted_title.length\n puts dashes\n puts formatted_title\n puts dashes\nend", "def all_digits_odd?(number)\n number.to_s.split(//).each_with_index do |digit,index|\n if index == 0 && digit.to_i == 2\n #Don't return false if first digit is 2\n elsif digit.to_i%2==0\n return false\n end\n end\n return true\nend", "def twice(number)\n num_length = number.to_s.length\n num_is_odd = (num_length % 2 == 0) ? false : true \n return (number * 2) if num_is_odd\n \n first_half = number.to_s.slice(0, num_length / 2)\n second_half = number.to_s.slice(num_length / 2, num_length)\n first_half == second_half ? number : number * 2\nend", "def odds_and_evens(string, return_odds)\n result = \"\"\n string.length.times do |index|\n next if\n return_odds == true && index.even?\n next if\n return_odds == false && index.odd?\n result << string[index]\n end\nresult\nend", "def hideWord (word)\n\tnumDashes = word.length\n\tdisplayDash = Array.new(numDashes) { |i| \n\ti = \"_\" }\n\n\treturn displayDash.join(\" \")\nend", "def is_odd?(integer)\n integer.abs.remainder\nend", "def staircase(n)\n i = 1\n while i <= n\n puts \" \" * (n - i) + \"#\" * i\n i += 1 \n end\nend", "def odds_and_evens(string, return_odds)\n odds = \"\"\n evens = \"\"\n string.each_char.with_index { |char, i|\n if i.odd?\n odds << char\n else\n evens << char\n end }\n if return_odds == true\n return odds\n else\n return evens\n end\nend", "def stringy(num)\n string = '10' * (num/2)\n num.even? ? string : string + '1'\nend", "def hide_last_four(string)\n\treturn string.gsub(/(\\d{2})-(\\d{2})-\\d{4}/, '\\1-\\2-****')\nend", "def odd_number_check_two(number)\r\n number % 2 == 1 || number % 2 == -1 \r\nend", "def two_digit(number)\n dizaine = (number/10) * 10\n unit = (number % 10)\n if unit == 0\n return specific_word(dizaine)\n else\n return specific_word(dizaine) + \" \" + specific_word(unit)\n end\nend", "def croon(str)\n str.split('').join('-')\nend" ]
[ "0.8318996", "0.7968655", "0.79432404", "0.7927553", "0.79227006", "0.7920647", "0.7899584", "0.77757", "0.7765964", "0.7704206", "0.77036357", "0.76868725", "0.7661751", "0.76534855", "0.7652473", "0.7633463", "0.7631875", "0.7612631", "0.7606616", "0.7600646", "0.7583064", "0.756611", "0.75653327", "0.74805915", "0.747643", "0.74665844", "0.74454904", "0.74432474", "0.74100095", "0.73733664", "0.72559667", "0.72403663", "0.71688443", "0.7075159", "0.70394534", "0.69987434", "0.6965745", "0.69231695", "0.68870115", "0.68259317", "0.6756817", "0.6588163", "0.65674096", "0.6529883", "0.6477833", "0.6476324", "0.64539677", "0.6421343", "0.63638306", "0.6347846", "0.6341708", "0.63040364", "0.62720937", "0.6266184", "0.62646914", "0.6263388", "0.6251602", "0.6224617", "0.62132573", "0.6202843", "0.61988163", "0.6197292", "0.6193731", "0.618545", "0.61813486", "0.61763906", "0.6169777", "0.6150122", "0.61479914", "0.61417055", "0.6136163", "0.6117099", "0.61124843", "0.61117095", "0.6109506", "0.61066216", "0.60974854", "0.6077501", "0.60641897", "0.6054672", "0.604757", "0.6046363", "0.60351455", "0.60312366", "0.6030134", "0.60256433", "0.602462", "0.602462", "0.60155517", "0.60092306", "0.60091317", "0.6006652", "0.599893", "0.5995014", "0.599346", "0.5989285", "0.5987672", "0.5980625", "0.5978889", "0.5973459" ]
0.78489393
7
Returns true if the user is logged in, false otherwise.
def logged_in? !curr_worker_id.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end", "def logged_in?\n user._logged_in?\n end", "def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\n end\n end", "def logged_in?\n if !session[:user_id].nil?\n return true\n else\n return false\n end\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end", "def logged_in?\n !!logged_user\n end", "def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end", "def logged_in?\n if current_user\n true\n else\n false\n end\n end", "def logged_in?\n current_user != :false\n end", "def logged_in?\n current_user != :false\n end", "def logged_in?\n current_user.present?\n end", "def logged_in?\n return true if self.current_user\n return false\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\r\n current_user != :false\r\n end", "def loggedin?\n @session.nil? ? false : (return true)\n end", "def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend", "def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend", "def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end", "def logged_in?\n current_user != :false \n end", "def is_logged_in_user?\n session[:user_authenticated]\n end", "def logged_in?\n @logged_in == true\n end", "def logged_in?\n @logged_in == true\n end", "def logged_in?\n if current_user\n true\n else \n false\n end\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend", "def logged_in?\n return false unless @auth_header\n true\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n\t\t !!current_user\n end", "def logged_in?\r\n\t\t!current_user.nil?\r\n\tend", "def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end", "def logged_in?\n\t\tcurrent_user.present?\n\tend", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !!logged_in_user \n end", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n current_user ? true : false;\n end", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n @logged_in\n end", "def logged_in?\n @logged_in\n end", "def logged_in?\n @logged_in\n end", "def logged_in?\n @logged_in\n end", "def logged_in?\n current_user.present? # True neu user login\n end", "def logged_in?\n #boolean return\t\n \tcurrent_user != nil\n end", "def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end", "def logged_in?\n @logged_in ? true : false\n end", "def logged_in?\n current_user != nil ? true : false\n end", "def logged_in?\n return session['current_user']\n end", "def logged_in?\n !current_user.nil?\n end", "def logged_in?\n !current_user.nil?\n end", "def logged_in?\n\t\t!current_user.nil?\n \tend", "def is_logged_in?\n return true if current_user || current_admin\n end", "def logged_in?\n \t\t!current_user.nil?\n \tend", "def logged_in?\n\t\t#if currentuser.nil returns true then logedin is false\n\t\t!current_user.nil?\n\tend", "def logged_in?\n !current_user.blank?\n end", "def logged_in?\n !!session[:logged_in]\n end", "def logged_in?\n # !! turns this into a boolean, so we DON'T get nil\n !!session[:user_id]\n end", "def logged_in?\n !!session[:user_id]\n # !!@current_user\n end", "def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end", "def _is_login\n p session[:user]\n session[:user] ? true : false\n end", "def logged_in?\n if session[:username].blank? or\n session[:authenticated].blank? or\n !session[:authenticated]\n return false\n end\n\n return true\n end", "def user_logged_in?\n current_user.present?\n end", "def user_logged_in?\n current_user.present?\n end", "def logged_in?\n current_user_id.to_i > 0\n end", "def is_logged_in?\n session[:user_id].present?\n end", "def logged_in?\n current_user.is_a? User\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end" ]
[ "0.9082417", "0.8764097", "0.87552106", "0.8718715", "0.86894006", "0.86498255", "0.86469626", "0.86372185", "0.8631328", "0.86285406", "0.86285406", "0.8582609", "0.85669243", "0.85613596", "0.85613596", "0.8551865", "0.85491496", "0.85443276", "0.85409296", "0.8539988", "0.8517927", "0.8511279", "0.8508452", "0.8508452", "0.8507709", "0.8505226", "0.84988797", "0.8491304", "0.8484085", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.84715056", "0.8469552", "0.84658724", "0.8465275", "0.84569186", "0.84569186", "0.84569186", "0.84569186", "0.84564346", "0.8454783", "0.8454261", "0.8453559", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.8442786", "0.8442786", "0.8442786", "0.8442786", "0.84288824", "0.84257317", "0.84221077", "0.8421079", "0.84119624", "0.8409261", "0.840512", "0.840512", "0.8403647", "0.8402856", "0.8402169", "0.83969295", "0.83946496", "0.8387275", "0.8384129", "0.83830756", "0.83823043", "0.83774966", "0.83763194", "0.8374361", "0.8374361", "0.83696514", "0.8369602", "0.836562", "0.8361304", "0.8361304", "0.8361304", "0.8361304" ]
0.0
-1
Redirects to stored location (or to the default).
def redirect_back_or(default) redirect_to(session[:forwarding_url] || default) session.delete(:forwarding_url) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect_to_stored(default='/')\n return_to = session[:return_to] || default\n session[:return_to] = nil\n redirect return_to\n end", "def redirect_to_stored_location_or(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end", "def redirect_back_or_default(default)\n redirect_to(pop_stored_location || default)\n end", "def redirect_back_or_default(default)\n redirect_to(pop_stored_location || default)\n end", "def redirect(options = {})\r\n end", "def redirect_to_stored_or_default(default)\n if session['return-to'].nil?\n redirect_to default\n else\n redirect_to_url session['return-to']\n session['return-to'] = nil\n end\nend", "def redirect_back_or_default(default)\n redirect_to(location_stored? ? session[:return_to] : default)\n session[:return_to] = nil\n end", "def redirect(location, status = '302'); request.redirect(location, status); end", "def store_location\n session[:redirect] = request.url\n end", "def restore_location_or(default)\n redirect_to(session[:return_to] || default)\n session.delete(:return_to)\n end", "def redirect?; end", "def store_location!\n session[\"return_to\"] = request.env[\"warden.options\"][:attempted_path] if request.get?\n end", "def store_location\n session[:redirect_path] = request.path\n end", "def redirect_to_target(default=nil)\n \n goto_url=params[:return_to] || session[:return_to] || default || \"/\"\n \n session[:return_to] = nil\n redirect_to(goto_url)\n end", "def redirect\n redirect_to @goto_url\n end", "def store_and_redirect_location\n #session[:return_to] = \"/\"\n redirect_to \"/welcome/new\",:status => 401\n end", "def redirect_back_or_default(default)\n redirect_to url_for_redirect(default)\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url) # Delete the stored URL for next log in\n end", "def redirect(path)\n throw :redirect, path\n end", "def store_location(url = url_for(:controller => controller_name, :action => action_name))\n # It's possible to create a redirection attack with a redirect to data: protocol... and possibly others, so:\n # Whitelisting redirection to our own site and relative paths.\n url = nil unless url =~ /\\A([%2F\\/]|#{root_url})/\n session[:return_to] = url\n end", "def redirect(url); end", "def store_redirect\n if params.key?(:redirect)\n store_redirect_url_for(params[:redirect], request.referer)\n end\n end", "def redirect_back_or_default(default)\n loc = session[:return_to] || default\n session[:return_to] = nil\n redirect loc\n end", "def redirect_path(name, default = nil)\n stored_redirect_path(name) || default || root_path\n end", "def store_location\n\t\t\tsession[:return_to] = request.fullpath\n\t\tend", "def store_location!\n session[:\"#{scope}_return_to\"] = attempted_path if request.get? && !http_auth?\n end", "def redirect_to_path(path)\n redirect_to path\n end", "def redirect_back_or_to(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "def redirect_back_or_default(default)\n redirect_to(default)\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n # The following deletion happens even though the redirect stastement is written first.\n # This is because the redirect doesn't actually happen until an explicit\n # return statement or until the end of a method.\n session.delete(:forwarding_url)\n end", "def redirect_back_or(default)\n\n\t\t# redirects user to page stored in session symbol or the\n\t\t# dafault location if return_ to is not set.\n\t\tredirect_to(session[:return_to] || default)\n\n\t\t# Deletes the session symbol return_to\n\t\tsession.delete(:return_to)\n\tend", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n # Delete after the redirect so that the user will not be forwarded to the\n # same URL upon each login attempt.\n # Redirects always wait for the rest of the code block to return before\n # actually redirecting.\n end", "def redirect_to(args={})\n # use an url if specified\n @redirect = args[:url] if args[:url]\n # or build up an action if specified\n @redirect = File.join(\"/#{@workingpath[1..-1].join('/')}\",args[:action].to_s) if args[:action]\n logmsg \"base_controller::redirect_to() setting redirect to #{@redirect}\" if @@debug\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url) #delete what is stored.\n end", "def store_location\n\t\tsession[:return_to] = request.url\n\tend", "def store_location\n\t\tsession[:return_to] = request.fullpath\n\tend", "def store_location\n\t\tsession[:return_to] = request.fullpath\n\tend", "def store_location\n\n\t\t# Stores the requested page in a session symbol return_to\n\t\tsession[:return_to] = request.url\n\tend", "def redirect_back_or(default)\n #send back to what was stored in\n #\"session[:return_to] or default location\n redirect_to(session[:return_to] || default)\n #deletes saved return location\n session.delete(:return_to)\n end", "def redirect_back_or( default )\n\t\tredirect_to( session[:forwarding_url] || default )\n\t\tsession.delete( :forwarding_url )\n\tend", "def set_redirect_location\n @redirect_location = @shareable\n end", "def redirects; end", "def store_location\n session[:redirect_after_login] = request.request_uri\n end", "def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end", "def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end", "def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end", "def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end", "def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end", "def redirect_to(path)\n render(:status => 302, \"Location\" => path) { p { text(\"You are redirected to \"); a(path, :href => path) } }\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "def redirect_back_or_default(default)\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end", "def store_location\n\t\tsession[ :forwarding_url ] = request.original_url if request.get?\n\tend", "def redirect_back(default)\n redirect_to(session[:forward_url] || default)\n session.delete(:forward_url)\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default )\n session.delete(:forwarding_url)\n end", "def redirect_back(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete :forwarding_url\n end", "def redirect_back_or(default)\n redirect_to session[:forwarding_url] || default\n session.delete(:forwarding_url)\n end", "def store_location\n store_location_for(:user, params[:redirect_to]) if params[:redirect_to].present?\n\n # note: don't store the previous url on each call. this led to an issue where\n # missing asset might get run through this code, causing the user to be redirected\n # to the missing asset during a login\n # session[:previous_url] = request.url if request.url != new_user_session_url\n end", "def hubssolib_redirect_back_or_default(default)\n url = hubssolib_get_return_to\n hubssolib_set_return_to(nil)\n\n redirect_to(url || default)\n end", "def redirect_to options = {}\n @has_redirect = options\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "def redirect_back_or_default(default=nil)\n default = self.default_route\n redirect_to(session[:return_to] || default)\n session[:return_to] = nil\n end", "def redirect_back_or(default)\n # Redirects don’t happen until an explicit return or the end of the method, \n # so any code appearing after the redirect is still executed.\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "def redirect_back_or(default)\n redirect_url = session[:forwarding_url] || default\n session.delete :forwarding_url\n redirect_to redirect_url\n end", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def redirect_to_forwarding_url_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarding_url)\n end", "def store_location\n session[:return_to] = request.original_url\n end", "def redirect_back_or_default(default)\n redirect(session[:return_to] || default)\n session[:return_to] = nil\n end", "def store_location\n\t\t\tsession[:return_to] = request.fullpath\n\t end", "def redirect_back_or(default)\n\t\tredirect_to(session[:return_to] || default)\n\t\tclear_return_to\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:return_to] || default)\n\t\tclear_return_to\n\tend", "def redirect_back_or_default(default)\n loc = session[:return_to] || default\n session[:return_to] = nil\n redirect_to loc\n end", "def redirect_back_or_default(default, options = {})\n target = url_to_store(session[:return_to])\n (target = logged_in? ? home_url(current_user) : nil) if target == '{home}'\n #target = nil if target == APP_CONFIG.hostname || target == APP_CONFIG.hostname + '/'\n target = default unless target\n target = safe_redirect(target)\n session[:return_to] = nil\n return target if options[:find_target_only]\n redirect_to(target)\n end", "def redirect_back_or_default(default)\n\t\tredirect_to(session[:return_to] || default)\n\t\tsession[:return_to] = nil\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default )\n\t\tsession.delete(:forwarding_url)\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url]||default)\n\t\tsession.delete(:forwarding_url)\n\tend", "def store_location\n \t\tsession[:forwarding_url] = request.original_url if request.get?\n \tend", "def redirect_back_or_default(default)\n if session[:return_to].nil?\n redirect_to default\n else\n redirect_to session[:return_to]\n session[:return_to] = nil\n end\n end", "def redirect_back_or_default(default)\n if session[:return_to].nil?\n redirect_to default\n else\n redirect_to session[:return_to]\n session[:return_to] = nil\n end\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default)\n session.delete(:forwarind_url)\n end", "def set_redirect\n @redirect = params[:origin_url] == nil ? bookmarks_path : params[:origin_url]\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || default )\n session.delete(:forwarding_url)\n end", "def redirect_back_or_default(default)\n session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)\n session[:return_to] = nil\n end", "def redirect_back_or_default(default)\n session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)\n session[:return_to] = nil\n end", "def redirect_back_or_default(default)\n session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)\n session[:return_to] = nil\n end", "def redirect_back_or( default )\n redirect_to( session[ :return_to ] || default )\n session.delete( :return_to )\n end", "def redirect_back_or(default)\n redirect_to(session[:forwarding_url] || root_path)\n session.delete(:forwarding_url)\n end", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend", "def redirect_back_or(default)\n\t\tredirect_to(session[:forwarding_url] || default)\n\t\tsession.delete(:forwarding_url)\n\tend", "def redirect(url)\n raise \"To be implemented by client application\"\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def redirect_back_or(default)\n \tredirect_to(session[:forwarding_url] || default)\n\t session.delete(:forwarding_url)\n\tend" ]
[ "0.7730111", "0.7649159", "0.704684", "0.7029194", "0.6981081", "0.6871779", "0.67809576", "0.67569697", "0.6699827", "0.65908873", "0.6580519", "0.65731466", "0.65681744", "0.6567211", "0.654002", "0.653624", "0.6530604", "0.65075284", "0.64961356", "0.64893895", "0.6443822", "0.6438121", "0.64144045", "0.64038223", "0.63955456", "0.63915783", "0.638389", "0.63774705", "0.6366385", "0.6365043", "0.6356526", "0.63548374", "0.6352605", "0.63401383", "0.633513", "0.63308966", "0.63308966", "0.63304746", "0.6327596", "0.6324449", "0.63240635", "0.63172257", "0.631491", "0.63140327", "0.63140327", "0.63140327", "0.63140327", "0.63140327", "0.6307154", "0.6288226", "0.6288226", "0.6286348", "0.628622", "0.6282425", "0.62797725", "0.6279272", "0.62750477", "0.6270668", "0.62699354", "0.6269081", "0.62617534", "0.6260936", "0.6243385", "0.62430793", "0.624299", "0.624299", "0.624299", "0.624299", "0.6242862", "0.62418014", "0.6233176", "0.6231419", "0.62295544", "0.6228895", "0.6228895", "0.6228469", "0.62256324", "0.6223309", "0.6220299", "0.6220131", "0.62192047", "0.62185204", "0.62185204", "0.62183094", "0.62165177", "0.62163824", "0.6214744", "0.6214744", "0.6214744", "0.6214643", "0.6213592", "0.6211143", "0.6211143", "0.6211143", "0.6211143", "0.6211143", "0.6211143", "0.6211143", "0.6209995", "0.6208843", "0.6204134" ]
0.0
-1
Stores the URL trying to be accessed.
def store_location session[:forwarding_url] = request.url if request.get? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_location\n session[:forwarding_url] = request.url if request.get?\n # Makes sure that the URL is saved only for a GET request because submitting\n # DELETE, PATCH or POST will raise errors when the URL is expecting\n # a GET request.\n end", "def store_location\n # store last url as long as it isn't a /users path\n\tsession[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/ or request.fullpath =~ /\\/json/ or request.fullpath =~ /\\/static/\n\t\n end", "def store_location\n\t\tif request.get?\n\t\t\tcookies[:previous_url] = request.url\n\t\tend\n\tend", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location!\n session[:\"#{scope}_return_to\"] = attempted_path if request.get? && !http_auth?\n end", "def store_location\n # Store the URL only when the reqest was GET\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_URL\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def store_url\n session[:forwarding_url] = request.original_url if request.get?\n end", "def url= new_url\n new_url = self.class.standardized_url new_url\n return if new_url == url\n super new_url # Heading for trouble if url wasn't unique\n @indexing_url = nil # Clear the memoized indexing_url\n self.http_status = nil # Reset the http_status\n # We do NOT build the associated site here, because we may be BUILDING the page_ref for a site, in\n # which case that site will assign itself to us. Instead, the site attribute is memoized, and if it\n # hasn't been built by the time that it is accessed, THEN we find or build an appropriate site\n self.site = SiteServices.find_or_build_for self\n self.kind = :site if site&.page_ref == self # Site may have failed to build\n # We trigger the site-adoption process if the existing site doesn't serve the new url\n # self.site = nil if site&.persisted? && (SiteServices.find_for(url) != site) # Gonna have to find another site\n request_attributes :url # Trigger gleaning and mercury_result to validate/modify url\n attrib_ready! :url # Has been requested but is currently ready\n end", "def url=(_); end", "def store_location!\n store_location_for(scope, attempted_path) if request.get? && !http_auth?\n end", "def set_url\n @url = Url.find_by(key: params[:key])\n end", "def store_location\n session[:forward_url] = request.url if request.get?\n end", "def store_location\n\t\tsession[:forwarding_url]=request.original_url if request.get?\n\tend", "def store_location\n\t\t# store last url - this is needed for post-login redirect to whatever the user last visited.\n\t\tif (request.fullpath != \"/users/sign_in\" &&\n\t\t\t\trequest.fullpath != \"/users/sign_up\" &&\n\t\t\t\trequest.fullpath != \"/users/password\" &&\n\t\t\t\trequest.fullpath != \"/users/sign_out\" &&\n\t\t\t\trequest.fullpath !~ /\\/users\\/confirmation/i &&\n\t\t\t\t!request.xhr?) # don't store ajax calls\n\t\t\tsession[:previous_url] = request.fullpath\n\t\tend\n\tend", "def store_location\n # store last url - this is needed for post-login redirect to whatever the user last visited.\n return unless request.get? \n if (!request.fullpath.match(\"/users\") &&\n !request.xhr?) # don't store ajax calls\n session[\"user_return_to\"] = request.fullpath\n end\n end", "def url_server\n\t\t\tunless @links_to_visit.empty?\n\t\t\t\t@url = @links_to_visit.pop\n\t\t\tend\n\t\tend", "def store_location\n session[:forwarding_url] = request.url? if request.get?\n end", "def store_location\n \tsession[:forwarding_url] = request.url if request.get?\n end", "def store_location\n\t\tsession[ :forwarding_url ] = request.original_url if request.get?\n\tend", "def store_location\n if request.get?\n session[:forwarding_url] = request.original_url\n end\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location\n session[:forwarding_url] = request.original_url if request.get?\n end", "def store_location \n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def store_location\n\t # store last url - this is needed for post-login redirect to whatever the user last visited.\n\t if !devise_controller? && !request.xhr? # don't store ajax calls\n\t session[:previous_url] = request.fullpath \n\t end\n\tend", "def url=(url)\n @@url = url\n end", "def store_location\n session[ :return_to ] = request.url if request.get?\n end", "def store_location\n # store last url - this is needed for post-login redirect to whatever the user last visited.\n if (request.path != \"/users/sign_in\" &&\n request.path != \"/users/sign_up\" &&\n request.path != \"/users/password/new\" &&\n request.path != \"/users/password/edit\" &&\n request.path != \"/users/confirmation\" &&\n request.path != \"/users/sign_out\" &&\n !request.fullpath.match(/\\/users\\/auth\\//) &&\n !request.xhr?) # don't store ajax calls\n session[:previous_url] = request.fullpath\n end\n end", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location_url(url)\n session[:forwarding_url] = url\n end", "def store_location\n session[:forwarding_url] = request.original_fullpath if request.get?\n end", "def store_location\n \t\tsession[:forwarding_url] = request.original_url if request.get?\n \tend", "def url=(url)\n @@url = url\n end", "def store_location\n # session[:forwarding_url] = request.url if request.get?\n user_session[:forwarding_url] = request.referer if request.get? && request.referer\n end", "def save_previous_url\n\t\t\tunless request.referer.include?('likes')\n\t\t\t\tsession[:previous_url] = URI(request.referrer).path\n\t\t\tend\n\t\tend", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n\t\t#Store target location (only if request=get). (For example, if user request a page but\n\t\t# it's not signed in. It remembers the request)\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def store_location\n session[:forwarding_url]=request.fullpath if request.get?\n end", "def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def store_location\n\t\tsession[:last_page] = @request.request_uri\n\tend", "def store_location\n\t session[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n \tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location(url = url_for(:controller => controller_name, :action => action_name))\n # It's possible to create a redirection attack with a redirect to data: protocol... and possibly others, so:\n # Whitelisting redirection to our own site and relative paths.\n url = nil unless url =~ /\\A([%2F\\/]|#{root_url})/\n session[:return_to] = url\n end", "def store_location\n session[:forwarding_url] = request.url if request.get? # only for get requests. A user could technically delete their cookie then submit a form\n end", "def store_forwarding_url\n session[:forwarding_url] = request.url if request.get?\n end", "def store_location\n if ((!request.fullpath.match(\"/users\") && !request.fullpath.match(\"/admin\") && !request.fullpath.match(\"/admin/login\")) &&\n !request.xhr?) # don't store ajax calls\n# puts \"----------------------------\"\n# puts \"--not store--\"\n session[:previous_url] = request.fullpath\n else\n# puts \"----------------------------\"\n# puts \"--store--\"\n end\n end", "def guardar_URL\n\t\tsession[:url_deseada] = request.original_url if request.get?\n\tend" ]
[ "0.6912814", "0.6897356", "0.688702", "0.6786295", "0.6786295", "0.6786295", "0.6786295", "0.6786295", "0.6786295", "0.6694544", "0.66805685", "0.66383713", "0.6634571", "0.6630931", "0.6593764", "0.6593764", "0.6593764", "0.6593764", "0.6593677", "0.65701944", "0.65585965", "0.6557071", "0.655092", "0.65458846", "0.6495066", "0.6492803", "0.64884543", "0.64841366", "0.64692926", "0.64670247", "0.6462621", "0.64622223", "0.6461886", "0.6461886", "0.6459761", "0.6457037", "0.6444241", "0.64190674", "0.6404889", "0.6394051", "0.6394051", "0.6394051", "0.6394051", "0.63932395", "0.6390039", "0.63803685", "0.63747966", "0.63697034", "0.63678056", "0.6352348", "0.63515145", "0.633886", "0.63378155", "0.63378155", "0.63378155", "0.63347703", "0.63187176", "0.6318029", "0.6318029", "0.6318029", "0.6318029", "0.63155544", "0.6314164", "0.6304329", "0.630132", "0.6292948", "0.62913555" ]
0.647905
55
Confirms a loggedin user.
def logged_in_user unless logged_in? store_location flash[:danger] = "Please enter your worker ID to continue." redirect_to start_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end", "def confirm_logged_in\n \tunless session[:user_id]\n \t\tflash[:notice] = \"Please Log in.\"\n \t\tredirect_to(login_path)\n \tend\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end", "def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere else in the app\n flash['notice'] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end", "def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end", "def confirm_logged_in\n unless session[:user_id]\n redirect_to login_path, alert: \"Please log in\"\n end\n end", "def confirm_user_logged_in\n unless logged_in?\n store_url # So that user is sent to the same URL after they log in\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end", "def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end", "def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end", "def confirm\n if current_visitor && current_visitor.has_role?('admin', 'manager')\n user = User.find(params[:id]) unless params[:id].blank?\n if !params[:id].blank? && user && user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n # assume this type of user just activated someone from somewhere else in the app\n flash[:notice] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n else\n flash[:notice] = \"Please login as an administrator.\"\n redirect_to(root_path)\n end\n end", "def correct_user\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend", "def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end", "def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end", "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend", "def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end", "def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end", "def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def confirm_user\n if session[:user_id]\n return true\n else\n flash[:notice] = \"please login\"\n redirect_to(:controller => 'manage', :action => 'login')\n return false\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end", "def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend", "def confirm_logged_in\n unless session[:username]\n redirect_to authenticate_login_path\n else\n true\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend", "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) #checks if current_user == @user\n #current_user? defined in session helper\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end", "def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n redirect_to root_path\n return false # halts the before_action\n else\n return true\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "def correct_user\n @user = User.find(params[:id])\n\n if @user != current_user\n redirect_to(root_path)\n else\n # nothing to do\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end", "def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user.id == @user.id)\n end", "def correct_user\n @user = User.find(params[:id])\n # current_user?() is a sessions_helper method. The user of the params hash has\n # to match the current user or will be redirected to root\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n\t\t@user = User.find(params[ :id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "def confirm_logged_in\r\n unless session[:username]\r\n redirect_to authenticate_index_path\r\n else\r\n true\r\n end\r\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) # current_user is method in sessions_helper.rb\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end" ]
[ "0.70087826", "0.6982988", "0.6919373", "0.688131", "0.6845446", "0.68326277", "0.67944413", "0.67929715", "0.6642435", "0.6624581", "0.66114175", "0.66022736", "0.6589018", "0.65539706", "0.65349805", "0.65303934", "0.6512816", "0.650312", "0.64878744", "0.6487622", "0.6480418", "0.6479267", "0.64705276", "0.64680994", "0.64656436", "0.6457351", "0.64541256", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.64485556", "0.6445996", "0.6437721", "0.64289176", "0.64260334", "0.6424799", "0.6417934", "0.64177954", "0.64163303", "0.6410097", "0.6401843", "0.63820904", "0.63622755", "0.63595843", "0.6355515", "0.635374", "0.6351282", "0.6350864", "0.63502026", "0.63502026", "0.63502026", "0.6347271", "0.63426447", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.6342538", "0.63400817", "0.63345385", "0.63329995", "0.6331134", "0.6330873", "0.632984", "0.6325074", "0.63200074", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605", "0.63152605" ]
0.0
-1
I worked on this challenge with: Jon Clayton. Your Solution Below
def leap_year? (year) case when year % 400 == 0 return true when year % 100 == 0 return false when year % 4 == 0 return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def challenge; end", "def decodeHalfway(input)\n sum = 0\n\n # Only have to loop through half the array since the numbers are being compared halfway around\n # Multiply each matching character by 2 to compensate for not looping through its pair\n input.chars[0..input.length/2 - 1].each_with_index do |char, i|\n sum += 2*char.to_i if char == input[i + input.length/2]\n end\n sum\nend", "def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsthalf = (n_string.length / 2) - 1\r\nsecondhalfstart = (n_string.length / 2)\r\nsecondhalfend = (n_string.length - 1)\r\n(0..firsthalf).each do |idx|\r\n half1 << n_string[idx].to_i\r\nend\r\n\r\n(secondhalfstart..secondhalfend).each do |idx|\r\n half2 << n_string[idx].to_i\r\nend\r\n\r\nreturn true if half1.inject(:+) == half2.inject(:+)\r\nreturn false\r\nend", "def solution(a)\n number = a.to_s.chars\n first_arrays = []\n (number.length/2).times do\n first_arrays << number.shift\n first_arrays << number.rotate(number.length-1).shift\n number.pop\n end\n ( first_arrays + number ).join(\"\").to_i\nend", "def problem_57\n ret,n,d = 0,1,1\n 1000.times do |i|\n n,d = (n+2*d),(n+d)\n ret += 1 if n.to_s.length > d.to_s.length\n end\n ret\nend", "def is_happy(n)\n i = 0\n r = false\n destination = []\n while r == false\n n.to_s.split(\"\").each do |x|\n destination << ((x.to_i * x.to_i))\n end\n i = i + 1\n n = destination.inject(&:+)\n r = true if n == 1\n destination = []\n break if i == 1000\n end\n if r == true\n p r\n else\n p false\n end\nend", "def solution(a)\n length = a.length\n sum = (length + 1) * (length + 1 + 1) / 2\n\n sum - a.inject(0) { |acc, e| acc += e }\nend", "def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043557\"\n result += \"66896648950445244523161731856403098711121722383113\"\n result += \"62229893423380308135336276614282806444486645238749\"\n result += \"30358907296290491560440772390713810515859307960866\"\n result += \"70172427121883998797908792274921901699720888093776\"\n result += \"65727333001053367881220235421809751254540594752243\"\n result += \"52584907711670556013604839586446706324415722155397\"\n result += \"53697817977846174064955149290862569321978468622482\"\n result += \"83972241375657056057490261407972968652414535100474\"\n result += \"82166370484403199890008895243450658541227588666881\"\n result += \"16427171479924442928230863465674813919123162824586\"\n result += \"17866458359124566529476545682848912883142607690042\"\n result += \"24219022671055626321111109370544217506941658960408\"\n result += \"07198403850962455444362981230987879927244284909188\"\n result += \"84580156166097919133875499200524063689912560717606\"\n result += \"05886116467109405077541002256983155200055935729725\"\n result += \"71636269561882670428252483600823257530420752963450\"\n\n result\nend", "def solution(s)\n if s.length.odd?\n center = s.length / 2\n if s[0...center] == s[center + 1..s.length].reverse\n return center \n end\n end\n -1\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 solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\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 solve(input)\n data = input.chars\n buckets = []\n current = []\n data.each_with_index do |c, i|\n n = data[i + 1]\n current << c\n unless n == c\n buckets << current\n current = []\n end\n break if n.nil?\n end\n\n ret = ''\n buckets.each do |b|\n ret += b.count.to_s\n ret += b.first\n end\n ret\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\n end\t\r\n return 1 if a.inject(:+) ==n*(n+1)/2;\r\nend", "def solution(a)\n n = a.size\n passing_cars = 0\n\n suffix_sums = Array.new(n + 1, 0)\n\n a.reverse.each_with_index do |elem, i|\n suffix_sums[i + 1] = suffix_sums[i] + elem\n end\n suffix_sums.reverse!\n\n a.each_with_index do |car, i|\n if car == 0\n passing_cars += suffix_sums[i]\n end\n end\n\n passing_cars > 1_000_000_000 ? -1 : passing_cars\nend", "def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend", "def isLucky(n)\n new_array = n.to_s.split(\"\")\n new_length = new_array.length\n\n a, b = [], []\n\n (0...new_length / 2).each { |x| a.push(new_array[x].to_i) }\n (new_length / 2...new_length).each { |y| b.push(new_array[y].to_i) }\n\n if a.inject(:+) == b.inject(:+)\n return true\n else\n false\n end\n\nend", "def solve(s)\n answer = \"\"\n (0...s.length - 1).each do |idx|\n if s[idx] != s[idx + 1]\n answer += s[idx]\n end\n if idx == s.length - 2 && s[idx] == s[idx + 1]\n answer += s[idx]\n end\n end\n return answer\nend", "def solution(a)\n return 1 if a.empty?\n a.sort!\n return 1 if a.first > 1\n return a.first + 1 if a.length <2\n (0..(a.length)).each do |index|\n return a[index] + 1 if a[index] + 1 != a[index + 1]\n end\n return a.last + 1\nend", "def solution\n (2..(9**5 * 6)).select do |n|\n n.to_s.split(//).map do |d|\n d.to_i ** 5\n end.reduce(:+) == n\n end.reduce(:+)\nend", "def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend", "def isLucky(n)\n sum, sum2 = 0, 0\n arr = n.to_s.split(\"\")\n \n first_half = arr.take(arr.size / 2) \n second_half = arr.drop((arr.size / 2))\n first_half.each { |x| sum += x.to_i }\n second_half.each {|x| sum2 += x.to_i}\n \n sum == sum2\nend", "def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend", "def solution(a)\n # write your code in Ruby 2.2\n n = a.length\n \n counter = Array.new(n+1, 0)\n \n a.each do |x|\n counter[x-1] += 1\n end\n \n return counter.index { |x| x == 0 } + 1\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = n.to_s(2)\n arr = []\n if a[-1] == '1'\n arr = a.split('1')\n else\n arr = a.split('1')\n arr.pop\n end\n if arr.max.nil?\n 0\n else\n arr.max.length\n end\nend", "def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend", "def solutions(a)\r\n\r\n ary = a.sort\r\n ary.each_with_index do |num, index|\r\n if ary[index+1] != num + 1 && index != ary.length-1\r\n return num + 1\r\n end\r\n end\r\n\r\nend", "def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend", "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(:+)\n acc = 0\n\n min = 99999999\n a[0..-2].each do |n|\n sum -= n\n acc += n\n\n min = [(acc - sum).abs, min].min\n end\n min\nend", "def solution(number)\nn = 0..number\na = []\nfor i in n\n if i % 3 == 0 || i % 5 == 0\n a = a.push(i)\n end\n end\ns = 0\n# a.pop\na.each {|x| s += x}\ns\nend", "def solution(a)\r\n a.each do |num|\r\n if (a.count(num) % 2) != 0\r\n return num\r\n end\r\n end\r\nend", "def captcha(input)\n sum = 0\n 0.upto(input.length - 1) do |i|\n sum += input[i].to_i if input[i] == input[(i+1) % input.length]\n end\n sum\nend", "def solution(roman)\n split = roman.split(\"\")\n last_value = 0\n split.reduce(0) do |final, char|\n current = CONVERSION[char.upcase]\n binding.pry\n if current >= last_value\n final += current\n else\n final -= current\n end\n binding.pry\n last_value = current\n final\n end\nend", "def num_decodings(s)\n\n decode = ('A'..'Z').to_a\n number_of_prev_ended_singly = 1\n\n ways_count = 1\n number_of_prev_ended_singly = 1\n\n s.chars[1..-1].each_with_index do |ch, idx|\n if s[idx - 1].to_i == 1 ||\n s[idx - 1] == 2.to_i && ch.to_i.between?(1,6)\n\n numbers_added_this_time = ways_count - number_of_prev_ended_singly\n ways_count += numbers_added_this_time\n number_of_prev_ended_singly = numbers_added_this_time\n else\n number_of_prev_ended_singly = 0\n end\n end\n\n ways_count\n\nend", "def solution(a)\n accessed = Array.new(a.size + 1, nil)\n caterpillar_back = 0\n count = 0\n\n a.each_with_index do |x, caterpillar_front|\n if accessed[x] == nil\n accessed[x] = caterpillar_front\n else\n new_caterpillar_back = accessed[x] + 1\n first_part_size = caterpillar_front - caterpillar_back\n second_part_size = caterpillar_front - new_caterpillar_back\n count += first_part_size * (first_part_size + 1) / 2\n count -= (second_part_size) * (second_part_size + 1) / 2\n caterpillar_back.upto(new_caterpillar_back - 1) { |n| accessed[a[n]] = nil}\n accessed[x] = caterpillar_front\n caterpillar_back = new_caterpillar_back\n end\n end\n\n remaining_size = a.size - caterpillar_back\n count += (remaining_size) * (remaining_size + 1) / 2\n end", "def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend", "def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend", "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "def isLucky(n)\n a = n.to_s.split(\"\")\n full = a.count - 1\n half = a.count/2 - 1\n \n total_1 = 0\n total_2 = 0\n \n for i in 0..full\n if i > half\n total_2 += a[i].to_i\n else\n total_1 += a[i].to_i\n end\n end\n \n if total_1 == total_2\n true\n else\n false\n end\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n is_perm = 0\n \n n = a.length\n b = [0]*n\n \n \n a.each do |v|\n break if v > n \n break if b[v] == 1 \n b[v] = 1\n end\n \n sum = b.inject(:+)\n if sum == n\n is_perm = 1\n end\n \n is_perm\nend", "def solution(a)\n cars_going_east = [0]\n\n a.each do |direction|\n next_counter = direction.zero? ? cars_going_east.last + 1 : cars_going_east.last\n cars_going_east << next_counter\n end\n\n passings = 0\n a.each_with_index do |direction, index|\n passings += cars_going_east[index] if direction == 1\n end\n\n return -1 if passings > 1000000000\n passings\nend", "def solution(n)\n # write your code in Ruby 2.2\n a = Math.sqrt(n).floor\n a -= 1 while n % a != 0\n b = n / a\n (a + b) * 2\nend", "def solution1(seeds)\n turn_map = {}\n seeds.each_with_index { |n, turn| turn_map[n] = [1, turn + 1, turn + 1] }\n last_number = seeds.last\n\n ((seeds.length+1)..2020).each do |turn|\n last_stats = turn_map[last_number]\n if last_stats[TIMES_SPOKEN] == 1\n zero = turn_map[0] || [0, turn, turn]\n zero[TIMES_SPOKEN] += 1\n zero[FIRST_SPOKEN] = zero[LAST_SPOKEN]\n zero[LAST_SPOKEN] = turn\n \n turn_map[0] = zero\n last_number = 0\n else\n age = last_stats[LAST_SPOKEN] - last_stats[FIRST_SPOKEN]\n\n num = turn_map[age] || [0, turn, turn]\n num[TIMES_SPOKEN] += 1\n num[FIRST_SPOKEN] = num[LAST_SPOKEN]\n num[LAST_SPOKEN] = turn\n \n turn_map[age] = num\n last_number = age\n end\n end\n\n last_number\nend", "def solution(a)\r\n # write your code in Ruby 2.2\r\n #trangular\r\n # a[0] = 10\r\n # a[2] = 5\r\n # a[4] = 8\r\n # 10 + 5 > 8\r\n # 5 + 8 > 10\r\n #8 + 10 > 5\r\n \r\n \r\n l=a.count\r\n \r\n i=0\r\n while(i<l) do\r\n j=i+1\r\n while(j<l) do\r\n k=j+1\r\n \r\n \r\n while(k<l) do\r\n if((a[i] + a[j] > a[k]) && (a[j] +a[k] > a[i]) && (a[k] + a[i] >a[j]))\r\n return 1\r\n end\r\n k+=1 \r\n end \r\n \r\n j+=1 \r\n end\r\n i+=1\r\n end\r\n \r\n return 0\r\n \r\nend", "def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend", "def icecreamParlor(m, arr)\n # Complete this function\n res = []\n arr.each_index do |i|\n if i + 1 !=nil\n j = i + 1\n while j <= arr.length - 1\n if arr[i]+arr[j] == m\n res.push([i+1,j+1])\n end\n j+=1\n end\n end\n end\n res\nend", "def day_2_part_2\n noun = 0\n verb = 0\n\n while noun < 100\n while verb < 100\n if compute(noun, verb) == 19690720\n return (100 * noun) + verb\n end\n verb += 1\n end\n noun += 1\n verb = 0\n end\nend", "def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend", "def hard(input)\n to = input / 10\n houses = Array.new(to, 0)\n (1..to).each do |n|\n count = 0\n n.step(by: n, to: to - 1) do |i|\n houses[i] += 11 * n\n count += 1\n break if count == 50\n end\n end\n houses.index { |count| count >= input }\nend", "def correct(element)\n result = nil\n element.downto(0).each do |j|\n i = element - j\n if j == element && j % 3 == 0\n result = Array.new(j, 5)\n elsif i % 5 == 0 && j % 3 == 0\n result = Array.new(j, 5) + Array.new(i, 3)\n elsif i == element && i % 5 == 0\n result = Array.new(i, 3)\n end\n\n break if result\n end\n\n if result.nil?\n puts -1\n else\n puts result.join()\n end\nend", "def solution(a)\n # write your code in Ruby 2.2\n permutation = Array(1..a.size)\n # puts permutation\n return 1 if permutation - a == []\n 0\nend", "def solution(a)\n n = a.size\n return 0 unless n > 2\n a.sort!\n\n (2..n - 1).each do |i|\n return 1 if a[i - 2] + a[i - 1] > a[i]\n end\n\n return 0\nend", "def hackerrankInString(str)\n expected_chars = %w[h a c k e r r a n k]\n input_chars = str.chars\n\n str.chars.each do |char|\n # Thought so, apparently not: Edge case: there should be no more chars after the last 'k' in hackerrank.\n # break if expected_chars.empty?\n\n input_chars.shift\n expected_chars.shift if char == expected_chars[0]\n end\n\n expected_chars.empty? && input_chars.empty? ? 'YES' : 'NO'\nend", "def solution(a)\n # write your code in Ruby 2.2\n\n # sort a\n a = a.sort\n odd = 0\n\n # loop over the array\n (0..(a.length-1)).step(2) do |i|\n if((i+1 >= a.length) || ((i+1 < a.length) && (a[i] != a[i+1])))\n odd = a[i]\n break\n end\n end\n\n odd\nend", "def alg; end", "def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend", "def solution(a)\n a.sort!\n a.each_with_index do |element, index|\n return 0 if element != index + 1\n end\n 1\nend", "def f(n)\n # your code here\n result = []\n possibles = (2..n).flat_map{ |s| [*2..n].combination(s).map(&:join).to_a }\n p possibles\n possibles.each do |i|\n x = 0\n temp_arr = []\n temp = i.split('').map { |j| j.to_i }\n p temp\n while x < temp.length do \n if i[x + 1] != i[x] + 1 || i[x + 1] == nil\n temp_arr << i[x]\n end\n x += 1\n end\n result << temp_arr\n end\n result.length\nend", "def solution(a)\n s= a.sort\n 0.step(s.size - 1).inject(0) do |result, x|\n z= x+2\n (x+1).step(s.size - 1).inject(result) do |acc, y|\n z+=1 while z < s.size && s[x] + s[y] > s[z]\n acc += z-y-1\n end\n end\nend", "def goodVsEvil(good, evil)\n # good_power, evil_power = 0, 0\n # good.split.each_with_index do |num, i|\n # if i < 3\n # good_power += num.to_i * (i + 1)\n # elsif i < 5\n # good_power += num.to_i * i\n # elsif i == 5\n # good_power += num.to_i * 2 * i\n # end\n # end\n god = good.split.each_with_index.inject(0) do |sum, (num, i)|\n if i < 3\n sum + num.to_i * (i + 1)\n elsif i < 5\n sum + num.to_i * i\n elsif i == 5\n sum + num.to_i * 2 * i\n end\n end\n \n \n evl = evil.split.each_with_index.inject(0) do |sum, (num, i)|\n case i\n when 0\n sum + num.to_i * (i + 1)\n when 1, 2, 3\n sum + num.to_i * 2\n when 4\n sum + num.to_i * (i - 1)\n when 5\n sum + num.to_i * i\n when 6\n sum + num.to_i * (i + 4) \n end\n end\n \n if evl > god\n str = \"Evil eradicates all trace of Good\"\n elsif evl < god\n str = \"Good triumphs over Evil\"\n else\n str = \"No victor on this battle field\"\n end\n \n \"Battle Result: #{str}\"\nend", "def solution(a)\n return 1 if a.count == 0\n \n real_sum = a.inject(:+)\n expected_sum = (a.count + 1) * (a.count + 2) / 2.0\n (expected_sum - real_sum).to_i\nend", "def main\n max = 10 ** 9 + 7\n all = 1\n zero = 1\n nine = 1\n zn = 1\n N.times.each do\n all = all * 10 % max\n zero = zero * 9 % max\n nine = nine * 9 % max\n zn = zn * 8 % max\n end\n return (all - zero - nine + zn) % max\nend", "def solve(s)\n answer = \"\"\n arr = s.split('')\n hash = Hash.new(0)\n arr.each_with_index do |el, idx|\n if el.to_i >= 1\n if arr[idx + 1] == \"(\"\n el.to_i.times do \n if arr[idx + 2].to_i >= 1\n if arr[idx + 3] == \"(\"\n arr[idx + 2].to_i.times do \n answer += (arr[(idx + 4)...arr.index(\")\")].join(''))\n end\n end\n end\n answer += (arr[(idx + 2)...arr.index(\")\")].join(''))\n end\n \n # hash[arr[idx + 1]] += 1\n end\n end\n \n end\n return answer\nend", "def solution(m, a)\n n = a.count\n result = 0\n front = 0\n numbers = Array.new(m + 1, false)\n n.times { |back|\n while front < n and not numbers[a[front] - 1]\n numbers[a[front] - 1] = true\n front += 1\n result += front - back\n return 1_000_000_000 if result >= 1_000_000_000\n end\n numbers[a[back] - 1] = false\n }\n result\nend", "def solve(nums)\n count = 0\n nums.each do |num|\n if num.to_s.length % 2 != 0\n count += 1\n end\n end\n return count\nend", "def solution(a)\n # write your code in Ruby 2.2\n counts = {}\n missing = -1\n\n a.each do |a_i|\n counts[a_i] = counts[a_i].to_i + 1\n end\n\n (1..a.length).each do |i|\n if(counts[i].nil?)\n missing = i\n break\n end\n end\n\n if(missing == -1)\n missing = a.length + 1\n end\n\n missing\nend", "def solution(a)\n return 0 if a.length < 3\n a.sort!\n\n for i in 0..(a.length - 3)\n return 1 if a[i] + a[i + 1] > a[i + 2]\n end\n return 0\nend", "def is_armstrong(n)\n n_str=n.to_s()\n char_list=n_str.split(//)\n int_list=char_list.map {|x| (x.to_i())**(n_str.length()) }\n mysum = int_list.reduce(0) { |sum, num| sum + num }\n return (mysum==n)\nend", "def isHappy? n\n acc = {}\n acc[n] = true\n begin\n sum = 0\n n.to_s.split(\"\").map {|i| sum += i.to_i**2}\n\n if sum == 1 then return true\n elsif acc.has_key?(sum) then return false\n else acc[sum] = true end\n\n n = sum\n end while sum != 1\nend", "def solution(s)\n return 0 if s.empty?\n t = 0\n ('A'..'Z').to_a.each do |c|\n t += s.count(c)\n end\n t + 1\nend", "def solution(n)\n (1..n).to_a.join.chars.map(&:to_i).sum\nend", "def strong_num(n)\n array = n.to_s.chars.map(&:to_i)\n sumarray = []\n array.each do |number|\n sum = (1..number).inject(:*) || 1\n sumarray << sum\n end\n sumarray.sum == n ? \"STRONG!!!!\" : \"Not Strong !!\"\nend", "def Lexicographic(myString)\n\n origArray = myString.split(//)\n newArr = origArray.permutation.to_a\n counter = 1\n newArr.each do |x|\n if counter == 1000000\n print counter, \"--> \", x.join, \"\\n\"\n break\n else\n counter = counter + 1\n end\n end\nend", "def odds_and_evens(string, return_odds)\n# Creates new method with two arguments, 'string' and 'return_odds' boolean.\n\n to_return = \"\"\n# Creates new variable and assigns it an empty string.\n\n string.size.times do |index|\n# First applies the .size method to the string to calculate the size of the string and return the resulting number. E.g. if the string is \"Rare\", .size will applied to the string returns 4 because \"Rare\" has 4 letters.\n\n# Second applies the .times to the number returned after calculating the string size. E.g. if the string is \"Rare\", .times will execute the following loop x4 times.\n\n# Third the \"| index |\" means do for each indexed character the following steps. A string has an index, e.g. [[0, r], [1, a], [2, r], [3, e]], where the first character is the index number and the second is the corresponding character. Note '0' is considered an even number for coding purposes.\n\n next if return_odds && index.even?\n # First iteration iterates over index[0], i.e. \"r'.\n # => next if false && r.even?\n # => next if false && true\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete next step using the return value of index[0].\n\n # Second iteration iterates over index[1], i.e. 'a'.\n # => next if false && a.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"a\" and instead move on to complete next step using the return value of index[1].\n\n # Third iteration iterates over index[2], i.e. the second letter \"r\".\n # => next if false && r.even?\n # => next if false && true\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete next step using the return value of index[2].\n\n # Fourth iteration iterates over index[3], i.e. \"e\".\n # => next if false && e.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"e\" and instead move on to complete next step using the return value of index[2].\n\n puts index\n\n # First iteration puts value of index[0] to screen.\n\n # Second iteration puts value of index[1] to screen.\n\n # Third iteration puts value of index[2] to screen.\n\n # Fourth iteration puts value of index[3] to screen.\n\n next if !return_odds && index.odd?\n # First iteration continues to iterate this step over index[0], i.e. \"r\".\n # => next if true && r.odd?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete the next steps using index[0] as return value.\n\n # Second iteration continues to iterate this step over index[1], i.e. \"a\".\n # => next if true && a.odd?\n # => next if true && true\n # => next if true\n # => therefore tells ruby to skip \"a\" and ignore the next steps.\n\n # Third iteration continues to iterate this step over index[2], i.e. \"r\".\n # => next if true && r.odd?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"r\" and instead move on to complete the next steps using index[2] as return value.\n\n # Second iteration continues to iterate this step over index[3], i.e. \"e\".\n # => next if true && e.odd?\n # => next if true && true\n # => next if true\n # => therefore tells ruby to skip \"e\" and ignore the next steps.\n\n puts \"#{index}+x\"\n\n # First iteration puts value of \"index[0]+x\" to screen, i.e. \"0+x\".\n\n # Third iteration puts value of \"index[2]+x\" to screen, i.e. \"2+x\".\n\n to_return << string[index]\n # First iteration continues to iterate this step over index[0], i.e. \"r\".\n # => \"\" << string[0]\n # => \"\" << \"r\"\n # => to_return = \"r\"\n # In other words, ruby adds the current return value, index[0] (i.e. \"r\"), to the variable \"to_return\".\n\n # Second iteration continues to iterate this step over index[2], i.e. \"r\".\n # => \"r\" << string[2]\n # => \"r\" << \"r\"\n # => to_return = \"rr\"\n # In other words, ruby adds the current return value, index[2] (i.e. \"r\"), to the variable \"to_return\".\n\n end\n\n to_return\n# Return the final value of to_return after iterating each character in the chosen string. This does not get returned until the above loop has completed.\n\nend", "def solution(a)\n # write your code in Ruby 2.2\n return 0 unless a[0]\n necklaces = create_necklaces(a)\n \n \n size = necklaces.length\n index = 0\n max = necklaces[index].length\n \n while index < size\n if necklaces[index].length > max\n max = necklaces[index].length\n end\n index += 1\n end\n \n return max\nend", "def funny string\n arr = string.chars\n count = 0\n arr.each_with_index do |x,xi|\n if xi > 0\n s1 = (x.ord - arr[xi-1].ord).abs\n s2 = (arr[-(xi+1)].ord - arr[-xi].ord).abs\n s1 == s2 ? count +=1 : break\n end\n end\n puts count == arr.size-1 ? 'Funny' : 'Not Funny'\nend", "def formingMagicSquare(s)\r\n out = 100\r\n for i in 0...8 do\r\n cost = 0\r\n for j in 0...3 do\r\n for k in 0...3 do\r\n cost += ($magic_square[i][j][k] - s[j][k]).abs\r\n end\r\n end\r\n puts cost\r\n out = [out, cost].min\r\n end \r\n out\r\nend", "def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\nend", "def solve(n, s, d, m)\n # Complete this function\n records = s;\n\n (1...n).each do |i|\n records[i] += records[i-1]\n end\n\n numberOfWays = (m <= n && records[m - 1] == d) ? 1 : 0;\n\n (m...n).each do |i|\n if records[i] - records[i - m] == d\n numberOfWays += 1\n end\n end\n\n numberOfWays\n\nend", "def happy? n\n visited = []\n until n == 1 || visited.include?(n)\n visited << n\n n = n.to_s.chars.map{ |x| x.to_i * x.to_i }.inject{ |sum, x| sum + x }\n end\n n == 1\nend", "def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend", "def is_happy(n)\n return false if n < 10 && n % 2 == 0\n return false if n < 1 \n return true if n == 1\n \n sum = 0\n\n nsplit = n.to_s.split(\"\")\n nsplit.each do |i|\n sum += (i.to_i * i.to_i)\n end\n\n return is_happy(sum)\n \nend", "def clumsy(n)\n a = (1..n).to_a.reverse\n \n result = [a[0]]\n \n a[1..a.size - 1].each_with_index do |num, index|\n if index % 4 == 0\n result << '*'\n elsif index % 4 == 1 \n result << '/'\n elsif index % 4 == 2\n result << '+'\n else\n result << '-'\n end\n \n result << num\n end\n \n result = multiply_and_divide_all_results(result)\n \n add_and_subtract_all_results(result)\nend", "def solution(arr)\n zeros = 0\n pass_cars = 0\n\n (0...arr.size).each do |idx|\n arr[idx] == 0 ? zeros += 1 : pass_cars += zeros\n\n return -1 if pass_cars > 1000000000\n end\n\n pass_cars\nend", "def problem18(r) \n h = r.length\n sum = 0\n for i in 0..h-1 \n \n end\nend", "def solution(a)\n # write your code in Ruby 2.2\n numbers = Array(1..(a.size + 1))\n res = numbers - a\n res[0]\nend", "def f_1_4tel_rek(n)\r\n if !n.integer? || n < 1\r\n return false\r\n end\r\n\r\n def end_rek(i, s)\r\n if i > 0\r\n end_rek(i - 1, (1.0 / (i * (i + 1.0) * (i + 2.0))) + s)\r\n else\r\n return s\r\n end\r\n end\r\n return end_rek(n, 0)\r\nend", "def decent_number(n)\n\tleft = 0\n\tright = 0\n\t(n+1).times do |i|\n\t\tleft = n - i \n\t\tright = n - left\n\t#\tputs \"#{left}%3 = #{left%3} | #{right}%5 = #{right%5}\"\n\t\tbreak if left % 3 == 0 && right % 5 == 0\n\tend\n\t#puts \"**l = #{left} r = #{right}\"\n\n\tif left % 3 == 0 && right % 5 == 0\n\t\tfives = \"5\"*left\n\t\tthrees = \"3\"*right\n\t\tputs fives+threes\n\telse\n\t\tputs -1\n\tend\nend", "def solution(n)\n sum = 0\n (1...n).each do |elem|\n sum += elem if elem % 3 == 0 or elem % 5 == 0\n end\n sum\nend", "def brut_force_solution\n (1...1000).inject(0){|sum, digit| ((digit % 3 == 0) || (digit % 5 == 0)) ? sum += digit : sum}\nend", "def solution(a)\n candidate = a[0]\n count = 0\n index = 0\n a.each_with_index do |d, idx|\n count = candidate == d ? count += 1 : count -= 1\n if count == 0\n candidate = d\n count = 1\n index = idx\n end\n end\n a.count { |d| d == candidate } * 2 > a.length ? index : -1\nend", "def pzoe\n sum = 0\n (0..9).each do |a|\n (0..9).each do |b|\n (0..9).each do |c|\n (0..9).each do |e|\n (0..9).each do |f|\n (0..9).each do |g|\n sum += a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g if a * 100000 + b * 10000 + c * 1000 + e * 100 + f * 10 + g == a ** 5 + b ** 5 + c ** 5 + e ** 5 + f ** 5 + g ** 5\n end\n end\n end\n end\n end\n end\n sum - 1\nend", "def part2(program)\n special = 19690720\n (0..99).to_a.repeated_permutation(2).each do |noun, verb|\n input = program.dup\n input[1] = noun\n input[2] = verb\n\n output = run(input)\n puts \"noun = #{noun}, verb = #{verb}, output = #{output[0]}\"\n if output[0] == special\n return [noun, verb]\n end\n end\n puts \"fuck\"\n return [-1, -1]\nend", "def find_missing_letter(arr)\n #your code here\n result = 0\n base_arr = arr.join().codepoints\n base_arr.each_with_index do |item,index|\n if base_arr[index+1] != item + 1\n result = item + 1\n break\n end\n end\n result.chr\nend", "def solution a\n a.sort!\n until a.empty?\n answer = a.pop\n return answer if a.pop != answer\n end\nend", "def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend", "def compute\n perimeter = 1000\n (1..(perimeter+ 1)).each do |a|\n ((a + 1)..(perimeter + 1)).each do |b|\n c = perimeter - a - b\n return (a * b * c).to_s if (a * a + b * b == c * c)\n end\n end\nend", "def solution(digits)\n result = 0\n digits.size.times do |n|\n new_number = digits[n...(n + 5)].to_i\n result = new_number if new_number > result\n end\n result\nend", "def part_two(input)\n found = false\n cleaned = input.each_with_index.map { |v, i| [v, i] unless v == 'x' }.compact\n iter = cleaned.map(&:first).max\n index = cleaned.map(&:first).find_index(iter)\n t = iter\n until found\n t += iter\n puts \"#{t}\"\n found = true\n v = t - index\n cleaned.each do |bus, i|\n if (v + i) % bus != 0\n found = false\n break\n end\n end\n end\n t\nend" ]
[ "0.6426526", "0.6196587", "0.6143841", "0.60725206", "0.60663986", "0.60514444", "0.6044827", "0.60304916", "0.60167587", "0.59670925", "0.59660167", "0.5930118", "0.5916622", "0.5908013", "0.5902738", "0.5890668", "0.5882447", "0.5870266", "0.5864797", "0.586191", "0.5860125", "0.5854231", "0.5853529", "0.5845457", "0.5843166", "0.58418006", "0.5826551", "0.5813903", "0.5804976", "0.5800246", "0.5798661", "0.57807326", "0.5767266", "0.5765492", "0.5761783", "0.5754697", "0.57498765", "0.5748685", "0.5742788", "0.57339054", "0.57213557", "0.57180685", "0.5706615", "0.5704251", "0.5702108", "0.5700464", "0.5700321", "0.56914973", "0.5690511", "0.5687178", "0.5685812", "0.5684718", "0.56805074", "0.568026", "0.5676355", "0.5674976", "0.56730014", "0.56640285", "0.56558913", "0.56465095", "0.5644003", "0.5643173", "0.5642629", "0.56403023", "0.56337196", "0.5629039", "0.56256676", "0.56235045", "0.5618923", "0.56161416", "0.56126493", "0.56104714", "0.56025416", "0.56001353", "0.55993783", "0.5595219", "0.55952126", "0.55918276", "0.5587841", "0.55849665", "0.5583667", "0.55796427", "0.5576227", "0.5575724", "0.55748755", "0.5574349", "0.55706024", "0.5564179", "0.556181", "0.5550908", "0.554988", "0.5548414", "0.55455494", "0.5545014", "0.5544324", "0.5543917", "0.5543872", "0.55431724", "0.55404335", "0.55397487", "0.5538874" ]
0.0
-1
GET /property_between_floor_slaps GET /property_between_floor_slaps.json
def index @property_between_floor_slaps = PropertyBetweenFloorSlap.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_property_between_floor_slap\n @property_between_floor_slap = PropertyBetweenFloorSlap.find(params[:id])\n end", "def property_between_floor_slap_params\n params.require(:property_between_floor_slap).permit(:between_floor_slap_id, :property_id, :quality_id)\n end", "def create\n @property_between_floor_slap = PropertyBetweenFloorSlap.new(property_between_floor_slap_params)\n\n respond_to do |format|\n if @property_between_floor_slap.save\n format.html { redirect_to @property_between_floor_slap, notice: 'Property between floor slap was successfully created.' }\n format.json { render :show, status: :created, location: @property_between_floor_slap }\n else\n format.html { render :new }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end", "def south_greater_than_north_roads\n north = 78\n east = -100\n south = 79\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def index\n @floor_plans = @location.floor_plans\n end", "def surface_bounds\n\n sql = \"select \"\\\n \"min(surface_longitude) as min_longitude, \"\\\n \"min(surface_latitude) as min_latitude, \"\\\n \"max(surface_longitude) as max_longitude, \"\\\n \"max(surface_latitude) as max_latitude \"\\\n \"from well where \"\\\n \"surface_longitude between -180 and 180 and \"\\\n \"surface_latitude between -90 and 90 and \"\\\n \"surface_longitude is not null and \"\\\n \"surface_latitude is not null\"\n\n corners = @gxdb[sql].all[0]\n\n {\n name: \"surface_bounds\",\n location: {\n type: \"polygon\",\n coordinates: [[\n [corners[:min_longitude], corners[:min_latitude]], #LL\n [corners[:min_longitude], corners[:max_latitude]], #UL\n [corners[:max_longitude], corners[:max_latitude]], #UR\n [corners[:max_longitude], corners[:min_latitude]], #LR\n [corners[:min_longitude], corners[:min_latitude]] #LL\n ]]\n }\n }\n end", "def index\n if params[:ax] && params[:ay] && params[:bx] && params[:by]\n @properties = Property.find_by_coordinates(\n upper_x: params[:ax],\n upper_y: params[:ay],\n bottom_x: params[:bx],\n bottom_y: params[:by]\n )\n else\n @properties = Property.all #in this case is much necessary to implement pagination system\n end\n\n respond_with :api, :v1, @properties, status: :ok\n end", "def bounds\n \t@data['bounds']\n end", "def index\n return render status: :bad_request, json: {message: \"Missing required param 'latitude'.\"} if params[:latitude].blank?\n return render status: :bad_request, json: {message: \"Missing required param 'longitude'.\"} if params[:longitude].blank?\n\n range = params[:range].blank? ? 10000 : params[:range]\n start_time = params[:start_time].blank? ? Time.now : params[:start_time]\n end_time = params[:end_time].blank? ? 1.day.from_now : params[:end_time]\n\n near = ParkingPlace.near([params[:latitude], params[:longitude]], range, :units => :km)\n\n time_slots = TimeSlot\n .includes(:parking_place).references(:parking_place).merge(near)\n .where('start_time <= ? AND end_time >= ?', start_time, end_time)\n .paginate(:page => params[:page], :per_page => params[:per_page])\n\n render json: time_slots, each_serializer: TimeSlotIndexSerializer\n end", "def index\n \tif @current_user\n \t\tsetting_distance = Setting.first.mile_for_list\n # raise setting_distance.inspect\n \t\tif params[:lat].present? && params[:lon].present?\n # @property = Property.where.not(is_active: false,status:'Sold').order(\"id DESC\").includes(:property_detail).distance(params[:lat].to_f,params[:lon].to_f,distance)\n @property = Property.where.not(is_active: false,status:'Sold').includes(:property_detail).order(\"id DESC\").near(\"#{params[:lat]},#{params[:lon]}\",setting_distance)\n\n # @property = Property.where(is_active: true).distance(params[:lat].to_f,params[:lon].to_f,distance)\n \t\t\t# @property.delete_if {|x| x.status == \"Sold\" || x.is_active == false }\n \t\telse\n \t\t\t@property = Property.where(status: \"For Sale\",is_active: true).order(\"id DESC\").includes(:property_detail)\n \t\tend\n \t\tif @property.present?\n \t\t\trender :file => 'api/v1/property/index'\n \t\telse\n \t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n \t\tend\n \tend\n end", "def elevators_at_floor(floor)\n\t\televators.select{|elevator| elevator.floor.eql? floor}\n\tend", "def get_bounds\n [ @min, @max ]\n end", "def midtown_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], [])\nend", "def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end", "def compute_bounds(stations)\n north = south = stations.first['lat']\n east = west = stations.first['lon']\n stations.each do |station|\n lat = station['lat']\n lon = station['lon']\n north = lat if lat > north\n south = lat if lat < south\n east = lon if lon > east\n west = lon if lon < west\n end\n [[north,west],[south,east]]\nend", "def show\n @companies = Company.where('floor_id = ?', @floor.id)\n @spaces = MeetingRoom.where('floor_id = ?', @floor.id)\n end", "def houses\n @request[:property_type] = 'houses'\n self\n end", "def hanover_roads\n hanover_north = 43.7031803975023\n hanover_east = -72.28413820266724\n hanover_south = 43.69828604529516\n hanover_west = -72.29262471199036\n OverpassGraph.get_roads(hanover_north, hanover_east, hanover_south, hanover_west, [], [])\nend", "def index\n @shooting_ranges = ShootingRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_ranges }\n end\n end", "def show\n @rooms = Room.all.where(floor_id: @floor.id)\n\n # преобразование массива точек в строку для SVG.js (для полигонов этажей):\n # @showPointsOfFloor = []\n # polygons_ids = Polygon.all.where(imageable_id: @floor.id).map{ |i| i.id }\n # polygons_ids.each do |i|\n # @showPointsOfFloor << Point.all.where(polygon_id: i)\n # .sort_by{ |j| j[:priority] }\n # .map{ |j| \"#{j.ox}, #{j.oy}\" }\n # .join(\" \")\n # end\n\n # преобразование массива точек в строку для SVG.js (для полигонов аудиторий):\n @showPointsOfRooms = []\n @showNamesOfRooms = []\n polygons_ids = Polygon.all.where(imageable_id: Room.all.where(floor_id: @floor.id))\n polygons_ids.each do |i|\n @showPointsOfRooms << Point.all.where(polygon_id: i.id )\n .sort_by{ |j| j[:priority] }\n .map{ |j| \"#{j.ox}, #{j.oy}\" }\n .join(\" \")\n @showNamesOfRooms << Room.all.where(id: i.imageable_id)[0].name\n end\n end", "def ranges\n attributes.fetch(:ranges)\n end", "def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end", "def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end", "def get_around_estates\n\n\t\t# center_x = 121.7155930000\n\t\t# center_y = 25.1215410000\n\t\t# delta_x = 0.00772495\n\t\t# delta_y = 0.01102129\n\n\t\tcenter_x = params[:center_x].to_f\n \tcenter_y = params[:center_y].to_f\n \tdelta_x = params[:delta_x].to_f\n \tdelta_y = params[:delta_y].to_f\n\n\n \tcritera = \"x_long IS NOT NULL and y_lat IS NOT NULL\"\n \tborder = \"and x_long > #{center_x - delta_x} and x_long < #{center_x + delta_x} and y_lat > #{center_y - delta_y} and y_lat < #{center_y + delta_y}\" \n\n \titems = Realestate.select(\"id, estate_group, x_long, y_lat\").where(\"#{critera} #{border}\").paginate(:page => 1, :per_page => 10)\n\n \trender :json => items\n\n\tend", "def range_from_params(json)\n return ::Time.now,::Time.now if json.empty?\n obj = JSON(json)\n min = ::Time.parse(obj['start'].to_s).at_beginning_of_day\n max = ::Time.parse(obj['end'].to_s).at_end_of_day\n min,max = max,min if min > max\n return min, max\n end", "def screen_params_for_range_limit\n if (params['range_end'].nil?) ||\n (params['range_start'].nil?) ||\n (params['range_start'].to_i > params['range_end'].to_i)\n render plain: \"Calls to range_limit should have a range_start \" +\n \"and a range_end parameter, and range_start \" +\n \"should be before range_end.\", status: 406\n end\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end", "def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end", "def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend", "def getInArea\n max=params[:max]||100\n\tlimit=params[:limit]||200\n\tif params[:mcc] then mcc=\" mcc=\"+params[:mcc]+\" AND \" else mcc=\"\" end\n\tif params[:mnc] then mnc=\" mnc=\"+params[:mnc]+\" AND \" else mnc=\"\" end\n if params[:BBOX]\n bbox=params[:BBOX].split(',')\n r=Rect.new bbox[0].to_f,bbox[1].to_f,bbox[2].to_f,bbox[3].to_f\n else\n r=Rect.new -180.to_f,-90.to_f,180.to_f,90.to_f\n end\n @cells=Cell.find_by_sql(\"SELECT * from cells where \"+mcc+mnc+\" lat>=\"+r.minLat.to_s+\" and lat<=\"+r.maxLat.to_s+\" and lon>=\"+r.minLon.to_s+\" and lon<=\"+r.maxLon.to_s+\" LIMIT \"+limit.to_s)\n if params[:fmt]==\"xml\"\n render(:action=>\"listXml\",:layout=>false)\n elsif params[:fmt]==\"txt\"\n\t\theaders['Content-Type'] = \"text/plain\" \n render(:action=>\"listCsv\",:layout=>false)\n else\n render(:action=>\"listKml\",:layout=>false)\n end\n end", "def index\n #query\n # query = Lodging.search(search_params)\n # puts query\n # location, check_in, check_out\n\n @lodgings = Lodging.where(\n 'location like ? AND\n ((end_availability >= ? AND start_availability <= ?) AND (end_availability >= ? AND start_availability <= ?))',\n \"%#{params[:location]}%\", params[:check_in], params[:check_in], params[:check_out], params[:check_out]).\n map{ |l| l }\n\n puts \"QUERY:\"\n @lodgings.each do |l|\n puts \"id: #{l.id}, location: #{l.location}, start: #{l.start_availability}, end: #{l.end_availability}\"\n end\n\n end", "def index\n @params = params.permit(:building, :floor)\n \n @buildings = Place.distinct.pluck(:building)\n @floors = Place.where(building:params[:building]).distinct.order(:floor).pluck(:floor) if @params[:building]\n @current_user_place = current_user.place\n if @params[:building] && @params[:floor]\n @cells = Place.where(building: @params[:building], floor: @params[:floor]).order(:room, :id).includes(:user).group_by{|i| i.cell}\n end\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @lines = Line.where(:no=>line_range[0]..line_range[1])\n line_op = Hash.new\n respond_to do |format|\n format.html #range.html.erb\n #format.json { render json: @lines }\n format.json {render :json => @lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url])}\n #format.json {render :json => {:lines => @lines, :marker => line_op }}\n end\n end", "def index\n @landings = Landing.all\n end", "def index\n @landings = Landing.all\n end", "def best_laps\n best_laps = []\n RACER_RECORDS.each {|racer| best_laps << [ racer.piloto, racer.best_lap ]}\n @view.display_best_laps(best_laps)\n end", "def get_road_volume\n @volumes_east = RoadVolume.get_road_volume('East')\n @volumes_west = RoadVolume.get_road_volume('West')\n end", "def betweenTime\n page = params[:page] || 1\n per = params[:per] || 10\n\n if params[:start_time] and params[:end_time]\n surprise = @current_user.event.where(event_type: \"surprise\").where(date: params[:start_time]..params[:end_time]).page(page).per(per)\n\n render :json => {\n :event => surprise.as_json(:except => [:created_at , :updated_at] , include: {surprise: {include: :surprise_user}})\n } , status: 200\n return\n else\n render json: { message: \"sent parameters completely\" } , status: 422\n end\n end", "def floor_updates(options = {})\n get('/floor_updates', options)\n end", "def locations\n unless defined?(@locations)\n @locations=[]\n for loc in Location.order(\"id ASC\").includes(:bottom_right_coordinate, :top_left_coordinate)\n @locations << loc if do_overlap_with?(loc.area)\n end \n end \n @locations\n end", "def destroy\n @property_between_floor_slap.destroy\n respond_to do |format|\n format.html { redirect_to property_between_floor_slaps_url, notice: 'Property between floor slap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @workrooms = @floor ? @floor.workrooms : Workroom.all\n end", "def get_mushrooms\n @all_mushrooms\n end", "def index\n @state = params[:state]\n @region = params[:region]\n @town = params[:town]\n @kind = params[:kind]\n @min_price = params[:min_price]\n @max_price = params[:max_price]\n @min_population = params[:min_population]\n @max_population = params[:max_population]\n @q = Property.search(:state_cont => @state,\n :region_cont => @region,\n :town_cont => @town,\n :kind_cont => @kind,\n :price_gt => @min_price,\n :price_lt => @max_price,\n :population_gt => @min_population,\n :population_lt => @max_population\n )\n @properties = @q.result\n end", "def betweenTime\n page = params[:page] || 1\n per = params[:per] || 10\n\n if params[:start_time] and params[:end_time]\n meeting = @current_user.event.where(event_type: \"meeting\").where(date: params[:start_time]..params[:end_time]).page(page).per(per)\n \n render :json => {\n :event => meeting.as_json(:except => [:created_at , :updated_at] , include: {meeting: {include: :meeting_user}})\n } , status: 200\n return\n else\n render json: { message: \"sent parameters completely\" } , status: 422\n end\n end", "def update\n respond_to do |format|\n if @property_between_floor_slap.update(property_between_floor_slap_params)\n format.html { redirect_to @property_between_floor_slap , notice: 'Property between floor slap was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_between_floor_slap }\n else\n format.html { render :edit }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end", "def define_bounds\n\tminLat = 900\n\tminLng = 900\n\tmaxLat = -900\n\tmaxLng = -900\n\t\n\t@locations.map do |location|\n\t\tif location.lat < minLat\n\t\t\tminLat = location.lat\n\t\tend\n\t\tif location.lng < minLng\n\t\t\tminLng = location.lng\n\t\tend\n\t\tif location.lat > maxLat\n\t\t\tmaxLat = location.lat\n\t\tend\n\t\tif location.lng > maxLng\n\t\t\tmaxLng = location.lng\n\t\tend\n\tend\n\t@marker_bounds[\"n\"] = maxLat\n\t@marker_bounds[\"s\"] = minLat\n\t@marker_bounds[\"e\"] = maxLng\n\t@marker_bounds[\"w\"] = minLng\n\t@marker_bounds[\"maxLat\"] = maxLat\n\t@marker_bounds[\"minLat\"] = minLat\n\t@marker_bounds[\"maxLng\"] = maxLng\n\t@marker_bounds[\"minLng\"] = minLng\nend", "def get_rooms(request_parameters)\r\n http_service.request_get(\"/json/bookings.getRooms\", request_parameters)\r\n # https://distribution-xml.booking.com/json/bookings.getRooms?rows=10&hotel_ids=121543\r\n end", "def index\n @points = Array.new\n @profiles = Profile.where(:user_id => current_user.id)\n @user = User.find(current_user.id)\n @bounds = Hash.new\n\n lng_max=lat_max=-999999\n lng_min=lat_min=999999\n @anzahl = @user.profile.meeting_points.count\n @user.profile.meeting_points.each do |val|\n if val.lng.to_f > lng_max.to_f\n lng_max = val.lng\n end\n if val.lng.to_f < lng_min.to_f\n lng_min = val.lng\n end\n if val.lat.to_f > lat_max.to_f\n lat_max = val.lat\n end\n if val.lat.to_f < lat_min.to_f\n lat_min = val.lat\n end\n\n @points << [ val.lng.to_s, val.lat.to_s, val.description, val.id ]\n end\n @bounds={:lng_max => lng_max, :lng_min=>lng_min, :lat_max=>lat_max, :lat_min=>lat_min }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def divs\n Div.where(\"chromosome = ? and position between ? and ?\",\n chromosome, start, stop)\n .order(\"position ASC\")\n end", "def index\n if params[:top].present?\n top = params[:top].to_f\n bottom = params[:bottom].to_f\n left = params[:left].to_f\n right = params[:right].to_f\n @pets = Pet.where(lat: (bottom)..(top)).where(long: (left)..(right))\n else\n @pets = Pet.order(created_at: :desc)\n end\n end", "def shore_acres_roads\n shore_acres_north = 40.95352042058797\n shore_acres_east = -73.71407747268677\n shore_acres_south = 40.94329381595473\n shore_acres_west = -73.73105049133301\n OverpassGraph.get_roads(shore_acres_north, shore_acres_east, shore_acres_south, shore_acres_west, [], [])\nend", "def index\n @properties = if params[\"q\"].present?\n then Property.all.by_city_state(params[\"q\"])\n else Property.all\n end\n respond_to do |format|\n format.html {}\n format.json {\n # This is a temp solution to ignore records without latitude & longitude\n render json: @properties.where.not(longitude: nil)\n .where.not(latitude: 0.0)\n .where.not(city: nil)\n }\n end\n end", "def my_properties\n @api_v1_properties = current_api_v1_user.properties.\n includes(:reservations).\n order(\"reservations.created_at DESC\")\n\n render template: '/api/v1/properties/index', status: 200\n end", "def my_properties\n @api_v1_properties = current_api_v1_user.properties\n .includes(:reservations)\n .order('reservations.created_at DESC')\n\n render template: '/api/v1/properties/index', status: 200\n end", "def invalid_longitude_roads\n north = 80\n east = -178\n south = 79\n west = -181\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def midtown_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, ['primary'], [])\nend", "def show\n @map_area = MapArea.find(params[:id])\n @start = @map_area\n @zoom= 4\n @houses = House.count(:conditions => [\"map_area_id = ?\",params[:id]])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map_area }\n end\n end", "def show\n @map_area = MapArea.find(params[:id])\n @start = @map_area\n @zoom= 4\n @houses = House.count(:conditions => [\"map_area_id = ?\",params[:id]])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map_area }\n end\n end", "def locations_to_coverage_and_placenames\n [lambda {|d|\n d.locations? and d.locations.size > 0 },\n lambda {|d|\n d.coverage = d.locations.select {|l|\n l.north? and l.east? and l.south? and l.west?\n }.map {\n |l|\n { :north => l.north, :east => l.east, :south => l.south, :west => l.west }\n }\n d.placenames = d.locations.map {|l| l.area}.map {|area|\n case area\n when \"dronning_maud_land\"\n {\"placename\"=>\"Dronning Maud Land\", \"country\" => \"AQ\" }\n when \"svalbard\"\n {\"placename\"=>\"Svalbard\", \"country\" => \"NO\" }\n else {\"placename\"=>area}\n end\n }.select{|p|not p.nil? and not p[\"placename\"] =~ /norway|arctic|antartic/ }.uniq\n d.delete :locations\n d\n }]\n end", "def building_list(property_id)\n perform_get_request(\"/property/#{property_id}/building/list\")\n end", "def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end", "def dates\n render json: @standings\n end", "def get_area\n\n # Finds the floor and space parents and assigns them to @floor and @space\n # variables to be used later\n parent = get_parents\n parent.each do |findcommand|\n if ( findcommand.commandName == \"FLOOR\" )\n @floor = findcommand\n end\n if ( findcommand.commandName == \"SPACE\")\n @space = findcommand\n end\n end\n\n # Get the keyword value for location\n begin\n location = get_keyword_value(\"LOCATION\")\n rescue\n end\n\n # Get the keyword value for polygon\n begin\n polygon_id = get_keyword_value(\"POLYGON\")\n rescue\n end\n\n # if the polygon_id keyword value was nil and the location value was nil, then\n # the height and width are directly defined within the \"roof\" command\n\n\n if ( location == \"BOTTOM\" || location == \"TOP\") && (@space.get_shape != \"BOX\")\n return @space.polygon.get_area\n\n elsif ( location == nil && polygon_id == nil )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n height = height.to_f\n width = width.to_f\n return height * width\n elsif ( location == nil && polygon_id != nil)\n return @space.polygon.get_area\n\n\n # if the location was defined as \"SPACE...\", it is immediately followed by a\n # vertex, upon which lies the width of the roof\n elsif location.match(/SPACE.*/)\n location = location.sub( /^(.{6})/, \"\")\n width = @space.polygon.get_length(location)\n height = @floor.get_space_height\n return width * height\n # if the shape was a box, the width and height would be taken from the\n # \"SPACE\" object\n elsif ( @space.get_shape == \"BOX\" )\n width = @space.get_width\n height = @space.get_height\n return width * height\n else\n raise \"The area could not be evaluated\"\n end\n end", "def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend", "def show\n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @floor }\n end\n end", "def test_range_overlap_for_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n segment.instance_variable_set(:@end_time, 3.0)\n\n assert_in_delta(1.0, segment.send(:range_overlap, 2.0..4.0))\n end", "def index\n @pickup_point_time_details = PickupPointTimeDetail.includes(:route, :location, :pickup_route_start_time)\n end", "def show\n @policies = @client.policies.order(created_at: :desc)\n @firehalls = FireHall.all\n\n if @client.geocoded?\n closest = Float::INFINITY\n @firehall_closest\n @firehall_near = []\n @firehall_close = []\n @firehall_far = []\n\n @firehalls.each do |hall|\n if hall.distance_to([@client.latitude, @client.longitude], :km) < closest\n closest = hall.distance_to([@client.latitude, @client.longitude], :km)\n @firehall_closest = hall\n end\n\n if hall.distance_to([@client.latitude, @client.longitude], :km) <= 2.5\n @firehall_near << hall\n elsif hall.distance_to([@client.latitude, @client.longitude], :km) > 2.5 && hall.distance_to([@client.latitude, @client.longitude], :km) < 5\n @firehall_close << hall\n elsif hall.distance_to([@client.latitude, @client.longitude], :km) >= 5\n @firehall_far << hall\n end\n end\n end\n \n end", "def test_detailed_properties_for_leads_properties\n property_service = PropertyService.new(SAMPLE_UDPRN)\n agent = Agents::Branches::AssignedAgent.last\n branch = Agents::Branch.last\n agent.branch_id = branch.id\n branch.district = SAMPLE_DISTRICT\n assert agent.save!\n assert branch.save!\n vendor_id = Vendor.last.id\n\n get :detailed_properties, { agent_id: agent.id }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 0\n\n ### Create a new lead\n property_service.attach_vendor_to_property(vendor_id)\n\n ### Claim that lead for the agent\n post :claim_property, { udprn: SAMPLE_UDPRN.to_i, agent_id: agent.id }\n\n get :detailed_properties, { agent_id: agent.id }\n\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 1\n end", "def get_room_stuff(pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{$roomnumber}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_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 if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend", "def fetch_rooms_values(lcode, dfrom, dto, rooms = nil, token = @token)\n if rooms != nil then\n response = server.call(\"fetch_rooms_values\", token, lcode, dfrom.strftime('%d/%m/%Y'), dto.strftime('%d/%m/%Y'), rooms)\n else\n response = server.call(\"fetch_rooms_values\", token, lcode, dfrom.strftime('%d/%m/%Y'), dto.strftime('%d/%m/%Y'))\n end\n\n handle_response(response, \"Unable to fetch room values\")\n end", "def areas_of_specialization\n self.dig_for_array(\"areasOfSpecialization\")\n end", "def show\n @filter = Filter.find(params[:id])\n\n @area = @filter.polygon\n\n if @filter.edited && (@filter.include_markers_for == 0 || @filter.include_markers_for == 1)\n #@listings = []\n #@listings = Listing.where(:area.in => @filter.areas)\n @listings = Listing.where(location: {\n '$geoWithin' => {\n '$geometry' => {\n type: 'Polygon',\n coordinates: [\n @filter.polygon\n ]\n }\n }\n })\n @listings_agent_ids = []\n @listings.each do |listing|\n @listings_agent_ids.push listing.agent_id\n end\n @all_agents = Agent.where(:id.in => @listings_agent_ids)\n else\n @listings = []\n @all_agents = []\n end\n\n if @filter.edited && (@filter.include_markers_for == 0 || @filter.include_markers_for == 2)\n @agents = Agent.where(location: {\n '$geoWithin' => {\n '$geometry' => {\n type: 'Polygon',\n coordinates: [\n @filter.polygon\n ]\n }\n }\n })\n else\n @agents = []\n end\n\n @location = [-0.167, 51.474]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filter }\n end\n end", "def bottom_floor\n\t\t@flrs.first\n\tend", "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 span\n span_min = @locations.min { |a,b| a.from <=> b.from }\n span_max = @locations.max { |a,b| a.to <=> b.to }\n return span_min.from, span_max.to\n end", "def test_detailed_properties_for_leads_properties_for_rent\n property_service = PropertyService.new('123456')\n agent = Agents::Branches::AssignedAgent.last\n branch = Agents::Branch.last\n agent.branch_id = branch.id\n branch.district = SAMPLE_DISTRICT\n assert agent.save!\n assert branch.save!\n vendor_id = Vendor.last.id\n\n get :detailed_properties, { agent_id: agent.id, property_for: 'Rent' }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 0\n\n ### Create a new lead\n property_service.attach_vendor_to_property(vendor_id)\n\n ### Claim that lead for the agent\n post :claim_property, { udprn: '123456'.to_i, agent_id: agent.id }\n sleep(3)\n get :detailed_properties, { agent_id: agent.id, property_for: 'Rent' }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 1\n end", "def test_mid_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end", "def show\n @property = Property.find(params[:id])\n\n do_search(@property.number_of_rooms, @property.location)\n @properties.delete @property\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end", "def shifts_between(start_time, end_time)\n start_time = start_time.to_time\n end_time = end_time.to_time\n shifts = Shift.where(\"start >= ? AND end <= ? AND location_id = ? AND active = ?\", start_time, end_time, self.id, true)\n end", "def points_query\n # request.path => \"/points/123,-74.006605,40.714623\"\n query = request.path.split(\"/\").last.split(\";\")\n points = query.inject([]) do |r, _|\n id, lon, lat = _.split(\",\")\n r << {:id => id, :lon => lon, :lat => lat}\n end\n\n tolerance = params[:tolerance].to_f if params[:tolerance].present?\n\n lon_lats = points.map{|point| [point[:lon], point[:lat]] }\n areas = Area.polygon_contains_points(points, tolerance)\n points_in_area = []\n areas.each do |area|\n points = area.filter_including_points(points)\n area_as_json = {\n :layer_id => area.layer_id,\n :area_id => area.id,\n :points => points,\n :pointsWithinCount => points.count\n }\n points_in_area << area_as_json\n end\n\n if params['idsonly'] && params['idsonly'] == 'true'\n points_in_area.each { |p| p.delete(:points) }\n end\n\n result = {\n :points_in_area => points_in_area\n }\n\n # points_in_area = (\n # {id => id, layer_id => layer_id, area_id => area_id, points => ( {id => id, x =>x, y =>y}, {id => id, x =>x, y =>y}, ...)},\n # {id => id, layer_id => layer_id, area_id => area_id, points => ( {id => id, x =>x, y =>y}, {id => id, x =>x, y =>y}, ...)}\n # )\n render :json => result\n end", "def range_limit\n solr_field = params[:range_field] # what field to fetch for\n start = params[:range_start].to_i\n finish = params[:range_end].to_i\n \n solr_params = solr_search_params(params)\n \n # Remove all field faceting for efficiency, we won't be using it.\n solr_params.delete(\"facet.field\")\n solr_params.delete(\"facet.field\".to_sym)\n \n add_range_segments_to_solr!(solr_params, solr_field, start, finish )\n # We don't need any actual rows or facets, we're just going to look\n # at the facet.query's\n solr_params[:rows] = 0\n solr_params[:facets] = nil\n # Not really any good way to turn off facet.field's from the solr default,\n # no big deal it should be well-cached at this point.\n \n @response = Blacklight.solr.find( solr_params )\n \n render('blacklight_range_limit/range_segments', :locals => {:solr_field => solr_field}) \n end", "def hotel_rooms\n \tobject.available_hotel_rooms @instance_options[:check_in], @instance_options[:check_out]\n end", "def range\n attributes.fetch(:range)\n end", "def range\n attributes.fetch(:range)\n end", "def range\n attributes.fetch(:range)\n end", "def range\n attributes.fetch(:range)\n end", "def neighborhood_openings(start_date, end_date)\n self.listings.select {|l| l.reservations.where(\"checkout < start_date OR checkin > end_date\")}\n end", "def index\n @floor_ammenities = Floor::Ammenity.all\n end", "def show\n #@place = Place.find(params[:id])\n # get the current location from incming parameters\n if is_iphone_request? \n \n current_lat = params[:current_lat].to_f\n current_lng = params[:current_lng].to_f\n # caculate the boundary of rectangle \n lat_NE = current_lat + 5/111.0\n lng_NE = current_lng + 5/111.0\n lat_SW = current_lat - 5/111.0\n lng_SW = current_lng - 5/111.0\n \n # run query from place database \n @place = Place.find(:all, \n :conditions => [\"longtitude BETWEEN ? and ? and latitue BETWEEN ? and ?\",lng_SW, lng_NE,lat_SW, lat_NE])\n \n #\"and (places.longtitude between lng_NE and lng_SW)\"\n \n else\n \n current_lat = params[:current_lat].to_f\n current_lng = params[:current_lng].to_f\n \n #run query to see if can find the matched places \n @place = Place.find(:all, \n :conditions => [\"longtitude = ? and latitue = ?\", current_lng, current_lat])\n \n end \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n format.js\n format.json { render :layout => false,\n :json =>@place.to_json}\n end\n end", "def calculate_location_left\n self.location_left = {}\n if location_right.key? :east\n location_left[:west] = location_right[:east]\n else\n location_left[:east] = location_right[:west]\n end\n\n if location_right.key? :north\n location_left[:south] = location_right[:north]\n else\n location_left[:north] = location_right[:south]\n end\n end", "def percent_land\n land_area / total_area if land_area\n end", "def get_bbox(left, bottom, right, top)\n raise TypeError.new('\"left\" value needs to be a number between -180 and 180') unless(left.kind_of?(Float) && left >= -180 && left <= 180)\n raise TypeError.new('\"bottom\" value needs to be a number between -90 and 90') unless(bottom.kind_of?(Float) && bottom >= -90 && bottom <= 90)\n raise TypeError.new('\"right\" value needs to be a number between -180 and 180') unless(right.kind_of?(Float) && right >= -180 && right <= 180)\n raise TypeError.new('\"top\" value needs to be a number between -90 and 90') unless(top.kind_of?(Float) && top >= -90 && top <= 90)\n response = get(\"map?bbox=#{left},#{bottom},#{right},#{top}\")\n check_response_codes(response)\n db = OSM::Database.new\n parser = OSM::StreamParser.new(:string => response.body, :db => db)\n parser.parse\n db\n end", "def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end", "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "def show\n @location = Location.find(params[:id])\n \n @landmarks = Landmark.all(:order => 'name')\n \n @results = Array.new\n \n @landmarks.each do |landmark|\n #route = Route.find_or_create_by_landmark_id_and_location_id(landmark.id, @location.id)\n route = Route.find_or_create_by_landmark_id_and_location_id(landmark.id, @location.id)\n if route.duration.nil?\n route.duration=route.calculate_duration landmark.id, @location.id\n route.save\n end\n\n @results.append({:name => landmark.name, :duration => route.duration})\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def index\n @all_lots = Lot.sum('appraised_value') #all.sum(&:appraised_value)\n @commericial_appeal = Lot.all_commericial_appeal.sum(&:full_appeal)\n @commericial_appraised = Lot.all_commericial_appraised.sum(&:appraised_value)\n @commericial_digest = Lot.commercial_property.sum(&:appraised_value)\n @commericial_taxable = (@commericial_appeal + @commericial_appraised)\n @residential_taxable = (@all_lots - @commericial_taxable)\n @commericial_city_taxes_collected = (@commericial_taxable * 0.01642)\n @commericial_school_taxes_collected = (@commericial_taxable * 0.0209)\n @commericial_lost_to_appeal = (@commericial_digest - @commericial_taxable)\n @city_commericial_tax_lost_to_appeal = (@commericial_lost_to_appeal * 0.01642)\n @school_commericial_tax_lost_to_appeal = (@commericial_lost_to_appeal * 0.0209)\n @total_commericial_tax_lost_to_appeal = (@city_commericial_tax_lost_to_appeal + @school_commericial_tax_lost_to_appeal)\n if user_signed_in?\n @search = Lot.search(params[:q])\n else\n @search = Lot.commercial_property.search(params[:q])\n end\n @lots = @search.result.page(params[:page]).per(100)\n @search.build_condition if @search.conditions.empty?\n @search.build_sort if @search.sorts.empty?\n @properties = @lots.order('appraised_value desc')\n @properties_for_workflow = @search.result\n\n @json = @lots.all.to_gmaps4rails do |lot, marker|\n marker.title \"#{lot.owner}\"\n marker.json({ :id => lot.id })\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lots }\n end\n\n end", "def within_range\n @site.loads.desc(:time).where(:time.gt => @timeframe.from, :time.lt => @timeframe.to)\n end" ]
[ "0.69060063", "0.61157036", "0.5888169", "0.5649257", "0.5491359", "0.5422482", "0.5376796", "0.5331189", "0.53073645", "0.52703154", "0.5230716", "0.52174205", "0.52156436", "0.52033854", "0.51998276", "0.5193905", "0.51654613", "0.51582396", "0.5149543", "0.510811", "0.51012236", "0.5085275", "0.5085275", "0.50812286", "0.50643563", "0.50605315", "0.5056479", "0.50534093", "0.50363153", "0.50339663", "0.50324017", "0.5020114", "0.50147563", "0.5005458", "0.5005458", "0.5003364", "0.4985564", "0.49849722", "0.49840015", "0.4982471", "0.49767128", "0.49654925", "0.49438974", "0.49233407", "0.4914997", "0.49100697", "0.4900939", "0.48919892", "0.48880804", "0.4879672", "0.48564687", "0.48511672", "0.48483875", "0.4828856", "0.4824385", "0.4814192", "0.48085397", "0.48070526", "0.48070526", "0.48026186", "0.47908452", "0.47885492", "0.47851825", "0.47762597", "0.4770336", "0.4766294", "0.476418", "0.4762209", "0.47593045", "0.47569373", "0.47548342", "0.47486442", "0.47392416", "0.47349912", "0.47299176", "0.4728943", "0.47125754", "0.47124225", "0.47121826", "0.4696866", "0.46934772", "0.46931818", "0.46930227", "0.46915457", "0.46910983", "0.4686444", "0.4686444", "0.4686444", "0.4686444", "0.46836454", "0.4682087", "0.46790567", "0.4676331", "0.46747825", "0.46724266", "0.4664144", "0.46524128", "0.46507844", "0.46496275", "0.46491465" ]
0.78588855
0
GET /property_between_floor_slaps/1 GET /property_between_floor_slaps/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @property_between_floor_slaps = PropertyBetweenFloorSlap.all\n end", "def set_property_between_floor_slap\n @property_between_floor_slap = PropertyBetweenFloorSlap.find(params[:id])\n end", "def create\n @property_between_floor_slap = PropertyBetweenFloorSlap.new(property_between_floor_slap_params)\n\n respond_to do |format|\n if @property_between_floor_slap.save\n format.html { redirect_to @property_between_floor_slap, notice: 'Property between floor slap was successfully created.' }\n format.json { render :show, status: :created, location: @property_between_floor_slap }\n else\n format.html { render :new }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end", "def property_between_floor_slap_params\n params.require(:property_between_floor_slap).permit(:between_floor_slap_id, :property_id, :quality_id)\n end", "def index\n @floor_plans = @location.floor_plans\n end", "def index\n if params[:ax] && params[:ay] && params[:bx] && params[:by]\n @properties = Property.find_by_coordinates(\n upper_x: params[:ax],\n upper_y: params[:ay],\n bottom_x: params[:bx],\n bottom_y: params[:by]\n )\n else\n @properties = Property.all #in this case is much necessary to implement pagination system\n end\n\n respond_with :api, :v1, @properties, status: :ok\n end", "def show\n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @floor }\n end\n end", "def index\n \tif @current_user\n \t\tsetting_distance = Setting.first.mile_for_list\n # raise setting_distance.inspect\n \t\tif params[:lat].present? && params[:lon].present?\n # @property = Property.where.not(is_active: false,status:'Sold').order(\"id DESC\").includes(:property_detail).distance(params[:lat].to_f,params[:lon].to_f,distance)\n @property = Property.where.not(is_active: false,status:'Sold').includes(:property_detail).order(\"id DESC\").near(\"#{params[:lat]},#{params[:lon]}\",setting_distance)\n\n # @property = Property.where(is_active: true).distance(params[:lat].to_f,params[:lon].to_f,distance)\n \t\t\t# @property.delete_if {|x| x.status == \"Sold\" || x.is_active == false }\n \t\telse\n \t\t\t@property = Property.where(status: \"For Sale\",is_active: true).order(\"id DESC\").includes(:property_detail)\n \t\tend\n \t\tif @property.present?\n \t\t\trender :file => 'api/v1/property/index'\n \t\telse\n \t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n \t\tend\n \tend\n end", "def south_greater_than_north_roads\n north = 78\n east = -100\n south = 79\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def show\n @companies = Company.where('floor_id = ?', @floor.id)\n @spaces = MeetingRoom.where('floor_id = ?', @floor.id)\n end", "def index\n return render status: :bad_request, json: {message: \"Missing required param 'latitude'.\"} if params[:latitude].blank?\n return render status: :bad_request, json: {message: \"Missing required param 'longitude'.\"} if params[:longitude].blank?\n\n range = params[:range].blank? ? 10000 : params[:range]\n start_time = params[:start_time].blank? ? Time.now : params[:start_time]\n end_time = params[:end_time].blank? ? 1.day.from_now : params[:end_time]\n\n near = ParkingPlace.near([params[:latitude], params[:longitude]], range, :units => :km)\n\n time_slots = TimeSlot\n .includes(:parking_place).references(:parking_place).merge(near)\n .where('start_time <= ? AND end_time >= ?', start_time, end_time)\n .paginate(:page => params[:page], :per_page => params[:per_page])\n\n render json: time_slots, each_serializer: TimeSlotIndexSerializer\n end", "def index\n @landings = Landing.all\n end", "def index\n @landings = Landing.all\n end", "def houses\n @request[:property_type] = 'houses'\n self\n end", "def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend", "def midtown_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, [], [])\nend", "def surface_bounds\n\n sql = \"select \"\\\n \"min(surface_longitude) as min_longitude, \"\\\n \"min(surface_latitude) as min_latitude, \"\\\n \"max(surface_longitude) as max_longitude, \"\\\n \"max(surface_latitude) as max_latitude \"\\\n \"from well where \"\\\n \"surface_longitude between -180 and 180 and \"\\\n \"surface_latitude between -90 and 90 and \"\\\n \"surface_longitude is not null and \"\\\n \"surface_latitude is not null\"\n\n corners = @gxdb[sql].all[0]\n\n {\n name: \"surface_bounds\",\n location: {\n type: \"polygon\",\n coordinates: [[\n [corners[:min_longitude], corners[:min_latitude]], #LL\n [corners[:min_longitude], corners[:max_latitude]], #UL\n [corners[:max_longitude], corners[:max_latitude]], #UR\n [corners[:max_longitude], corners[:min_latitude]], #LR\n [corners[:min_longitude], corners[:min_latitude]] #LL\n ]]\n }\n }\n end", "def show\n nodes = Node.get_coordinates(params[:id])\n @floor_plan = { 'floor_plan': nodes }\n respond_to do |format|\n if !nodes.blank?\n format.json { render json: @floor_plan, status: :ok }\n else\n format.json { render json: @floor_plan, status: :not_found }\n end\n end\n end", "def index\n @workrooms = @floor ? @floor.workrooms : Workroom.all\n end", "def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end", "def index\n @params = params.permit(:building, :floor)\n \n @buildings = Place.distinct.pluck(:building)\n @floors = Place.where(building:params[:building]).distinct.order(:floor).pluck(:floor) if @params[:building]\n @current_user_place = current_user.place\n if @params[:building] && @params[:floor]\n @cells = Place.where(building: @params[:building], floor: @params[:floor]).order(:room, :id).includes(:user).group_by{|i| i.cell}\n end\n end", "def hanover_roads\n hanover_north = 43.7031803975023\n hanover_east = -72.28413820266724\n hanover_south = 43.69828604529516\n hanover_west = -72.29262471199036\n OverpassGraph.get_roads(hanover_north, hanover_east, hanover_south, hanover_west, [], [])\nend", "def show\n @rooms = Room.all.where(floor_id: @floor.id)\n\n # преобразование массива точек в строку для SVG.js (для полигонов этажей):\n # @showPointsOfFloor = []\n # polygons_ids = Polygon.all.where(imageable_id: @floor.id).map{ |i| i.id }\n # polygons_ids.each do |i|\n # @showPointsOfFloor << Point.all.where(polygon_id: i)\n # .sort_by{ |j| j[:priority] }\n # .map{ |j| \"#{j.ox}, #{j.oy}\" }\n # .join(\" \")\n # end\n\n # преобразование массива точек в строку для SVG.js (для полигонов аудиторий):\n @showPointsOfRooms = []\n @showNamesOfRooms = []\n polygons_ids = Polygon.all.where(imageable_id: Room.all.where(floor_id: @floor.id))\n polygons_ids.each do |i|\n @showPointsOfRooms << Point.all.where(polygon_id: i.id )\n .sort_by{ |j| j[:priority] }\n .map{ |j| \"#{j.ox}, #{j.oy}\" }\n .join(\" \")\n @showNamesOfRooms << Room.all.where(id: i.imageable_id)[0].name\n end\n end", "def floor_updates(options = {})\n get('/floor_updates', options)\n end", "def elevators_at_floor(floor)\n\t\televators.select{|elevator| elevator.floor.eql? floor}\n\tend", "def index\n @shooting_ranges = ShootingRange.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_ranges }\n end\n end", "def bounds\n \t@data['bounds']\n end", "def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end", "def get_locations\n splits = SplitLocationFinder.splits(params).where.not(course_id: @event.course_id)\n render json: splits, each_serializer: SplitLocationSerializer\n end", "def show\n if (current_user.role == \"customer\" || current_user.role == \"supervisor\")\n if params[:location_id].present?\n add_breadcrumb 'Location', 'locations_path'\n add_breadcrumb \"#{Location.where(:id => params[:location_id])[0].nickname}\", '#' \n add_breadcrumb \"Floors\", 'floors_path(:location_id => \"#{params[:location_id]}\")'\n add_breadcrumb \"View\", '#' \n end \n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @floor }\n end\n else\n redirect_to error_users_path and return\n end \n end", "def bottom_floor\n\t\t@flrs.first\n\tend", "def get_road_volume\n @volumes_east = RoadVolume.get_road_volume('East')\n @volumes_west = RoadVolume.get_road_volume('West')\n end", "def current_floor\n\t\t@current_floor\n\tend", "def show\n @map_area = MapArea.find(params[:id])\n @start = @map_area\n @zoom= 4\n @houses = House.count(:conditions => [\"map_area_id = ?\",params[:id]])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map_area }\n end\n end", "def show\n @map_area = MapArea.find(params[:id])\n @start = @map_area\n @zoom= 4\n @houses = House.count(:conditions => [\"map_area_id = ?\",params[:id]])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map_area }\n end\n end", "def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @stanzas = Stanza.where(:section_id=>line_range[0]..line_range[2],:runningno=>line_range[1]..line_range[3]).order('no')\n lines = Array.new\n @stanzas.each {|s| lines << s.cached_lines }\n respond_to do |format|\n format.html #range.html.erb\n format.json {render :json => lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url,:no])}\n end\n end", "def range\n #@lines = Line.where(:no=> params[:id])\n line_range = params[:id].split(\"-\")\n @lines = Line.where(:no=>line_range[0]..line_range[1])\n line_op = Hash.new\n respond_to do |format|\n format.html #range.html.erb\n #format.json { render json: @lines }\n format.json {render :json => @lines.to_json(:only =>[:line, :stanza_id],:methods=>[:section,:runningno,:share_url])}\n #format.json {render :json => {:lines => @lines, :marker => line_op }}\n end\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end", "def destroy\n @property_between_floor_slap.destroy\n respond_to do |format|\n format.html { redirect_to property_between_floor_slaps_url, notice: 'Property between floor slap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def get_room_stuff(pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{$roomnumber}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_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 if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend", "def index\n @pickup_point_time_details = PickupPointTimeDetail.includes(:route, :location, :pickup_route_start_time)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @floor_plan }\n end\n end", "def show\n @location = Location.find(params[:id])\n \n @landmarks = Landmark.all(:order => 'name')\n \n @results = Array.new\n \n @landmarks.each do |landmark|\n #route = Route.find_or_create_by_landmark_id_and_location_id(landmark.id, @location.id)\n route = Route.find_or_create_by_landmark_id_and_location_id(landmark.id, @location.id)\n if route.duration.nil?\n route.duration=route.calculate_duration landmark.id, @location.id\n route.save\n end\n\n @results.append({:name => landmark.name, :duration => route.duration})\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location }\n end\n end", "def show\n @location_property = LocationProperty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_property }\n end\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 my_properties\n @api_v1_properties = current_api_v1_user.properties\n .includes(:reservations)\n .order('reservations.created_at DESC')\n\n render template: '/api/v1/properties/index', status: 200\n end", "def index\n id = params[:id].to_i\n\n if id != 0\n @properties = @properties.paginate(page: params[:page], per_page: 10).\n order('ensure_availability_before_booking desc, name').\n find_all_by_id(id)\n if @properties.any?\n @property_name = @properties.first.name\n end\n else\n @properties = @properties.paginate(page: params[:page], per_page: 10).\n order('ensure_availability_before_booking desc, name').find(:all)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @properties }\n end\n end", "def my_properties\n @api_v1_properties = current_api_v1_user.properties.\n includes(:reservations).\n order(\"reservations.created_at DESC\")\n\n render template: '/api/v1/properties/index', status: 200\n end", "def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end", "def update\n respond_to do |format|\n if @property_between_floor_slap.update(property_between_floor_slap_params)\n format.html { redirect_to @property_between_floor_slap , notice: 'Property between floor slap was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_between_floor_slap }\n else\n format.html { render :edit }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end", "def floor\n ru_floor_value = property_hash.get(\"Floor\").to_i\n return -1 if ru_floor_value == -1000\n return ru_floor_value\n end", "def midtown_primary_roads\n midtown_north = 40.764104432913086\n midtown_east = -73.97675156593323\n midtown_south = 40.75897668730365\n midtown_west = -73.98523807525635\n OverpassGraph.get_roads(midtown_north, midtown_east, midtown_south, midtown_west, ['primary'], [])\nend", "def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end", "def building_list(property_id)\n perform_get_request(\"/property/#{property_id}/building/list\")\n end", "def index\n #query\n # query = Lodging.search(search_params)\n # puts query\n # location, check_in, check_out\n\n @lodgings = Lodging.where(\n 'location like ? AND\n ((end_availability >= ? AND start_availability <= ?) AND (end_availability >= ? AND start_availability <= ?))',\n \"%#{params[:location]}%\", params[:check_in], params[:check_in], params[:check_out], params[:check_out]).\n map{ |l| l }\n\n puts \"QUERY:\"\n @lodgings.each do |l|\n puts \"id: #{l.id}, location: #{l.location}, start: #{l.start_availability}, end: #{l.end_availability}\"\n end\n\n end", "def get_mushrooms\n @all_mushrooms\n end", "def show\n @property = Property.find(params[:id])\n\n do_search(@property.number_of_rooms, @property.location)\n @properties.delete @property\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end", "def show\n @policies = @client.policies.order(created_at: :desc)\n @firehalls = FireHall.all\n\n if @client.geocoded?\n closest = Float::INFINITY\n @firehall_closest\n @firehall_near = []\n @firehall_close = []\n @firehall_far = []\n\n @firehalls.each do |hall|\n if hall.distance_to([@client.latitude, @client.longitude], :km) < closest\n closest = hall.distance_to([@client.latitude, @client.longitude], :km)\n @firehall_closest = hall\n end\n\n if hall.distance_to([@client.latitude, @client.longitude], :km) <= 2.5\n @firehall_near << hall\n elsif hall.distance_to([@client.latitude, @client.longitude], :km) > 2.5 && hall.distance_to([@client.latitude, @client.longitude], :km) < 5\n @firehall_close << hall\n elsif hall.distance_to([@client.latitude, @client.longitude], :km) >= 5\n @firehall_far << hall\n end\n end\n end\n \n end", "def index\n\n @hurdle_times = HurdleTime.order('time, hurdle_match_id, lane')\n\n if params[:hurdle_match_id]\n @hurdle_times = @hurdle_times.where(:hurdle_match_id => params[:hurdle_match_id])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hurdle_times }\n end\n end", "def test_detailed_properties_for_leads_properties_for_rent\n property_service = PropertyService.new('123456')\n agent = Agents::Branches::AssignedAgent.last\n branch = Agents::Branch.last\n agent.branch_id = branch.id\n branch.district = SAMPLE_DISTRICT\n assert agent.save!\n assert branch.save!\n vendor_id = Vendor.last.id\n\n get :detailed_properties, { agent_id: agent.id, property_for: 'Rent' }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 0\n\n ### Create a new lead\n property_service.attach_vendor_to_property(vendor_id)\n\n ### Claim that lead for the agent\n post :claim_property, { udprn: '123456'.to_i, agent_id: agent.id }\n sleep(3)\n get :detailed_properties, { agent_id: agent.id, property_for: 'Rent' }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 1\n end", "def index\n @properties = if params[\"q\"].present?\n then Property.all.by_city_state(params[\"q\"])\n else Property.all\n end\n respond_to do |format|\n format.html {}\n format.json {\n # This is a temp solution to ignore records without latitude & longitude\n render json: @properties.where.not(longitude: nil)\n .where.not(latitude: 0.0)\n .where.not(city: nil)\n }\n end\n end", "def test_detailed_properties_for_leads_properties\n property_service = PropertyService.new(SAMPLE_UDPRN)\n agent = Agents::Branches::AssignedAgent.last\n branch = Agents::Branch.last\n agent.branch_id = branch.id\n branch.district = SAMPLE_DISTRICT\n assert agent.save!\n assert branch.save!\n vendor_id = Vendor.last.id\n\n get :detailed_properties, { agent_id: agent.id }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 0\n\n ### Create a new lead\n property_service.attach_vendor_to_property(vendor_id)\n\n ### Claim that lead for the agent\n post :claim_property, { udprn: SAMPLE_UDPRN.to_i, agent_id: agent.id }\n\n get :detailed_properties, { agent_id: agent.id }\n\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 1\n end", "def index\n @points = Array.new\n @profiles = Profile.where(:user_id => current_user.id)\n @user = User.find(current_user.id)\n @bounds = Hash.new\n\n lng_max=lat_max=-999999\n lng_min=lat_min=999999\n @anzahl = @user.profile.meeting_points.count\n @user.profile.meeting_points.each do |val|\n if val.lng.to_f > lng_max.to_f\n lng_max = val.lng\n end\n if val.lng.to_f < lng_min.to_f\n lng_min = val.lng\n end\n if val.lat.to_f > lat_max.to_f\n lat_max = val.lat\n end\n if val.lat.to_f < lat_min.to_f\n lat_min = val.lat\n end\n\n @points << [ val.lng.to_s, val.lat.to_s, val.description, val.id ]\n end\n @bounds={:lng_max => lng_max, :lng_min=>lng_min, :lat_max=>lat_max, :lat_min=>lat_min }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def get_floor()\n get_parent(\"FLOOR\")\n end", "def get_floor()\n get_parent(\"FLOOR\")\n end", "def index\n @branch_rooms = Room.get_all_rooms(params[:branch_id])\n \n render json: @branch_rooms\n end", "def index\n @floor_ammenities = Floor::Ammenity.all\n end", "def get_some_room_stuff(roomnumberone,pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{roomnumberone}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_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 if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend", "def shore_acres_roads\n shore_acres_north = 40.95352042058797\n shore_acres_east = -73.71407747268677\n shore_acres_south = 40.94329381595473\n shore_acres_west = -73.73105049133301\n OverpassGraph.get_roads(shore_acres_north, shore_acres_east, shore_acres_south, shore_acres_west, [], [])\nend", "def show\n @filter = Filter.find(params[:id])\n\n @area = @filter.polygon\n\n if @filter.edited && (@filter.include_markers_for == 0 || @filter.include_markers_for == 1)\n #@listings = []\n #@listings = Listing.where(:area.in => @filter.areas)\n @listings = Listing.where(location: {\n '$geoWithin' => {\n '$geometry' => {\n type: 'Polygon',\n coordinates: [\n @filter.polygon\n ]\n }\n }\n })\n @listings_agent_ids = []\n @listings.each do |listing|\n @listings_agent_ids.push listing.agent_id\n end\n @all_agents = Agent.where(:id.in => @listings_agent_ids)\n else\n @listings = []\n @all_agents = []\n end\n\n if @filter.edited && (@filter.include_markers_for == 0 || @filter.include_markers_for == 2)\n @agents = Agent.where(location: {\n '$geoWithin' => {\n '$geometry' => {\n type: 'Polygon',\n coordinates: [\n @filter.polygon\n ]\n }\n }\n })\n else\n @agents = []\n end\n\n @location = [-0.167, 51.474]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filter }\n end\n end", "def set_floor\n @floor = Floor.find(params[:id])\n end", "def set_floor\n @floor = Floor.find(params[:id])\n end", "def show\n if @power_supply.nil?\n head :not_found\n else\n render json: @power_supply.properties\n end\n end", "def range_from_params(json)\n return ::Time.now,::Time.now if json.empty?\n obj = JSON(json)\n min = ::Time.parse(obj['start'].to_s).at_beginning_of_day\n max = ::Time.parse(obj['end'].to_s).at_end_of_day\n min,max = max,min if min > max\n return min, max\n end", "def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend", "def getInArea\n max=params[:max]||100\n\tlimit=params[:limit]||200\n\tif params[:mcc] then mcc=\" mcc=\"+params[:mcc]+\" AND \" else mcc=\"\" end\n\tif params[:mnc] then mnc=\" mnc=\"+params[:mnc]+\" AND \" else mnc=\"\" end\n if params[:BBOX]\n bbox=params[:BBOX].split(',')\n r=Rect.new bbox[0].to_f,bbox[1].to_f,bbox[2].to_f,bbox[3].to_f\n else\n r=Rect.new -180.to_f,-90.to_f,180.to_f,90.to_f\n end\n @cells=Cell.find_by_sql(\"SELECT * from cells where \"+mcc+mnc+\" lat>=\"+r.minLat.to_s+\" and lat<=\"+r.maxLat.to_s+\" and lon>=\"+r.minLon.to_s+\" and lon<=\"+r.maxLon.to_s+\" LIMIT \"+limit.to_s)\n if params[:fmt]==\"xml\"\n render(:action=>\"listXml\",:layout=>false)\n elsif params[:fmt]==\"txt\"\n\t\theaders['Content-Type'] = \"text/plain\" \n render(:action=>\"listCsv\",:layout=>false)\n else\n render(:action=>\"listKml\",:layout=>false)\n end\n end", "def index\n @state = params[:state]\n @region = params[:region]\n @town = params[:town]\n @kind = params[:kind]\n @min_price = params[:min_price]\n @max_price = params[:max_price]\n @min_population = params[:min_population]\n @max_population = params[:max_population]\n @q = Property.search(:state_cont => @state,\n :region_cont => @region,\n :town_cont => @town,\n :kind_cont => @kind,\n :price_gt => @min_price,\n :price_lt => @max_price,\n :population_gt => @min_population,\n :population_lt => @max_population\n )\n @properties = @q.result\n end", "def index\n @floor_stages = Floor::Stage.all\n end", "def get_json_from_openstreetmaps(key,val,constrain_to_usa = true)\n timeout = 20000\n bounds = \"#{CONTINENTAL_US[:s]},#{CONTINENTAL_US[:w]},#{CONTINENTAL_US[:n]},#{CONTINENTAL_US[:e]}\"\n bounds_string = constrain_to_usa ? \"(#{bounds})\" : \"\"\n\n #This string fetches all geometry of a way including center points, but does not restrict how many ways to download\n #str = \"data=[out:json][timeout:#{timeout}];way[\\\"#{key}\\\"=\\\"#{val}\\\"](#{bounds_string});foreach((._;>;);out center #{NUMBER_TO_DOWNLOAD};);\"\n\n #This string fetches almost all geometry of a way except for center points. Does restrict number to download. \n str = \"data=[out:json][timeout:#{timeout}][maxsize:1073741824];way[\\\"#{key}\\\"=\\\"#{val}\\\"]#{bounds_string};out count;out meta geom #{NUMBER_TO_DOWNLOAD};\"\n\n print str\n base_url = \"http://overpass-api.de/api/interpreter?\"\n url = \"#{base_url}#{URI.escape(str)}\"\n puts url\n response = Typhoeus.get(url, {followlocation: true, timeout: timeout})\n response.body\nend", "def show\n @agent = @property.account\n @count = Property.where(zona: @property.zona).where.not(id: @property).count\n @neighbourhood = Property.where(zona: @property.zona).where.not(id: @property).limit(3)\n end", "def my_listing\n \tif authorize_agent?\n \t\t@property = @current_user.properties.where(is_active: true).includes(:property_detail).order(\"id DESC\")#.where(status: \"For Sale\")\n \t\tif @property.present?\n \t\t\trender :file => 'api/v1/property/my_listing'\n \t\telse\n \t\t\trender_json({\"status\" => \"Fail\", \"message\" => \"No property found.\"}.to_json)\n \t\tend\n \telse\n \t\trender_json({\"status\" => \"Fail\", \"message\" => \"Not authorize to view property(LogIn as Agent).\"}.to_json)\n \tend\n end", "def index\n if(params.has_key?(:floor) && params.has_key?(:building))\n @nodes = Node.where(:floor => params[:floor],:building => params[:building])\n elsif(params.has_key?(:floor).present?)\n @nodes = Node.where(:floor => params[:floor])\n elsif(params.has_key?(:building).present?)\n @nodes = Node.where(:building => params[:building])\n else\n @nodes = Node.all\n end\n\n respond_to do |format|\n format.any { render json: @nodes, content_type: 'application/json' }\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 show\n render json: @iprange \n end", "def compute_bounds(stations)\n north = south = stations.first['lat']\n east = west = stations.first['lon']\n stations.each do |station|\n lat = station['lat']\n lon = station['lon']\n north = lat if lat > north\n south = lat if lat < south\n east = lon if lon > east\n west = lon if lon < west\n end\n [[north,west],[south,east]]\nend", "def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end", "def show\n @property = Property.find(params[:id])\n @json = @property.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @property }\n end\n end", "def get_rooms(request_parameters)\r\n http_service.request_get(\"/json/bookings.getRooms\", request_parameters)\r\n # https://distribution-xml.booking.com/json/bookings.getRooms?rows=10&hotel_ids=121543\r\n end", "def show\n @sherlock = Sherlock.find(params[:id])\n @region_size = Apartment.find_size_of_region(@sherlock.region_id)\n\t\t@apartments = Apartment.find_with_features(@sherlock.required, @sherlock.desired, @sherlock.nots, @sherlock.region_id, @sherlock.price_min, @sherlock.price_max)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sherlock }\n end\n end", "def show\n @arrival_range = ArrivalRange.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arrival_range }\n end\n end", "def invalid_longitude_roads\n north = 80\n east = -178\n south = 79\n west = -181\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def search\n @buildings = Building.search(params[:longitude], params[:latitude])\n\n if stale? last_modified: @buildings.maximum(:updated_at)\n render json: @buildings\n end\n end", "def get_area_details\n response = RestClient.get \"http://www.broadbandmap.gov/broadbandmap/census/block?latitude=#{self.location_lat}&longitude=#{self.location_lng}&format=json\"\n if response.code == 200\n response = JSON.parse(response)\n self.fips_block_type = response['Results']['block'][0]['geographyType']\n self.fips_state = response['Results']['block'][0]['FIPS'][0..1]\n self.fips_county = response['Results']['block'][0]['FIPS'][2..4]\n self.fips_tract = response['Results']['block'][0]['FIPS'][5..10]\n true\n end\n false\n end", "def show\n @estate_agent = EstateAgent.find(params[:id])\n @properties = Property.where(\"estate_agent_id = ?\", @estate_agent.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @properties }\n end\n end", "def get_around_estates\n\n\t\t# center_x = 121.7155930000\n\t\t# center_y = 25.1215410000\n\t\t# delta_x = 0.00772495\n\t\t# delta_y = 0.01102129\n\n\t\tcenter_x = params[:center_x].to_f\n \tcenter_y = params[:center_y].to_f\n \tdelta_x = params[:delta_x].to_f\n \tdelta_y = params[:delta_y].to_f\n\n\n \tcritera = \"x_long IS NOT NULL and y_lat IS NOT NULL\"\n \tborder = \"and x_long > #{center_x - delta_x} and x_long < #{center_x + delta_x} and y_lat > #{center_y - delta_y} and y_lat < #{center_y + delta_y}\" \n\n \titems = Realestate.select(\"id, estate_group, x_long, y_lat\").where(\"#{critera} #{border}\").paginate(:page => 1, :per_page => 10)\n\n \trender :json => items\n\n\tend", "def rounds\n @title = \"My Rounds\"\n\n puts '====================== rounds'\n\n @user = User.find(params[:id])\n #@rounds = @user.rounds.where(complete: 'Y').paginate(page: params[:page], :per_page => 50)\n #@rounds = @user.rounds.paginate(page: params[:page], :per_page => 50)\n @rounds = @user.rounds\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :rounds=>@rounds.as_json(\n :include => { \n :holes => { },\n :scorecard => { },\n :event => { \n :include => { \n :course => {\n :include => {\n :facility => { :only => [:id, :facility_code, :facility_name, :address, :city, :state, :longitude, :latitude], \n :include => { \n :courses => { :only => [:id, :course_code, :facility_code, :course_name, :hol, :par] }\n }\n }\n } \n } \n }\n }\n }\n )\n } }\n end\n end", "def show\n #@place = Place.find(params[:id])\n # get the current location from incming parameters\n if is_iphone_request? \n \n current_lat = params[:current_lat].to_f\n current_lng = params[:current_lng].to_f\n # caculate the boundary of rectangle \n lat_NE = current_lat + 5/111.0\n lng_NE = current_lng + 5/111.0\n lat_SW = current_lat - 5/111.0\n lng_SW = current_lng - 5/111.0\n \n # run query from place database \n @place = Place.find(:all, \n :conditions => [\"longtitude BETWEEN ? and ? and latitue BETWEEN ? and ?\",lng_SW, lng_NE,lat_SW, lat_NE])\n \n #\"and (places.longtitude between lng_NE and lng_SW)\"\n \n else\n \n current_lat = params[:current_lat].to_f\n current_lng = params[:current_lng].to_f\n \n #run query to see if can find the matched places \n @place = Place.find(:all, \n :conditions => [\"longtitude = ? and latitue = ?\", current_lng, current_lat])\n \n end \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @place }\n format.js\n format.json { render :layout => false,\n :json =>@place.to_json}\n end\n end", "def show\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_map_road }\n end\n end", "def show\n @island = Island.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @island }\n end\n end", "def getlocation\n \tlocafid = Windmill.where(no: params[:no])\nif locafid.present?\n \t\tlocafid = Windmill.find_by(no: params[:no])\n \t\trender json: [locafid.as_json(only: [:no, :latitude, :londitude,:location])]\nelse\n \t\trender json: {massage: 'windmill not found'}\n end\nend" ]
[ "0.7740396", "0.69099206", "0.60001385", "0.59754264", "0.5973053", "0.54860026", "0.54810286", "0.54681605", "0.54676515", "0.54211324", "0.5353735", "0.53311706", "0.53311706", "0.5323841", "0.53222436", "0.5319887", "0.5318211", "0.53117114", "0.52870905", "0.52593625", "0.5253285", "0.5230153", "0.521289", "0.51995033", "0.51886606", "0.51879233", "0.5186213", "0.51782715", "0.51782715", "0.51740587", "0.517024", "0.51546437", "0.5153594", "0.51488674", "0.51488674", "0.5137049", "0.51297414", "0.5129491", "0.51294166", "0.5124448", "0.51237243", "0.5109715", "0.5103823", "0.5098429", "0.5095341", "0.507698", "0.50746095", "0.5066834", "0.5062166", "0.5058128", "0.5043906", "0.5043362", "0.5036794", "0.5034496", "0.50342983", "0.50331444", "0.50245935", "0.5023679", "0.50236565", "0.5014346", "0.5013633", "0.50080925", "0.49868873", "0.4982391", "0.49677467", "0.4962727", "0.49557328", "0.49539855", "0.49526766", "0.49522576", "0.49521658", "0.4949219", "0.4949219", "0.49468642", "0.49400598", "0.49396336", "0.49291074", "0.49235123", "0.4906769", "0.4905321", "0.4901085", "0.4897202", "0.4896705", "0.4891379", "0.4884015", "0.48839167", "0.48829663", "0.48788407", "0.487181", "0.48645914", "0.48568594", "0.48554015", "0.48439535", "0.48377937", "0.48371416", "0.48358315", "0.4835576", "0.4832631", "0.4829833", "0.48297855", "0.48296884" ]
0.0
-1
POST /property_between_floor_slaps POST /property_between_floor_slaps.json
def create @property_between_floor_slap = PropertyBetweenFloorSlap.new(property_between_floor_slap_params) respond_to do |format| if @property_between_floor_slap.save format.html { redirect_to @property_between_floor_slap, notice: 'Property between floor slap was successfully created.' } format.json { render :show, status: :created, location: @property_between_floor_slap } else format.html { render :new } format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @property_between_floor_slaps = PropertyBetweenFloorSlap.all\n end", "def set_property_between_floor_slap\n @property_between_floor_slap = PropertyBetweenFloorSlap.find(params[:id])\n end", "def property_between_floor_slap_params\n params.require(:property_between_floor_slap).permit(:between_floor_slap_id, :property_id, :quality_id)\n end", "def create\n @shooting_range = ShootingRange.new(params[:shooting_range])\n\n respond_to do |format|\n if @shooting_range.save\n format.html { redirect_to(@shooting_range, :notice => 'Shooting range was successfully created.') }\n format.xml { render :xml => @shooting_range, :status => :created, :location => @shooting_range }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shooting_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @blank_wall = BlankWall.new(blank_wall_params)\n budget_range = blank_wall_params[:budget_range].split(\",\")\n @blank_wall.min_budget = budget_range[0]\n @blank_wall.max_budget = budget_range[1]\n respond_to do |format|\n if @blank_wall.save\n format.html { redirect_to @blank_wall, notice: 'Blank wall was successfully created.' }\n format.json { render :show, status: :created, location: @blank_wall }\n else\n format.html { render :new }\n format.json { render json: @blank_wall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property_between_floor_slap.update(property_between_floor_slap_params)\n format.html { redirect_to @property_between_floor_slap , notice: 'Property between floor slap was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_between_floor_slap }\n else\n format.html { render :edit }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_mid_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def create\n @floor = Floor.new(params[:floor])\n\n respond_to do |format|\n if @floor.save\n format.html { redirect_to @floor, notice: 'Floor was successfully created.' }\n format.json { render json: @floor, status: :created, location: @floor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @property_between_floor_slap.destroy\n respond_to do |format|\n format.html { redirect_to property_between_floor_slaps_url, notice: 'Property between floor slap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_mid_left_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_range_overlap_for_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n segment.instance_variable_set(:@end_time, 3.0)\n\n assert_in_delta(1.0, segment.send(:range_overlap, 2.0..4.0))\n end", "def build_geographies\n build_start_or_end_area unless start_or_end_area\n build_trip_within_area unless trip_within_area\n end", "def create\n @floor = Floor.new(floor_params)\n\n respond_to do |format|\n if @floor.save\n editorData = @floor.editor_data\n editorData = editorData.split(\"<END>\").map{|i| i.split(\"<NEXT>\")}\n editorData.each do |obj|\n if obj[0] == 'submain'\n object = Room.new(name: obj[1],\n description: obj[2],\n capacity: obj[3],\n computers: obj[4],\n roomtype_id: Roomtype.all.where(id: obj[5].to_i)[0],\n floor_id: @floor.id)\n object.save\n elsif obj[0] == 'main'\n object = @floor\n end\n polygon = Polygon.new(imageable: object)\n polygon.save\n points = obj[6].split(\" \").map{|i| i.split(\",\")}\n for i in 0 ... points.size\n point = Point.create(ox: points[i][0].to_f,\n oy: points[i][1].to_f,\n priority: i,\n polygon: polygon\n )\n point.save\n end\n end\n\n format.html { redirect_to @floor, notice: t('flash.floor.create') }\n format.json { render :show, status: :created, location: @floor }\n else\n format.html { render :new }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_mid_left_two_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def create\n @salary_range = SalaryRange.new(params[:salary_range])\n\n respond_to do |format|\n if @salary_range.save\n format.html { redirect_to @salary_range, notice: 'Salary range was successfully created.' }\n format.json { render json: @salary_range, status: :created, location: @salary_range }\n else\n format.html { render action: \"new\" }\n format.json { render json: @salary_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def houses\n @request[:property_type] = 'houses'\n self\n end", "def test_mid_left_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Left' # Forces single front corridor\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_mid_left_one_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_top_left_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_top_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def floor_params\n params.require(:floor).permit(:building_id, :floor)\n end", "def test_range_overlap_for_non_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n segment.instance_variable_set(:@end_time, 3.0)\n\n assert_in_delta(0.0, segment.send(:range_overlap, 4.0..5.0))\n end", "def setBoundaries(boundaries)\n @boundaries = boundaries\n end", "def create\n @arrival_range = ArrivalRange.new(params[:arrival_range])\n\n respond_to do |format|\n if @arrival_range.save\n format.html { redirect_to @arrival_range, notice: 'Arrival range was successfully created.' }\n format.json { render json: @arrival_range, status: :created, location: @arrival_range }\n else\n format.html { render action: \"new\" }\n format.json { render json: @arrival_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def hit_floor\n return nil if rising?\n what_object_hit_me_on_the :side => :bottom, :restrict => Standable, :look_ahead => 10, :margin_of_error => 25\n end", "def create\n @pharmacy_range = PharmacyRange.new(params[:pharmacy_range])\n\n respond_to do |format|\n if @pharmacy_range.save\n format.html { redirect_to(@pharmacy_range, :notice => 'PharmacyRange was successfully created.') }\n format.xml { render :xml => @pharmacy_range, :status => :created, :location => @pharmacy_range }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @pharmacy_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def define_bounds\n\tminLat = 900\n\tminLng = 900\n\tmaxLat = -900\n\tmaxLng = -900\n\t\n\t@locations.map do |location|\n\t\tif location.lat < minLat\n\t\t\tminLat = location.lat\n\t\tend\n\t\tif location.lng < minLng\n\t\t\tminLng = location.lng\n\t\tend\n\t\tif location.lat > maxLat\n\t\t\tmaxLat = location.lat\n\t\tend\n\t\tif location.lng > maxLng\n\t\t\tmaxLng = location.lng\n\t\tend\n\tend\n\t@marker_bounds[\"n\"] = maxLat\n\t@marker_bounds[\"s\"] = minLat\n\t@marker_bounds[\"e\"] = maxLng\n\t@marker_bounds[\"w\"] = minLng\n\t@marker_bounds[\"maxLat\"] = maxLat\n\t@marker_bounds[\"minLat\"] = minLat\n\t@marker_bounds[\"maxLng\"] = maxLng\n\t@marker_bounds[\"minLng\"] = minLng\nend", "def create\n @fixture = @league.fixture.new(fixture_params)\n\n respond_to do |format|\n if @fixture.home == @fixture.away\n format.html {redirect_to new_fixture_path(league_id: @league)}\n flash[:notice] = \"Home team and away team cannot be the same\"\n \n elsif @fixture.save\n format.html { redirect_to @league, notice: 'Fixture was successfully created.' }\n format.json { render :show, status: :created, location: @fixture }\n\n if @fixture.homegoals > @fixture.awaygoals\n @fixture.home.update_attribute(:MP, @fixture.home.MP + 1)\n @fixture.home.update_attribute(:W, @fixture.home.W + 1)\n @fixture.home.update_attribute(:Pts, @fixture.home.Pts + 3)\n\n @fixture.away.update_attribute(:MP, @fixture.away.MP + 1)\n @fixture.away.update_attribute(:L, @fixture.away.L + 1)\n\n elsif @fixture.homegoals < @fixture.awaygoals\n @fixture.away.update_attribute(:MP, @fixture.away.MP + 1)\n @fixture.away.update_attribute(:W, @fixture.away.W + 1)\n @fixture.away.update_attribute(:Pts, @fixture.away.Pts + 3)\n\n @fixture.home.update_attribute(:MP, @fixture.home.MP + 1)\n @fixture.home.update_attribute(:L, @fixture.home.L + 1)\n else\n @fixture.away.update_attribute(:MP, @fixture.away.MP + 1)\n @fixture.away.update_attribute(:D, @fixture.away.D + 1)\n @fixture.away.update_attribute(:Pts, @fixture.away.Pts + 1)\n\n @fixture.home.update_attribute(:MP, @fixture.home.MP + 1)\n @fixture.home.update_attribute(:D, @fixture.home.D + 1)\n @fixture.home.update_attribute(:Pts, @fixture.home.Pts + 1)\n end\n\n else\n format.html {redirect_to new_fixture_path(league_id: @league)}\n flash[:notice] = @fixture.errors.full_messages.to_sentence\n end\n end\n end", "def test_top_left_two_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def screen_params_for_range_limit\n if (params['range_end'].nil?) ||\n (params['range_start'].nil?) ||\n (params['range_start'].to_i > params['range_end'].to_i)\n render plain: \"Calls to range_limit should have a range_start \" +\n \"and a range_end parameter, and range_start \" +\n \"should be before range_end.\", status: 406\n end\n end", "def land_params\n params.require(:land).permit(:name)\n end", "def create\n @floor_plan = @location.floor_plans.new(floor_plan_params)\n\n respond_to do |format|\n if @floor_plan.save\n format.html { redirect_to location_path(@location), notice: 'Floor plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @floor_plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_top_left_one_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_top_left_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 8, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 5 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def south_greater_than_north_roads\n north = 78\n east = -100\n south = 79\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def create\n @floor = Floor.new(floor_params)\n\n respond_to do |format|\n if @floor.save\n format.html { redirect_to floors_path, notice: I18n.t('floors.create') }\n format.json { render :show, status: :created, location: @floor }\n else\n format.html { render :new }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def floor_params\n params.require(:floor).permit(:name, :description, :building_id, :editor_data)\n end", "def build_geographies\n build_trip_within_area unless trip_within_area\n end", "def test_bot_left_two_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def create\n @range_type = RangeType.new(range_type_params)\n\n respond_to do |format|\n if @range_type.save\n format.html { redirect_to @range_type, notice: 'Range type was successfully created.' }\n format.json { render :show, status: :created, location: @range_type }\n else\n format.html { render :new }\n format.json { render json: @range_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def rrange_params\n params.require(:rrange).permit(:name, :zone_id)\n end", "def test_mid_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_bot_left_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'None'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def create\n @bathroom = Bathroom.new(bathroom_params.except(:stalls))\n num_stalls = bathroom_params[:stalls].to_i\n\n respond_to do |format|\n if @bathroom.save\n (0..(num_stalls - 1)).each do |i|\n Stall.new({ bathroom_id: @bathroom.id, state: false, number: @bathroom.stalls.count }).save\n end\n format.html { redirect_to @bathroom, notice: 'Bathroom was successfully created.' }\n format.json { render :show, status: :created, location: @bathroom }\n else\n format.html { render :new }\n format.json { render json: @bathroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:floor][:loc_id].empty?\n params[:floor].delete :loc_id \n else\n params[:floor][:location_id] = params[:floor][:loc_id]\n params[:floor].delete :loc_id\n end\n @floor = Floor.new(params[:floor])\n @floor.user_id = current_user.id\n if current_user.role == \"customer\"\n floor_count = Floor.where(:delflag => \"false\", :user_id => \"#{current_user.id}\").count\n @children = current_user.children\n @children.each do |child|\n floor_count = floor_count + Floor.where(:delflag => \"false\", :user_id => child.id).count\n end\n restriction = UserConfig.where(:user_id => \"#{current_user.id}\")\n else\n floor_count = Floor.where(:delflag => \"false\", :user_id => \"#{current_user.parent.id}\").count\n @children = current_user.parent.children\n @children.each do |child|\n floor_count = floor_count + Floor.where(:delflag => \"false\", :user_id => child.id).count\n end\n restriction = UserConfig.where(:user_id => \"#{current_user.parent.id}\")\n end \n if restriction.blank?\n respond_to do |format|\n if @floor.save\n params[:floor][:location_id] = @floor.location_id\n format.html { redirect_to floors_path(:location_id => params[:floor][:location_id]), notice: 'Floor was successfully created.' }\n format.json { render json: @floor, status: :created, location: @floor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n elsif restriction.present? && floor_count < restriction[0].floorcapacity\n respond_to do |format|\n if @floor.save\n params[:floor][:location_id] = @floor.location_id\n format.html { redirect_to floors_path(:location_id => params[:floor][:location_id]), notice: 'Floor was successfully created.' }\n format.json { render json: @floor, status: :created, location: @floor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n else\n flash[:notice] = \"You are not allowed to create more floors because you have already reach your limit\"\n render action: \"new\" and return\n end \n end", "def create\n @rrange = Rrange.new(rrange_params)\n\n respond_to do |format|\n if @rrange.save\n format.html { redirect_to @rrange, notice: 'Rrange was successfully created.' }\n format.json { render :show, status: :created, location: @rrange }\n else\n format.html { render :new }\n format.json { render json: @rrange.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tower = Tower.new(params[:tower])\n\t\n\t#Vergabe der Koordinaten. Die Karte ist in vier Teile gteilt. Mittelpunkt ist 50/50\n\t#Es wird immer erst eine y Reihe ausgefüllt wobei der x Abstand zufällig bestimmt wird.\n\t#Es gibt 4 Startpunkte und somit $ reihen die abwechselnd gefüllt werden.\n\ttnortheast = Tower.where(:position => 'northeast')\n\ttnorthwest = Tower.where(:position => 'northwest')\n\ttsouthwest = Tower.where(:position => 'southwest')\n\ttsoutheast = Tower.where(:position => 'southeast')\n\tif tnortheast.last.nil? \n\t \n\t @tower.position = 'northeast'\n\t @tower.x = '51'\n\t @tower.y = '51'\n\t \n\telsif tnorthwest.last.nil?\n\t @tower.position = 'northwest'\n\t @tower.x = '49'\n\t @tower.y = '51'\n\t \n\telsif tsouthwest.last.nil?\n\t @tower.position = 'southwest'\n\t @tower.x = '49'\n\t @tower.y = '49'\n\t\n\telsif tsoutheast.last.nil?\n\t @tower.position = 'southeast'\n\t @tower.x = '51'\n\t @tower.y = '49'\n\t\n\telse\n\t \n\t if tsoutheast.count < tsouthwest.count\n\t if tsoutheast.last.x < 95\n\t @tower.position = 'southeast'\n\t \t @tower.x = tsoutheast.last.x + 1 + rand(5)\n\t \t @tower.y = tsoutheast.last.y\n\t \n\t else\n\t @tower.position = 'southeast'\n\t \t @tower.x = 51 + rand(4)\n\t \t @tower.y = tsoutheast.last.y - 1\n\t \n\t end\n\t \n\t \n\t \n\t \n\t elsif tsouthwest.count < tnorthwest.count\n\t if tsouthwest.last.x > 5\n\t @tower.position = 'southwest'\n\t \t @tower.x = tsouthwest.last.x - 1 - rand(5)\n\t \t @tower.y = tsouthwest.last.y \n\t \n\t else\n\t @tower.position = 'southwest'\n\t \t @tower.x = 49 - rand(4)\n\t \t @tower.y = tsouthwest.last.y - 1\n\t \n\t end\n\t \n\t elsif tnorthwest.count < tnortheast.count\n\t if tnorthwest.last.x > 5\n\t @tower.position = 'northwest'\n\t \t @tower.x = tnorthwest.last.x - 1 - rand(5)\n\t \t @tower.y = tnorthwest.last.y \n\t \n\t else\n\t @tower.position = 'northwest'\n\t \t @tower.x = 49 - rand(4)\n\t \t @tower.y = tnorthwest.last.y + 1\n\t \n\t end\n\t else\n\t if tnortheast.last.x < 95\n\t @tower.position = 'northeast'\n\t \t @tower.x = tnortheast.last.x + 1 + rand(5)\n\t \t @tower.y = tnortheast.last.y \n\t \n\t else\n\t @tower.position = 'northeast'\n\t \t @tower.x = 51 + rand(4)\n\t \t @tower.y = tnortheast.last.y + 1\n\t \n\t end\n\t \n\t \n\t end\n\tend\n\t\n\t#User_id wird zugewiesen\n\t@tower.user_id = current_user.id\n\t@tower.down2 = 'store 1'\n\n\t\n\t\n\t\n\t\n respond_to do |format|\n if @tower.save\n format.html { redirect_to @tower, :notice => 'Tower was successfully created.' }\n format.json { render :json => @tower, :status => :created, :location => @tower }\n \n #Coordinates für die MAp anlegen\n @c = Coordinate.new(params[:coordinates])\n @c.x = @tower.x\n @c.y = @tower.y\n @c.user_id = @tower.user_id\n @c.save\n \n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tower.errors, :status => :unprocessable_entity }\n end\n end\n end", "def change_status(start_floor, end_floor)\n\t\t#Determines whether the elevator's status changes\n\t\tif end_floor > start_floor\n\t\t\tset_status(\"up\")\n\t\telsif end_floor < start_floor\n\t\t\tset_status(\"down\")\n\t\telse end_floor < start_floor\n\t\t\tset_status(\"stationary\")\n\t\tend\n\tend", "def create\n @plant = @project.plants.new(plant_params)\n @plant.foreman_start_date = @plant.contract_start_date\n @plant.foreman_end_date = @plant.contract_end_date\n @plant.client_company_id = @project.client_company_id\n if ((@project.start_date..@project.end_date).cover?(@plant.contract_start_date)) &&\n ((@project.start_date..@project.end_date).cover?(@plant.contract_end_date))\n\n respond_to do |format|\n if @plant.save\n format.html {redirect_to project_plants_path, notice: 'Plant was successfully created.'}\n format.json {render :show, status: :created, location: @plant}\n else\n format.html {render :new}\n format.json {render json: @plant.errors, status: :unprocessable_entity}\n end\n\n\n end\n else\n @plant.errors.add(:base, 'Date should be sub set of project start and end date.')\n render :action => 'new'\n end\n end", "def test_mid_left_four_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 12\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 9 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_bot_left_two_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_mid_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 7 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_bot_left_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 5 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def surface_bounds\n\n sql = \"select \"\\\n \"min(surface_longitude) as min_longitude, \"\\\n \"min(surface_latitude) as min_latitude, \"\\\n \"max(surface_longitude) as max_longitude, \"\\\n \"max(surface_latitude) as max_latitude \"\\\n \"from well where \"\\\n \"surface_longitude between -180 and 180 and \"\\\n \"surface_latitude between -90 and 90 and \"\\\n \"surface_longitude is not null and \"\\\n \"surface_latitude is not null\"\n\n corners = @gxdb[sql].all[0]\n\n {\n name: \"surface_bounds\",\n location: {\n type: \"polygon\",\n coordinates: [[\n [corners[:min_longitude], corners[:min_latitude]], #LL\n [corners[:min_longitude], corners[:max_latitude]], #UL\n [corners[:max_longitude], corners[:max_latitude]], #UR\n [corners[:max_longitude], corners[:min_latitude]], #LR\n [corners[:min_longitude], corners[:min_latitude]] #LL\n ]]\n }\n }\n end", "def change_ranges(params)\n @min = params.fetch(:min, 0).to_f\n @max = params.fetch(:max, 100).to_f\n end", "def map_in_range\n clean_grid\n UNITS.each do |unit|\n position = MAP[unit.y][unit.x]\n position.occupied = true\n if unit.team == 'G'\n position.goblin_in_grid = true\n position.up.goblin_in_range = true if position.up.type == '.'\n position.right.goblin_in_range = true if position.right.type == '.'\n position.down.goblin_in_range = true if position.down.type == '.'\n position.left.goblin_in_range = true if position.left.type == '.'\n else\n position.elf_in_grid = true\n position.up.elf_in_range = true if position.up.type == '.'\n position.right.elf_in_range = true if position.right.type == '.'\n position.down.elf_in_range = true if position.down.type == '.'\n position.left.elf_in_range = true if position.left.type == '.'\n end\n end\nend", "def valid_post_hash\n {\n :from_location_id => Location.first.id,\n :to_location_id => Location.last.id,\n :available_seats => 2,\n :total_price => 2,\n :departure_date => SpClock.date,\n :departure_time => SpClock.time,\n :duration_in_minutes => 15,\n :ride_type => \"sudan\"\n }\n end", "def test_bot_left_one_unit_per_floor_single_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Single Exterior (Front)'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_mid_one_unit_per_floor_with_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 2 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def set_boundaries(node, start, stop)\n node.start = start if node.start.nil? or node.start < start\n node.stop = node.start + node.min_size if node.stop.nil? or node.stop < node.start\n node.stop = stop if node.stop > stop\n end", "def test_detailed_properties_for_leads_properties\n property_service = PropertyService.new(SAMPLE_UDPRN)\n agent = Agents::Branches::AssignedAgent.last\n branch = Agents::Branch.last\n agent.branch_id = branch.id\n branch.district = SAMPLE_DISTRICT\n assert agent.save!\n assert branch.save!\n vendor_id = Vendor.last.id\n\n get :detailed_properties, { agent_id: agent.id }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 0\n\n ### Create a new lead\n property_service.attach_vendor_to_property(vendor_id)\n\n ### Claim that lead for the agent\n post :claim_property, { udprn: SAMPLE_UDPRN.to_i, agent_id: agent.id }\n\n get :detailed_properties, { agent_id: agent.id }\n\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 1\n end", "def create\n @floor = Floor.new(params[:floor])\n\n respond_to do |format|\n if @floor.save\n flash[:notice] = 'Floor was successfully created.'\n format.html { redirect_to(@floor) }\n format.xml { render :xml => @floor, :status => :created, :location => @floor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @floor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_standings\n season.standings.create(result: self)\n end", "def floor_params\n params.require(:floor).permit(:number, :name, :description, :colour)\n end", "def create\n @patient = Patient.find(params[:patient_id])\n @schedule = @patient.schedules.create(params[:schedule])\n\n # TODO can improve it to use nested attributes\n params[:pill_time].each do |pill_time|\n @schedule.pill_times.build(pill_time)\n end\n\n @pill_times = @schedule.pill_times\n\n respond_to do |format|\n if @schedule.save\n format.html { redirect_to [@patient, @schedule],\n notice: 'Schedule was successfully created.' }\n format.json { render json: @schedule,\n status: :created,\n location: [@patient, @schedule] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @schedule.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_floor\n @floor = @grid.collect { |v| v[1] }.max + 2\n\n (@min_width - 1000..@max_width + 1000).each do |x|\n @grid.add([x, @floor])\n end\n end", "def test_top_left_four_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 12\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 8, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 7 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def create_shifts\n\tself.shifts=[]\n\tif self.locations.size==0\n\t self.locations=self.area.locations\n\tend\n\tst=self.shifttimes \n \tst.each do |t|\n\t\tself.locations.each do |l|\n\t\t\n\t\t\tshift=Shift.new\n\t\t\tshift.location=l\n\t\t\tshift.start=t\n\t\t\tself.shifts << shift\n\t\tend\n \tend\n end", "def test_mid_two_unit_per_floor_exterior_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Double Exterior'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 3, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def create_rooms(rooms_id_array)\n if self.room_areas.empty?\n 1.upto(self.bedrooms) do \n room_area = RoomArea.new(:property_id => self.id,\n :room_id => Room.find_by_name(\"Room\").id)\n room_area.save\n end\n end\n for room_id in rooms_id_array do\n room_area = RoomArea.new(:property_id => self.id,\n :room_id => room_id)\n room_area.save\n end\n end", "def set_PropertyRooms(value)\n set_input(\"PropertyRooms\", value)\n end", "def test_detailed_properties_for_leads_properties_for_rent\n property_service = PropertyService.new('123456')\n agent = Agents::Branches::AssignedAgent.last\n branch = Agents::Branch.last\n agent.branch_id = branch.id\n branch.district = SAMPLE_DISTRICT\n assert agent.save!\n assert branch.save!\n vendor_id = Vendor.last.id\n\n get :detailed_properties, { agent_id: agent.id, property_for: 'Rent' }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 0\n\n ### Create a new lead\n property_service.attach_vendor_to_property(vendor_id)\n\n ### Claim that lead for the agent\n post :claim_property, { udprn: '123456'.to_i, agent_id: agent.id }\n sleep(3)\n get :detailed_properties, { agent_id: agent.id, property_for: 'Rent' }\n assert_response 200\n response = Oj.load(@response.body)\n assert_equal response['properties'].length, 1\n end", "def calculate_location_left\n self.location_left = {}\n if location_right.key? :east\n location_left[:west] = location_right[:east]\n else\n location_left[:east] = location_right[:west]\n end\n\n if location_right.key? :north\n location_left[:south] = location_right[:north]\n else\n location_left[:north] = location_right[:south]\n end\n end", "def test_top_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 6, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def elevators_at_floor(floor)\n\t\televators.select{|elevator| elevator.floor.eql? floor}\n\tend", "def compute_bounds(stations)\n north = south = stations.first['lat']\n east = west = stations.first['lon']\n stations.each do |station|\n lat = station['lat']\n lon = station['lon']\n north = lat if lat > north\n south = lat if lat < south\n east = lon if lon > east\n west = lon if lon < west\n end\n [[north,west],[south,east]]\nend", "def test_top_two_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 6\n args_hash['level'] = 'Top'\n args_hash['horz_location'] = 'None'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 8, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 5 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def set_floor\n @floor = Floor.find_by(id: params[:floor_id])\n end", "def test_mid_mid_six_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 18\n args_hash['level'] = 'Middle'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 11 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def test_top_one_unit_per_floor_with_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Top'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def property_params\n params.require(:property).permit(\n :marketing_name,\n :website,\n :description,\n :contact_email,\n :contact_phone,\n :street,\n :city,\n :state,\n :zip,\n :latitude,\n :longitude,\n :pet_dog,\n :pet_cat,\n :amenities,\n { floorplan_ids: [] },\n )\n end", "def index\n @floor_plans = @location.floor_plans\n end", "def test_top_mid_six_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 18\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 2, 'ShadingSurface' => 8, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 9 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def create_locations\n LOGGER.add 0, 'INFO: Beginning location generation'\n overpass = OverpassAPI.new(timeout: TIMEOUT, json: true)\n\n row = 0\n total = 0\n\n # rubocop:disable Metrics/BlockLength\n (GLOBAL_BOUNDARIES[:s]...GLOBAL_BOUNDARIES[:n]).step(STEP) do |ns|\n row += 1\n column = 0\n\n (GLOBAL_BOUNDARIES[:w]...GLOBAL_BOUNDARIES[:e]).step(STEP) do |ew|\n column += 1\n total += 1\n attempts = 0\n boundaries = { s: ns, n: ns + STEP, w: ew, e: ew + STEP }\n LOGGER.add 0, \"INFO: Beginning row #{row}, column #{column} (#{boundaries})\"\n\n begin\n attempts += 1\n overpass.query(query(boundaries)).slice_before { |result| result[:type] == 'node' }.each do |node_set|\n node_group = node_set.group_by { |item| item[:type] }\n\n streets = node_group['way']\n next if streets.blank?\n\n # We're only concerned with certain streets\n streets = streets.select { |way| way[:tags][:highway].present? }\n streets = streets.select { |way| way[:tags][:name].present? }\n streets = streets.select { |way| %w[footway cycleway path service track].exclude? way[:tags][:highway] }\n\n # Deduplicate names on four fields if they are present\n streets = streets.uniq { |way| strip_direction(way[:tags][:name]) }\n streets = streets.uniq { |way| strip_direction(way[:tags][:name_1]) || rand }\n streets = streets.uniq { |way| way[:tags][:'tiger:name_base'] || rand }\n streets = streets.uniq { |way| way[:tags][:'tiger:name_base_1'] || rand }\n\n streets = streets.map { |way| way[:tags][:name] }\n streets = streets.sort_by { |way| way.scan(/(?=\\d)/).length }.reverse\n\n node = node_group['node'].first\n next if node.blank?\n\n lat_lon_duplicate = Location.where(latitude: node[:lat], longitude: node[:lon]).first\n\n street_duplicate = Location.where(\n '(street1 = ? AND street2 = ?) OR (street2 = ? AND street1 = ?)',\n streets.first,\n streets.second,\n streets.first,\n streets.second,\n ).first\n\n if lat_lon_duplicate.present?\n LOGGER.add(\n 0,\n 'WARN: Found multiple street pairs at same lat/lon. '\\\n \"Found #{streets.first} & #{streets.last}, had #{street_duplicate}\",\n )\n elsif streets.try(:length) != 2\n LOGGER.add 0, \"WARN: Node didn't have 2 ways #{streets} (#{node[:lat]}, #{node[:lon]})\"\n elsif street_duplicate.present?\n LOGGER.add(\n 0,\n \"INFO: Adding #{humanize_street(streets.first)} & #{humanize_street(streets.second)} \"\\\n 'at midpoint & removed previous location',\n )\n Location.create!(\n latitude: (street_duplicate.latitude + node[:lat]) / 2,\n longitude: (street_duplicate.longitude + node[:lon]) / 2,\n active: false,\n street1: streets.first,\n street2: streets.second,\n name: \"#{humanize_street(streets.first)} & #{humanize_street(streets.second)}\",\n )\n street_duplicate.destroy!\n else\n LOGGER.add 0, \"INFO: Adding #{humanize_street(streets.first)} & #{humanize_street(streets.second)}\"\n Location.create!(\n latitude: node[:lat],\n longitude: node[:lon],\n active: false,\n street1: streets.first,\n street2: streets.second,\n name: \"#{humanize_street(streets.first)} & #{humanize_street(streets.second)}\",\n )\n end\n end\n rescue StandardError => e\n if attempts <= RETRIES\n LOGGER.add 0, \"WARN: Encountered error, retry #{attempts} of #{RETRIES}\"\n sleep(attempts < RETRIES ? PAUSE : TIMEOUT)\n retry\n else\n LOGGER.add 0, \"ERROR: #{e.message}\"\n end\n ensure\n sleep(PAUSE)\n end\n end\n # rubocop:enable Metrics/BlockLength\n end\n LOGGER.add 0, \"INFO: Total requests: #{total}\"\n end", "def create\n start_time = \"#{params[:start_time_hour]}:#{params[:start_time_min]}\"\n end_time = \"#{params[:end_time_hour]}:#{params[:end_time_min]}\"\n if params[:location].present?\n params[:location][:start_time] = start_time\n params[:location][:end_time] = end_time\n end\n @location = Location.new(params[:location])\n respond_to do |format|\n if @location.save\n format.js\n format.html { redirect_to @location, notice: '门店信息建立成功.' }\n format.json { render json: @location, status: :created, location: @location }\n else \n format.js {render 'new'}\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def locations_to_coverage_and_placenames\n [lambda {|d|\n d.locations? and d.locations.size > 0 },\n lambda {|d|\n d.coverage = d.locations.select {|l|\n l.north? and l.east? and l.south? and l.west?\n }.map {\n |l|\n { :north => l.north, :east => l.east, :south => l.south, :west => l.west }\n }\n d.placenames = d.locations.map {|l| l.area}.map {|area|\n case area\n when \"dronning_maud_land\"\n {\"placename\"=>\"Dronning Maud Land\", \"country\" => \"AQ\" }\n when \"svalbard\"\n {\"placename\"=>\"Svalbard\", \"country\" => \"NO\" }\n else {\"placename\"=>area}\n end\n }.select{|p|not p.nil? and not p[\"placename\"] =~ /norway|arctic|antartic/ }.uniq\n d.delete :locations\n d\n }]\n end", "def test_bot_left_four_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 12\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Left'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 12, 'ThermalZone' => 2, 'Space' => 2, 'SpaceType' => 2, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 7 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def add_within_arm_comparison_row\n\t # gather up the information sent via ajax\n\t\t@outcome_id = params[:outcome_id]\n\t\t@outcome_type = params[:outcome_type]\n\t\t@subgroup_id = params[:subgroup_id].nil? ? 0 : params[:subgroup_id]\n\t study_id = params[:study_id]\n\t ef_id = params[:ef_id]\n\t @comparator_id = params[:comparator_id]\n\t row_num = params[:group_id]\n\t @selected_timepoints = params[:selected_timepoints]\n\t @selected_tp_array = @selected_timepoints.split(\"_\")\n\t @timepoints = OutcomeTimepoint.find(@selected_tp_array)\n\t @comparison = Comparison.create(:within_or_between=>\"within\",:study_id=>study_id,:extraction_form_id=>ef_id,\n\t \t\t\t\t\t\t\t:outcome_id=>@outcome_id, :subgroup_id=>@subgroup_id, :group_id=>row_num)\n\t @comparison.assign_measures\n\t @comparison_id = @comparison.id\n\t @wa_measures = OutcomeDataEntry.get_within_arm_measures([@comparison])\n\t @arms = Study.get_arms(study_id)\n\t @project_id = params[:project_id]\n\t render 'outcome_data_entries/wa_comparisons/add_within_arm_comparison_row.js.erb'\n\tend", "def surrounding_params\n params.require(:surrounding).permit(:name, :latitude, :longitude, :photo)\n end", "def create\n @floor_stage = Floor::Stage.new(floor_stage_params)\n\n respond_to do |format|\n if @floor_stage.save\n format.html { redirect_to @floor_stage, notice: 'Stage was successfully created.' }\n format.json { render :show, status: :created, location: @floor_stage }\n else\n format.html { render :new }\n format.json { render json: @floor_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def landslide_params\n params.require(:landslide).permit(:id, :hazard_type, :injuries, :landslide_size, :landslide_type, :latitude, :location_accuracy, :location_description,\n :longitude, :near, :nearest_places, :trigger, :source_name)\n end", "def is_enough_space_room_west?\r\n return true if NARROW_BETWEEN_ROOM_AND_AREA_SIZE < @room.x1 - @x1\r\n return false\r\n end", "def set_floor\n @floor = Floor.find(params[:id])\n end", "def set_floor\n @floor = Floor.find(params[:id])\n end", "def test_bot_one_unit_per_floor_no_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 3\n args_hash['level'] = 'Bottom'\n args_hash['corridor_position'] = 'None'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 1, 'ShadingSurface' => 2, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 1 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def range_troop_number_params\n params.require(:range_troop_number).permit(:provider_id, :min, :max)\n end", "def floor_stage_params\n params.fetch(:floor_stage, {})\n end", "def build(raw_property)\n property = Roomorama::Property.new(raw_property['property_id'])\n property.instant_booking!\n\n set_base_info!(property, raw_property)\n set_images!(property, raw_property)\n set_amenities!(property, raw_property)\n set_description_append!(property, raw_property)\n\n result = set_rates_and_min_stay!(property, raw_property)\n return result unless result.success?\n\n set_security_deposit!(property, raw_property)\n\n Result.new(property)\n end", "def test_top_mid_three_unit_per_floor_double_corridor\n num_finished_spaces = 1\n args_hash = {}\n args_hash['num_floors'] = 3\n args_hash['num_units'] = 9\n args_hash['level'] = 'Top'\n args_hash['corridor_position'] = 'Double-Loaded Interior'\n args_hash['horz_location'] = 'Middle'\n expected_num_del_objects = {}\n expected_num_new_objects = { 'BuildingUnit' => 1, 'Surface' => 6, 'ThermalZone' => 1, 'Space' => 1, 'SpaceType' => 1, 'PeopleDefinition' => num_finished_spaces, 'People' => num_finished_spaces, 'ScheduleConstant' => 1, 'ShadingSurfaceGroup' => 3, 'ShadingSurface' => 7, 'ExternalFile' => 1, 'ScheduleFile' => 1 }\n expected_values = { 'FinishedFloorArea' => 900 * 1, 'BuildingHeight' => 8, 'Beds' => 3.0, 'Baths' => 2.0, 'NumOccupants' => 3.39, 'EavesDepth' => 2, 'NumAdiabaticSurfaces' => 3 }\n _test_measure(nil, args_hash, expected_num_del_objects, expected_num_new_objects, expected_values, __method__)\n end", "def create\n @location_property = LocationProperty.new(params[:location_property])\n\n respond_to do |format|\n if @location_property.save\n format.html { redirect_to @location_property, notice: 'Location property was successfully created.' }\n format.json { render json: @location_property, status: :created, location: @location_property }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location_property.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6934517", "0.68359023", "0.65886587", "0.55116165", "0.5449827", "0.5305369", "0.5082544", "0.50723386", "0.5067619", "0.50580436", "0.50201815", "0.50010294", "0.49929175", "0.49878052", "0.49708432", "0.4954112", "0.49523896", "0.49491084", "0.49345988", "0.49335435", "0.4928445", "0.49142134", "0.49101967", "0.48856503", "0.48794472", "0.48666015", "0.48507547", "0.48369616", "0.48314998", "0.48266935", "0.48264897", "0.48247153", "0.48231286", "0.48055527", "0.4804402", "0.480416", "0.4801207", "0.4789684", "0.47835964", "0.4782723", "0.47613582", "0.47613224", "0.47598907", "0.47576857", "0.47551414", "0.47542837", "0.47519463", "0.47439513", "0.47276565", "0.47177196", "0.47150564", "0.47103384", "0.46998176", "0.469897", "0.4697051", "0.46902785", "0.46876118", "0.4685493", "0.46851712", "0.46830633", "0.4679582", "0.4671646", "0.46640453", "0.4656726", "0.46513858", "0.46470472", "0.46291354", "0.46273723", "0.46268818", "0.46234673", "0.46027043", "0.4583364", "0.45830953", "0.45817402", "0.45770845", "0.45559794", "0.45553583", "0.4554619", "0.45482892", "0.45467237", "0.4537656", "0.45351586", "0.45321566", "0.45315242", "0.45274496", "0.45240238", "0.45195994", "0.45118028", "0.4511011", "0.45072618", "0.45011228", "0.45006374", "0.44991472", "0.44991472", "0.4498886", "0.4490649", "0.4486542", "0.44860792", "0.44857168", "0.44747004" ]
0.6978419
0
PATCH/PUT /property_between_floor_slaps/1 PATCH/PUT /property_between_floor_slaps/1.json
def update respond_to do |format| if @property_between_floor_slap.update(property_between_floor_slap_params) format.html { redirect_to @property_between_floor_slap , notice: 'Property between floor slap was successfully updated.' } format.json { render :show, status: :ok, location: @property_between_floor_slap } else format.html { render :edit } format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_property_between_floor_slap\n @property_between_floor_slap = PropertyBetweenFloorSlap.find(params[:id])\n end", "def update\n @floor = Floor.find(params[:id])\n params[:floor][:location_id] = params[:floor][:loc_id]\n params[:floor].delete :loc_id\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n format.html { redirect_to floors_path, notice: 'Floor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n format.html { redirect_to @floor, notice: 'Floor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @floor.update(floor_params)\n format.html { redirect_to floors_path, notice: I18n.t('floors.update') }\n format.json { render :show, status: :ok, location: @floor }\n else\n format.html { render :edit }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def property_between_floor_slap_params\n params.require(:property_between_floor_slap).permit(:between_floor_slap_id, :property_id, :quality_id)\n end", "def update\n @location_property = LocationProperty.find(params[:id])\n\n respond_to do |format|\n if @location_property.update_attributes(params[:location_property])\n format.html { redirect_to @location_property, notice: 'Location property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to location_path(@location), notice: 'Floor plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @floor_stage.update(floor_stage_params)\n format.html { redirect_to @floor_stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_stage }\n else\n format.html { render :edit }\n format.json { render json: @floor_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@opportunity = Opportunity.find(params[:id])\n #@floor = @opportunity.floor\n #@building = @floor.building\n\n respond_to do |format|\n if @opportunity.update_attributes(params[:opportunity])\n flash[:notice] = 'Opportunity was successfully updated.'\n format.html { redirect_to(opportunity_path(@opportunity)) }\n format.xml { head :ok }\n else\n flash[:error] = 'Opportunity could not be updated.'\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @opportunity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @min_num_bathrooms = args[:min_num_bathrooms] if args.key?(:min_num_bathrooms)\n @min_num_bedrooms = args[:min_num_bedrooms] if args.key?(:min_num_bedrooms)\n end", "def update\n respond_to do |format|\n if @property_closet.update(property_closet_params)\n format.html { redirect_to @property_closet, notice: 'Property closet was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_closet }\n else\n format.html { render :edit }\n format.json { render json: @property_closet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shooting_range = ShootingRange.find(params[:id])\n\n respond_to do |format|\n if @shooting_range.update_attributes(params[:shooting_range])\n format.html { redirect_to(@shooting_range, :notice => 'Shooting range was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shooting_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to @floor_plan, notice: 'Floor plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_plan }\n else\n format.html { render :edit }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to :back, notice: 'Floor plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property_interior_closure.update(property_interior_closure_params)\n format.html { redirect_to @property_interior_closure, notice: 'Property interior closure was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_interior_closure }\n else\n format.html { render :edit }\n format.json { render json: @property_interior_closure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @rectangle = args[:rectangle] if args.key?(:rectangle)\n @strict_restriction = args[:strict_restriction] if args.key?(:strict_restriction)\n end", "def update\n if @api_v1_property.update(api_v1_property_params)\n render :show, status: :ok, location: @api_v1_property\n else\n render json: @api_v1_property.errors, status: :unprocessable_entity\n end\n end", "def create\n @property_between_floor_slap = PropertyBetweenFloorSlap.new(property_between_floor_slap_params)\n\n respond_to do |format|\n if @property_between_floor_slap.save\n format.html { redirect_to @property_between_floor_slap, notice: 'Property between floor slap was successfully created.' }\n format.json { render :show, status: :created, location: @property_between_floor_slap }\n else\n format.html { render :new }\n format.json { render json: @property_between_floor_slap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stolen_property.update(stolen_property_params)\n format.html { redirect_to @stolen_property, notice: 'Stolen property was successfully updated.' }\n format.json { render :show, status: :ok, location: @stolen_property }\n else\n format.html { render :edit }\n format.json { render json: @stolen_property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @roadmap = Roadmap.find(@roadmap_step.roadmap_id)\n\n respond_to do |format|\n if @roadmap_step.update(roadmap_step_params)\n format.html { redirect_to @roadmap, notice: 'Roadmap step was successfully updated.' }\n format.json { render :show, status: :ok, location: @roadmap_step }\n else\n format.html { render :edit }\n format.json { render json: @roadmap_step.errors, status: :unprocessable_entity }\n end\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!(**args)\n @building = args[:building] if args.key?(:building)\n @city = args[:city] if args.key?(:city)\n @floor = args[:floor] if args.key?(:floor)\n @latitude = args[:latitude] if args.key?(:latitude)\n @longitude = args[:longitude] if args.key?(:longitude)\n @section = args[:section] if args.key?(:section)\n @simple_name = args[:simple_name] if args.key?(:simple_name)\n end", "def update\n respond_to do |format|\n if @horizontal_property.update(horizontal_property_params)\n format.html { redirect_to @horizontal_property.act, notice: 'Horizontal property was successfully updated.' }\n format.json { render :show, status: :ok, location: @horizontal_property.act }\n else\n format.html { render :edit }\n format.json { render json: @horizontal_property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @line_property.update(line_property_params)\n format.html { redirect_to @line_property, notice: 'Line property was successfully updated.' }\n format.json { render :show, status: :ok, location: @line_property }\n else\n format.html { render :edit }\n format.json { render json: @line_property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @bounding_marker = args[:bounding_marker] if args.key?(:bounding_marker)\n @conjoined_category = args[:conjoined_category] if args.key?(:conjoined_category)\n @distance_to_next_lane = args[:distance_to_next_lane] if args.key?(:distance_to_next_lane)\n @flow = args[:flow] if args.key?(:flow)\n @lane_connection = args[:lane_connection] if args.key?(:lane_connection)\n @lane_divider_crossing = args[:lane_divider_crossing] if args.key?(:lane_divider_crossing)\n @lane_follows_segment_begin_fraction = args[:lane_follows_segment_begin_fraction] if args.key?(:lane_follows_segment_begin_fraction)\n @lane_follows_segment_end_fraction = args[:lane_follows_segment_end_fraction] if args.key?(:lane_follows_segment_end_fraction)\n @lane_number = args[:lane_number] if args.key?(:lane_number)\n @lane_token = args[:lane_token] if args.key?(:lane_token)\n @metadata = args[:metadata] if args.key?(:metadata)\n @restriction = args[:restriction] if args.key?(:restriction)\n @shared = args[:shared] if args.key?(:shared)\n @stop_line = args[:stop_line] if args.key?(:stop_line)\n @surface = args[:surface] if args.key?(:surface)\n @type = args[:type] if args.key?(:type)\n @width = args[:width] if args.key?(:width)\n end", "def update\n respond_to do |format|\n if @floor_ammenity.update(floor_ammenity_params)\n format.html { redirect_to @floor_ammenity, notice: 'Ammenity was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_ammenity }\n else\n format.html { render :edit }\n format.json { render json: @floor_ammenity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n if @mini_map_road.update_attributes(params[:mini_map_road])\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end", "def update\n respond_to do |format|\n if @property_sector.update(property_sector_params)\n format.html { redirect_to @property_sector, notice: 'Property sector was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_sector }\n else\n format.html { render :edit }\n format.json { render json: @property_sector.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @arrival_range = ArrivalRange.find(params[:id])\n\n respond_to do |format|\n if @arrival_range.update_attributes(params[:arrival_range])\n format.html { redirect_to @arrival_range, notice: 'Arrival range was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arrival_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pagetitle = \"Edit division\"\n \n @division = Division.find(params[:id])\n \n @company = Company.find(@division[:company_id])\n \n @locations = @company.get_locations()\n\n respond_to do |format|\n if @division.update_attributes(params[:division])\n format.html { redirect_to(@division, :notice => 'Division was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @division.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @property_between_floor_slaps = PropertyBetweenFloorSlap.all\n end", "def floor_updates(options = {})\n get('/floor_updates', options)\n end", "def update\n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n if @floor.update_attributes(params[:floor])\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to(@floor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @floor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @request_property.update(request_property_params)\n format.html { redirect_to @request_property, notice: 'Request property was successfully updated.' }\n format.json { render :show, status: :ok, location: @request_property }\n else\n format.html { render :edit }\n format.json { render json: @request_property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @location = Location.find(params[:id]) \n start_time = @location.start_time\n end_time = @location.end_time\n\n @start_time_hour = start_time.split(':')[0]\n @start_time_min = start_time.split(':')[1]\n @end_time_hour = end_time.split(':')[0]\n @end_time_min = end_time.split(':')[1]\n respond_to do |format|\n start_time = \"#{params[:start_time_hour]}:#{params[:start_time_min]}\"\n end_time = \"#{params[:end_time_hour]}:#{params[:end_time_min]}\"\n if params[:location].present?\n params[:location][:start_time] = start_time\n params[:location][:end_time] = end_time\n end \n\n if @location.update_attributes(params[:location])\n format.html { redirect_to @location }\n format.json { head :no_content }\n else\n format.js{render 'new'}\n format.html { redirect_to edit_location_path(params[:id]) }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @updateProperties = []\n Property.all.each do |p|\n if @building.half_address == p.buildinginfo\n @updateProperties << p\n end\n end\n @updateTenants = []\n Tenant.all.each do |t|\n if @building.half_address == t.tenantbuildinginfo\n @updateTenants << t\n end\n end\n @updateExpenses = []\n Expense.all.each do |e|\n if @building.half_address == e.buildinginfo\n @updateExpenses << e\n end\n end\n\n respond_to do |format|\n if @building.update(building_params)\n @updateProperties.each do |p|\n p.buildinginfo = @building.half_address\n p.save\n end\n @updateTenants.each do |t|\n t.tenantbuildinginfo = @building.half_address\n t.save\n end\n @updateExpenses.each do |e|\n e.buildinginfo = @building.half_address\n e.save\n end\n format.html { redirect_to @building, notice: 'Building was successfully updated.' }\n format.json { render :show, status: :ok, location: @building }\n else\n format.html { render :edit }\n format.json { render json: @building.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subcellular_location = SubcellularLocation.find(params[:id])\n\n respond_to do |format|\n if @subcellular_location.update_attributes(params[:subcellular_location])\n format.html { redirect_to @subcellular_location, notice: 'Subcellular location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subcellular_location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_zoom_rooms_location_structure_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RoomsLocationApi.update_zoom_rooms_location_structure ...'\n end\n # resource path\n local_var_path = '/rooms/locations/structure'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = ['OAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoomsLocationApi#update_zoom_rooms_location_structure\\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 @location.update(location_params)\n if @location.dt_devolucao.nil?\n else\n @vehicle = Vehicle.find_by(id: @location.vehicle_id)\n @client = Client.find_by(id: @location.client_id)\n \n @vehicle.update_attribute(:status, 'DISPONÍVEL')\n @client.update_attribute(:status, 'DISPONÍVEL')\n end\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @property = Property.find(params[:id])\n\n if @property.update(property_params)\n head :no_content\n else\n render json: @property.errors, status: :unprocessable_entity\n end\n end", "def update\n if !check_permissions?(session[:user_type], \"edit_property\")\n redirect_to root_path\n end\n puts \"The params in update are\",params\n respond_to do |format|\n if @property.update(property_params)\n add_property_feature(@property)\n format.html { redirect_to @property, notice: \"Property was successfully updated.\" }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mostsmallroad = Mostsmallroad.find(params[:id])\n\n respond_to do |format|\n if @mostsmallroad.update_attributes(params[:mostsmallroad])\n format.html { redirect_to @mostsmallroad, notice: 'Mostsmallroad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallroad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @property.Rate = ((@property.CurrentPrice - @property.Price) / @property.Price) * 100\n @property.ShareValue = @property.CurrentPrice / @property.Shares\n # update share value in individual shares\n @property.shares.update_all(value: @property.ShareValue)\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Please Press edit to verify changes and PRESS UDATE again' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @income_loss_house_property.update(income_loss_house_property_params)\n format.html { redirect_to @income_loss_house_property, notice: 'Income loss house property was successfully updated.' }\n format.json { render :show, status: :ok, location: @income_loss_house_property }\n else\n format.html { render :edit }\n format.json { render json: @income_loss_house_property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @island = Island.find(params[:id])\n\n respond_to do |format|\n if @island.update_attributes(params[:island])\n format.html { redirect_to @island, notice: 'Island was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @island.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @location = args[:location] if args.key?(:location)\n @diff_mask = args[:diff_mask] if args.key?(:diff_mask)\n end", "def update\n respond_to do |format|\n if @ride_level.update(ride_level_params)\n format.html { redirect_to @ride_level, notice: 'Ride level was successfully updated.' }\n format.json { render :show, status: :ok, location: @ride_level }\n else\n format.html { render :edit }\n format.json { render json: @ride_level.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @r_property_definition.update(r_property_definition_params)\n format.html { redirect_to @r_property_definition, notice: 'R property definition was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @r_property_definition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # if ((@plant.start_date..@project.end_date).cover?(params[:plant][:foreman_start_date]))\n respond_to do |format|\n # if @plant.foreman_id.eql?(params[:plant][:foreman_id])\n if @plant.update(plant_params)\n\n format.html {redirect_to \"/projects/#{@project.id}/plants\", notice: 'Plant was successfully updated.'}\n format.json {render :show, status: :ok, location: @plant}\n else\n format.html {render :edit}\n format.json {render json: @plant.errors, status: :unprocessable_entity}\n end\n\n end\n\n end", "def update\n @route = Route.find(params[:id])\n if user_signed_in?\n routeInfo = JSON.parse(params[:route_map_points].gsub(\"jb\",\"latitude\").gsub(\"kb\",\"longitude\"))\n \n \n @route.route_points = routeInfo['overview_path']\n @route.starting_point = routeInfo['overview_path'].first\n @route.end_point = routeInfo['overview_path'].last\n\n\n respond_to do |format|\n if @route.save(params[:route])\n if @route.schedule.update_attributes(\n departure: params[:route_schedule_departure], \n arrival: params[:route_schedule_arrival]) \n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end\nend\n # DELETE /routes/1\n # DELETE /routes/1.json\n def destroy\n @route = Route.find(params[:id])\n @route.destroy\n\n respond_to do |format|\n format.html { redirect_to routes_url }\n format.json { head :no_content }\n end\n end\nend", "def update\n if params[:place_id]\n @safe_house = Place.find(params[:place_id])\n place_id_present = true\n end\n\n respond_to do |format|\n if place_id_present && @safe_house.update_attributes( :name => params[:name],\n :zombie_probability => params[:zombie_probability],\n :latitude => params[:latitude],\n :longitude => params[:longitude],\n :has_weapons => params[:has_weapons],\n :has_food => params[:has_food],\n :has_people => params[:has_people])\n format.json { render :json => { :status => \"OK\", :response => {:updated => true} }}\n else\n format.json { render :json => { :status => \"Error\", :response => {} }}\n end\n end\n end", "def update!(**args)\n @diff_mask = args[:diff_mask] if args.key?(:diff_mask)\n @location = args[:location] if args.key?(:location)\n end", "def update!(**args)\n @diff_mask = args[:diff_mask] if args.key?(:diff_mask)\n @location = args[:location] if args.key?(:location)\n end", "def update!(**args)\n @location = args[:location] if args.key?(:location)\n @restriction = args[:restriction] if args.key?(:restriction)\n end", "def update\n @property = Property.find(params[:id])\n\n if @property.update(params[:property])\n head :no_content\n else\n render json: @property.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lens = Lens.find(params[:id])\n attrb = select_params(lens_params)\n # linear_data is an array of Objects of Components Properties\n # that needs to be deserialized correctly\n attrb[\"linear_data\"] = JSON.parse(attrb[\"linear_data\"])\n lens = Lens.update(attrb)\n \n # @lens.update(lens_params)\n # render inline: \"<%= @lens.id %>\"\n end", "def update\n @medium_road = MediumRoad.find(params[:id])\n\n respond_to do |format|\n if @medium_road.update_attributes(params[:medium_road])\n format.html { redirect_to @medium_road, notice: 'Medium road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @medium_road.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts 'kkkkkkkkkkkkkkkkkkkkk'\n puts property_params\n\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: \"Property was successfully updated.\" }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @restaurant_floor_plan.update(restaurant_floor_plan_params)\n format.html { redirect_to @restaurant_floor_plan, notice: 'Restaurant floor plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_floor_plan }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pharmacy_range = PharmacyRange.find(params[:id])\n\n respond_to do |format|\n if @pharmacy_range.update_attributes(params[:pharmacy_range])\n format.html { redirect_to(@pharmacy_range, :notice => 'PharmacyRange was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pharmacy_range.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end", "def update\n #@property = Property.find(params[:id])\n\n respond_to do |format|\n if @property.update_attributes(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @prominence_meters = args[:prominence_meters] if args.key?(:prominence_meters)\n end", "def update\n @rooms_for_draw = []\n\n respond_to do |format|\n if @floor.update(floor_params)\n\n editorData = @floor.editor_data\n editorData = editorData.split(\"<END>\").map{|i| i.split(\"<NEXT>\")}\n editorData.each do |obj|\n if obj[7] == 'edit'\n # Обновление точек:\n\n Point.all.where(polygon_id: obj[6]).each{ |point| point.destroy }\n points = obj[8].gsub(\", \", \",\").split(\" \").map{ |j| j.split(',') }\n for i in 0 ... points.size\n point = Point.create(ox: points[i][0].to_f,\n oy: points[i][1].to_f,\n priority: i,\n polygon_id: obj[6]\n )\n point.save\n end\n\n if obj[0] == 'submain'\n # Обновление аудиторий:\n room = Room.all.where(id: Polygon.all.where(id: obj[6].to_i)[0].imageable_id)[0]\n room.update(name: obj[1],\n description: obj[2],\n capacity: obj[3],\n computers: obj[4],\n roomtype_id: Roomtype.all.where(id: obj[5].to_i)[0]\n )\n end\n elsif obj[7] == 'destroy'\n Point.all.where(polygon_id: obj[6]).each{ |point| point.destroy }\n if obj[0] == 'submain'\n # raise (\"#{obj[6]}\")\n room = Room.all.where(id: Polygon.all.where(id: obj[6].to_i)[0].imageable_id)[0]\n room.destroy\n end\n elsif obj[7] == 'new'\n if obj[0] == 'submain'\n object = Room.new(name: obj[1],\n description: obj[2],\n capacity: obj[3],\n computers: obj[4],\n roomtype_id: Roomtype.all.where(id: obj[5].to_i)[0],\n floor_id: @floor.id)\n object.save\n elsif obj[0] == 'main'\n object = @floor\n end\n polygon = Polygon.new(imageable: object)\n polygon.save\n points = obj[8].gsub(\", \", \",\").split(\" \").map{ |j| j.split(',') }\n for i in 0 ... points.size\n point = Point.create(ox: points[i][0].to_f,\n oy: points[i][1].to_f,\n priority: i,\n polygon: polygon\n )\n point.save\n end\n end\n end\n\n format.html { redirect_to @floor, notice: t('flash.floor.update') }\n format.json { render :show, status: :ok, location: @floor }\n else\n format.html { render :edit }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @salary_range = SalaryRange.find(params[:id])\n\n respond_to do |format|\n if @salary_range.update_attributes(params[:salary_range])\n format.html { redirect_to @salary_range, notice: 'Salary range was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @salary_range.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @polygon_shape_id = args[:polygon_shape_id] if args.key?(:polygon_shape_id)\n @rest_of_world_polygon_shape_id = args[:rest_of_world_polygon_shape_id] if args.key?(:rest_of_world_polygon_shape_id)\n @rights_status = args[:rights_status] if args.key?(:rights_status)\n @self_polygon_shape_id = args[:self_polygon_shape_id] if args.key?(:self_polygon_shape_id)\n @trust_prop = args[:trust_prop] if args.key?(:trust_prop)\n @water_removed_polygon_shape_id = args[:water_removed_polygon_shape_id] if args.key?(:water_removed_polygon_shape_id)\n end", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n num_stalls = bathroom_params[:stalls].to_i\n respond_to do |format|\n if @bathroom.update(bathroom_params.except(:stalls))\n if num_stalls > @bathroom.stalls.count\n (@bathroom.stalls.count..num_stalls).each do |i|\n Stall.new({ bathroom_id: @bathroom.id, state: false, number: @bathroom.stalls.count }).save\n end\n elsif num_stalls < @bathroom.stalls.count && num_stalls >= 0\n while num_stalls < @bathroom.stalls.count do\n @bathroom.stalls.last.destroy\n end\n end\n format.html { redirect_to @bathroom, notice: 'Bathroom was successfully updated.' }\n format.json { render :show, status: :ok, location: @bathroom }\n else\n format.html { render :edit }\n format.json { render json: @bathroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @explained_range = args[:explained_range] if args.key?(:explained_range)\n @geo_query_coverage = args[:geo_query_coverage] if args.key?(:geo_query_coverage)\n end", "def update\n @round = Round.find(params[:id])\n params[:round][:start_date] = Date.strptime(params[:round][:start_date], '%d/%m/%Y').strftime.to_s\n params[:round][:end_date] = Date.strptime(params[:round][:end_date], '%d/%m/%Y').strftime.to_s\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, :notice => 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @round.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property_detail.update(property_detail_params)\n format.html { redirect_to @property_detail, notice: 'Property detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n # Remove all features by property objects\n @property.features_properties.delete_all\n\n # Get features parameter\n features = params[:features]\n\n # Verify whether features array comes in the parameters list\n if features.present?\n # Intantiate & create features by property\n features_property_create = FeaturesPropertyCreate.new(@property)\n features_property_create.create(features, params[:quantities])\n end\n\n # Remove all photos by property objects\n #@property.photos.delete_all\n\n # Get photos parameter\n photos = params[:photos]\n\n # Verify whether photos array comes in the parameters list\n if photos.present?\n # Intantiate & create photos by property\n photo_create = PhotoCreate.new(@property)\n photo_create.create(photos)\n end\n\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @restricted_hours = args[:restricted_hours] if args.key?(:restricted_hours)\n @restriction_type = args[:restriction_type] if args.key?(:restriction_type)\n @service_type = args[:service_type] if args.key?(:service_type)\n @vehicle_type = args[:vehicle_type] if args.key?(:vehicle_type)\n end", "def update\n \n begin\n DetailValue.transaction do\n # Increment the instance version\n increment_instance_version\n @resource = update_value(params[:detail_id], \n params[:id], \n {\n 'lock_version' => params[:value][:lock_version],\n 'value' => params[:value][:value] \n })\n \n end\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def update\n @occupant = Occupant.find_by(:id => params[:id])\n @occupant.name = params[:name]\n @occupant.sex = params[:sex]\n @occupant.number_of_beds = params[:number_of_beds]\n @occupant.shelter_id = params[:shelter_id]\n\n if @occupant.save\n @shelter = Shelter.find_by_id(params[:shelter_id])\n @shelter.open_beds = @shelter.open_beds - @occupant.number_of_beds\n @shelter.save\n redirect_to shelter_url(@shelter.id)\n else\n render 'new'\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @property.update(property_params)\n format.html { redirect_to @property, notice: \"Property was successfully updated.\" }\n format.json { render :show, status: :ok, location: @property }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @property.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_floor\n @floor = Floor.with_deleted.find(params[:id])\n end", "def update!(**args)\n @building_id = args[:building_id] if args.key?(:building_id)\n @building_name = args[:building_name] if args.key?(:building_name)\n @current = args[:current] if args.key?(:current)\n @desk_code = args[:desk_code] if args.key?(:desk_code)\n @floor_name = args[:floor_name] if args.key?(:floor_name)\n @floor_section = args[:floor_section] if args.key?(:floor_section)\n @last_update_time = args[:last_update_time] if args.key?(:last_update_time)\n @metadata = args[:metadata] if args.key?(:metadata)\n @source = args[:source] if args.key?(:source)\n @type = args[:type] if args.key?(:type)\n @value = args[:value] if args.key?(:value)\n end", "def update\n @compartment = Compartment.find(params[:id])\n level = @compartment.level\n\n respond_to do |format|\n if @compartment.update_attributes(params[:compartment])\n format.html { redirect_to ([level, @compartment]), notice: 'Compartment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @road = Road.find(params[:id])\n\n respond_to do |format|\n if @road.update_attributes(params[:road])\n format.html { redirect_to @road, notice: 'Road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @road.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @specialization_area.update(specialization_area_params)\n format.html { redirect_to admin_specialization_area_path(@specialization_area), notice: 'Specialization area was successfully updated.' }\n format.json { render :show, status: :ok, location: @specialization_area }\n else\n format.html { render :edit }\n format.json { render json: @specialization_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @spherical_panorama = args[:spherical_panorama] if args.key?(:spherical_panorama)\n @vr180_panorama = args[:vr180_panorama] if args.key?(:vr180_panorama)\n end", "def update!(**args)\n @allow_non_street_level_address = args[:allow_non_street_level_address] if args.key?(:allow_non_street_level_address)\n @departure_hour_local = args[:departure_hour_local] if args.key?(:departure_hour_local)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @road_traffic = args[:road_traffic] if args.key?(:road_traffic)\n @start_location = args[:start_location] if args.key?(:start_location)\n @travel_time = args[:travel_time] if args.key?(:travel_time)\n end", "def update!(**args)\n @allow_non_street_level_address = args[:allow_non_street_level_address] if args.key?(:allow_non_street_level_address)\n @departure_hour_local = args[:departure_hour_local] if args.key?(:departure_hour_local)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @road_traffic = args[:road_traffic] if args.key?(:road_traffic)\n @start_location = args[:start_location] if args.key?(:start_location)\n @travel_time = args[:travel_time] if args.key?(:travel_time)\n end", "def update_availability\n @property.update(is_available: 0, owner_id: @current_user.id)\n render json: @property\n end", "def update\n respond_to do |format|\n if @place.update(place_params)\n format.html { redirect_to @place, notice: 'Place was successfully updated.' }\n format.json { render :show, status: :ok, location: @place }\n else\n format.html { render :edit }\n format.json { render json: @place.errors, status: :unprocessable_entity }\n end\n end\n @place.cuisine_type_ids = params[:place][:cuisine_type_ids]\n @place.highlight_ids = params[:place][:highlight_ids]\n @place.dining_type_ids = params[:place][:dining_type_ids]\n 7.times { @place.opening_hours.build }\n end", "def update!(**args)\n @bounding_marker = args[:bounding_marker] if args.key?(:bounding_marker)\n @bounding_marker_token = args[:bounding_marker_token] if args.key?(:bounding_marker_token)\n @flowline_adjacency_begin_fraction = args[:flowline_adjacency_begin_fraction] if args.key?(:flowline_adjacency_begin_fraction)\n @flowline_adjacency_end_fraction = args[:flowline_adjacency_end_fraction] if args.key?(:flowline_adjacency_end_fraction)\n @marker_adjacency_begin_fraction = args[:marker_adjacency_begin_fraction] if args.key?(:marker_adjacency_begin_fraction)\n @marker_adjacency_end_fraction = args[:marker_adjacency_end_fraction] if args.key?(:marker_adjacency_end_fraction)\n @side = args[:side] if args.key?(:side)\n end" ]
[ "0.6611928", "0.64026827", "0.6253212", "0.6180711", "0.59178376", "0.58830047", "0.5867793", "0.581085", "0.5779907", "0.57641405", "0.5741139", "0.57381433", "0.56444305", "0.5617428", "0.5576063", "0.5557531", "0.5538262", "0.55241364", "0.551262", "0.5512446", "0.5505184", "0.5502735", "0.5500453", "0.5497089", "0.5496625", "0.54917157", "0.5487882", "0.5485683", "0.5484792", "0.5475621", "0.54698265", "0.54668653", "0.54652774", "0.5458519", "0.54563653", "0.54548913", "0.54516304", "0.5451302", "0.54473656", "0.5444759", "0.54442227", "0.5438215", "0.54294765", "0.54267025", "0.5412374", "0.5412053", "0.541055", "0.5406748", "0.540641", "0.5400623", "0.54003406", "0.5391183", "0.53911453", "0.53905445", "0.53905445", "0.538677", "0.53733057", "0.5368181", "0.5368181", "0.5362585", "0.5350897", "0.534726", "0.53458536", "0.5345584", "0.534381", "0.53404367", "0.5333693", "0.5330171", "0.53264177", "0.5323011", "0.5321345", "0.53189594", "0.531766", "0.53150886", "0.52965957", "0.52960086", "0.5288474", "0.52845746", "0.5284478", "0.5283971", "0.52801734", "0.52801734", "0.52801734", "0.52801734", "0.52801734", "0.52801734", "0.52801734", "0.52801734", "0.5278307", "0.52772886", "0.5275804", "0.52730554", "0.527276", "0.5272129", "0.5270389", "0.5269506", "0.5269111", "0.52650255", "0.5263748", "0.5263343" ]
0.69383144
0
DELETE /property_between_floor_slaps/1 DELETE /property_between_floor_slaps/1.json
def destroy @property_between_floor_slap.destroy respond_to do |format| format.html { redirect_to property_between_floor_slaps_url, notice: 'Property between floor slap was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to location_path(@location) }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor = Floor.find(params[:id])\n @floor.destroy\n\n respond_to do |format|\n format.html { redirect_to floors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor.destroy\n respond_to do |format|\n format.html { redirect_to floors_url, notice: I18n.t('floors.destroy') }\n format.json { head :no_content }\n end\n end", "def destroy\n @location_property = LocationProperty.find(params[:id])\n @location_property.destroy\n\n respond_to do |format|\n format.html { redirect_to location_properties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @location_granularity.destroy\n respond_to do |format|\n format.html { redirect_to location_granularities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor.destroy\n respond_to do |format|\n format.html { redirect_to @floor.building, notice: t('flash.floor.delete') }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.photos.delete_all\n @property.features_properties.delete_all\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor_ammenity.destroy\n respond_to do |format|\n format.html { redirect_to floor_ammenities_url, notice: 'Ammenity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor = Floor.find(params[:id])\n @floor.destroy\n\n respond_to do |format|\n format.html { redirect_to(floors_url) }\n format.xml { head :ok }\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 @shooting_range = ShootingRange.find(params[:id])\n @shooting_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(shooting_ranges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @income_loss_house_property.destroy\n respond_to do |format|\n format.html { redirect_to income_loss_house_properties_url, notice: 'Income loss house property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to runner_home_path, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @r_property_definition.destroy\n respond_to do |format|\n format.html { redirect_to r_property_definitions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @line_property.destroy\n respond_to do |format|\n format.html { redirect_to line_properties_url, notice: 'Line property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @roadmap_step.destroy\n respond_to do |format|\n format.html { redirect_to roadmap_steps_url, notice: 'Roadmap step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @horizontal_property.destroy\n respond_to do |format|\n format.html { redirect_to act_path(@act), notice: 'Horizontal property 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 destroy\n @area_attribute.destroy\n respond_to do |format|\n format.html { redirect_to area_attributes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @property_closet.destroy\n respond_to do |format|\n format.html { redirect_to property_closets_url, notice: 'Property closet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def destroy\n debug('Removing location')\n crm('configure', 'delete', @resource[:name])\n @property_hash.clear\n end", "def destroy\n @property_detail.destroy\n respond_to do |format|\n format.html { redirect_to property_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor_stage.destroy\n respond_to do |format|\n format.html { redirect_to floor_stages_url, notice: 'Stage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ride_level.destroy\n respond_to do |format|\n format.html { redirect_to ride_levels_url, notice: 'Ride level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subcellular_location = SubcellularLocation.find(params[:id])\n @subcellular_location.destroy\n\n respond_to do |format|\n format.html { redirect_to subcellular_locations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n head :no_content\n end", "def destroy\n @property_sector.destroy\n respond_to do |format|\n format.html { redirect_to property_sectors_url, notice: 'Property sector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to my_properties_properties_url , notice: \"Property was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n\n head :no_content\n end", "def destroy\n @open_shoot = OpenShoot.find(params[:id])\n @open_shoot.destroy\n\n respond_to do |format|\n format.html { redirect_to open_shoots_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_property.destroy\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityOpening_times( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/opening_times\",params)\n end", "def delete\n render json: Location.delete(params[\"id\"])\n end", "def destroy\n properties_delete(@property)\n @property.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { render json: {success: true} }\n end\n end", "def destroy\n @road = Road.find(params[:id])\n @road.destroy\n\n respond_to do |format|\n format.html { redirect_to roads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :ok }\n end\n end", "def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :ok }\n end\n end", "def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@opportunity = Opportunity.find(params[:id])\n #@building = @opportunity.floor.building\n @opportunity.destroy\n\n respond_to do |format|\n flash[:notice] = 'Opportunity was deleted.'\n format.html { redirect_to(opportunities_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @island = Island.find(params[:id])\n @island.destroy\n\n respond_to do |format|\n format.html { redirect_to islands_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wall_plate.destroy\n respond_to do |format|\n format.html { redirect_to wall_plates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to floor_plans_url, notice: 'Floor plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant_floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_floor_plans_url, notice: 'Restaurant floor plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to propertys_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @house.destroy\n respond_to do |format|\n format.html { redirect_to house_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @property_field = PropertyField.find(params[:id])\n @property_field.destroy\n\n respond_to do |format|\n format.html { redirect_to property_fields_url }\n format.json { head :no_content }\n end\n end", "def destroy\n onevnet('delete', resource[:name])\n @property_hash.clear\n end", "def destroy\n # @observation = Observation.find(params[:observation_id])\n @area = Area.find(params[:area_id])\n @touch = @area.touches.find(params[:id])\n\n\n # @touch = Touch.find(params[:id])\n @touch.destroy\n\n respond_to do |format|\n format.html { redirect_to coral_observation_area_path(@area.observation.coral, @area.observation, @area), notice: 'Area was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_property.destroy\n respond_to do |format|\n format.html { redirect_to client_properties_url, notice: 'Client property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stolen_property.destroy\n respond_to do |format|\n format.html { redirect_to stolen_properties_url, notice: 'Stolen property was successfully destroyed.' }\n format.json { head :no_content }\n end\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 destroy\n @checklist_property = ChecklistProperty.find(params[:id])\n @checklist_property.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\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 #@netracks = @location.net_racks.all\n #binding.pry\n #@netracks.destroy.all\n @location.destroy\n respond_to do |format|\n format.html { redirect_to locations_url, notice: 'Location was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def api_remove\n data_hash = make_hash\n delete_hash = { division: data_hash[:division][:value] }\n handler.remove(delete_hash, path, subscriber_id)\n end", "def destroy\n @line_property_item.destroy\n respond_to do |format|\n format.html { redirect_to line_property_items_url, notice: 'Line property item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @aws_route_table_propogate.destroy\n respond_to do |format|\n format.html { redirect_to aws_route_table_propogates_url, notice: 'Aws route table propogate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to category_sub_category_item_properties_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 @land = Land.find(params[:id])\n @land.destroy\n\n respond_to do |format|\n format.html { redirect_to(lands_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @location_time.destroy\n respond_to do |format|\n format.html { redirect_to location_times_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @building_id = @unit.building_id\n @unit.destroy\n respond_to do |format|\n format.html { redirect_to building_path(@building_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_property.destroy\n respond_to do |format|\n format.html { redirect_to request_properties_url, notice: 'Request property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @level.destroy\n respond_to do |format|\n format.html { redirect_to levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @landing = Landing.find(params[:id])\n @landing.destroy\n\n respond_to do |format|\n format.html { redirect_to landings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmacy_range = PharmacyRange.find(params[:id])\n @pharmacy_range.destroy\n\n respond_to do |format|\n format.html { redirect_to(pharmacy_ranges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @property_state.destroy\n respond_to do |format|\n format.html { redirect_to property_states_url, notice: 'Property state was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n onetemplate('delete', resource[:name])\n @property_hash.clear\n end", "def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @level_goal = LevelGoal.find(params[:id])\n @level_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to level_goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to(properties_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url }\n format.json { head :no_content }\n format.js { render nothing: true}\n end\n end", "def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to houses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @slope.destroy\n respond_to do |format|\n format.html { redirect_to slopes_url, notice: 'Slope was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @route_detail = RouteDetail.find(params[:id])\r\n @route_detail.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to route_details_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @show_house = ShowHouse.find(params[:id])\n @show_house.destroy\n\n respond_to do |format|\n format.html { redirect_to show_houses_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 @administrative_division = AdministrativeDivision.find(params[:id])\n @administrative_division.destroy\n\n respond_to do |format|\n format.html { redirect_to(administrative_divisions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @house_list.destroy\n respond_to do |format|\n format.html { redirect_to house_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @property = Property.find(params[:id])\n @property.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_properties_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @location = Location.find(params[:id])\r\n @location.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @property.destroy\n respond_to do |format|\n format.html { redirect_to properties_url, notice: 'Property was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6767104", "0.6629417", "0.65859383", "0.6548821", "0.65027034", "0.6496672", "0.6478902", "0.64782614", "0.6418464", "0.6389761", "0.63772845", "0.63682294", "0.63654083", "0.63643336", "0.6358095", "0.634887", "0.6343281", "0.6322753", "0.6319015", "0.63171756", "0.6308039", "0.62873155", "0.62790143", "0.6263358", "0.625515", "0.6240062", "0.6237045", "0.62345713", "0.6210892", "0.62071127", "0.61964124", "0.6196279", "0.61932814", "0.6186847", "0.6181124", "0.61776006", "0.61776006", "0.61616725", "0.61583346", "0.61571676", "0.6154395", "0.61483175", "0.61483175", "0.6141612", "0.6141612", "0.6132637", "0.6127817", "0.6126806", "0.6126652", "0.61220115", "0.61220115", "0.6120773", "0.6103744", "0.6097669", "0.6093148", "0.6091621", "0.6089162", "0.6082314", "0.6075143", "0.60742974", "0.60741127", "0.60585994", "0.6056742", "0.6054202", "0.60356694", "0.6035346", "0.60345525", "0.6032963", "0.6029998", "0.6028145", "0.6026737", "0.6026018", "0.6024572", "0.6022243", "0.60137457", "0.6013178", "0.60113007", "0.60044926", "0.6003367", "0.6002457", "0.6000506", "0.5997478", "0.5996402", "0.59916425", "0.59916425", "0.5988678", "0.59868944", "0.5985855", "0.59822696", "0.59804636", "0.59804386", "0.59796894", "0.597723", "0.59739625", "0.5973248", "0.5973248", "0.5973248", "0.5973248", "0.5973248", "0.5973248" ]
0.78118306
0
Use callbacks to share common setup or constraints between actions.
def set_property_between_floor_slap @property_between_floor_slap = PropertyBetweenFloorSlap.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\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 event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.5330087", "0.5311993", "0.5297402", "0.5296789", "0.52957207", "0.52596015", "0.5245442", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5235431", "0.5231888", "0.5226663", "0.52220625", "0.5217086", "0.52137345", "0.5208314", "0.5205469", "0.5175606", "0.5174914", "0.5173361", "0.51662856", "0.5161792", "0.51572216", "0.5153063", "0.5152982", "0.5152632", "0.51435786", "0.5139829", "0.51346594", "0.511372", "0.511372", "0.51136476", "0.51083213", "0.5108011", "0.5091935", "0.5089297", "0.5081576", "0.50807106", "0.50656676", "0.50548106", "0.50537366", "0.505074", "0.505074", "0.5033361", "0.5025158", "0.5020441", "0.5015611", "0.50142473", "0.5000281", "0.50001067", "0.49989453", "0.4989465", "0.4989465", "0.4985425", "0.49805096", "0.49795893", "0.49783278", "0.49676263", "0.49656346", "0.49579078", "0.4955427", "0.49554235", "0.49536413", "0.49523768", "0.49457142", "0.49433607", "0.4933641", "0.49320185", "0.49265638", "0.49262375", "0.49259067", "0.4922456", "0.49201223", "0.49165115", "0.49158815", "0.49151883", "0.49149552", "0.4914386" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def property_between_floor_slap_params params.require(:property_between_floor_slap).permit(:between_floor_slap_id, :property_id, :quality_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
saves Backer instance to all class variable
def save self.class.all << self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n self.class.save(self)\n end", "def save\n @@all << self\n @@current << self\n end", "def save!\n end", "def save # save the instance to all\n @@all << self\n end", "def save\n super save\n end", "def save\n @@all << self\n end", "def save\n @saved = @state\n end", "def save \n @@all << self\n end", "def instance=(instance); end", "def save\n SAVE\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def store\n self.class.store\n end", "def save\n @@all << self\n end", "def save\n @@all << self\n end", "def restore; end", "def save_object\n end", "def initialize\n save\n end", "def save\n self.class.persistable\n DB[self.class.name] ||= {}\n DB[self.class.name][name] = self\n Maglev.commit_transaction\n end", "def initialize \n save\n end", "def persist!\n ::File.write(self.path, Marshal.dump(self))\n rescue => e\n puts e.message\n exit\n end", "def save \n# # - this method will add Song instances to the @@all array\n @@all << self \n end", "def save\n dump = Marshal.dump(self)\n file = File.new(FILENAME, 'w')\n file = Zlib::GzipWriter.new(file)\n file.write(dump)\n file.close\n puts \"Bot state saved.\"\n end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save; end", "def save\n @@all.push(self)\n end", "def save()\n @@list.push(self)\n end", "def restore!\n restore\n save!(validate: false)\n end", "def save()\n super\n end", "def save()\n super\n end", "def save()\n super\n end", "def save()\n super\n end", "def save()\n super\n end", "def save\n end", "def save\n end", "def save\n DB.transaction do\n DB[self.class.name] ||= {}\n DB[self.class.name][name] = self\n end\n end", "def save\n @@all << self\n @@all = @@all.uniq\n end", "def restore\n end", "def save \n @record << self.name\n puts \"save instance method\"\n end", "def save\n perform_save\n end", "def save\n self.class.mapper.put(self)\n end", "def save(data)\n\t\t# NOTE: in a low-level implementation of this, you want to have two \"save slots\", and juggle pointers to figure out what data is \"this\" and what is \"prev\", rather moving the data down one slot. (ie, you alternate saving data into the left slot, and the right slot, rather than always saving in the right slot)\n\t\t@prev = @this\n\t\t@this = data\n\tend", "def save\n\t\t\tsuper\n\t\t\t@@env = self\n\t\tend", "def save()\n @env.sync(true)\n self\n end", "def save\n @@all << self #The particular concert's copy of @all\n end", "def save!\n object.save!\n end", "def store\n Model.model_store.store(self)\n end", "def save\n @@data_store.insert(self)\n self\n end", "def save\n end", "def save(instance)\n @pstore.transaction do\n @registry << instance\n @pstore[:registry] = @registry\n end\n end", "def restore\n RESTORE\n end", "def save(data)\n raise \"Implement this in subclass\"\n end", "def save_tb_data\n @tb_state = TB_DataSave.new\n end", "def save!\n no_recursion do\n _sq_around_original_save do\n super if defined?(super)\n end\n\n save_queue.save!\n end\n end", "def save\r\n @@items.push self\r\n end", "def save\n # Nothing in base class. This should be used to persist settings in\n # subclasses that use files.\n end", "def _save\n properties\n end", "def save\n end", "def store; end", "def store; end", "def store; end", "def save\n raise NotImplementedError\n end", "def save!\n raise Cooler::InvalidObject unless save\n end", "def save\n object.save\n end", "def save(**)\n super.tap { self.unsaved = false }\n end", "def persist; end", "def persist; end", "def persist; end", "def save!\n super\n logger.debug \"overriden save called!\"\n update_vars\n super\n end", "def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n end", "def mark_as_saved!\n self.saved_attributes = attributes.dup\n self\n end", "def initialize(name)\n @name = name\n @@all << self # every time new instance of Backer, add self \n # to instances of Backer\n end", "def save_unknown!\n\t\t @saved = []\n\t end", "def save_self(safe = true)\n super && embedments.values.each do |e|\n e.loaded?(self) && Array(e.get!(self)).each { |r| r.original_attributes.clear }\n end\n end", "def backup\n ModelHelper::backup self\n end", "def close\n save\n end", "def save\r\n props = {}\r\n instance_variables.each{|v|\r\n # props[v.to_s[1..-1]] = instance_variable_get(\"#{v}\")\r\n p = v.to_s[1..-1]\r\n props[p] = self.send(p)\r\n }\r\n File.write(STORAGE, YAML.dump(props))\r\n end", "def Save\n\t\tself.bien[0].save\n\t\tself.save\n\tend", "def save_grip; end", "def backup\n BACKUP_MODELS.each do |obj|\n puts \"Preparing to back up #{obj}\"\n self.send(obj.to_sym)\n end \n end", "def save\n raise NotImplementedError\n end", "def save_branch\n @@save_branch << @@obj.current_branch\n end" ]
[ "0.6845503", "0.67512846", "0.6586266", "0.6576874", "0.656088", "0.6484752", "0.6478859", "0.6467663", "0.6466897", "0.6466213", "0.6458924", "0.6458924", "0.6458924", "0.6458924", "0.6458924", "0.6458924", "0.6458924", "0.6458924", "0.6438646", "0.6400386", "0.63979304", "0.636643", "0.63448066", "0.63192284", "0.63098073", "0.62656254", "0.6261627", "0.625619", "0.62134415", "0.62031144", "0.62031144", "0.62031144", "0.62031144", "0.62031144", "0.62031144", "0.62031144", "0.62031144", "0.6201531", "0.61973125", "0.61970174", "0.6182069", "0.6182069", "0.6182069", "0.6182069", "0.6182069", "0.61776155", "0.61776155", "0.6175333", "0.61622417", "0.6160804", "0.61478704", "0.61461157", "0.613544", "0.6132654", "0.6115008", "0.61075115", "0.60577476", "0.60542715", "0.6051955", "0.6051335", "0.60445094", "0.60282993", "0.60215694", "0.6019123", "0.60065633", "0.5977307", "0.5975899", "0.5975793", "0.59757924", "0.59706", "0.5968401", "0.5968401", "0.5968401", "0.5966162", "0.5963989", "0.59559983", "0.59502447", "0.5949582", "0.5949582", "0.5949582", "0.5938271", "0.5935806", "0.593557", "0.59294033", "0.5922138", "0.5913993", "0.59047127", "0.58902246", "0.588774", "0.5876509", "0.5875104", "0.58498746", "0.58465344", "0.584194" ]
0.63020873
30
initializes ProjectBacker with the given project and self represents the relationship between given arguments
def back_project(project) ProjectBacker.new(project, self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(project, backer) # takes in a project and a backer on initialization, accessible through an attribute reader \n @project = project\n @backer = backer\n @@all << self # stores the new instance of ProjectBacker in the @@all class variable\n end", "def initialize(project, backer)\n @project = project\n @backer = backer\n @@all << self # on initialization, add self instance \n # to all instances of ProjectBacker\n end", "def back_project_0(project)\n new_project = ProjectBacker.new(project, self)\n end", "def back_project(project)\n ProjectBacker.new(project, self)\n end", "def back_project(project)\n @backed_projects << project\n # backer = self.new(name) #logan = Backer.new(\"Logan\")\n # project_name = backer #hoverboard = Project.new(\"Awesome Hoverboard\")\n # backer.back_project #logan.back_project(hoverboard)\n project.backers << self #(backer) # expect(hoverboard.backers).to include(logan)\n end", "def initialize(name) #new instance of a backer takes in a name\n @name= name\n @backed_projects= []\n end", "def back_project(project)\n # When a backer has added a project to its list of backed projects,\n @backed_projects << project\n # that project instance should also add the backer to its list of backers.\n project.backers << self\n\n end", "def initialize(project)\n @project = project\n end", "def back_project(project)\n @backed_projects << project\n project.backers << self\n end", "def back_project(project)\n @backed_projects << project\n project.add_backer(self) if !project.backers.include?(self)\n end", "def back_project(project)\n backed_projects << project\n project.backers << self\n end", "def add_backer(backer)\n ProjectBacker.new(self, backer)\n end", "def initialize(project)\n @project = project\n end", "def initialize(project)\n @project = project\n end", "def add_backer(backer)\n ProjectBacker.new( self, backer )\n end", "def add_backer(backer)\n @backers << backer\n#also adds the project to the backer's backed_projects array\n backer.backed_projects << self\n end", "def add_backer(backer)\n @backers << backer\n#also adds the project to the backer's backed_projects array\n backer.backed_projects << self\n end", "def add_backer(backer)\n ProjectBacker.new(self, backer)\n end", "def initialize(name)\n@name = name\n@backed_projects = []\nend", "def initialize(name)\n @backed_projects = []\n @name = name\n end", "def project=(_arg0); end", "def initialize(project:)\n raise ArgumentError, 'Name must not be empty' if project.to_s.empty?\n\n @project = project.to_path\n end", "def initialize(title)\n @title = title\n @@all << self # on init, add self instance of Project\n # to all instances of Project arr\n end", "def add_backer(backer)\n backers << backer\n backer.backed_projects << self\n end", "def init_project(*args)\n # anything to do?\n end", "def initialize(name)\n @name = name\n @backed_projects = []\n end", "def new\n @project = Project.new()\n end", "def back_project(project_name)\n @backed_projects << project_name\n project_name.add_backer(self) unless project_name.backers.include?(self)\n end", "def initialize(name)\n\t\t@backed_projects = []\t\t\t#p/i - initialize w @backed_projects var set to an empty array\n\t\t@name = name\n\tend", "def set_project\n\n end", "def set_project\n\n end", "def project_backers\n # 1. we have to get all the projectBackers, filter them to\n # find only the projectBackers that reference self/the object that\n # invoked this method\n ProjectBacker.all.select { |pb_instance| pb_instance.project == self }\n end", "def initialize(project, number, jobs, generator)\n # Set instance vars\n @project = Marshal.load(Marshal.dump(project))\n @number = number\n @jobs = Marshal.load(Marshal.dump(jobs))\n @generator = Marshal.load(Marshal.dump(generator))\n\n # Run\n run!\n end", "def initialize(project, options)\n @project = project\n @options = options\n end", "def initialize(project, commits, ref = nil)\n @project = project\n @commits = commits\n @ref = ref\n end", "def create_project (project, pledge_goal)\n Project.new(project, self, pledge_goal)\n end", "def initialize(name) # takes a name on initialization\n @name = name # saves it as an attribute\n @backed_projects = Array.new # initializes a placeholder empty array of projects which needs to be filled with backers from class Project\n # expect(spencer.backed_projects).to include(magic) - this is how we know it is an instance variable\n end", "def backers\n # 2. using the array of projectBackers of self, create another array\n # of just the projects that those projectBackers reference\n self.project_backers.map { |pb_instance| pb_instance.backer }\n end", "def new\n @project = Project.new\n @errors = []\n end", "def initialize(project:, from:, to:, per_page: COMMITS_PER_PAGE)\n @project = project\n @from = from\n @to = to\n @per_page = per_page\n end", "def backers \n self.projectbackers.map do |project_pb|\n project_pb.backer \n end\n end", "def project; end", "def new\n @project = Project.new\n @refdb = Project.where(reference: true)\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def new\n @project = Project.new\n end", "def set_project\n @project = Project.first\n end", "def initialize(parent); end", "def f_create(user)\n\t\tuser.projects << self\n\tend", "def project_backers\n # find all of this project's projectBackers\n ProjectBacker.all.select { |projectBacker_instance| projectBacker_instance.project == self }\n end", "def initialize(project, current_user, params = {})\n @project = project\n @current_user = current_user\n @params = params\n init_collection\n end", "def initialize(*args)\n @entity, @period, @project_id, @with_details, @engine_version, @mocked_data, @simulate_draft = *args\n end", "def initialize(project)\n $_MIGA_DAEMON_LAIR << self\n @project = project\n @runopts = JSON.parse(\n File.read(File.expand_path('daemon/daemon.json', project.path)),\n symbolize_names: true)\n @jobs_to_run = []\n @jobs_running = []\n @loop_i = -1\n end", "def initialize(project, uuid, attributes)\n @project, @attributes = project, attributes\n self.isa ||= self.class.isa\n unless uuid\n # Add new objects to the main hash with a unique UUID\n uuid = generate_uuid\n @project.add_object_hash(uuid, @attributes)\n end\n @uuid = uuid\n end", "def initialize(project)\n @project = project\n @errors = []\n end", "def backed_projects #returns an array of projects associated with this Backer instance\n bp = ProjectBacker.all.select {|object| object.backer == self} #get all objects with backer matching self\n bp.map {|x| x.project}\n end", "def initialize(project, translations)\n @project = project\n @translations = translations\n end", "def create_project(project)\n pgtr = project.build_project_grid_table_row\n pgtr.title = project.book_title\n pgtr.genre = project.genres.map(&:name).join(\", \")\n pgtr.teamroom_link = project.teamroom_link\n\n roles = Hash[*Role.all.map{ | role | [role.name.downcase.gsub(/ /, \"_\").to_sym, role.id] }.flatten]\n\n # These are not roles in the PGTR\n roles.delete_if {|name, id| name == :advisor || name == :agent }\n\n # adding each role\n roles.each do | key, value |\n pgtr[key] = project.team_memberships.includes(:member).where(role_id: value).map(&:member).map(&:name).join(\", \")\n end\n\n # since the publisher only publishes :create_project on projects#create\n # there will only every be one author since we only allow one author selection\n # when creating a new project. We can also skip other_contributors\n author = project.team_memberships\n .includes(:member)\n .where(role: Role.find_by_name(\"Author\")).first.member\n\n pgtr.author_last_first = author.last_name_first\n pgtr.author_first_last = author.name\n\n # adding the current_tasks\n project.current_tasks.includes(:task => :workflow).each do | ct |\n keybase = ct.task.workflow.name.downcase.gsub(/ /, \"_\")\n pgtr[keybase + \"_task_id\"] = ct.task.id\n pgtr[keybase + \"_task_name\"] = ct.task.name\n pgtr[keybase + \"_task_display_name\"] = ct.task.display_name\n pgtr[keybase + \"_task_last_update\"] = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n end\n\n pgtr.save\n end", "def create\n\n @backlog = Backlog.new(backlog_params)\n \n # adiciona o backlog no final da lista\n p = Project.find params[:project_id]\n @backlog.position = (p.get_last_backlog_position + 1)\n\n respond_to do |format|\n if @backlog.save\n format.html { redirect_to project_backlogs_path(@backlog.project.id), notice: 'Backlog criado com sucesso.' }\n format.json { render action: 'show', status: :created, location: @backlog }\n else\n format.html { render action: 'new' }\n format.json { render json: @backlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(parent)\n @parent = parent\n end", "def initialize(*args)\n\t\t\t\t\tself.track_changed_attributes = true\n\t\t\t\t\tself.changed_attributes_aado = []\n\n\t\t\t\t\tsuper(*args)\n\t\t\t\t\t\n\t\t\t\t\trequire \"obdb/AR_DatabaseObject\"\t# its here because of a circular reference problem\n\t\t\t\t\tself.database_object = DatabaseObject.create_do(self.class, self.id, self)\n\t\t\t\tend", "def backed_projects\n # from each of this backer's project backers,\n # pull out the projects\n self.project_backers.map { |pb_instance| pb_instance.project }\n end", "def build(*args)\n @instance = @obj.send(PolyBelongsTo::Pbt::BuildCmd[@obj, @child], *args)\n self\n end", "def new\n add_breadcrumb \"Nouveau\"\n @project = Project.new\n end", "def initialize(project, client)\n @project = project\n @client = client\n end", "def project_backers\n # find all of the project backers for this backer\n ProjectBacker.all.select do |pb_instance|\n pb_instance.backer == self\n end\n end", "def initialize(opts)\n unless File.exists?(opts[:project])\n puts \"Cannot access project: #{opts[:project]}\"\n return\n end\n super # inits a gxdb ref from Discovery\n @project = opts[:project]\n @label = opts[:label]\n end", "def initialize(grid) # new objects of class BB will be created by passing a grid to init method\n\t\t@grid = grid # usual init assignment of instance to local/self\n\tend", "def projectbackers\n ProjectBacker.all.select do |pb_instance|\n pb_instance.project == self \n end \n end", "def backers\n self.project_backers.map do |projectbacker| \n projectbacker.backer\n end\n end", "def initialize(\n project,\n user,\n version:,\n branch: project.default_branch_or_main,\n from: nil,\n to: branch,\n date: DateTime.now,\n trailer: DEFAULT_TRAILER,\n file: DEFAULT_FILE,\n message: \"Add changelog for version #{version}\"\n )\n @project = project\n @user = user\n @version = version\n @from = from\n @to = to\n @date = date\n @branch = branch\n @trailer = trailer\n @file = file\n @message = message\n end", "def initialize(*args)\n @args = args\n assign_attributes\n end", "def initialize(project_name, client)\n @project_name = project_name\n @client = client\n end", "def initialize(project, recover_missing_commits: false)\n @project = project\n @recover_missing_commits = recover_missing_commits\n @project_key = project.import_data.data['project_key']\n @repository_slug = project.import_data.data['repo_slug']\n @client = BitbucketServer::Client.new(project.import_data.credentials)\n @formatter = Gitlab::ImportFormatter.new\n @errors = []\n @users = {}\n @temp_branches = []\n @logger = Gitlab::Import::Logger.build\n end", "def projects \n ProjectBacker.all.select {|project| project.backer == self}\n end", "def with_project(project, &bl)\n fail 'You have to specify a project when using with_project' if project.nil? || (project.is_a?(String) && project.empty?)\n old_project = GoodData.project\n begin\n GoodData.use(project)\n bl.call(GoodData.project)\n rescue RestClient::ResourceNotFound => e\n fail GoodData::ProjectNotFound.new(e)\n ensure\n GoodData.project = old_project\n end\n end", "def init_project\n da_user = user\n new_project = da_user.projects.build(\n # user_id: self.id, # handled through build method\n school_id: school_id, # merged from user.school.Institution_ID\n name: name, # take on name of work\n\n file_content_md: file_content_md, # these are of most recent, will be replaced as versions are added\n file_content_html: file_content_html,\n file_content_text: file_content_text,\n\n works_count: 1, # is first work\n recent_work_id: id, # as original work\n\n anonymouse: anonymouse?, # and work gets this from user\n author_name: author_name, # ditto\n school_name: school_name,\n )\n\n if new_project.save\n self.update_columns(project_id: new_project.id, is_latest_version: true, project_name: name)\n else\n errors[:base] << (\"There was an error versioning this work.\")\n end\n end", "def backed_projects \n self.project_backers.map do |projectbacker| \n projectbacker.project\n end\n end", "def create_gantt(project=Project.generate!, options={})\n @project = project\n @gantt = Redmine::Helpers::Gantt.new(options)\n @gantt.project = @project\n @gantt.query = IssueQuery.new(:project => @project, :name => 'Gantt')\n @gantt.view = self\n @gantt.instance_variable_set(:@date_from, options[:date_from] || (today - 14))\n @gantt.instance_variable_set(:@date_to, options[:date_to] || (today + 14))\n end", "def initialize(*args)\n # Call the ArsModels::Base initializer and delegate to the build or generate method\n super(*args)\n end", "def initialize(*args)\n # Call the ArsModels::Base initializer and delegate to the build or generate method\n super(*args)\n end", "def initialize(name, actor, project)\n @name = name\n @actor = actor\n @project = project\n @@all << self\n end", "def new\n # build a 'temporary' post which is written to DB later (create-method)\n @subproject = Subproject.new\n end", "def initialize( * )\n\t\tsuper\n\t\t@presenter = self.setup_presentation_layer\n\tend", "def initialize(*args)\r\n super(*args)\r\n end", "def initialize_project(project_desc)\n project_name = extract_project(project_desc)\n repo_name = extract_repository(project_desc)\n repo_path = File.expand_path(repo_name, $project_dir)\n repo = initialize_repo(project_desc, repo_path)\n if project_desc[:library]\n Project::Library.new(\n repository: repo,\n sub_project: (project_name == repo_name) ? nil : project_name,\n auto_reset: $options[:auto_reset],\n mvn_flags: project_desc[:mvn_flags],\n pull_branches: $pull_branches,\n rebase_branches: $rebase_branches,\n local_branches: $local_branches,\n basis_branch: project_desc[:basis_branch] || $global_basis_branch,\n always_build: project_desc[:always_build]\n )\n else\n Project::Service.new(\n repository: repo,\n sub_project: (project_name == repo_name) ? nil : project_name,\n archive: project_desc[:archive],\n service: project_desc[:wlp],\n restart: project_desc[:restart],\n auto_reset: $options[:auto_reset],\n mvn_flags: project_desc[:mvn_flags],\n pull_branches: $pull_branches,\n rebase_branches: $rebase_branches,\n local_branches: $local_branches,\n basis_branch: project_desc[:basis_branch] || $global_basis_branch\n )\n end\nend", "def follow_project(project)\n ProjectFollower.make_follow self, project\n end", "def new\n propose_nr = Integer(Project.order(\"nr desc\").first.nr) + 1\n @project = Project.new(:nr => propose_nr, :active => true)\n @project.tasks.new(:name => \"Project Mgmt\", :description => \"\")\n @project.tasks.new(:name => \"Pre-P\", :description => \"Moodboards | Examining project data, plans, briefing, etc.\")\n @project.tasks.new(:name => \"Web\", :description => \"Flatfinder/Boligvelger (eve-Estate) | CMS/Website (eve-Publisher) | Landingpage\")\n @project.tasks.new(:name => \"Undividable 3D work for exteriors\", :description => \"Modeling/texturing of buildings and their surroundings. Populating/detailing with plants, outdoor furniture, traffic, etc.\")\n @project.tasks.new(:name => \"Undividable 3D work for interiors\", :description => \"Modeling/texturing of X apartments. Setting up furniture, accessories, decoration according to moodboards.\")\n @project.tasks.new(:name => \"#{propose_nr}-01_e\", :description => \"Scene setup, lighting and detail adjustments, rendering with subsequent post-production/compositing.\")\n @project.tasks.order(:name)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def initialize(name)\n @name = name\n @@all << self # every time new instance of Backer, add self \n # to instances of Backer\n end", "def initialize(project, client: GitlabClient)\n @project = project\n @client = client\n end" ]
[ "0.8448165", "0.83274466", "0.80026174", "0.76844823", "0.7049351", "0.6912803", "0.6855352", "0.6848492", "0.67650247", "0.6757127", "0.664558", "0.66261196", "0.6597131", "0.6597131", "0.6485619", "0.6438077", "0.6438077", "0.6434818", "0.6300408", "0.62980866", "0.62380385", "0.6220118", "0.61927277", "0.6164482", "0.61593926", "0.61506873", "0.6075974", "0.6075147", "0.60551995", "0.59466857", "0.59466857", "0.59107405", "0.58669907", "0.5837438", "0.5782996", "0.57824343", "0.57544816", "0.57064456", "0.5701641", "0.569598", "0.5683931", "0.56681967", "0.56644225", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5659794", "0.5646597", "0.5640332", "0.5637116", "0.5621201", "0.5618608", "0.56131953", "0.5595562", "0.5585396", "0.5579192", "0.55775", "0.55731255", "0.5566634", "0.55654114", "0.55547595", "0.5551066", "0.55478996", "0.55316496", "0.55265945", "0.55106646", "0.55034554", "0.55027413", "0.5489747", "0.54582274", "0.5439874", "0.54231197", "0.5409816", "0.5403875", "0.54026896", "0.5401404", "0.5389597", "0.53861976", "0.5384234", "0.5375399", "0.5367317", "0.5367317", "0.53554296", "0.53458506", "0.53446484", "0.5342974", "0.5334681", "0.53130406", "0.53119737", "0.53054965", "0.52999216" ]
0.76913834
4
Return all ProjectBacker objects associated with this backer
def project_backers ProjectBacker.all.select do |projectbacker| projectbacker.backer == self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backers\n # 2. using the array of projectBackers of self, create another array\n # of just the projects that those projectBackers reference\n self.project_backers.map { |pb_instance| pb_instance.backer }\n end", "def backers\n # from those projectBackers, pull out the backers\n self.project_backers.map { |projectBacker_instance| projectBacker_instance.backer }\n end", "def backers\n ProjectBacker.all.map do |p_b|\n if p_b.project == self then\n p_b.backer\n else\n nil\n end\n end.compact\n end", "def backers\n ProjectBacker.all.select{|project_backer| project_backer.project == self}.map{|project_backer| project_backer.backer}\n end", "def project_backers\n # find all of the project backers for this backer\n ProjectBacker.all.select do |pb_instance|\n pb_instance.backer == self\n end\n end", "def project_backers\n # find all of this project's projectBackers\n ProjectBacker.all.select { |projectBacker_instance| projectBacker_instance.project == self }\n end", "def backers \n self.projectbackers.map do |project_pb|\n project_pb.backer \n end\n end", "def projectbackers\n ProjectBacker.all.select do |pb_instance|\n pb_instance.project == self \n end \n end", "def project_backers\n # 1. we have to get all the projectBackers, filter them to\n # find only the projectBackers that reference self/the object that\n # invoked this method\n ProjectBacker.all.select { |pb_instance| pb_instance.project == self }\n end", "def backers\n self.project_backers.map do |projectbacker| \n projectbacker.backer\n end\n end", "def backed_projects #returns an array of projects associated with this Backer instance\n bp = ProjectBacker.all.select {|object| object.backer == self} #get all objects with backer matching self\n bp.map {|x| x.project}\n end", "def backed_projects\n # from each of this backer's project backers,\n # pull out the projects\n self.project_backers.map { |pb_instance| pb_instance.project }\n end", "def backers\n ProjectBacker.all.select {|p| p.project == self}.map{ |b| b.backer}\nend", "def project_backers\n ProjectBacker.all.select do |projectbacker| \n projectbacker.project == self\n end\n end", "def projects \n ProjectBacker.all.select {|project| project.backer == self}\n end", "def backed_projects \n self.project_backers.map do |projectbacker| \n projectbacker.project\n end\n end", "def find_projects\n #binding.pry\n ProjectBacker.all.select do |element|\n element.backer == self\n end\n end", "def backed_projects\n self.projects.map {|back_project| back_project.project}\n end", "def backers\n projects.collect { |title| title.backer }\n # is this reverse engineering?\n end", "def backed_projects\n\n # iterate thru existing list of projects and backers to pull just our current\n # instanced backer (self)\n projects_backed = ProjectBacker.all.select do |backed|\n backed.backer == self\n end \n # iterate thru array of projects backed by current user and remove user info\n # while returning an array of just project titles\n projects_backed.map do |projects_b|\n projects_b.project \n end \n end", "def back_project(project)\n # When a backer has added a project to its list of backed projects,\n @backed_projects << project\n # that project instance should also add the backer to its list of backers.\n project.backers << self\n\n end", "def back_project(project)\n ProjectBacker.new(project, self)\n end", "def back_project(project)\n ProjectBacker.new(project, self)\n end", "def back_project(project)\n ProjectBacker.new(project, self)\n end", "def back_project(project)\n backed_projects << project\n project.backers << self\n end", "def back_project(project)\n @backed_projects << project\n project.backers << self\n end", "def add_backer(backer)\n @backers << backer\n#also adds the project to the backer's backed_projects array\n backer.backed_projects << self\n end", "def add_backer(backer)\n @backers << backer\n#also adds the project to the backer's backed_projects array\n backer.backed_projects << self\n end", "def add_backer(backer)\n ProjectBacker.new(self, backer)\n end", "def add_backer(backer)\n backers << backer\n backer.backed_projects << self\n end", "def back_project(project)\n @backed_projects << project\n # backer = self.new(name) #logan = Backer.new(\"Logan\")\n # project_name = backer #hoverboard = Project.new(\"Awesome Hoverboard\")\n # backer.back_project #logan.back_project(hoverboard)\n project.backers << self #(backer) # expect(hoverboard.backers).to include(logan)\n end", "def back_project(project)\n @backed_projects << project\n project.add_backer(self) if !project.backers.include?(self)\n end", "def add_backer(backer)\n ProjectBacker.new(self, backer)\n end", "def backers\n Person.where(id: pledges.pluck(:person_id))\n end", "def add_backer(backer)\n ProjectBacker.new( self, backer )\n end", "def backed_projects\n pledges.map { |pledge| pledge.project }\n end", "def backed_projects\n pledges.map { |pledge| pledge.project }\n end", "def my_backers\n self.pledges.collect do |pledge|\n pledge.user\n end.uniq\n end", "def pledges\n Pledge.all.select {|pledge| pledge.backer == self}\n end", "def back_project_0(project)\n new_project = ProjectBacker.new(project, self)\n end", "def back_project(project_name)\n @backed_projects << project_name\n project_name.add_backer(self) unless project_name.backers.include?(self)\n end", "def deliverables\n return Deliverable.where(project_id: @project.id)\n end", "def initialize(project, backer)\n @project = project\n @backer = backer\n @@all << self # on initialization, add self instance \n # to all instances of ProjectBacker\n end", "def all_backlinks\n\t\t@data = UrlData.all\n\n\t\t@backlinks = Array.new\n\t\t@data.each do |details|\n\t\t\t@backlinks.push details.google_backlinks\n\t\t\t@backlinks.push details.moz_backlinks\n\t\tend\n\n\t\t@backlinks = @backlinks.compact.reject { |s| s.blank? }\n\n\t\t@backlinks = @backlinks.inject(:+)\n\t\treturn @backlinks\n\tend", "def all\n @projects\n end", "def all\n @projects\n end", "def index\n @running_backs = RunningBack.all\n end", "def initialize(project, backer) # takes in a project and a backer on initialization, accessible through an attribute reader \n @project = project\n @backer = backer\n @@all << self # stores the new instance of ProjectBacker in the @@all class variable\n end", "def all_deliverable_projects\n all_digest_projects\n end", "def all\n self.class.all\n end", "def pending_refund_payments_projects\n pending_refund_payments.map(&:project)\n end", "def cross_project\n []\n end", "def backstage\n @stage.backstage\n end", "def related_projects\n case self.object\n when Project\n [self.object]\n when TimeSheet\n self.object.projects\n else\n []\n end\n end", "def find_all\n api.command(:listProjects).collect do |project|\n project[1]['project'].map { |p| self.new p }\n end.flatten\n end", "def projects\n @projects ||= Project.all\n end", "def referenced_objects\n return @referenced_objects\n end", "def all_below\n @bottom.empty? ? [self] : @bottom.flat_map { |r| r.all_below }.uniq\n end", "def all\n self\n end", "def index\n @barangay_bridge_projects = BarangayBridgeProject.all\n end", "def foreigns\n []\n end", "def index\n @q = Admin::Giveback.ransack(params[:q])\n @admin_givebacks = @q.result.includes(:project)\n end", "def getDeliverables\n readDeliverables\n\n return @Deliverables\n end", "def all\n repository.all(self)\n end", "def beers\n @beers ||= fetch_beers\n end", "def collection\n\t\treturn Treequel::BranchCollection.new( self.all )\n\tend", "def all_children(scope = {})\n full_set(scope) - [self]\n end", "def projects\n return [] unless basecamp\n @projects ||= basecamp.projects\n end", "def viewers\n self.queue_items.map {|item| item.viewer}\n end", "def pledges\n Pledge.all.filter do |pledge|\n pledge.project == self\n end\n end", "def index\n @badge_projects = BadgeProject.all\n end", "def array\n self.allObjects\n end", "def self_and_descendants_from_active_record\n [self]\n end", "def discover_projects\n self.feeds.map(&:discover_projects).flatten.uniq.each do |project|\n project.makers << self\n end\n end", "def projects\n PivotalTracker::Project.all\n end", "def pledges\n Pledge.all.select do |pledge|\n pledge.project == self\n end\n end", "def all\n Maglev::PERSISTENT_ROOT[self].values\n end", "def ring_projects\n @ring_projects ||= strategy.rings.each_with_index.map do |r,idx|\n ObsProject.new(\"#{rings_project_name}:#{idx}-#{r}\", \"#{idx}-#{r}\")\n end\n end", "def all\n self.all\n end", "def to_a\n resources\n end", "def self_and_descendants_from_active_record\n [self]\n end", "def index\n @project = Project.find params[:project_id].to_i\n @backlogs = @project.backlogs\n end", "def children\n child_objects(Dependency)\n end", "def find_projects\n @projects = Project.all\n end", "def references\n return @references\n end", "def pbt_parents\n if poly?\n Array[pbt_parent].compact\n else\n self.class.pbts.map do |i|\n try{ \"#{i}\".camelize.constantize.where(id: send(\"#{i}_id\")).first }\n end.compact\n end\n end", "def backtrackable_elements\n select &:backtrackable?\n end", "def games\n self.teams.map{|team| team.game }\n end", "def all\n Maglev::PERSISTENT_ROOT[self].values\n end", "def parents\n parent_objects(Dependency)\n end", "def get_all_zapps\n return plant_attributes\n end", "def projects\n map(&:projects).flatten.uniq.sort\n end", "def breadcrumbs\n Set.new(parent? ? (parent.breadcrumbs + [self]) : [self])\n end", "def bakeries\n dessert.map do |dessert|\n dessert.bakery\n end\n \n end", "def releases\n Release.branch(self)\n end", "def children\n _children\n end", "def index\n @zoigl_beers = ZoiglBeer.all\n end", "def projects\n @projects\n end", "def projects\n Project.all.select { |project| project.creator == self }\n end", "def all\n @all.dup\n end" ]
[ "0.8512667", "0.85015064", "0.8492337", "0.8425159", "0.84197015", "0.8414574", "0.8365984", "0.8309112", "0.8215396", "0.816752", "0.80928695", "0.7977554", "0.79288846", "0.7781661", "0.77471024", "0.76209307", "0.7386665", "0.7314135", "0.71163714", "0.6968477", "0.6421876", "0.6348626", "0.6348626", "0.6315676", "0.6258923", "0.6192831", "0.6187322", "0.6187322", "0.6168874", "0.6150382", "0.6059317", "0.60152125", "0.59741634", "0.5964138", "0.59162843", "0.59082496", "0.5769206", "0.5759934", "0.57183564", "0.5693845", "0.56850433", "0.5682449", "0.56266195", "0.5558363", "0.55387473", "0.55387473", "0.55174536", "0.54192775", "0.54131293", "0.54025143", "0.537491", "0.53735393", "0.5344869", "0.53224355", "0.53039235", "0.5288277", "0.52762794", "0.52474135", "0.52416587", "0.523153", "0.5223363", "0.5213267", "0.5201371", "0.5196708", "0.51916254", "0.51502275", "0.51366675", "0.513368", "0.5112599", "0.51076144", "0.5098118", "0.5097694", "0.5090854", "0.5084145", "0.5076278", "0.5070521", "0.5068051", "0.5064097", "0.50635517", "0.50618", "0.506028", "0.50592035", "0.5054055", "0.5046865", "0.50436926", "0.50311357", "0.5028844", "0.5023369", "0.5006564", "0.5004416", "0.5000828", "0.49823314", "0.4980808", "0.4978668", "0.49758863", "0.4973171", "0.49727097", "0.49705443", "0.4958371", "0.49529895" ]
0.7870026
13
Returns all Project objects associated with this backer
def backed_projects self.project_backers.map do |projectbacker| projectbacker.project end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all\n @projects\n end", "def all\n @projects\n end", "def backed_projects\n self.projects.map {|back_project| back_project.project}\n end", "def projects \n ProjectBacker.all.select {|project| project.backer == self}\n end", "def projects\n PivotalTracker::Project.all\n end", "def find_all\n api.command(:listProjects).collect do |project|\n project[1]['project'].map { |p| self.new p }\n end.flatten\n end", "def backed_projects #returns an array of projects associated with this Backer instance\n bp = ProjectBacker.all.select {|object| object.backer == self} #get all objects with backer matching self\n bp.map {|x| x.project}\n end", "def projects\n @projects ||= Project.all\n end", "def backed_projects\n\n # iterate thru existing list of projects and backers to pull just our current\n # instanced backer (self)\n projects_backed = ProjectBacker.all.select do |backed|\n backed.backer == self\n end \n # iterate thru array of projects backed by current user and remove user info\n # while returning an array of just project titles\n projects_backed.map do |projects_b|\n projects_b.project \n end \n end", "def find_projects\n @projects = Project.all\n end", "def find_projects\n #binding.pry\n ProjectBacker.all.select do |element|\n element.backer == self\n end\n end", "def projectbackers\n ProjectBacker.all.select do |pb_instance|\n pb_instance.project == self \n end \n end", "def projects\n settings.projects.map do |project_settings|\n Project.new(project_settings)\n end\n end", "def backed_projects\n # from each of this backer's project backers,\n # pull out the projects\n self.project_backers.map { |pb_instance| pb_instance.project }\n end", "def projects\n\t\tProject.order(\"created_at\").find_all_by_account_id(account_id).reverse\n\tend", "def projects\n @projects\n end", "def projects\n DataStore.projects\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects\n Harvest::Resources::Project\n end", "def projects\n return [] unless basecamp\n @projects ||= basecamp.projects\n end", "def projects\n ::Syncano::QueryBuilder.new(self, ::Syncano::Resources::Project)\n end", "def project_backers\n # find all of this project's projectBackers\n ProjectBacker.all.select { |projectBacker_instance| projectBacker_instance.project == self }\n end", "def related_projects\n case self.object\n when Project\n [self.object]\n when TimeSheet\n self.object.projects\n else\n []\n end\n end", "def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end", "def projects\n Easybill::Api::Projects\n end", "def list_all\n query = create_query(:Project, :all, by: default_sort_order)\n show_selected_projects(query)\n end", "def load_projects\n @projects = Project.all\n end", "def project_backers\n ProjectBacker.all.select do |projectbacker| \n projectbacker.project == self\n end\n end", "def collection\n return @client.api_helper.collection(\"projects\")\n end", "def projects\n Project.all.select { |project| project.creator == self }\n end", "def all_projects()\n @endpoint = \"/projects.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"projects\"].sort_by { |proj| proj[\"name\"] }\n end", "def projects\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:proj, RDF.type, Ruta::Class.project],\n [:proj, RDF::FOAF.member, :mir],\n [:mir, Ruta::Property.has_member, uri]\n )\n projs = []\n query.each_solution { |sol| projs.push(sol.proj.as(Organisation)) }\n projs\n end", "def project_backers\n # 1. we have to get all the projectBackers, filter them to\n # find only the projectBackers that reference self/the object that\n # invoked this method\n ProjectBacker.all.select { |pb_instance| pb_instance.project == self }\n end", "def projects\n Sifter.\n get(\"/api/projects\").\n parsed_response[\"projects\"].\n map { |p| Sifter::Project.new(p) }\n end", "def projects\n map(&:projects).flatten.uniq.sort\n end", "def index\n\t\t@projects = Project.all\n\tend", "def cross_project\n []\n end", "def index\n @projects = Project.all\n end", "def projects\n projects = object.projects\n unless current_user.admin?\n projects = object.projects.select { |project| project.users.include?(current_user) }\n end\n projects.map { |p| p.id }\n end", "def projects\n projects = object.projects\n unless current_user.admin?\n projects = object.projects.select { |project| project.users.include?(current_user) }\n end\n projects.map { |p| p.id }\n end", "def list(params = {})\n response = get_request('/projects/', params)\n response.map { |project| TheShiningSource::Project.new(project) }\n end", "def project_backers\n # find all of the project backers for this backer\n ProjectBacker.all.select do |pb_instance|\n pb_instance.backer == self\n end\n end", "def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end", "def ring_projects\n @ring_projects ||= strategy.rings.each_with_index.map do |r,idx|\n ObsProject.new(\"#{rings_project_name}:#{idx}-#{r}\", \"#{idx}-#{r}\")\n end\n end", "def pending_refund_payments_projects\n pending_refund_payments.map(&:project)\n end", "def staging_projects_all\n @staging_projects ||= StagingProject.for(self, false)\n end", "def projects(params = {})\n fetch_all('projects', 'projects', params)\n end", "def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end", "def backers\n ProjectBacker.all.select{|project_backer| project_backer.project == self}.map{|project_backer| project_backer.backer}\n end", "def backers\n ProjectBacker.all.select {|p| p.project == self}.map{ |b| b.backer}\nend", "def projects\n projects = object.projects.select { |p| !current_user || p.users.include?(current_user) }\n projects.map { |p| p.id }\n end", "def projects\n if is_deploy_key\n [project]\n else\n user.projects\n end\n end", "def get_projects\n me = request('/services/v5/me')\n me['projects']\n end", "def projects\n @projects ||= Harvest::API::Projects.new(credentials)\n end", "def all_deliverable_projects\n all_digest_projects\n end", "def index\n \t@projects = Project.all\n end", "def my_projects\n @projects = Project.where(:client_id => current_user.client_id)\n end", "def all_dashboard_projects\n project_ids = []\n project_ids += all_viewable_and_site_projects.pluck(:id)\n project_ids += AeReviewAdmin.where(user_id: id).pluck(:project_id)\n project_ids += AeTeamMember.where(user_id: id).pluck(:project_id)\n Project.current.where(id: project_ids.uniq)\n end", "def projects\n investigation.try(:projects) || []\n end", "def backed_projects\n pledges.map { |pledge| pledge.project }\n end", "def backers\n ProjectBacker.all.map do |p_b|\n if p_b.project == self then\n p_b.backer\n else\n nil\n end\n end.compact\n end", "def projects(options = {})\n get(\"projects\", options).projects\n end", "def project_list\n project_folders = Dir::entries(::File.join(Msf::Config.log_directory, 'projects'))\n projects = []\n framework.db.workspaces.each do |s|\n if project_folders.include?(s.name)\n projects << s.name\n end\n end\n return projects\n end", "def active_projects\n self.projects.where(:is_canceled => false, :is_finished => false )\n end", "def index\n @all_projects = Project.by_user_plan_and_tenant(params[:tenant_id], current_user)\n end", "def index\n @projects = (Project.includes(:users).includes(:owner).includes(:errands).where(owner: current_user.id) + current_user.projects.includes(:owner).includes(:users).includes(:errands)).uniq\n end", "def index\n @project_environments = @project.project_environments.all\n end", "def query_projects(options = nil)\n require_relative 'telerivet/project'\n self.cursor(Project, get_base_api_path() + \"/projects\", options)\n end", "def index\n @projects = @namespace.projects.all\n end", "def projects\n where(:_type => ProjectCategory.name)\n end", "def projects\n my_proj = self.my_projects\n my_memb = self.collaborations\n my_proj + my_memb\n end", "def [] project\n Project.new(project) if Profile.projects[project]\n end", "def show\n @projects = Project.all\n end", "def projects\n return @projects if @projects\n @projects = []\n IO.readlines(@file).each do |line|\n @projects << Project.new(line, @dir) if /^Project.*\\.csproj/ =~ line\n end\n end", "def projects\n if is_deploy_key\n [project]\n else\n user.authorized_projects\n end\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def index\n @projects = Project.all\n end", "def backers\n # 2. using the array of projectBackers of self, create another array\n # of just the projects that those projectBackers reference\n self.project_backers.map { |pb_instance| pb_instance.backer }\n end", "def index\n @projects = Project.all\n end", "def index\n @project_connections = ProjectConnection.all\n end", "def project_and_children\n return @project_and_children if defined?(@project_and_children)\n\n # Smile specific #994 Budget and Remaining enhancement\n @project_and_children = Project.where(:id => project_and_children_ids)\n\n @project_and_children\n end", "def backers\n # from those projectBackers, pull out the backers\n self.project_backers.map { |projectBacker_instance| projectBacker_instance.backer }\n end" ]
[ "0.7967018", "0.7967018", "0.7767808", "0.7650023", "0.76355", "0.7597072", "0.7594041", "0.7529875", "0.73503333", "0.7340241", "0.7286543", "0.7274472", "0.7220433", "0.71822315", "0.71686846", "0.71537143", "0.7083149", "0.70614475", "0.70041305", "0.6965981", "0.6945272", "0.6935995", "0.6926693", "0.69204956", "0.6885461", "0.686497", "0.67764676", "0.6730399", "0.66547763", "0.66428244", "0.66396934", "0.66329616", "0.6629327", "0.6605658", "0.65555954", "0.6552996", "0.65485084", "0.6530074", "0.65257263", "0.65257263", "0.65241265", "0.6499998", "0.6499074", "0.64868355", "0.647461", "0.6468374", "0.6467426", "0.6464813", "0.6448781", "0.6440977", "0.642841", "0.64268434", "0.64246446", "0.6414978", "0.6410771", "0.6396006", "0.63905454", "0.63847286", "0.6382306", "0.6374799", "0.6366909", "0.63643944", "0.6357756", "0.635356", "0.633017", "0.6322944", "0.6317564", "0.6314502", "0.6313281", "0.6312942", "0.6304386", "0.62888676", "0.62887734", "0.628258", "0.62741536", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.62698084", "0.6268475", "0.6267726", "0.62561876", "0.62435466", "0.6238197" ]
0.7235962
12
Show contents of specific email
def show @email = Email.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def body\n render text: fetch_email(params[:id]).body, content_type: 'text/html'\n end", "def show_body\n I18n.with_locale @email_locale do\n @mail_body = mail_body(@preview, @part_type)\n render :show_body, layout: 'rails_email_preview/email'\n end\n end", "def mail\n mail = MailTasks::Mail.query_by_id( params[:id] )\n render :text => mail.content_with_layout( mail_layout_options ), :layout => false\n end", "def show\n email = Gmailer.gmail.inbox.find(:all).find {|e| e.msg_id == @message.message_id.to_i } #convert due to wrong type\n @attachments = email ? email.message.attachments : []\n end", "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def show\n if params[:email_thread]\n @email_thread = EmailThread.find(params[:email_thread])\n elsif session[:id]\n @summary = Summary.find(session[:id])\n @email_thread = @summary.email_thread\n else\n flash[:notice] = \"You are logged out.\"\n redirect_to(:controller => '/account', :action => 'login')\n return\n end\n @emails = []\n email_count = 0\n for email in @email_thread.myemails\n email_count+=1\n s = email.Body\n #Keep track of tag beginning and ending\n open = false\n count = 1\n while s.include? \"^\"\n if !open\n case params[:control]\n when 'read' , 'sum' , 'show'\n s[s.index(\"^\"),1] = sent(email_count, count)\n when 'label'\n s[s.index(\"^\"),1] = label(email_count, count)\n end\n open = true\n count += 1\n else\n s[s.index(\"^\"),1] = '</div></div>'\n open = false\n end\n end\n s.gsub! \"/-\\\\\", \"^\"\n @emails << email\n end\n #Render correct action\n case params[:control]\n when 'read'\n render :action => 'read'\n when 'sum'\n render :action => 'sum'\n when 'label'\n render :action => 'label'\n when 'show'\n render :action => 'show'\n end\n end", "def show\n puts \" begin \"\n # puts User.findUser(\"how_man@mail\").inspect #User.getEmail User.find_user_by_id @message.reciever\n # puts User.getEmail User.find_user_by_id(@message.reciever)#.inspect \n #User.findUser(params[:email]) #user_messages_path(@message.reciever)\n puts \" end \"\n end", "def show\n session[:applicant_token] = params[:id] unless current_user\n @email = ERB.new(Settings.email_template).result(get_binding)\n p EMAIL: @email\n end", "def read_emails(folder,keyword,atrans,acftrans)\r\n view = framework.threads.spawn(\"ButtonClicker\", false) {\r\n click_button(atrans,acftrans)\r\n }\r\n command = \"Get-Emails \\\"#{keyword}\\\" \\\"#{folder}\\\"\"\r\n execute_outlook_script(command)\r\n end", "def show\n respond_with fetch_email(params[:id])\n end", "def get_mail_content\n Log.add_info(request, params.inspect)\n\n email_id = params[:id]\n\n begin\n @email = Email.find(email_id)\n render(:partial => 'ajax_mail_content', :layout => false)\n rescue => evar\n Log.add_error(nil, evar)\n render(:text => '')\n end\n end", "def preview\n task = MailTasks::Task.new( params[:task] )\n recipient = StoreUser.find( params[:id], :include => \"customer\", :readonly => true )\n mail = task.generate_mails( [recipient], false, mail_layout_options ).first\n render :text => mail.content_with_layout( mail_layout_options ), :layout => false\n # rescue => exception\n # headers[\"Content-Type\"] = \"text/plain\"\n # render :text => exception.to_yaml, :layout => false\n end", "def show\n if @sent_email.photo.nil?\n @display_name = ''\n @title = ''\n @flickr_url = ''\n else\n @display_name = @sent_email.photo.member.display_name\n @title = @sent_email.photo.title\n @flickr_url = @sent_email.photo.get_flickr_url\n end\n end", "def show_message(id, persona)\n @subject = RecipientsFor::Subject.includes(:contents).find(id)\n @content = RecipientsFor::Content.new\n RecipientsFor::ReaderInfo.mark_as_read(@subject.id, persona)\n end", "def show\n @entry_mail = EntryMail.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @entry_mail }\n end\n end", "def show\n @emails = JSON.parse(@notification.fetch_emails)\n end", "def open\n mail = MailTasks::Mail.find_by_token( params[:id] )\n raise ActiveRecord::RecordNotFound unless mail # raise 404 if mail is not found\n \n options = {\n :post_back_url => url_for( :controller => \"/email\", :action => \"red_logo\" ),\n :base => [request.protocol, request.host].join\n }\n render :text => mail.content_with_layout( options ), :layout => false\n end", "def show\n #TRACKER.track(current_user['email'], \"READ_EMAIL\", {\"email_id\" => @email.id, \"email_reference\" => @email.reference_id})\n TRACKER.track(current_user['email'], \"READ_EMAIL\", @email.id, @email.reference_id)\n end", "def show\n @mail = Mail.find(params[:id])\n end", "def scrape_email_texts\n switch_to_chronological_view\n expand_all_emails\n all('div#tm-tl div.GJHURADDJB').map(&:text)\n end", "def show\n @decrypted = @autocrypt.decrypt(@email)\n @reply_params = {\n to: @email.from,\n subject: 'Re: ' + @email.subject,\n body: (@decrypted || @email.body).gsub(/^/, '> ')\n }\n end", "def content_for_preview( layout_options )\r\n content = self.body.dup\r\n content.gsub!( /<%=\\s?(@[^%]+)\\s?%>/, '<code>\\1</code>' )\r\n mail = Mail.new( :token => \"\" )\r\n mail.content = Render::Base.new( content ).mail_content\r\n template = IO.read(\"#{RAILS_ROOT}/app/views/mail_tasks/mailer/this_mail.text.html.rhtml\")\r\n \r\n render = Render::Base.new( template, layout_options.merge( :mail => mail ) )\r\n render.mail_content\r\n end", "def mail_content_with_layout( mail, layout_options={} )\n tmail = Mailer.create_this_mail( mail, layout_options )\n tmail.parts.find{ |mail| mail.content_type == 'text/html' }.body\n end", "def get_the_email_html(message)\n # Addressage du fichier message\n message = File.read(message)\n return message\nend", "def text_notification(email)\n content = \"\"\n address = email\n phone = User.where(email: email).first.phone\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n if task.priority == 3\n content << \"#{task.title}\\n\"\n end\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n if subtask.priority == 3\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n end\n unless phone.nil?\n if content.empty? == false\n TWILIO_CLIENT.account.sms.messages.create(\n from: TWILIO_NUMBER,\n to: \"+#{phone}\",\n body: content\n )\n end\n end\n end", "def all_email(email)\n content = \"\"\n address = email\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n content << \"#{task.title}\\n\"\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n unless content.empty?\n mail(to: address, subject: \"Your Tasks\", body: content)\n end\n end", "def mail; get_data_in_file :mail end", "def show\n @email_id = params[:id]\n @email = JSON[access_token.get(\"/api/v1/emails/#{@email_id}\").body]\n @email_tags = JSON[access_token.get(\"/api/v1/emails/#{@email_id}/tags\").body]\n @tags_obj = JSON[access_token.get(\"/api/v1/tags\").body]\n @attachments = JSON[access_token.get(\"/api/v1/emails/#{@email_id}/attachments\").body]\n @email_text = access_token.get(\"/api/v1/emails/#{@email_id}/text_body\").body\n @email_html = access_token.get(\"/api/v1/emails/#{@email_id}/html_body\").body\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @email }\n end\n end", "def email\n\t\temail_response = EmailHandler.new(email_content).deliver_email\n\t\t\trender text: email_response + \"\\n\"\n\tend", "def show\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email }\n end\n end", "def show\n @email = @user.emails.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email }\n end\n end", "def show\n @email = Email.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @email }\n end\n end", "def preview_email\r\n invitation = Invitation.new(:user => current_user, :code => Code.new)\r\n mail = Mailers::Debate.create_invitation(current_user, @resource, invitation)\r\n @mail_body = mail.body.sub('No message provided', 'YOUR PERSONALIZED NOTE GOES HERE')\r\n\r\n render :inline => %Q{<%= simple_format(@mail_body, {:style => 'margin: 8px 0px'}) %>}\r\n end", "def show\n @email = Email.find(params[:id])\n respond_with @email\n end", "def show\n @email = DirectEmail.find(params[:id])\n respond_with @email\n end", "def display_mail_queue(what)\n emails = case what\n when 'all' then\n puts 'Showing all emails in the system'\n ArMailerRevised.email_class.all\n when 'deliverable' then\n puts 'Showing emails ready to deliver'\n ArMailerRevised.email_class.ready_to_deliver\n when 'delayed' then\n puts 'Showing delayed emails'\n ArMailerRevised.email_class.delayed\n else\n []\n end\n puts 'Mail queue is empty' and return if emails.empty?\n puts Hirb::Helpers::AutoTable.render emails, :fields => [:from, :to, :delivery_time, :last_send_attempt, :updated_at]\n end", "def show\n @emails = @job_application.emails.order(created_at: :desc)\n @email = @job_application.emails.new\n\n render layout: request.xhr? ? false : true\n end", "def show\n @participant_contact_email = Participant::Contact::Email.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @participant_contact_email }\n end\n end", "def get_mail\n \n end", "def get_the_email_html(nline)\n\trecipient = @ws[nline, 1].to_s\n\t$mailsubject = \"A l'attention de la mairie de #{recipient}\"\n\t$html_content = \"<p> <b> A l'attention de la mairie de #{recipient} </b> </p>\n<p>Bonjour, </p>\n<p>Je m'appelle Thomas, je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à #{recipient}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec #{recipient} ! </p>\n<p> Yann, Moussaillon de The Hacking Project</p>\" \n\nend", "def show\n @views_email = ViewsEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @views_email }\n end\n end", "def show\n json_response(@email)\n end", "def full_content\n result = <<END\n Message from: #{@name}\n\n Phone: #{@phone}\n Email: #{@email}\n %=====================================%\n\n #{self.content}\nEND\n result\n end", "def general_email(addresses, subject_line, body_content, article_content=nil)\n \n if article_content != nil\n attachments.inline['attachment.txt'] = article_content\n end \n \n @content = body_content\n \n #TODO check that email is creatible, ie has valid addresses\n mail(:to => addresses, :subject => subject_line)\n \n end", "def mail_hide(address, contents=nil)\n if ReCaptcha::Config.enabled\n contents = truncate(address,10) if contents.nil?\n k = ReCaptcha::MHClient.new(ReCaptcha::Config.mh_pub, ReCaptcha::Config.mh_priv, address)\n enciphered = k.crypted_address\n uri = \"http://mailhide.recaptcha.net/d?k=#{ReCaptcha::Config.mh_pub}&c=#{enciphered}\"\n t =<<-EOF\n <a href=\"#{uri}\"\n onclick=\"window.open('#{uri}', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">#{contents}</a>\n EOF\n end\n end", "def show\n # notification_email\n end", "def show\n @email = EventEmail.find(params[:id])\n respond_with @email\n end", "def show\n @mail = Mail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mail }\n end\n end", "def show\n @email = Email.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email }\n end\n end", "def show\n @email = Email.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email }\n end\n end", "def get_email(deputy_page_url)\n email = ''\n\n page = Nokogiri::HTML(open(deputy_page_url))\n\n page.css('a[@href ^=\"mailto:\"]').each do |element|\n email << element.text\n break\n end\n\n email\nend", "def show\n @my_mail = MyMail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_mail }\n end\n end", "def article_email( title, author, content )\n @user_emails = []\n @users = User.all\n @users.each do |user|\n if user.newletter\n @user_emails << user.email\n end\n\n end\n\n @user_emails.each do |user_email|\n @greeting = \"Newest Article: #{title}\n By: #{author},\n\n #{content}\n \"\n\n mail to: user_email, bcc: \"dave.jones@scc.spokane.edu\", subject: title\n end\n\n end", "def get_email_html(file_path)\n # Create empty string \n data = ''\n # Open the file with read permission\n f = File.open(file_path, \"r\") \n # Iterate each line and add it to the data\n f.each_line do |line|\n data += line\n end\n # Return the data as a string\n return data\nend", "def show\n @project = Project.find(params[:id])\n\n #we need to unit test the email part\n if(@project.thread_id)\n email_account = Emailaccount.where(email_address: @project.email_address).first\n inbox = Inbox::API.new(Rails.configuration.inbox_app_id, Rails.configuration.inbox_app_secret, email_account.authentication_token)\n @messages = EmailsController.new.get_messages(inbox,@project.thread_id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def show\n @mail_item = MailItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mail_item }\n end\n end", "def show\n @media_mail = MediaMail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @media_mail }\n end\n end", "def display_one_contact\n contact = retrieve_contact_by_email\n end", "def show\n @email_template = EmailTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @email_template }\n end\n end", "def show_messages(uids)\n return if uids.nil? or (Array === uids and uids.empty?)\n\n fetch_data = 'BODY.PEEK[HEADER.FIELDS (DATE SUBJECT MESSAGE-ID)]'\n messages = imap.fetch uids, fetch_data\n fetch_data.sub! '.PEEK', '' # stripped by server\n\n messages.each do |res|\n puts res.attr[fetch_data].delete(\"\\r\")\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @administration_email_template }\n end\n end", "def show\n @mailfetch = Mailfetch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mailfetch }\n end\n end", "def show\n @contact_us_email = ContactUsEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @contact_us_email }\n end\n end", "def show\n @verify_email = VerifyEmail.find(params[:id])\n if @verify_email\n if @verify_email.verified?\n redirect_to(verified_verify_email_path(@verify_email.hash_key)) and return false\n end\n opts = { from: ::VerifyEmail::From, verify_email: @verify_email }\n @mailer = VerifyEmailMailer.verify_email( @verify_email.email, opts )\n @mailer.deliver\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verify_email }\n end\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def show\n @user_mail = UserMail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_mail }\n end\n end", "def question(member, subject, content)\n @content = content\n\n mail to: member.email, subject: subject\n end", "def get_for_email(email)\n full_path = full_resource_path(\"/email\")\n query_params = MaropostApi.set_query_params({\"contact[email]\" => email})\n \n MaropostApi.get_result(full_path, query_params)\n end", "def show\n @alert_email = AlertEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @alert_email }\n end\n end", "def printmailq(mailq)\n text = \"\"\n mailq.each do |m|\n m[:frozen] ? frozen = \"*** frozen ***\" : frozen = \"\"\n \n text += \"%3s%6s %s %s %s\\n\" % [ m[:age], m[:size], m[:msgid], m[:sender], frozen ]\n \n m[:recipients].each do |r|\n text += \" #{r}\\n\"\n end\n \n text += \"\\n\"\n end\n\n text\n end", "def mailHasContent(useraccount, password, subject, content, unread)\n Gmail.connect(useraccount, password) do |gmail|\n # @users = Users.new\n # gmail = @users.getSession(useraccount, password)\n puts \"Looking for '#{subject}' in gmail account...\"\n gmail.inbox.emails(:unread, :subject => subject).each do |email|\n if email.body.to_s =~ /#{content}/m\n puts \"Found the content we were looking for!\"\n unread ? email.mark(:unread) : email.mark(:read)\n return true\n else\n email.mark(:unread)\n end\n end\n end\n return false\n end", "def getemail (adresse)\n\tpage = Nokogiri::HTML(open(adresse))\n\treturn page.css('td.style27 p.Style22 font')[6].text\nend", "def show\n @email_listing = EmailListing.find(params[:id])\n unless current_user.is_admin?\n @emails = []\n else\n @emails = @email_listing.emails\n end\n @listing = (@emails.nil? ? [] : @emails.map(&:address).compact.each_slice(@email_listing.per_line).to_a)\n\n @listing_size = @emails.size\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_listing }\n end\n end", "def edit\n yield @editor\n @mail = @editor.mail\n @message = @mail.to_s\n end", "def read_mail(options = {})\n default_options = {:conditions => [\"mail_items.read = ?\", true]}\n add_mailbox_condition!(default_options, @type)\n return get_mail(default_options, options)\n end", "def demo\n preview(DemoMailer.demo)\n end", "def demo\n preview(DemoMailer.demo)\n end", "def content(address, name)\n @greeting = \"Hi! #{name}\"\n\n mail to: address, subject: '謝謝你報名參加TKU Hackathon,提醒您活動時間是2014/3/29'\n end", "def show\n @emailcontact = Emailcontact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @emailcontact }\n end\n end", "def send_one_email_to(name, mail)\n email = @gmail.compose do\n to mail\n subject \"Apprentissage entre pairs + gratuité + code = The Hacking Project\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body get_the_email_html(name) #TODO faire pour toutes les villes du tableau -> suppose de lire les colonnes du tableau dans une boucle (ajouter un délai)\n end\n end\nemail.deliver!\nend", "def as_eloqua_email\n subject = \"#{self.title}: #{self.abstracts.first.headline}\"\n\n {\n :html_body => view.render_view(\n :template => \"/editions/email/template\",\n :formats => [:html],\n :locals => { edition: self }).to_s,\n\n :plain_text_body => view.render_view(\n :template => \"/editions/email/template\",\n :formats => [:text],\n :locals => { edition: self }).to_s,\n\n :name => \"[scpr-edition] #{self.title[0..30]}\",\n :description => \"SCPR Short List\\n\" \\\n \"Sent: #{Time.now}\\nSubject: #{subject}\",\n :subject => subject,\n :email => \"theshortlist@scpr.org\"\n }\n end", "def show\n @inbound_email = InboundEmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inbound_email }\n end\n end", "def show\n @qmail = Qmail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @qmail }\n end\n end", "def extract_mail_body(mail)\n if mail.multipart?\n # Try to find an HTML part.\n part = find_mail_part(mail, ['text/html', 'text/plain'])\n if part.nil?\n '<em>Nachricht kann leider nicht angezeigt werden.</em>'\n else\n mail_html = sanitize_mail part\n if part.content_type == 'text/plain'\n \"<div class='text-mail'>#{mail_html}</div>\"\n else\n mail_html\n end\n \n end\n else\n sanitize_mail mail\n end\n end", "def mailto_body_template\n Liquid::Template.parse(File.read(File.join(@options[:templates], \"mailto_body.liquid\")))\n end", "def show\n @mailuser = Mailuser.find(params[:id])\n\t\tallowed_to_edit(@mailuser)\n\t\t@domain = @mailuser.domain\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mailuser }\n end\n end", "def url_for_read_online\n \"http://red.com/email/read/#{self.mail_task.id}?sid=#{self.sid}\"\n end", "def show\n @account_inbox.read_inbox \n end", "def reply(content)\n @greeting = \"Hi\"\n @admin = content[:from]\n @contact = content[:to]\n @message = content[:message]\n mail to: content[:to].email, subject: \"RE: \"+content[:to].subject\n end", "def execute\n puts Mailbot::Repository.new(file).entries.map { |entry| colorized_subject entry }.map(&:strip).join(\"\\n\")\n end", "def email\n mail.first\n end", "def email\n mail.first\n end", "def build_email_content\n txt = I18n.t(\"estimate_request.fltk.email_content\", :origin => self.origin_port.name, :destination => destination_port.name, :count => self.estimate_items.first.number_of_items, :description => self.estimate_items.first.description)\n txt\n end", "def voicemail\n request = @browser.get(\"#{VoipfoneClient::API_GET_URL}?vm_view\")\n parse_response(request)[\"vm_view\"].first[\"voicemail\"]\n end", "def show\n @inform_mail = InformMail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inform_mail }\n end\n end", "def fetch_email_details(email_id)\n to_email(ItemId.new(email_id))\n end", "def get_the_email_of_a_townhall_from_its_webpage(mailcheck) #def de la methode\ndoc = Nokogiri::HTML(open(mailcheck))\ndoc.xpath('//p[@class=\"Style22\"]').each do |email| #ciblé l'email dans la class et appliquer un each do\n if email.text.include? \"@\" #si l'email contient un @, ecrire email\n email.text\n puts email.text\n end\n end\nend", "def show\n @entry_mail_type = EntryMailType.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @entry_mail_type }\n end\n end" ]
[ "0.7092966", "0.70180696", "0.6938679", "0.6808215", "0.6807669", "0.6782516", "0.67396253", "0.66930294", "0.6521007", "0.6489616", "0.6475744", "0.6475348", "0.64712644", "0.6452298", "0.6423639", "0.6414615", "0.6389906", "0.63884676", "0.63853973", "0.6374227", "0.6332617", "0.6323122", "0.6264777", "0.62459034", "0.6241666", "0.6236267", "0.62158316", "0.62115544", "0.61945707", "0.6174122", "0.6169686", "0.61658674", "0.61658674", "0.6165377", "0.61357987", "0.6135284", "0.6099015", "0.6093947", "0.60804605", "0.6079931", "0.60718596", "0.6061096", "0.6060195", "0.6042337", "0.6022979", "0.60187316", "0.6018463", "0.59999144", "0.59702235", "0.595838", "0.5950649", "0.5950649", "0.5950347", "0.5923283", "0.5920369", "0.5906592", "0.58948755", "0.5891743", "0.5887185", "0.58736897", "0.58703786", "0.5862189", "0.5862158", "0.58492696", "0.58363634", "0.58331394", "0.58312714", "0.58193284", "0.5815104", "0.5804943", "0.57963866", "0.5792996", "0.57835567", "0.5777134", "0.5774282", "0.577144", "0.5762036", "0.5759576", "0.5759576", "0.57552207", "0.5745555", "0.5745247", "0.57430005", "0.5742349", "0.5739808", "0.5731761", "0.57249963", "0.57221466", "0.57214874", "0.5716957", "0.57154447", "0.5711203", "0.5709792", "0.5709792", "0.57091576", "0.5704904", "0.5704868", "0.57041925", "0.5704171", "0.57021904" ]
0.64256
14
Reader for field's value
def value bindings[:object].send(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_field\n end", "def value_read; end", "def read\n value = record.send(\"#{name}_data\")\n value unless value.nil? || value.empty?\n end", "def [](field_name)\n f = field(field_name)\n f && f.value\n end", "def process_field_value(value)\r\n value\r\n end", "def read(io)\n data = self.new\n data.read(io)\n data.single_value? ? data.value : data\n end", "def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end", "def get(field)\n self.class.get(field, @data)\n end", "def field_content\n value\n end", "def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end", "def field_reader(name)\n class_eval <<-READER\n def #{name}\n @#{name} ||= fields[:#{name}].default\n end\n READER\n end", "def value\n attributes['FieldValue']\n end", "def get_field_value(data, field_name)\n data[field_name]['__content__'] if data[field_name]\n end", "def get_field_value(label)\n field_detect(label)\n element = @field.all(:css, 'div[class*=\"clearfix data-column\"]').first\n element.all(:css, 'span[class^=\"read edit\"]').each do |entry|\n entry.text\n end\n end", "def get_string_value(field_name)\n\t\tend", "def read_attribute(name)\n fields[name].get(@attributes[name])\n end", "def value_read=(_arg0); end", "def imported_field_value(field)\n resource.try(field) || resource.try(:primary_imported_metadata)&.[](field) || parent_resource&.try(field) || parent_resource&.try(:primary_imported_metadata)&.[](field)\n end", "def get_field_values document, _field, field_config, options = {}\n presenter(document).field_values field_config, options\n end", "def field_value(field_name, specification_hash, line)\n field_name = field_name.to_s\n content_ar = line.split('')\n value_str = ''\n if !specification_hash.keys.include? field_name \n raise InvalidAttrName, \"The specified attr name was not found in the specification hash.\"\n else\n range = specification_hash[field_name]\n range.each do |n|\n value_str.concat content_ar[n]\n end\n value_str.strip\n end\n end", "def custom_reader(key); end", "def get_field_value(field)\n field_values = get_fields(field)\n return nil if field_values.blank?\n if field_values.first.delegation_field.multiple\n field_values.map(&:to_value)\n else\n field_values.first.to_value\n end\n end", "def read_attribute\n Logging.debug \"Read attribute #{field_name}, got #{object.send(:read_attribute,field_name)} for #{object.inspect}\"\n object.send( :read_attribute, field_name )\n end", "def fetch\n if raw\n values = Array.wrap(super)\n (field =~ /_[a-z]$/) ? values : values.first\n else\n super\n end\n end", "def get_value\n read_attribute('text_value')\n end", "def read_external(in_stream)\n # fieldNumber = in.readShort ();\n # value = in.readUTF();\n end", "def get(field)\n @dataset.get(field)\n end", "def get_field(field_name)\n\t\tend", "def deserialize_value(value)\r\n value\r\n end", "def get_coll_field_val(fedora_obj, desired_field)\n if (desired_field.is_a?(String))\n desired_field = desired_field.to_sym\n end\n if (fedora_obj.collections.size > 0)\n coll_obj = HypatiaCollection.load_instance(fedora_obj.collections[0].pid)\n return get_values_from_datastream(coll_obj, \"descMetadata\", desired_field).first\n elsif (fedora_obj.sets.size > 0)\n # we can load the parent object as a set because we are only going to check \"collections\" and \"sets\"\n return values = get_coll_field_val(HypatiaSet.load_instance(fedora_obj.sets[0].pid), desired_field)\n end\n return \"\"\n end", "def value_for(field, env)\n raw = env.attributes.delete(field)\n raw.is_a?(Array) ? raw.map { |val| deserialize(val) } : deserialize(raw)\n end", "def get_integer_value(field_name)\n\t\tend", "def deserialize_value(column, value)\n value\n end", "def field_value(field)\n @object.respond_to?(field) ? @object.send(field) : ''\n end", "def read(input)\n # wrap strings in stringIO\n input = StringIO.new(input) if input.kind_of? ::String\n\n @offset = input.pos\n @values.each {|field|\n field.read_io(input)\n }\n @size = input.pos - @offset\n end", "def value_field\n \"string\"\n end", "def read_attribute_with_dynamo(field_name)\n field_name = field_name.to_s\n if is_dynamo_field?(field_name)\n \n # If the model's id is nil then we know there aren't going to be any values to read.\n # example: If this is a supplier model and we are creating a new supplier at this point its id is nil\n # Because of this fact we know there are no dynamo_field_values associated with it so return.\n # If we didn't return here then when checking for values we would create extra queries.\n # Any time we do a df.dynamo_field_values we create overhead so we only want to do that when we have to.\n return if self.id == nil\n \n # We're doing a real read now so get the dynamo_field from the cache then query to get the correct value.\n dynamo_field = cached_dynamo_field_by_name(field_name)\n \n # Get all the dynamo field values for this model from the cache.\n dynamo_field_value = cached_dynamo_field_values.detect{|dyn_field_val| dyn_field_val.dynamo_field_id == dynamo_field.id && dyn_field_val.model_id == self.id }\n \n return nil if dynamo_field_value.blank?\n return dynamo_field_value.send(dynamo_field.field_type)\n end\n # If its a 'normal' attribute let rails handle it in its usual way\n read_attribute_without_dynamo(field_name)\n end", "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "def read_field_for_id(id, field)\n Sidekiq.redis do |conn|\n conn.hmget(id, field)[0]\n end\n end", "def get_object_value(object, fieldname)\n # first, attempt to split the fieldname based on the '.' character\n # (if it exists in the string)\n dot_split = fieldname.split('.')\n if dot_split.size > 1\n # if it's a dot-separated form, then drill down until we find the\n # value that the dot-separated form refers to and return that value\n value = object\n prev_key = dot_split[0]\n dot_split.each { |keyname|\n # throw an error if the 'value' is not a hash (before attempting to retrieve the next 'value')\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{prev_key}' is not a Hash value\" unless value.is_a?(Hash)\n # if get here, then just retrieve the next element from nested hash maps referred\n # to in the dot-separated form (note that for top-level fields the keys will be\n # prefixed with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n value = value[\"@#{keyname}\"] || value[keyname]\n # throw an error if a field with the key 'keyname' was not found (it's an illegal reference in that case)\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{keyname}' cannot be found\" unless value\n # otherwise, save this keyname for the next time through the loop and continue\n prev_key = keyname\n }\n return value\n end\n # otherwise, retrieve the field referred to by the fieldname and return\n # that value (note that for top-level fields the keys will be prefixed\n # with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n object[\"@#{fieldname}\"] || object[fieldname]\n end", "def get_string(field)\n field['stringValue']\n end", "def show_field_value(id)\n get(\"fieldValues/#{id}\")\n end", "def custom_reader(key)\n value = regular_reader(convert_key(key))\n yield value if block_given?\n value\n end", "def field_value field, options = {}\n field_values(field, options)\n end", "def field_value(field_identifier, options={})\n data[lookup_field_code(field_identifier, options)]\n end", "def field_value(field_identifier, options={})\n data[lookup_field_id_string(field_identifier, options)]\n end", "def [](name)\n field(name).convert(@raw)\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def value(field)\n if DATE_FIELDS.include? (name=attr(field))\n Time.parse(field.text) rescue field.text\n elsif USER_FIELDS.include? name\n users[field.text.downcase]\n else\n field.text\n end\n end", "def fetch\n if raw\n field_config.accessor ? retieve_using_accessor : retrieve_simple\n else\n super\n end\n end", "def getFieldValue( name , formName = \"\" , frameName = \"\" )\n # returns the current value of the field\n \n fname = getFunctionName()\n log fname + ' Starting. getting value for field with name: ' + name if $debuglevel >=0\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n v = \"\"\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name \n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n if o != nil\n v = o.value.to_s\n else\n v = nil\n end\n\n rescue => e\n showException(e)\n v = nil \n end \n return v\n \n end", "def dynamic_getter(name)\n field = self.content_type.find_field(name)\n value = self.localized_dynamic_attribute_value(field)\n\n case field.type\n when :date, :date_time\n value.is_a?(String) ? Chronic.parse(value) : value\n when :file\n value.present? ? { 'url' => value } : nil\n when :belongs_to\n field.klass.find_entry(value)\n when :has_many\n field.klass.find_entries_by(field.inverse_of, [self._label, self._permalink])\n when :many_to_many\n field.klass.find_entries_among(value)\n else\n # :string, :text, :select, :boolean, :email, :integer, :float, :tags\n value\n end\n end", "def read\n @_cache ||= (value = read_value) ? serializer_class.load(read_value) : {}\n end", "def field_value(field)\n field_config = blacklight_config.show_fields[field]\n Blacklight::ShowPresenter.new(@document, self).field_value field_config\n end", "def value_field\n \"text\"\n end", "def fetch_value(value); end", "def reader; end", "def get_field(name)\n self[name]\n end", "def get_string_field(field_name)\n\t\tend", "def typecast_attribute_for_read(attr_name, value)\n self\n .find_typecaster(attr_name)\n .from_api(value)\n end", "def getvalue\n @source.getvalue\n end", "def field_value(field, opt = nil)\n opt ||= {}\n super(field, opt.merge(raw: true, blacklight_config: configuration))\n end", "def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend", "def reader_name\n self[:reader_name].read_string\n end", "def get_value_or_id(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_or_id_for_item(self)\n end", "def value_field\n BlacklightBrowseNearby::Engine.config.value_field\n end", "def getter\r\n @getter ||= Field.getter(@name)\r\n end", "def value\n @value ||= extract_value\n end", "def field_content(name)\n if field_exists?(name)\n value_by_key(@fields, name)\n else\n {}\n end\n end", "def field(key)\n pdf_field(key).getValueAsString\n rescue NoMethodError\n raise \"unknown key name `#{key}'\"\n end", "def read\n data_sources.each_member do |field_name, field_source|\n new_value = field_source.read\n set(field_name, new_value)\n if new_value\n last_known.set(field_name, new_value)\n end\n end\n end", "def get_value name\n get name\n end", "def raw_value; end", "def input\n @input ||= reader.read\n end", "def field(name); end", "def value\n record.send(name).value\n end", "def get_value\n value\n end", "def get_value\n value\n end", "def [](field_name)\n get(field_name)\n end", "def metadata_field_value(field, value)\n return (value == 'true' ? 'open' : 'restricted') if field[:metadata_name] == 'visibility'\n return value if field[:multivalued] == :no\n return [value] if field[:multivalued] == :yes\n return value.split(';') if value.present?\n []\n end", "def get_binary_field(field_name)\n\t\tend", "def valGetter\n \"#{DataMetaDom.getterName(@fld)}()\" + ( isMapping ? '.getKey()' : '')\n end", "def get_field_value(obj, name)\n begin\n @struct_field_getter.call(obj, name)\n rescue\n 0\n end\n end", "def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end", "def read(record, cursor)\n return :NULL if null?(record)\n cursor.name(type.name) { type.reader.read(record, cursor, length(record)) }\n end", "def read\n\t\t\t\t\tnil\n\t\t\t\tend", "def read_field(*args)\n m = 0\n args.flatten.each_with_index do |bit, i|\n if bit.is_a?(Integer)\n m |= ((@value[bit] || 0) << i)\n end\n end\n m\n end", "def read\n load_column(read_attribute)\n end", "def _read_attribute(key); end", "def parse_value; end", "def value\n parsed_value\n end", "def get_value\n @value\n end", "def get\n val\n end", "def get\n val\n end", "def field_value(name, field)\n placement_collection[name].collect{|entry| entry[field]}\n end", "def value\n return nil if @value.is_a? NilPlaceholder\n @value.nil? ? deserialize_value : @value\n end", "def read(io)\n @record_class.read(io)\n end", "def fetch\n @value\n end", "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def read_type(field_info)\n # if field_info is a Fixnum, assume it is a Thrift::Types constant\n # convert it into a field_info Hash for backwards compatibility\n if field_info.is_a? Fixnum\n field_info = {:type => field_info}\n end\n\n case field_info[:type]\n when Types::BOOL\n read_bool\n when Types::BYTE\n read_byte\n when Types::DOUBLE\n read_double\n when Types::I16\n read_i16\n when Types::I32\n read_i32\n when Types::I64\n read_i64\n when Types::STRING\n if field_info[:binary]\n read_binary\n else\n read_string\n end\n else\n raise NotImplementedError\n end\n end", "def read_attribute\n record.public_send(attribute)\n end" ]
[ "0.7273547", "0.70294005", "0.67918694", "0.67404556", "0.65841675", "0.6344593", "0.632313", "0.63162744", "0.6315854", "0.6307784", "0.62778014", "0.6255537", "0.6250033", "0.62345195", "0.6217381", "0.6055541", "0.6012342", "0.6012229", "0.6004448", "0.5990767", "0.5950257", "0.5936163", "0.5932686", "0.5912455", "0.5911089", "0.59087247", "0.5901454", "0.5884374", "0.58594185", "0.58462965", "0.58305275", "0.5830066", "0.582186", "0.58030725", "0.57914925", "0.5787518", "0.57823616", "0.57817596", "0.5779109", "0.57657874", "0.57485056", "0.57435495", "0.57280433", "0.5724877", "0.5721602", "0.5710396", "0.56985307", "0.56828207", "0.5681926", "0.567922", "0.56754065", "0.5674744", "0.5671791", "0.5670479", "0.5667012", "0.56544", "0.56510305", "0.564792", "0.56375474", "0.56194025", "0.56056195", "0.56044286", "0.5596316", "0.5571291", "0.55492294", "0.55491847", "0.5545392", "0.5535703", "0.5535242", "0.55162084", "0.5513423", "0.5511179", "0.550793", "0.550546", "0.55041534", "0.55038106", "0.5500575", "0.5500575", "0.55001324", "0.5498962", "0.5492249", "0.5489158", "0.5486457", "0.54762733", "0.547562", "0.54730517", "0.54686236", "0.5467785", "0.5467027", "0.5462011", "0.5460397", "0.545817", "0.5457757", "0.5457757", "0.5451082", "0.5436933", "0.5432828", "0.54264826", "0.54242027", "0.54208666", "0.5419913" ]
0.0
-1
Reader for field's value
def value bindings[:object].send(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_field\n end", "def value_read; end", "def read\n value = record.send(\"#{name}_data\")\n value unless value.nil? || value.empty?\n end", "def [](field_name)\n f = field(field_name)\n f && f.value\n end", "def process_field_value(value)\r\n value\r\n end", "def read(io)\n data = self.new\n data.read(io)\n data.single_value? ? data.value : data\n end", "def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end", "def get(field)\n self.class.get(field, @data)\n end", "def field_content\n value\n end", "def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end", "def field_reader(name)\n class_eval <<-READER\n def #{name}\n @#{name} ||= fields[:#{name}].default\n end\n READER\n end", "def value\n attributes['FieldValue']\n end", "def get_field_value(data, field_name)\n data[field_name]['__content__'] if data[field_name]\n end", "def get_field_value(label)\n field_detect(label)\n element = @field.all(:css, 'div[class*=\"clearfix data-column\"]').first\n element.all(:css, 'span[class^=\"read edit\"]').each do |entry|\n entry.text\n end\n end", "def get_string_value(field_name)\n\t\tend", "def read_attribute(name)\n fields[name].get(@attributes[name])\n end", "def value_read=(_arg0); end", "def imported_field_value(field)\n resource.try(field) || resource.try(:primary_imported_metadata)&.[](field) || parent_resource&.try(field) || parent_resource&.try(:primary_imported_metadata)&.[](field)\n end", "def get_field_values document, _field, field_config, options = {}\n presenter(document).field_values field_config, options\n end", "def field_value(field_name, specification_hash, line)\n field_name = field_name.to_s\n content_ar = line.split('')\n value_str = ''\n if !specification_hash.keys.include? field_name \n raise InvalidAttrName, \"The specified attr name was not found in the specification hash.\"\n else\n range = specification_hash[field_name]\n range.each do |n|\n value_str.concat content_ar[n]\n end\n value_str.strip\n end\n end", "def custom_reader(key); end", "def get_field_value(field)\n field_values = get_fields(field)\n return nil if field_values.blank?\n if field_values.first.delegation_field.multiple\n field_values.map(&:to_value)\n else\n field_values.first.to_value\n end\n end", "def read_attribute\n Logging.debug \"Read attribute #{field_name}, got #{object.send(:read_attribute,field_name)} for #{object.inspect}\"\n object.send( :read_attribute, field_name )\n end", "def fetch\n if raw\n values = Array.wrap(super)\n (field =~ /_[a-z]$/) ? values : values.first\n else\n super\n end\n end", "def get_value\n read_attribute('text_value')\n end", "def read_external(in_stream)\n # fieldNumber = in.readShort ();\n # value = in.readUTF();\n end", "def get(field)\n @dataset.get(field)\n end", "def get_field(field_name)\n\t\tend", "def deserialize_value(value)\r\n value\r\n end", "def get_coll_field_val(fedora_obj, desired_field)\n if (desired_field.is_a?(String))\n desired_field = desired_field.to_sym\n end\n if (fedora_obj.collections.size > 0)\n coll_obj = HypatiaCollection.load_instance(fedora_obj.collections[0].pid)\n return get_values_from_datastream(coll_obj, \"descMetadata\", desired_field).first\n elsif (fedora_obj.sets.size > 0)\n # we can load the parent object as a set because we are only going to check \"collections\" and \"sets\"\n return values = get_coll_field_val(HypatiaSet.load_instance(fedora_obj.sets[0].pid), desired_field)\n end\n return \"\"\n end", "def value_for(field, env)\n raw = env.attributes.delete(field)\n raw.is_a?(Array) ? raw.map { |val| deserialize(val) } : deserialize(raw)\n end", "def get_integer_value(field_name)\n\t\tend", "def deserialize_value(column, value)\n value\n end", "def field_value(field)\n @object.respond_to?(field) ? @object.send(field) : ''\n end", "def read(input)\n # wrap strings in stringIO\n input = StringIO.new(input) if input.kind_of? ::String\n\n @offset = input.pos\n @values.each {|field|\n field.read_io(input)\n }\n @size = input.pos - @offset\n end", "def value_field\n \"string\"\n end", "def read_attribute_with_dynamo(field_name)\n field_name = field_name.to_s\n if is_dynamo_field?(field_name)\n \n # If the model's id is nil then we know there aren't going to be any values to read.\n # example: If this is a supplier model and we are creating a new supplier at this point its id is nil\n # Because of this fact we know there are no dynamo_field_values associated with it so return.\n # If we didn't return here then when checking for values we would create extra queries.\n # Any time we do a df.dynamo_field_values we create overhead so we only want to do that when we have to.\n return if self.id == nil\n \n # We're doing a real read now so get the dynamo_field from the cache then query to get the correct value.\n dynamo_field = cached_dynamo_field_by_name(field_name)\n \n # Get all the dynamo field values for this model from the cache.\n dynamo_field_value = cached_dynamo_field_values.detect{|dyn_field_val| dyn_field_val.dynamo_field_id == dynamo_field.id && dyn_field_val.model_id == self.id }\n \n return nil if dynamo_field_value.blank?\n return dynamo_field_value.send(dynamo_field.field_type)\n end\n # If its a 'normal' attribute let rails handle it in its usual way\n read_attribute_without_dynamo(field_name)\n end", "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "def read_field_for_id(id, field)\n Sidekiq.redis do |conn|\n conn.hmget(id, field)[0]\n end\n end", "def get_object_value(object, fieldname)\n # first, attempt to split the fieldname based on the '.' character\n # (if it exists in the string)\n dot_split = fieldname.split('.')\n if dot_split.size > 1\n # if it's a dot-separated form, then drill down until we find the\n # value that the dot-separated form refers to and return that value\n value = object\n prev_key = dot_split[0]\n dot_split.each { |keyname|\n # throw an error if the 'value' is not a hash (before attempting to retrieve the next 'value')\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{prev_key}' is not a Hash value\" unless value.is_a?(Hash)\n # if get here, then just retrieve the next element from nested hash maps referred\n # to in the dot-separated form (note that for top-level fields the keys will be\n # prefixed with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n value = value[\"@#{keyname}\"] || value[keyname]\n # throw an error if a field with the key 'keyname' was not found (it's an illegal reference in that case)\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{keyname}' cannot be found\" unless value\n # otherwise, save this keyname for the next time through the loop and continue\n prev_key = keyname\n }\n return value\n end\n # otherwise, retrieve the field referred to by the fieldname and return\n # that value (note that for top-level fields the keys will be prefixed\n # with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n object[\"@#{fieldname}\"] || object[fieldname]\n end", "def get_string(field)\n field['stringValue']\n end", "def show_field_value(id)\n get(\"fieldValues/#{id}\")\n end", "def custom_reader(key)\n value = regular_reader(convert_key(key))\n yield value if block_given?\n value\n end", "def field_value field, options = {}\n field_values(field, options)\n end", "def field_value(field_identifier, options={})\n data[lookup_field_code(field_identifier, options)]\n end", "def field_value(field_identifier, options={})\n data[lookup_field_id_string(field_identifier, options)]\n end", "def [](name)\n field(name).convert(@raw)\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def value(field)\n if DATE_FIELDS.include? (name=attr(field))\n Time.parse(field.text) rescue field.text\n elsif USER_FIELDS.include? name\n users[field.text.downcase]\n else\n field.text\n end\n end", "def fetch\n if raw\n field_config.accessor ? retieve_using_accessor : retrieve_simple\n else\n super\n end\n end", "def dynamic_getter(name)\n field = self.content_type.find_field(name)\n value = self.localized_dynamic_attribute_value(field)\n\n case field.type\n when :date, :date_time\n value.is_a?(String) ? Chronic.parse(value) : value\n when :file\n value.present? ? { 'url' => value } : nil\n when :belongs_to\n field.klass.find_entry(value)\n when :has_many\n field.klass.find_entries_by(field.inverse_of, [self._label, self._permalink])\n when :many_to_many\n field.klass.find_entries_among(value)\n else\n # :string, :text, :select, :boolean, :email, :integer, :float, :tags\n value\n end\n end", "def getFieldValue( name , formName = \"\" , frameName = \"\" )\n # returns the current value of the field\n \n fname = getFunctionName()\n log fname + ' Starting. getting value for field with name: ' + name if $debuglevel >=0\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n v = \"\"\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name \n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n if o != nil\n v = o.value.to_s\n else\n v = nil\n end\n\n rescue => e\n showException(e)\n v = nil \n end \n return v\n \n end", "def read\n @_cache ||= (value = read_value) ? serializer_class.load(read_value) : {}\n end", "def field_value(field)\n field_config = blacklight_config.show_fields[field]\n Blacklight::ShowPresenter.new(@document, self).field_value field_config\n end", "def value_field\n \"text\"\n end", "def fetch_value(value); end", "def reader; end", "def get_field(name)\n self[name]\n end", "def get_string_field(field_name)\n\t\tend", "def typecast_attribute_for_read(attr_name, value)\n self\n .find_typecaster(attr_name)\n .from_api(value)\n end", "def getvalue\n @source.getvalue\n end", "def field_value(field, opt = nil)\n opt ||= {}\n super(field, opt.merge(raw: true, blacklight_config: configuration))\n end", "def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend", "def reader_name\n self[:reader_name].read_string\n end", "def get_value_or_id(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_or_id_for_item(self)\n end", "def value_field\n BlacklightBrowseNearby::Engine.config.value_field\n end", "def getter\r\n @getter ||= Field.getter(@name)\r\n end", "def field_content(name)\n if field_exists?(name)\n value_by_key(@fields, name)\n else\n {}\n end\n end", "def value\n @value ||= extract_value\n end", "def read\n data_sources.each_member do |field_name, field_source|\n new_value = field_source.read\n set(field_name, new_value)\n if new_value\n last_known.set(field_name, new_value)\n end\n end\n end", "def field(key)\n pdf_field(key).getValueAsString\n rescue NoMethodError\n raise \"unknown key name `#{key}'\"\n end", "def get_value name\n get name\n end", "def raw_value; end", "def input\n @input ||= reader.read\n end", "def field(name); end", "def value\n record.send(name).value\n end", "def [](field_name)\n get(field_name)\n end", "def get_value\n value\n end", "def get_value\n value\n end", "def metadata_field_value(field, value)\n return (value == 'true' ? 'open' : 'restricted') if field[:metadata_name] == 'visibility'\n return value if field[:multivalued] == :no\n return [value] if field[:multivalued] == :yes\n return value.split(';') if value.present?\n []\n end", "def get_binary_field(field_name)\n\t\tend", "def valGetter\n \"#{DataMetaDom.getterName(@fld)}()\" + ( isMapping ? '.getKey()' : '')\n end", "def get_field_value(obj, name)\n begin\n @struct_field_getter.call(obj, name)\n rescue\n 0\n end\n end", "def read(record, cursor)\n return :NULL if null?(record)\n cursor.name(type.name) { type.reader.read(record, cursor, length(record)) }\n end", "def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end", "def read\n\t\t\t\t\tnil\n\t\t\t\tend", "def read\n load_column(read_attribute)\n end", "def read_field(*args)\n m = 0\n args.flatten.each_with_index do |bit, i|\n if bit.is_a?(Integer)\n m |= ((@value[bit] || 0) << i)\n end\n end\n m\n end", "def _read_attribute(key); end", "def parse_value; end", "def value\n parsed_value\n end", "def get_value\n @value\n end", "def get\n val\n end", "def get\n val\n end", "def field_value(name, field)\n placement_collection[name].collect{|entry| entry[field]}\n end", "def value\n return nil if @value.is_a? NilPlaceholder\n @value.nil? ? deserialize_value : @value\n end", "def read(io)\n @record_class.read(io)\n end", "def fetch\n @value\n end", "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def read_type(field_info)\n # if field_info is a Fixnum, assume it is a Thrift::Types constant\n # convert it into a field_info Hash for backwards compatibility\n if field_info.is_a? Fixnum\n field_info = {:type => field_info}\n end\n\n case field_info[:type]\n when Types::BOOL\n read_bool\n when Types::BYTE\n read_byte\n when Types::DOUBLE\n read_double\n when Types::I16\n read_i16\n when Types::I32\n read_i32\n when Types::I64\n read_i64\n when Types::STRING\n if field_info[:binary]\n read_binary\n else\n read_string\n end\n else\n raise NotImplementedError\n end\n end", "def read_attribute\n record.public_send(attribute)\n end" ]
[ "0.7275084", "0.7029871", "0.6794409", "0.67397946", "0.65828663", "0.63447976", "0.63250345", "0.631679", "0.63144624", "0.63071734", "0.62797993", "0.6254796", "0.6250294", "0.6234026", "0.6216726", "0.6057279", "0.6013759", "0.60137326", "0.6004446", "0.59906214", "0.59514713", "0.5934954", "0.59340394", "0.59139526", "0.5910048", "0.59088606", "0.5902181", "0.5885493", "0.58590126", "0.58462167", "0.58308065", "0.5829777", "0.58215284", "0.58029544", "0.57923216", "0.5785931", "0.5783717", "0.57831323", "0.577941", "0.5766138", "0.57471746", "0.5743373", "0.57287997", "0.5723625", "0.57212514", "0.5710079", "0.5700187", "0.56824076", "0.56818473", "0.5681704", "0.56762177", "0.5675718", "0.5673075", "0.56699264", "0.56654906", "0.5654196", "0.565299", "0.5648902", "0.56376857", "0.5621215", "0.5606032", "0.56042916", "0.5597257", "0.55733424", "0.5548472", "0.55479246", "0.55462134", "0.55357325", "0.5535063", "0.5515665", "0.551517", "0.5511971", "0.5508022", "0.55058956", "0.55055106", "0.550444", "0.55003506", "0.5499352", "0.5499352", "0.5497444", "0.5493246", "0.5489106", "0.54868025", "0.54778", "0.54765815", "0.5475367", "0.5470584", "0.54692435", "0.54683924", "0.546168", "0.54593575", "0.545724", "0.54564095", "0.54564095", "0.5450381", "0.54369587", "0.5434221", "0.54265994", "0.5425162", "0.54219025", "0.5421189" ]
0.0
-1
Reader for field's value
def value bindings[:object].send(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_field\n end", "def value_read; end", "def read\n value = record.send(\"#{name}_data\")\n value unless value.nil? || value.empty?\n end", "def [](field_name)\n f = field(field_name)\n f && f.value\n end", "def process_field_value(value)\r\n value\r\n end", "def read(io)\n data = self.new\n data.read(io)\n data.single_value? ? data.value : data\n end", "def read_metadata_field(field_name)\n @client.get(\"#{metadata_path}/#{field_name}\")\n end", "def get(field)\n self.class.get(field, @data)\n end", "def field_content\n value\n end", "def get_value(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_for_item(self)\n end", "def field_reader(name)\n class_eval <<-READER\n def #{name}\n @#{name} ||= fields[:#{name}].default\n end\n READER\n end", "def value\n attributes['FieldValue']\n end", "def get_field_value(data, field_name)\n data[field_name]['__content__'] if data[field_name]\n end", "def get_field_value(label)\n field_detect(label)\n element = @field.all(:css, 'div[class*=\"clearfix data-column\"]').first\n element.all(:css, 'span[class^=\"read edit\"]').each do |entry|\n entry.text\n end\n end", "def get_string_value(field_name)\n\t\tend", "def read_attribute(name)\n fields[name].get(@attributes[name])\n end", "def value_read=(_arg0); end", "def imported_field_value(field)\n resource.try(field) || resource.try(:primary_imported_metadata)&.[](field) || parent_resource&.try(field) || parent_resource&.try(:primary_imported_metadata)&.[](field)\n end", "def get_field_values document, _field, field_config, options = {}\n presenter(document).field_values field_config, options\n end", "def field_value(field_name, specification_hash, line)\n field_name = field_name.to_s\n content_ar = line.split('')\n value_str = ''\n if !specification_hash.keys.include? field_name \n raise InvalidAttrName, \"The specified attr name was not found in the specification hash.\"\n else\n range = specification_hash[field_name]\n range.each do |n|\n value_str.concat content_ar[n]\n end\n value_str.strip\n end\n end", "def custom_reader(key); end", "def get_field_value(field)\n field_values = get_fields(field)\n return nil if field_values.blank?\n if field_values.first.delegation_field.multiple\n field_values.map(&:to_value)\n else\n field_values.first.to_value\n end\n end", "def read_attribute\n Logging.debug \"Read attribute #{field_name}, got #{object.send(:read_attribute,field_name)} for #{object.inspect}\"\n object.send( :read_attribute, field_name )\n end", "def fetch\n if raw\n values = Array.wrap(super)\n (field =~ /_[a-z]$/) ? values : values.first\n else\n super\n end\n end", "def get_value\n read_attribute('text_value')\n end", "def read_external(in_stream)\n # fieldNumber = in.readShort ();\n # value = in.readUTF();\n end", "def get(field)\n @dataset.get(field)\n end", "def get_field(field_name)\n\t\tend", "def deserialize_value(value)\r\n value\r\n end", "def get_coll_field_val(fedora_obj, desired_field)\n if (desired_field.is_a?(String))\n desired_field = desired_field.to_sym\n end\n if (fedora_obj.collections.size > 0)\n coll_obj = HypatiaCollection.load_instance(fedora_obj.collections[0].pid)\n return get_values_from_datastream(coll_obj, \"descMetadata\", desired_field).first\n elsif (fedora_obj.sets.size > 0)\n # we can load the parent object as a set because we are only going to check \"collections\" and \"sets\"\n return values = get_coll_field_val(HypatiaSet.load_instance(fedora_obj.sets[0].pid), desired_field)\n end\n return \"\"\n end", "def value_for(field, env)\n raw = env.attributes.delete(field)\n raw.is_a?(Array) ? raw.map { |val| deserialize(val) } : deserialize(raw)\n end", "def get_integer_value(field_name)\n\t\tend", "def deserialize_value(column, value)\n value\n end", "def field_value(field)\n @object.respond_to?(field) ? @object.send(field) : ''\n end", "def read(input)\n # wrap strings in stringIO\n input = StringIO.new(input) if input.kind_of? ::String\n\n @offset = input.pos\n @values.each {|field|\n field.read_io(input)\n }\n @size = input.pos - @offset\n end", "def value_field\n \"string\"\n end", "def read_attribute_with_dynamo(field_name)\n field_name = field_name.to_s\n if is_dynamo_field?(field_name)\n \n # If the model's id is nil then we know there aren't going to be any values to read.\n # example: If this is a supplier model and we are creating a new supplier at this point its id is nil\n # Because of this fact we know there are no dynamo_field_values associated with it so return.\n # If we didn't return here then when checking for values we would create extra queries.\n # Any time we do a df.dynamo_field_values we create overhead so we only want to do that when we have to.\n return if self.id == nil\n \n # We're doing a real read now so get the dynamo_field from the cache then query to get the correct value.\n dynamo_field = cached_dynamo_field_by_name(field_name)\n \n # Get all the dynamo field values for this model from the cache.\n dynamo_field_value = cached_dynamo_field_values.detect{|dyn_field_val| dyn_field_val.dynamo_field_id == dynamo_field.id && dyn_field_val.model_id == self.id }\n \n return nil if dynamo_field_value.blank?\n return dynamo_field_value.send(dynamo_field.field_type)\n end\n # If its a 'normal' attribute let rails handle it in its usual way\n read_attribute_without_dynamo(field_name)\n end", "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "def read_field_for_id(id, field)\n Sidekiq.redis do |conn|\n conn.hmget(id, field)[0]\n end\n end", "def get_object_value(object, fieldname)\n # first, attempt to split the fieldname based on the '.' character\n # (if it exists in the string)\n dot_split = fieldname.split('.')\n if dot_split.size > 1\n # if it's a dot-separated form, then drill down until we find the\n # value that the dot-separated form refers to and return that value\n value = object\n prev_key = dot_split[0]\n dot_split.each { |keyname|\n # throw an error if the 'value' is not a hash (before attempting to retrieve the next 'value')\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{prev_key}' is not a Hash value\" unless value.is_a?(Hash)\n # if get here, then just retrieve the next element from nested hash maps referred\n # to in the dot-separated form (note that for top-level fields the keys will be\n # prefixed with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n value = value[\"@#{keyname}\"] || value[keyname]\n # throw an error if a field with the key 'keyname' was not found (it's an illegal reference in that case)\n raise ProjectHanlon::Error::Slice::InputError, \"Parsing of '#{fieldname}' failed; field '#{keyname}' cannot be found\" unless value\n # otherwise, save this keyname for the next time through the loop and continue\n prev_key = keyname\n }\n return value\n end\n # otherwise, retrieve the field referred to by the fieldname and return\n # that value (note that for top-level fields the keys will be prefixed\n # with an '@' character but for lower-level fields that will not be the\n # case, this line will retrieve one or the other)\n object[\"@#{fieldname}\"] || object[fieldname]\n end", "def get_string(field)\n field['stringValue']\n end", "def show_field_value(id)\n get(\"fieldValues/#{id}\")\n end", "def custom_reader(key)\n value = regular_reader(convert_key(key))\n yield value if block_given?\n value\n end", "def field_value field, options = {}\n field_values(field, options)\n end", "def field_value(field_identifier, options={})\n data[lookup_field_code(field_identifier, options)]\n end", "def field_value(field_identifier, options={})\n data[lookup_field_id_string(field_identifier, options)]\n end", "def [](name)\n field(name).convert(@raw)\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def value(field)\n if DATE_FIELDS.include? (name=attr(field))\n Time.parse(field.text) rescue field.text\n elsif USER_FIELDS.include? name\n users[field.text.downcase]\n else\n field.text\n end\n end", "def fetch\n if raw\n field_config.accessor ? retieve_using_accessor : retrieve_simple\n else\n super\n end\n end", "def getFieldValue( name , formName = \"\" , frameName = \"\" )\n # returns the current value of the field\n \n fname = getFunctionName()\n log fname + ' Starting. getting value for field with name: ' + name if $debuglevel >=0\n\n begin # if there are 2 elements with the same name, we get an exception - so we need a different version of this method\n\n container = getObjectContainer( name , formName , frameName )\n\n o = nil\n v = \"\"\n container.all.each do |c|\n next unless o == nil\n begin\n if c.name.to_s == name \n #log 'Hack:: found the object. '\n o = c\n end\n rescue\n # probably no name\n end\n end\n if o != nil\n v = o.value.to_s\n else\n v = nil\n end\n\n rescue => e\n showException(e)\n v = nil \n end \n return v\n \n end", "def dynamic_getter(name)\n field = self.content_type.find_field(name)\n value = self.localized_dynamic_attribute_value(field)\n\n case field.type\n when :date, :date_time\n value.is_a?(String) ? Chronic.parse(value) : value\n when :file\n value.present? ? { 'url' => value } : nil\n when :belongs_to\n field.klass.find_entry(value)\n when :has_many\n field.klass.find_entries_by(field.inverse_of, [self._label, self._permalink])\n when :many_to_many\n field.klass.find_entries_among(value)\n else\n # :string, :text, :select, :boolean, :email, :integer, :float, :tags\n value\n end\n end", "def read\n @_cache ||= (value = read_value) ? serializer_class.load(read_value) : {}\n end", "def field_value(field)\n field_config = blacklight_config.show_fields[field]\n Blacklight::ShowPresenter.new(@document, self).field_value field_config\n end", "def value_field\n \"text\"\n end", "def fetch_value(value); end", "def reader; end", "def get_field(name)\n self[name]\n end", "def get_string_field(field_name)\n\t\tend", "def typecast_attribute_for_read(attr_name, value)\n self\n .find_typecaster(attr_name)\n .from_api(value)\n end", "def getvalue\n @source.getvalue\n end", "def field_value(field, opt = nil)\n opt ||= {}\n super(field, opt.merge(raw: true, blacklight_config: configuration))\n end", "def field(p,field_name)\n f = p.fields.find {|f| f.name == field_name}\n if f.nil? then\n return nil\n else\n return f.value\n end\nend", "def reader_name\n self[:reader_name].read_string\n end", "def get_value_or_id(field)\n field = item_type.find_field(field) unless field.is_a? Field\n field.value_or_id_for_item(self)\n end", "def value_field\n BlacklightBrowseNearby::Engine.config.value_field\n end", "def getter\r\n @getter ||= Field.getter(@name)\r\n end", "def value\n @value ||= extract_value\n end", "def field_content(name)\n if field_exists?(name)\n value_by_key(@fields, name)\n else\n {}\n end\n end", "def field(key)\n pdf_field(key).getValueAsString\n rescue NoMethodError\n raise \"unknown key name `#{key}'\"\n end", "def read\n data_sources.each_member do |field_name, field_source|\n new_value = field_source.read\n set(field_name, new_value)\n if new_value\n last_known.set(field_name, new_value)\n end\n end\n end", "def get_value name\n get name\n end", "def raw_value; end", "def input\n @input ||= reader.read\n end", "def field(name); end", "def value\n record.send(name).value\n end", "def get_value\n value\n end", "def get_value\n value\n end", "def [](field_name)\n get(field_name)\n end", "def metadata_field_value(field, value)\n return (value == 'true' ? 'open' : 'restricted') if field[:metadata_name] == 'visibility'\n return value if field[:multivalued] == :no\n return [value] if field[:multivalued] == :yes\n return value.split(';') if value.present?\n []\n end", "def get_binary_field(field_name)\n\t\tend", "def valGetter\n \"#{DataMetaDom.getterName(@fld)}()\" + ( isMapping ? '.getKey()' : '')\n end", "def get_field_value(obj, name)\n begin\n @struct_field_getter.call(obj, name)\n rescue\n 0\n end\n end", "def fetch_field\n return nil if @field_index >= @fields.length\n ret = @fields[@field_index]\n @field_index += 1\n ret\n end", "def read(record, cursor)\n return :NULL if null?(record)\n cursor.name(type.name) { type.reader.read(record, cursor, length(record)) }\n end", "def read\n\t\t\t\t\tnil\n\t\t\t\tend", "def read_field(*args)\n m = 0\n args.flatten.each_with_index do |bit, i|\n if bit.is_a?(Integer)\n m |= ((@value[bit] || 0) << i)\n end\n end\n m\n end", "def read\n load_column(read_attribute)\n end", "def _read_attribute(key); end", "def parse_value; end", "def value\n parsed_value\n end", "def get_value\n @value\n end", "def get\n val\n end", "def get\n val\n end", "def field_value(name, field)\n placement_collection[name].collect{|entry| entry[field]}\n end", "def value\n return nil if @value.is_a? NilPlaceholder\n @value.nil? ? deserialize_value : @value\n end", "def read(io)\n @record_class.read(io)\n end", "def fetch\n @value\n end", "def read(cursor, field_length)\n cursor.name(@data_type.name) { cursor.read_bytes(field_length) }\n end", "def read_type(field_info)\n # if field_info is a Fixnum, assume it is a Thrift::Types constant\n # convert it into a field_info Hash for backwards compatibility\n if field_info.is_a? Fixnum\n field_info = {:type => field_info}\n end\n\n case field_info[:type]\n when Types::BOOL\n read_bool\n when Types::BYTE\n read_byte\n when Types::DOUBLE\n read_double\n when Types::I16\n read_i16\n when Types::I32\n read_i32\n when Types::I64\n read_i64\n when Types::STRING\n if field_info[:binary]\n read_binary\n else\n read_string\n end\n else\n raise NotImplementedError\n end\n end", "def read_attribute\n record.public_send(attribute)\n end" ]
[ "0.7273547", "0.70294005", "0.67918694", "0.67404556", "0.65841675", "0.6344593", "0.632313", "0.63162744", "0.6315854", "0.6307784", "0.62778014", "0.6255537", "0.6250033", "0.62345195", "0.6217381", "0.6055541", "0.6012342", "0.6012229", "0.6004448", "0.5990767", "0.5950257", "0.5936163", "0.5932686", "0.5912455", "0.5911089", "0.59087247", "0.5901454", "0.5884374", "0.58594185", "0.58462965", "0.58305275", "0.5830066", "0.582186", "0.58030725", "0.57914925", "0.5787518", "0.57823616", "0.57817596", "0.5779109", "0.57657874", "0.57485056", "0.57435495", "0.57280433", "0.5724877", "0.5721602", "0.5710396", "0.56985307", "0.56828207", "0.5681926", "0.567922", "0.56754065", "0.5674744", "0.5671791", "0.5670479", "0.5667012", "0.56544", "0.56510305", "0.564792", "0.56375474", "0.56194025", "0.56056195", "0.56044286", "0.5596316", "0.5571291", "0.55492294", "0.55491847", "0.5545392", "0.5535703", "0.5535242", "0.55162084", "0.5513423", "0.5511179", "0.550793", "0.550546", "0.55041534", "0.55038106", "0.5500575", "0.5500575", "0.55001324", "0.5498962", "0.5492249", "0.5489158", "0.5486457", "0.54762733", "0.547562", "0.54730517", "0.54686236", "0.5467785", "0.5467027", "0.5462011", "0.5460397", "0.545817", "0.5457757", "0.5457757", "0.5451082", "0.5436933", "0.5432828", "0.54264826", "0.54242027", "0.54208666", "0.5419913" ]
0.0
-1
Unregisters the webhook with Jive
def unregister_webhook require "open-uri" require "net/http" require "openssl" return if self.add_on.nil? # Can't do it without a token! return if self.oauth_token.nil? # Can't do it without a token! uri = URI.parse("#{self.add_on.jive_url}/api/core/v3/webhooks/#{self.webhook_id}") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Delete.new(uri.request_uri) request["Content-Type"] = "application/json" request["Authorization"] = "Bearer #{self.oauth_token.access_token}" response = http.request(request) # Need 2XX status code if !response.code.to_i.between?(200, 299) errors[:base] << "#{request.inspect} => #{response.body}" return false end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe_request_hook(name)\n EasyPost::Hooks.unsubscribe(:request, name)\n end", "def delete_webhook(target_url)\n Uploadcare::Webhook.delete(target_url)\n end", "def unsubscribe_response_hook(name)\n EasyPost::Hooks.unsubscribe(:response, name)\n end", "def unregisterHook\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n #redirect_to :controller=>\"room\", :action=> 'registerHook' #, :params[:registerHook].url => url, :params[:registerHook].token=>token\n\n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n result = am.unregisterHook()\n flash[:result] = \"unregisterHook result success: \" + result\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n end", "def destroy\n @webhook_endpoint.destroy\n respond_to do |format|\n format.html { redirect_to webhook_endpoints_url, notice: 'Webhook endpoint was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe_all_request_hooks\n EasyPost::Hooks.unsubscribe_all(:request)\n end", "def destroy\n @bitpay_webhook.destroy\n respond_to do |format|\n format.html { redirect_to bitpay_webhooks_url, notice: 'Bitpay webhook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @m_webhook.destroy\n respond_to do |format|\n format.html { redirect_to m_webhooks_url, notice: 'M webhook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe\n unregister\n end", "def unregister_stripe_webhook_if_necessary\n return unless previous_changes.include?(:stripe_secret_key)\n\n # secret key was changed\n\n # if we HAD a secret key\n if previous_changes[:stripe_secret_key][0].present?\n domain = default_url_options[:host]\n manager = StripeWebhook::Manager.new(previous_changes[:stripe_secret_key][0], domain)\n manager.unregister_callback\n end\n end", "def unregister\n user_to_be_removed = @event.users.find(current_user)\n if user_to_be_removed\n @event.users.delete(user_to_be_removed)\n end\n #flash[:notice] = \"Unregistered for #{@event.title}\"\n respond_to do |format|\n format.js\n end\n end", "def deregister_inbound_handler(handler)\n\t\t@inbound_handlers.delete(handler)\n\tend", "def unregister\n client.post('/v1/push/deregister', body: {\n uuid: user_id, device_id: id, push_type: type\n })\n end", "def delete_webhook(id)\n make_json_api_request :delete, \"v2/#{account_id}/webhooks/#{id}\"\n end", "def un_register\n unless @unregistered\n @unregistered = true\n RightLinkLog.info(\"SEND [un_register]\")\n @amq.fanout('registration', :no_declare => @options[:secure]).publish(@serializer.dump(UnRegister.new(@identity)))\n end\n true\n end", "def unsubscribe_all_response_hooks\n EasyPost::Hooks.unsubscribe_all(:response)\n end", "def unregister\n puts \"APN::Device.unregister\"\n http_delete(\"/api/device_tokens/#{self.token}\")\n end", "def app_uninstalled\n puts(\"yolo\")\n # data = request.body.read\n # # env[\"HTTP_X_SHOPIFY_HMAC_SHA256\"]\n # puts(\"Putsing REQUESTXXXXX\")\n # verified = verify_webhook(data, ENV[\"HTTP_X_SHOPIFY_HMAC_SHA256\"])\n json_obj = request.params.to_json\n # other_obj = request.to_json\n\n # puts(\"inspect\")\n # puts(params.inspect)\n\n puts(\"about to put the request params:\")\n # puts(json_obj)\n # puts(other_obj)\n\n if hmac_valid?(request.raw_post)\n puts(\"Valid hmac!!!\")\n puts(\"Valid hmac!!!2\")\n shop_domain = params['uninstall']['myshopify_domain']\n\n uninstall_call({\"shop_domain\" => shop_domain})\n\n return \"Complete\"\n else\n puts(\"not valid\")\n return head :unauthorized\n end\n end", "def unsubscribe()\n end", "def delete(id)\n Mailgun.submit :delete, webhook_url(id)\n end", "def remove(domain, action)\n fail Mailgun::ParameterError('Domain not provided to remove webhook from') unless domain\n fail Mailgun::ParameterError('Action not provided to identify webhook to remove') unless action\n @client.delete(\"domains/#{domain}/webhooks/#{action}\").to_h['message'] == 'Webhook has been deleted'\n rescue Mailgun::CommunicationError\n false\n end", "def user_cleaned_hook(hook_data)\n unsubscribe_hook(hook_data)\n end", "def unregister_middleware(key); end", "def unregister\n @is_registered = false\n self\n end", "def destroy_omniauth\n return redirect_to root_url unless is_admin\n\n shop_name = current_organization.oauth_uid\n token = current_organization.oauth_token\n current_organization.clear_omniauth\n Shopify::Webhooks::WebhooksManager.queue_destroy_webhooks(current_organization.uid, shop_name, token) unless shop_name.blank? || current_organization.uid.blank? || token.blank?\n\n redirect_to root_url\n end", "def on_twitter_engine_unregister_user(e, who)\n pre = '<Twitter::Engine>'\n @log.info(\"#{pre} Unregistering user: #{who} (xmpp).\")\n end", "def delete_webhook\n # find the next sprint using that webhook, and recreate webhook in that sprint.user's name\n # delete webhook if no other sprint is using that webhook\n if webhook\n webhook.sprints.count > 1 ? webhook.sprints.where.not(user: user)[0].post_webhook : webhook.destroy\n end\n user.delete_wh_by_sprint(self)\n end", "def unsubscribe; end", "def unsubscribe\n end", "def destroy\n @registration_request.destroy\n\n head :no_content\n end", "def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end", "def remove_webhook(project_id_or_key, webhook_id)\n delete(\"projects/#{project_id_or_key}/webhooks/#{webhook_id}\")\n end", "def unsubscribe()\n \n end", "def destroy\n @hookup = Hookup.find(params[:id])\n @hookup.destroy\n\n respond_to do |format|\n format.html { redirect_to(hookups_url) }\n format.xml { head :ok }\n end\n end", "def remove_registration\n reg = Iq.new_register\n reg.to = jid.domain\n reg.query.add(REXML::Element.new('remove'))\n send_with_id(reg)\n end", "def unpost\n Rentlinx.client.unpost(type, send(identity))\n end", "def unsubscribed\n end", "def unsubscribed\n end", "def send_webhooks(user, answer)\n answer_remove_list(answer, user)\n end", "def unregister username = nil, &block\n\t\t\traise NotVerifiedError.new unless @verified\n\n\t\t\tusername ||= @username\n\n\t\t\t@request_queue.delete \"/api/#{username}/config/whitelist/#{username}\", :registration, 6 do |response|\n\t\t\t\tstatus, result = check_json response\n\n\t\t\t\tif @username == username && status\n\t\t\t\t\t@registered = false\n\t\t\t\t\t@username = nil\n\t\t\t\t\tBridge.notify_bridge_callbacks self, false\n\t\t\t\tend\n\n\t\t\t\tyield status, result\n\t\t\tend\n\t\tend", "def unregister(event_type, body, opts = {})\n data, _status_code, _headers = unregister_with_http_info(event_type, body, opts)\n return data\n end", "def unsubscribe(key)\n @lock.synchronize do\n @handlers.clear\n @@name2inst.delete_if { |k, v| k == id.to_sym || k == address.to_sym}\n end\n end", "def unregister(context)\n raise \"Cannot unregister out without a user context.\" if context.nil?\n \n @response = client.request :user, :unregister do\n soap.element_form_default = :unqualified \n soap.namespaces[\"xmlns:login\"] = 'http://login.ext.soap.yodlee.com'\n\n soap.body = {\n :user_context => context \n }\n end\n\n @user_context = nil\n end", "def delete_webhook_with_token(webhook_id, webhook_token)\n route = Route.new(:DELETE, '/webhooks/%{webhook_id}/%{webhook_token}',\n webhook_id: webhook_id, webhook_token: webhook_token)\n request(route)\n end", "def destroy\n @register_signal.destroy\n respond_to do |format|\n format.html { redirect_to register_signals_url, notice: 'Register signal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_hook!\n client.remove_hook(full_name, github_hook_id)\n\n self.github_hook_id = nil\n end", "def unregister\n \n @event = Event.find(params[:id])\n #@user = User.find(params[:userid])\n @event.users.delete(@current_user)\n\n # Redirect to the action \"show\"\n redirect_to :action => :show, :id => @event\n # Redirect to the action \"users\"\n # Redirect to /event/1/users for event id 1\n #redirect_to :action => :users, :id => @event\n end", "def after_shopify_auth\n # shopify_session do\n # create an uninstall webhook, this webhook gets sent\n # when your app is uninstalled from a shop. It is good\n # practice to clean up any data from a shop when they\n # uninstall your app:\n\n # uninstall_webhook = ShopifyAPI::Webhook.new(\n # topic: 'app/uninstalled',\n # address: \"#{base_url}/uninstall\",\n # format: 'json'\n # )\n # begin\n # uninstall_webhook.save!\n # rescue => e\n # raise unless uninstall_webhook.persisted?\n # end\n # end\n end", "def deregister_event_handlers\n\t\tframework.events.remove_session_subscriber(self)\n\tend", "def delete_by_uuid uuid\n deliberately_unscoped(Webhook).where(uuid: uuid).destroy\n end", "def unsubscribe\n email = Base64.decode64(params[:token])\n Subscription.where(email: email).destroy_all\n end", "def unregister_action(action, path)\n unless @channels[path].nil?\n Triggers.un_add @channels[path], action\n end\n end", "def unregister(symbol); end", "def unregister\n exclusively do\n SendReceive::Tokens.free(send_log.token) if send_log\n end\n end", "def successful_unsubscribe\n end", "def unsubscribed\n\tend", "def unsubscribe_from_channel; end", "def unbind\n @gateway_handler.disconnect(self)\n end", "def destroy\n @hook = Hook.find(params[:id])\n @hook.destroy\n respond_with(@hook)\n end", "def unregister(object)\n\t\t\t@registered.delete(object)\n\t\tend", "def destroy_omniauth\n organization = Maestrano::Connector::Rails::Organization.find_by_id(params[:organization_id])\n if organization && is_admin?(current_user, organization)\n shop_name = organization.oauth_uid\n token = organization.oauth_token\n organization.oauth_uid = nil\n organization.oauth_token = nil\n organization.refresh_token = nil\n organization.sync_enabled = false\n organization.save\n Shopify::Webhooks::WebhooksManager.queue_destroy_webhooks(organization.uid, shop_name, token) unless shop_name.blank? || organization.uid.blank? || token.blank?\n end\n\n redirect_to root_url\n end", "def destroy\n @user_event.destroy\n respond_to do |format|\n format.html { redirect_to user_events_url, notice: 'User event was successfully unregistered.' }\n format.json { head :no_content }\n end\n end", "def remove_badge!\n self.badge_token = nil\n self.badge_token_set_at = nil\n self.save!\n end", "def unsubscribe\n if Friend.unsubscribe_friend(params[:requestor], params[:target])\n render json: {\n success: true\n }\n else\n render json: {\n success: false\n }\n end\n end", "def destroy\n log_failure do\n handler.destroy\n end\n end", "def destroy\n @twodstructureregion.destroy\n respond_to do |format|\n format.html { redirect_to twodstructureregions_url, notice: 'Twodstructureregion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unregister_action(action, path=BASE_PATH)\n @instance.unregister_action action, path\n end", "def destroy\n @lcb_registry.destroy\n respond_to do |format|\n format.html { redirect_to lcb_registries_url, notice: 'Lcb registry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unsave\n post(\"/api/unsave\", id: fullname)\n end", "def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end", "def destroy\n @event.bundles.delete(@bundle)\n redirect_to :back\n end", "def stop_registering_extension\n @register_path = nil\n end", "def unregister(*extensions); end", "def delete(id)\n _params = {:id => id}\n return @master.call 'webhooks/delete', _params\n end", "def unregister_from_event_loop\n if @loop == :em\n @em_connection.unattach(false)\n else\n raise NotImplementedError.new(\"unregister_from_event_loop not implemented for #{@loop}\")\n end\n end", "def unsubscribe\n logger.info \"Loading MemberSubscriber unsubscribe action - remote\"\n @subscriber = @current_resource\n logger.debug \"Subscriber attributes hash: #{@subscriber.attributes.inspect}\" if @subscriber\n @merchant_store = MerchantStore.find(@subscriber.merchant_store.id)\n logger.debug \"Merchant-store attributes hash: #{@merchant_store.attributes.inspect}\" if @merchant_store\n if @subscriber.present? && @merchant_store.present?\n logger.debug \"Subscriber found in database. Starting unsubscribe process: #{@subscriber.attributes}\"\n if @subscriber.destroy\n logger.debug \"Unsubscribe completed successfully: #{@subscriber.attributes}\"\n #Send opt-out e-mail to member\n MemberMailer.delay.web_opt_out(@subscriber.member.id, @merchant_store.id)\n logger.debug \"Sending delayed unsubscribe email to member\"\n else\n logger.debug \"Error unsubscribing via Google Maps\" \n logger.fatal \"Error unsubscribing via Google Maps\" \n end\n end\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js \n end\n end", "def destroy\n @event_registration.destroy\n respond_to do |format|\n format.html { redirect_to event_registrations_path}\n format.json { head :no_content }\n end\n end", "def agent_logoff\n begin\n queue = PbxQueue.where(:name => params[:queue])[0]\n agent = User.find(params[:agent_id])\n @pbxis_ws.log_off agent.extension, queue.name\n rescue => e\n flash[:alert] = e.message\n end\n \n respond_to do |format|\n format.js\n end\n end", "def unsubscribe(cls)\n @subscribers.delete(name)\n end", "def destroy\n @registration.destroy\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def destroy\n @registration.destroy\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_push_key.destroy\n respond_to do |format|\n format.html { redirect_to user_push_keys_url, notice: 'User push key was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe(&blk)\n pres = connection.presence_stanza('to'=>jid.bare, 'type' => 'unsubscribe')\n connection.send_stanza pres, &blk\n end", "def destroy\n # Send goodbye email\n YamrsMailer.goodbye_email(@user).deliver\n @user.destroy\n cookies.delete(:auth_token)\n respond_to do |format|\n format.html { redirect_to '/', notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unsubscribe_all\n send_action('unsubscribe_all')\n end", "def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end", "def unregister\n begin\n if @user.unregister_device(params[:id])\n render json_status_response(200, \"Device unregistered successfully\")\n else\n render json_status_response(404, \"Device not found\")\n end\n rescue Redis::CannotConnectError\n render json_status_response(500, \"Registration server error. Please \" <<\n \"let me know at dange -at- seas.upenn.edu\")\n end\n end", "def destroy\n @payload.destroy\n respond_to do |format|\n format.html { redirect_to payloads_url, notice: 'Payload was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def unregister_message_handler(message)\n @messages.delete(message)\n end", "def disconnect(request, _unused_call)\n if @register.token == request.token\n @register.disconnect\n return Binocular::Comm::UnregisterResponse.new\n end\n raise GRPC::BadStatus.new(GRPC::Core::StatusCodes::INVALID_ARGUMENT, \"The provided token does not match with the one provided by the gateway!\")\n end", "def destroy\n @registry = Registry.find(params[:id])\n @registry.destroy\n logger.info \"*-*-*-*-* #{@registry.name} deleted by #{@user.name}.\"\n\n respond_to do |format|\n format.html { redirect_to( user_gifts_url(@user)) }\n format.xml { head :ok }\n end\n end", "def unsubscribed; end", "def unsubscribed\n @attributes[:unsubscribed]\n end", "def destroy\n # remove integrations from user\n begin\n current_user.integrations.delete(@integration)\n\n # remove integrations from agents\n current_user.agents.each do |agent|\n agent.integrations.delete(@integration)\n end\n\n # remove integrations from templates\n current_user.templates.each do |template|\n template.integrations.delete(@integration)\n end\n\n # remove integration\n @integration.destroy\n rescue Exception => e\n Services::Slog.exception e\n end\n\n respond_to do |format|\n format.html { redirect_to integrations_url }\n format.json { head :no_content }\n end\n end", "def sign_out\n @token.destroy\n render json: { message: 'Sign-out successfully' }, status: :ok\n end", "def register_webhook\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\turi = URI.parse(\"#{self.add_on.jive_url}/api/core/v3/webhooks\")\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\t#http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n\t\t\t\t\trequest = Net::HTTP::Post.new(uri.request_uri)\n\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest[\"Authorization\"] = \"Bearer #{self.oauth_token.access_token}\"\n\n\t\t\t\t\tbody = {\n\t\t\t\t\t\t\"callback\" => self.callback,\n\t\t\t\t\t\t\"object\" => self.object,\n\t\t\t\t\t}\n\t\t\t\t\tbody[\"events\"] = self.events if !self.events.to_s.empty?\n\n\t\t\t\t\trequest.body = body.to_json\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Need 2XX status code\n\t\t\t\t\tif !response.code.to_i.between?(200, 299)\n\t\t\t\t\t\terrors[:base] << \"#{request.inspect} => #{response.body}\"\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\tjson_body = JSON.parse(response.body)\n\n\t\t\t\t\tself.webhook_id = json_body[\"id\"]\n\n\t\t\t\t\ttrue\n\t\t\t\tend", "def destroy\n @openfire_user.destroy\n respond_to do |format|\n format.html { redirect_to openfire_users_url(:tache=>\"rem\") }\n end\n end", "def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end", "def unsubscribe\n @issue.skip_email_notifications = true\n @issue.unsubscribe(current_user)\n render 'issues/update.js.erb', locals: {project: @project, key: @key, translation: @translation, issue: @issue }\n end", "def forget\n Forgotten.new(@object, @remote_key)\n end" ]
[ "0.6840325", "0.6647022", "0.64943475", "0.64802325", "0.6425156", "0.6414358", "0.64120054", "0.64065605", "0.63679594", "0.6276741", "0.62552524", "0.62387514", "0.623862", "0.62308806", "0.61917335", "0.6186117", "0.6183866", "0.6099072", "0.60828346", "0.6080911", "0.60728943", "0.6064133", "0.6033521", "0.60170585", "0.60161984", "0.59966135", "0.5994762", "0.5983008", "0.5964398", "0.5954033", "0.593651", "0.5928145", "0.59209377", "0.5887809", "0.5887196", "0.5877242", "0.585401", "0.585401", "0.58522874", "0.58475864", "0.58120537", "0.5808772", "0.580226", "0.5790152", "0.5749989", "0.57213324", "0.57076156", "0.5691478", "0.56860054", "0.56782377", "0.56768596", "0.5672702", "0.56696576", "0.5666074", "0.5665765", "0.5658643", "0.5635359", "0.5619286", "0.5610023", "0.560324", "0.5599746", "0.55995995", "0.55900335", "0.5589945", "0.5580697", "0.55730915", "0.55726635", "0.55687696", "0.55684435", "0.5564229", "0.5562934", "0.5558866", "0.55569106", "0.55460703", "0.55385053", "0.5536279", "0.5522603", "0.5514877", "0.55136204", "0.5513361", "0.5513361", "0.55067825", "0.5500096", "0.54987556", "0.5491845", "0.5491375", "0.54906726", "0.5480814", "0.54770875", "0.5473764", "0.54667157", "0.5463015", "0.5460097", "0.54536486", "0.54480845", "0.5446074", "0.5445951", "0.5437978", "0.54376256", "0.54322934" ]
0.7900918
0
Registers the webhook with Jive
def register_webhook require "open-uri" require "net/http" require "openssl" uri = URI.parse("#{self.add_on.jive_url}/api/core/v3/webhooks") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true #http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Post.new(uri.request_uri) request["Content-Type"] = "application/json" request["Authorization"] = "Bearer #{self.oauth_token.access_token}" body = { "callback" => self.callback, "object" => self.object, } body["events"] = self.events if !self.events.to_s.empty? request.body = body.to_json response = http.request(request) # Need 2XX status code if !response.code.to_i.between?(200, 299) errors[:base] << "#{request.inspect} => #{response.body}" return false end json_body = JSON.parse(response.body) self.webhook_id = json_body["id"] true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_webhook(project_id_or_key, name, hook_url, params = {})\n params[:name] = name\n params[:hook_url] = hook_url\n post(\"projects/#{project_id_or_key}/webhooks\", params)\n end", "def webhook\n @config = ZipMoney::Configuration \n @_webhook = ZipMoney::WebHook if @_webhook.nil?\n @_webhook\n end", "def post_webhook\n HTTParty.post(\n \"https://api.trello.com/1/tokens/#{user.token}/webhooks/?key=#{ENV['TRELLO_KEY']}\",\n query: {\n description: \"Sprint webhook user#{user.id}\",\n callbackURL: \"#{ENV['BASE_URL']}webhooks\",\n idModel: trello_ext_id\n },\n headers: { \"Content-Type\" => \"application/json\" }\n )\n end", "def webhooks\n @webhooks ||= WebhookRegistry.new\n end", "def initialize webhook\n @nfe_webhook = @nfe_account.nfe_webhook\n @webhook = webhook\n \n response = update\n end", "def create\n Webhook.log(params)\n \n render text: \"\\nhello chargify\\n\\n\", layout: false, status: 200, :content_type => 'application/xml'\n\n # respond_to do |format|\n # if @webhook.save\n # format.html { redirect_to @webhook, notice: 'Webhook was successfully created.' }\n # format.json { render json: @webhook, status: :created, location: @webhook }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @webhook.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def webhook\r\n WebhookController.instance\r\n end", "def create_hook!\n hook = client.create_hook(\n full_name,\n 'web',\n {\n url: Constants::HOOK_URL,\n content_type: 'json'\n },\n {\n events: ['release'],\n active: true\n }\n )\n\n self.github_hook_id = hook.id\n end", "def send_webhook!(tag)\n response = Net::HTTP.post(\n URI(\"https://webhook.site/b069a239-60dd-47ec-9dba-1f4295639a8d\"),\n { tag: tag.name }.to_json,\n \"Content-Type\": \"application/json\"\n )\n\n raise WebhookError unless response.is_a?(Net::HTTPSuccess)\n end", "def webhook(request)\n WebHook.new(request, self)\n end", "def register_webhook!(trigger, name, url)\n trigger = trigger.to_s.camelize(:lower).to_sym\n raise ArgumentError, \"Invalid hook trigger #{trigger}\" unless ALLOWED_HOOKS.include?(trigger)\n if trigger == :function\n response = client.fetch_function(name)\n # if it is either an error (which has no results) or there is a result but\n # no registered item with a URL (which implies either none registered or only cloud code registered)\n # then create it.\n if response.results.none? { |d| d.has_key?(\"url\") }\n response = client.create_function(name, url)\n else\n # update it\n response = client.update_function(name, url)\n end\n warn \"Webhook Registration warning: #{response.result[\"warning\"]}\" if response.result.has_key?(\"warning\")\n warn \"Failed to register Cloud function #{name} with #{url}\" if response.error?\n return response\n else # must be trigger\n response = client.fetch_trigger(trigger, name)\n # if it is either an error (which has no results) or there is a result but\n # no registered item with a URL (which implies either none registered or only cloud code registered)\n # then create it.\n if response.results.none? { |d| d.has_key?(\"url\") }\n # create it\n response = client.create_trigger(trigger, name, url)\n else\n # update it\n response = client.update_trigger(trigger, name, url)\n end\n\n warn \"Webhook Registration warning: #{response.result[\"warning\"]}\" if response.result.has_key?(\"warning\")\n warn \"Webhook Registration error: #{response.error}\" if response.error?\n return response\n end\n end", "def create_webhook(post_url, include_received_email, events)\n include_received_email = include_received_email ? true : false\n url = \"v2/#{account_id}/webhooks\"\n\n make_json_api_request :post, url, private_generate_resource(\n \"webhooks\",\n {\n \"post_url\" => post_url,\n \"include_received_email\" => include_received_email,\n \"events\" => events\n }\n )\n end", "def webhook\n\t\tpayload = {event: params, company_id: params[:company_id]}\n\t\tBraintree::WebhookService.new.instrument(payload)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend", "def create\n @m_webhook = MWebhook.new(m_webhook_params)\n\n respond_to do |format|\n if @m_webhook.save\n format.html { redirect_to @m_webhook, notice: 'M webhook was successfully created.' }\n format.json { render :show, status: :created, location: @m_webhook }\n else\n format.html { render :new }\n format.json { render json: @m_webhook.errors, status: :unprocessable_entity }\n end\n end\n end", "def on(webhook, &block)\n webhooks.on(webhook, &block)\n end", "def send_incoming_webhook(key, feature, channel_id)\n payload = $redis.get(\"payload:#{key}\")\n if payload.nil?\n payload = {\n :text => \"\"\n }\n attachments = []\n attachments << build_attachment(key, feature)\n payload[:attachments] = attachments\n $redis.setex(\"payload:#{key}\", 60*60*24, payload.to_json)\n else\n payload = JSON.parse(payload)\n end\n payload[:channel] = channel_id\n HTTParty.post(ENV[\"INCOMING_WEBHOOK_URL\"], :body => payload.to_json)\nend", "def create\n @webhook_endpoint = WebhookEndpoint.new(webhook_endpoint_params)\n\n respond_to do |format|\n if @webhook_endpoint.save\n format.html { redirect_to @webhook_endpoint, notice: 'Webhook endpoint was successfully created.' }\n format.json { render :show, status: :created, location: @webhook_endpoint }\n else\n format.html { render :new }\n format.json { render json: @webhook_endpoint.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tStripe::WebhookService.new.instrument(params)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend", "def create_webhook(channel_id, name: :undef, avatar: :undef)\n avatar_data = if avatar != :undef && !avatar.nil?\n \"data:#{avatar.content_type};base64,#{Base64.encode64(avatar.io.read)}\"\n else\n :undef\n end\n json = filter_undef({ name: name, avatar: avatar_data })\n route = Route.new(:POST, '/channels/%{channel_id}/webhooks', channel_id: channel_id)\n request(route, json: json)\n end", "def add_hook(url)\n post(\"/hooks\", :body => {:url => url})\n end", "def set_webhook\n @webhook = Webhook.find(params[:id])\n end", "def set_webhook\n @webhook = Webhook.find(params[:id])\n end", "def create(domain, action, url = '')\n res = @client.post(\"domains/#{domain}/webhooks\", id: action, url: url)\n res.to_h['webhook']['url'] == url && res.to_h['message'] == 'Webhook has been created'\n end", "def create\n if !valid_signatures?\n render json: { message: \"Invalid sigs\" }, status: 400\n return\n end\n #idempotent\n if !WebhookEvent.find_by(source: params[:source], external_id: external_id).nil?\n render json: { message: \"Already processed #{ external_id }\"}\n return\n end\n\n event = WebhookEvent.create(webhook_params)\n ProcessEventsJob.perform_later(event.id) \n render json: params\n end", "def webhook url\n @webhook_uri = url\n end", "def send_webhook\n config = Rails.application.config_for(:webhooks)\n\n return unless config.webhooks\n\n config.webhooks.each do |_k, webhook|\n next if webhook.nil?\n\n url = URI(webhook)\n headers = { 'content-type' => 'application/json' }\n payload = {\n 'job_id' => id,\n 'job_type' => kind,\n 'status' => status,\n 'results' => results.count\n }.to_json\n res = Net::HTTP.post(URI(url), payload, headers)\n\n res.code\n end\n end", "def create_webhook(target_url, event: 'file.uploaded', is_active: true, signing_secret: nil)\n options = { target_url: target_url, event: event, is_active: is_active, signing_secret: signing_secret }\n Uploadcare::Webhook.create(**options.compact)\n end", "def create_webhook(access_token:, events:)\n client(token: access_token).post(\n 'v1/webhooks',\n {\n url: \"#{ENV['APP_URL']}/webhooks\",\n events: events\n }.to_json\n )\n end", "def create\n @hook = Hook.new(params[:hook])\n @hook.save\n respond_with(@hook)\n end", "def create(id, url=default_webhook_url)\n params = {:id => id, :url => url}\n Mailgun.submit :post, webhook_url, params\n end", "def create_webhook(repo, config = {}, options = {})\n opts = options.dup\n opts[:config] = config\n raise Octokit::MissingKey unless config.key? :url\n\n post \"#{Repository.path repo}/hooks\", opts\n end", "def register_stripe_webhook_if_necessary\n return unless previous_changes.include?(:stripe_secret_key)\n\n # secret key was changed\n\n # we HAVE a secret_key\n if stripe_secret_key.present?\n domain = default_url_options[:host]\n manager = StripeWebhook::Manager.new(stripe_secret_key, domain)\n result = manager.register_callback\n update(stripe_webhook_secret: result.secret)\n end\n end", "def create\n processor = Mandrill::WebHook::Processor.new(params, self)\n processor.on_unhandled_mandrill_events = self.class.on_unhandled_mandrill_events!\n processor.run!\n head(:ok)\n end", "def create\n payload_body = request.body.read\n unless verify_signature?(payload_body, request.env['HTTP_X_HUB_SIGNATURE'], Rails.application.secrets.github_webhook_encryption_key)\n raise \"Signatures didn't match: #{request.env['HTTP_X_GITHUB_DELIVERY']}\"\n end\n payload = parse_payload(payload_body)\n resource = resolve_webhook(request.env['HTTP_X_GITHUB_EVENT'], payload)\n unless resource\n raise \"Unsupported event detected: #{request.env['HTTP_X_GITHUB_DELIVERY']}: #{request.env['HTTP_GITHUB_EVENT']}\"\n end\n respond_to do |format|\n if resource.save_or_destroy(action: payload.action)\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: {}, status: :unprocessable_entity }\n end\n end\n end", "def notify_after_create\n NotifyJob.perform('create', self) if web_hook_actions.include? :create\n end", "def create_webhook room_name, hook_name, event, url, pattern:nil\n post_body = {\n url: url,\n event: event,\n name: hook_name\n }\n\n if event == 'room_message' && pattern\n post_body['pattern'] = pattern\n end\n\n response = self.class.post \"/room/#{room_name}/webhook\", body: post_body.to_json\n response.parsed_response['id']\n end", "def create\n @bitpay_webhook = BitpayWebhook.new(bitpay_webhook_params)\n\n respond_to do |format|\n if @bitpay_webhook.save\n format.html { redirect_to @bitpay_webhook, notice: 'Bitpay webhook was successfully created.' }\n format.json { render :show, status: :created, location: @bitpay_webhook }\n else\n format.html { render :new }\n format.json { render json: @bitpay_webhook.errors, status: :unprocessable_entity }\n end\n end\n end", "def insert_webhook(webhook, opts = {})\n data, _status_code, _headers = insert_webhook_with_http_info(webhook, opts)\n data\n end", "def create_hook(repository, callback_url)\n return unless self.class.enable_hook?\n hook = client.create_hook(repository.full_name, 'web',\n {url: callback_url, content_type: 'json'},\n events: ['push'], active: true)\n yield hook if block_given?\n hook\n rescue Octokit::UnprocessableEntity => e\n if e.message.include? 'Hook already exists'\n true\n else\n raise\n end\n end", "def webhooks\n @webhooks_manager\n end", "def register\n logger.info params.inspect\n message = MySlack::People.register(params[:user_id])\n\n render json: message\n end", "def webhook_params\n params.require(:webhook).permit(:request)\n end", "def add_webhook(wallet_id: default_wallet_id, type:, url:, confirmations: 0)\n add_webhook_params = {\n type: type,\n url: url,\n numConfirmations: confirmations\n }\n call :post, '/wallet/' + wallet_id + '/webhooks', add_webhook_params\n end", "def update\n webhook.update(webhook_params)\n respond_with(webhook)\n end", "def webhook(id)\n make_json_api_request :get, \"v2/#{account_id}/webhooks/#{id}\"\n end", "def confirm_webhook\n render :json => \"ok\", :status => 200\n end", "def webhook_params\n params.permit(:id, :webhook_id, :url)\n end", "def set_webhook_endpoint\n @webhook_endpoint = WebhookEndpoint.find(params[:id])\n end", "def webhook\n puts \"webhook params: #{params.inspect}\"\n if GoCardless.webhook_valid?(params[:payload])\n render :text => \"true\", :status => 200\n else\n render :text => \"false\", :status => 403\n end\n end", "def set_webhook_endpoint\n @webhook_endpoint = WebhookEndpoint.find(params[:id])\n end", "def unregister_webhook\n\t\t\t\t\trequire \"open-uri\"\n\t\t\t\t\trequire \"net/http\"\n\t\t\t\t\trequire \"openssl\"\n\n\t\t\t\t\treturn if self.add_on.nil? # Can't do it without a token!\n\t\t\t\t\treturn if self.oauth_token.nil? # Can't do it without a token!\n\n\t\t\t\t\turi = URI.parse(\"#{self.add_on.jive_url}/api/core/v3/webhooks/#{self.webhook_id}\")\n\t\t\t\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\t\t\thttp.use_ssl = true\n\n\t\t\t\t\trequest = Net::HTTP::Delete.new(uri.request_uri)\n\n\t\t\t\t\trequest[\"Content-Type\"] = \"application/json\"\n\t\t\t\t\trequest[\"Authorization\"] = \"Bearer #{self.oauth_token.access_token}\"\n\n\t\t\t\t\tresponse = http.request(request)\n\n\t\t\t\t\t# Need 2XX status code\n\t\t\t\t\tif !response.code.to_i.between?(200, 299)\n\t\t\t\t\t\terrors[:base] << \"#{request.inspect} => #{response.body}\"\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\ttrue\n\t\t\t\tend", "def set_webhook_subscription(id)\n\t\tputs \"Setting subscription for 'host' account for webhook id: #{id}\"\n\n\t\turi_path = \"#{@twitter_api.uri_path}/webhooks/#{id}/subscriptions.json\"\n\t\tresponse = @twitter_api.make_post_request(uri_path, nil)\n\t\t\n\t\tif response == '204'\n\t\t\tputs \"Webhook subscription for #{id} was successfully added.\"\n\t\telse\n\t\t\tputs response\n\t\tend\n\n response\n\tend", "def set_webhook_identifier(response)\n\t\t\n\tend", "def update\n webhook.update_attributes(webhook_params)\n respond_with(webhook)\n end", "def webhooks\n \n data = JSON.parse(params['json'])\n# puts \"\"\n# puts data.inspect\n # if it's an authorization webhook.\n if data['type'].include?(\"member.authorization\")\n\n # fetch the user for this webhook.\n user = User.find_by(kpass_id: data['data']['object']['member']['id'])\n \n # if we found the user in our sample app..\n if user.present?\n \n\n # if the webhook is telling us they've been approved..\n if data['type'] == \"member.authorization.approved\"\n\n # for some reason if we save user with password the session is kicked out\n\n\n # update the username of the user, since we should have access to it now\n user.username = data['data']['object']['member']['username']\n # user.password = 'batterypop' #devise throws exception without a password upon save\n user.birthday = data['data']['object'][\"member\"][\"birthday\"]\n user.gender = data['data']['object'][\"member\"][\"gender\"]\n user.username_avatar_age_gender = data['data']['object'][\"keys\"][\"username_avatar_age_gender\"]\n user.access_to_moderated_chats = data['data']['object'][\"keys\"][\"access_to_moderated_chats\"]\n user.youtube_and_3rdparty_videos = data['data']['object'][\"keys\"][\"batterypop_youtube_and_3rdparty_videos\"]\n user.publish_public_profile = data['data']['object'][\"keys\"][\"batterypop_publish_public_profile\"]\n\n user.save\n\n\n\n # if the webhook is telling us that our authorization has been revoked..\n elsif data['type'] == \"member.authorization.revoked\"\n\n # destroy the user.\n # user.destroy\n anonymize_user(user)\n\n # if the webhook is telling us that the parent of an under-13 user has\n # denied our ability to see personal information for this user..\n elsif data['type'] == \"member.authorization.rejected\"\n\n # destroy the user.\n # user.destroy\n anonymize_user(user)\n end\n\n end\n\n end\n\n # communicate back to kpass that we've received the webhook.\n render json: [true]\n\n end", "def add_hooks(repo, endpoint)\n hook = api.create_hook(\n repo,\n 'web',\n {\n url: endpoint,\n secret: ENV['GITHUB_SECRET_TOKEN']\n },\n {\n events: %w(push pull_request), active: true,\n }\n )\n\n yield hook.id\n rescue Octokit::UnprocessableEntity => error\n raise unless error.message.include? 'Hook already exists'\n end", "def webhook_url\n return @config[ :webhook ]\n end", "def receive\n # I chose to store the whole webhook response, as well as breaking out\n # certain pieces of it into columns on the Webhooks model. IMO, it makes\n # things a bit more easy to read and work with.\n\n # Storing the whole webhook might not be the best solution here, but in\n # the future, if something from the original webhook was needed, we have\n # record of it and can find/work with it.\n data = JSON.parse(request.body.read)\n event = data['payload']['event']\n event_name = data['payload']['event_type']['name']\n start_time = event['start_time']\n end_time = event['end_time']\n\n canceled = event['canceled']\n canceler = event['canceler_name']\n cancel_reason = event['cancel_reason']\n canceled_at = event['canceled_at']\n\n invitee = data['payload']['invitee']\n invitee_name = invitee['name']\n invitee_email = invitee['email']\n\n Webhook.create(\n data: data.as_json, \n canceled: canceled,\n event_name: event_name,\n start_time: start_time,\n end_time: end_time,\n canceler: canceler,\n cancel_reason: cancel_reason,\n canceled_at: canceled_at,\n invitee_name: invitee_name,\n invitee_email: invitee_email)\n end", "def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n create_client_webhook_setting\n\n success_with_data(webhook: @client_webhook_setting.get_hash)\n end", "def create\n megam_rest.post_event(to_hash)\n end", "def subscribe_request_hook(name = SecureRandom.hex.to_sym, &block)\n EasyPost::Hooks.subscribe(:request, name, block)\n end", "def create\n super(template: 'webhooks/index')\n end", "def webhook_endpoint_params\n params.require(:webhook_endpoint).permit!\n end", "def webhook_payload\n {}\n end", "def push name='create'\n \n end", "def register\n \n end", "def modify_webhook_with_token(webhook_id, webhook_token, name: :undef, avatar: :undef, channel_id: :undef)\n avatar_data = if avatar != :undef && !avatar.nil?\n \"data:#{avatar.content_type};base64,#{Base64.encode64(avatar.io.read)}\"\n else\n :undef\n end\n json = filter_undef({ name: name, avatar: avatar_data, channel_id: channel_id })\n route = Route.new(:PATCH, '/webhooks/%{webhook_id}/%{webhook_token}',\n webhook_id: webhook_id, webhook_token: webhook_token)\n request(route, json: json)\n end", "def webhook_endpoint_params\n params.require(:webhook_endpoint).permit(:url, :auth_type, :auth_token, :secret)\n end", "def webhook_response\n # if get request, checks if it is the subscription call\n # if it is, echoes back the hub.challenge token\n if request.get?\n params = request.query_parameters\n\n if params['hub.mode'] == 'subscribe' && params['hub.verify_token'] == ENV['VERIFICATION_TOKEN']\n render json: { 'hub.challenge': params['hub.challenge'] }, status: :ok\n else\n raise 'Bad Request'\n end\n\n # if post request, checks if it is an activity creation post\n elsif request.post?\n params = request.request_parameters\n\n if params['object_type'] == 'activity' && params['aspect_type'] == 'create'\n # potentially should make it only change if the name is one of the default ones, so custom names won't be overriden\n this_user = User.find(params['owner_id'])\n this_user.update_user_token!(@client)\n\n user_client = this_user.generate_user_client\n\n updated_activity = user_client.update_activity(\n id: params['object_id'],\n name: Quote.order(\"RANDOM()\").first.format_quote\n )\n render json: {}, status: :ok\n else\n render json: {}, status: :ok\n end\n else\n raise 'Bad Request'\n end\n end", "def registerHook\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n url = params[:registerhook][\"url\"]\n token = params[:registerhook][\"token\"]\n\n #redirect_to :controller=>\"room\", :action=> 'registerHook' #, :params[:registerHook].url => url, :params[:registerHook].token=>token\n \n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n result = am.registerHook(url, token)\n flash[:result] = \"registerHook result success: \" + result\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n end", "def create_trigger(hook_id:, project_id:, trigger_body:)\n url = \"#{@base_url}/vapid/webhooks/hooks/#{hook_id}/triggers?project_id=#{project_id}\"\n res = HTTParty.post(url, body: trigger_body.to_json, headers: procore_headers(token: @customer_info[:token], company_id: @customer_info[:company_id]) ) # returns HTTParty object {code, response}\n if res.code == 201\n res\n else\n raise StandardError.new({message: 'Error Creating Hook', data: res})\n end \n end", "def set_webhook_subscription(id)\n\t\tputs \"Setting subscription for 'host' account for webhook id: #{id}\"\n\n\t\tif @api_tier == 'premium'\n\t\t\t@uri_path = \"#{@uri_path}/all/#{id}/subscriptions.json\"\n\t\telse\n\t\t\t@uri_path = \"#{@uri_path}/webhooks/#{id}/subscriptions/all.json\"\n\t\tend\n\n\t\tresponse = @twitter_api.make_post_request(@uri_path, nil)\n\t\t\n\t\tif response == '204'\n\t\t\tputs \"Webhook subscription for #{id} was successfully added.\"\n\t\telse\n\t\t\tputs response\n\t\tend\n\n response\n\tend", "def register\n end", "def register\n end", "def register\n end", "def telegram_webhook(controller, bot = :default, **options)\n bot = Client.wrap(bot)\n params = {\n to: Middleware.new(bot, controller),\n as: RoutesHelper.route_name_for_bot(bot),\n format: false,\n }.merge!(options)\n post(\"telegram/#{RoutesHelper.escape_token bot.token}\", params)\n UpdatesPoller.add(bot, controller) if Telegram.bot_poller_mode?\n end", "def create\n # Shopify passes the shop domain (aka uid) as an environment variable,\n # not as part of the request body.\n shop_uid = request.env['HTTP_X_SHOPIFY_SHOP_DOMAIN']\n\n Rails.logger.info(\"Shopify webook received for shop '#{shop_uid}'\")\n\n shop = Shop.find_by(shopify_uid: shop_uid)\n\n if shop\n SynchronizeTeamJob.new.async.perform(shop.team.id)\n else\n Rails.logger.info(\"Shop not found '#{shop_uid}'\")\n end\n\n rescue StandardError => e\n # Rescue any error so that we always respond with 200, otherwise Shopify will disable the webhook.\n # Still log and report an error to newrelic, though, so that we know about it.\n ReportError.call(\"Error processing shopify webhook: #{e.message}\")\n ensure\n head :ok\n end", "def save\n raise ArgumentError, 'Can not update a webhook with an unknown project_id.' if project_id.nil?\n\n Endpoints::Webhook.new(client).update(self, UpdateRepresenter.new(Webhook.new(self.dirty_attributes)))\n end", "def setup_incoming_webhook\n @uri = URI.parse \"https://#{@options['team']}.slack.com/services/hooks/incoming-webhook?token=#{@options['incoming_token']}\"\n @http = Net::HTTP.new(@uri.host, @uri.port)\n @http.use_ssl = true\n @http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end", "def receive\n # Step 1: save the incoming payload just in case further processing fails\n @webhook = Webhook.create(payload: payload, origin: request.remote_ip)\n\n # Step 2: queue a background job to process the webhook payload that was received.\n GetResourceInfoJob.perform_later @webhook\n\n # Step 3: respond to server sending the webhook letting it know that we received the data\n head :ok\n end", "def create\n super\n # slack通知\n c = Payment.create_customer(resource.email, resource.name)\n resource.update(pay_customer_id: c.id)\n notifier = Slack::Notifier.new(Rails.application.config.slack_webhook_url)\n notifier.ping(\"新しく管理人が登録されました!\")\n end", "def webhook_params\n params.require(:webhook).permit(:url, :request_type, :message_body).\n merge(device_id: params[:device_id], user_id: current_user.id)\n end", "def post_webhook(project_id, queue_name, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling post_webhook\" if project_id.nil?\n \n # verify the required parameter 'queue_name' is set\n raise \"Missing the required parameter 'queue_name' when calling post_webhook\" if queue_name.nil?\n \n\n # resource path\n path = \"/{project_id}/queues/{queue_name}/webhook\".sub('{format}','json').sub('{' + 'project_id' + '}', project_id.to_s).sub('{' + 'queue_name' + '}', queue_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\n _header_accept_result = Swagger::Request.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = []\n header_params['Content-Type'] = Swagger::Request.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = Swagger::Request.object_to_http_body(opts)\n \n auth_names = ['oauth_token']\n Swagger::Request.new(:POST, path, {:params => query_params,:headers => header_params, :form_params => form_params, :body => post_body, :auth_names => auth_names}).make\n nil\n end", "def trigger(webhook, data)\n raise InvalidSignature unless verify_signature(data)\n\n webhooks.trigger(webhook, data)\n end", "def install_webhooks(hostname = I18n.t('shopifyconnect.install.hostname'), topic_urls_map = I18n.t('shopifyconnect.install.topic_urls'))\n # remove existing if any\n ShopifyAPI::Webhook.find(:all, params: { limit: 100 }).each {|webhook| webhook.destroy if webhook.address.match(hostname) }\n # create new\n topic_urls_map.each {|topic,url| puts ShopifyAPI::Webhook.where(address: url, topic: topic, format: 'json').first_or_create.inspect if topic.present? && url.present? }\n true # explicit truthy value for aasm\n end", "def process_post\n service.sign_up_fisherman(\n JSON.parse(request.body.to_s).symbolize_keys\n ).on(\n fishing_application_succeeded: ->(result) {\n response.headers['Content-Type'] = \"application/json\"\n response.body = result.to_json\n true\n },\n fishing_application_conflicts: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 409\n },\n fishing_application_invalid: ->(result) {\n render_json_error_response(\n error: \"command_failed_validation\", message: result.fetch(:message)\n )\n 422\n }\n )\n end", "def webhooks\n puts \"*************** inside webhooks ************************\"\n puts \"***params: \" + params.inspect\n puts \"*********************************************************\"\n # Check to insure valid freshbooks api request.\n if params[:system] == \"https://skunkwerxperformanceautomotivellc.freshbooks.com\"\n puts \"**************** inside params[:system] ***************\"\n puts \"***params: \" + \" - \" + params.inspect + \" - \"\n # Callback Verify action for all webhook methods;\n if params[\"name\"] == \"callback.verify\"\n puts \"****************** inside callback.verify **************\"\n puts \"***params[:verifier]: \" + params[:verifier]\n puts \"********************************************************\"\n callback_verify(params[:verifier])\n end\n # Freshbooks sends notification on item create, update and destroy.\n if params[\"key\"] == \"item.create\"\n puts \"********************* inside item.create **************\"\n puts \"***params[:object_id] : \" + params[:object_id]\n item_create(params[:object_id])\n puts \"******************************************************\"\n end\n\n if params[\"key\"] == \"item.update\"\n puts \"********************* inside item.update **************\"\n puts \"***params[:object_id] : \" + params[:object_id]\n item_update(params[:object_id])\n puts \"******************************************************\"\n end\n\n if params[\"key\"] == \"item.delete\"\n puts \"********************* inside item.delete ***************\"\n puts \"***params[:object_id] : \" + params[:object_id]\n item_delete(params[:object_id])\n puts \"******************************************************\"\n end\n # Send response status ok.\n head 200\n end\n end", "def create\n processor = Mailgun::WebHook::Processor.new(mailgun_params, self)\n processor.on_unhandled_mailgun_events = self.class.on_unhandled_mailgun_events!\n processor.run!\n block_given? ? yield : head(:ok)\n end", "def webhook\n header = \"<h4>#{params[:verb]} #{params[:url]}</h4><p>Server: <b>#{params[:mode]}</b></p>\"\n query = if params[:params] then \"<p>Params: <pre>#{params[:params]}</pre></p>\" else \"\" end\n session = if params[:session] then \"<p>Session Attribute: <pre>#{params[:session]}</pre></p>\" else \"\" end\n exception = \"<p>Exception: <pre>#{params[:exception]}</pre></p>\"\n content = header + query + session + exception\n @project_logs = ProjectLog.create(project: @project, category: 'ERROR', content: content, date: Date.today)\n render nothing: true\n end", "def add(url, description=nil, events=[])\n _params = {:url => url, :description => description, :events => events}\n return @master.call 'webhooks/add', _params\n end", "def initialize(webhook_inspector)\n super()\n @webhook_inspector = webhook_inspector\n end", "def hook\n @project = Project.find(params[:id])\n c = JSON.parse(params[:payload])\n\n @project.do_hook(c)\n\n #respond 200\n end", "def register\n end", "def subscribe_response_hook(name = SecureRandom.hex.to_sym, &block)\n EasyPost::Hooks.subscribe(:response, name, block)\n end", "def trigger(payload)\n inject_payload!(payload)\n uri = URI(url)\n begin\n Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == \"https\") do |http|\n response = http.post(uri.request_uri, payload.to_json, {\"Content-Type\" => \"application/json\"})\n if response.code.to_i != 200\n logger.warn \"Webhook responded #{response.code}\"\n end\n end\n rescue => e\n logger.warn(e)\n end\n end", "def webhook(id)\n @webhooks[id.resolve_id]\n end", "def create_listener\n return unless self.controller_name == \"registrations\"\n @listener = Listener.new\n @listener.save\n end", "def create\n # registered_application = RegisteredApplication.find_by(url: request.env['HTTP_ORIGIN'])\n # if registered_application == nil\n givenToken = params[:token]\n if givenToken == \"TEpHGQVbeAMK8y93b34Tw40c\"\n username = givenToken\n mymessage = {\n \"text\": username,\n \"attachments\": [\n {\n \"text\":\"Partly cloudy today and tomorrow\"\n }\n ]\n }\n render json: mymessage, status: 200\n else\n render json: {error: \"Token is invalid\", status: 400}, status: 400\n end\n # else\n # @event = Event.new(event_params)\n # @event.registered_application = registered_application\n #\n # if @event.valid?\n # @event.save!\n # render json: @event, status: :created\n # else\n # render json: {errors: @event.errors}, status: :unprocessable_entity\n # end\n # end\n\n end", "def send_webhooks(user, answer)\n answer_remove_list(answer, user)\n end", "def cmd_notify_set_webhook(*args)\n\t\t\t\tif args.length > 0\n\t\t\t\t\tprint_status(\"Setting the Webhook URL to #{args[0]}\")\n\t\t\t\t\t@webhook_url = args[0]\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"Please provide a value\")\n\t\t\t\tend\n\t\t\tend" ]
[ "0.6617718", "0.656444", "0.65150595", "0.64781016", "0.64551556", "0.6398318", "0.63663626", "0.63569754", "0.63287765", "0.63153994", "0.6296852", "0.6244124", "0.62091345", "0.61630535", "0.6134478", "0.61271334", "0.6125525", "0.6123998", "0.6104226", "0.6083307", "0.60763174", "0.60763174", "0.6062172", "0.606017", "0.6048484", "0.60398114", "0.6007024", "0.5992883", "0.5989739", "0.59872854", "0.5963274", "0.59571564", "0.591837", "0.5886173", "0.5874907", "0.58617455", "0.5840957", "0.5835623", "0.58073694", "0.5792696", "0.57526124", "0.5733533", "0.5731436", "0.57275945", "0.5721106", "0.57175773", "0.5717483", "0.57099164", "0.5707106", "0.57046235", "0.569604", "0.5691316", "0.5663273", "0.5660234", "0.56573564", "0.56223154", "0.5568289", "0.5541659", "0.55412024", "0.55358523", "0.5535331", "0.55211717", "0.55010134", "0.5481891", "0.547477", "0.54622304", "0.5459201", "0.5455386", "0.54428625", "0.5432239", "0.54131347", "0.53926224", "0.53887236", "0.53887236", "0.53887236", "0.53855747", "0.5372906", "0.53691924", "0.53687", "0.5361526", "0.53573114", "0.5356252", "0.5353512", "0.5352371", "0.5350358", "0.53446156", "0.5338555", "0.5333263", "0.5328176", "0.5325648", "0.5315647", "0.53108877", "0.5296571", "0.5284559", "0.52822983", "0.527287", "0.52700114", "0.52644974", "0.526391", "0.5259555" ]
0.8315143
0
angular using only: index, create
def index defaults = (@project.construction_default.present?) ? [@project.construction_default] : [] respond_with(defaults) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n create\n end", "def new\n index\n end", "def index\n new\n end", "def index\n create\n render action: :create\n end", "def index\n @creates = Create.all\n end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end", "def index\n\n end" ]
[ "0.73265076", "0.6820173", "0.6668644", "0.6653575", "0.65715", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.63550186", "0.6354634", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6333669", "0.6316323", "0.6316323", "0.6316323", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374", "0.62929374" ]
0.0
-1
Write a method that computes the difference between the square of the sum of the first n positive integers and the sum of the squares of the first n positive integers. Examples:
def sum_square_difference(n) n_integers = (1..n).to_a square_of_sum = n_integers.inject(:+)**2 sum_of_squares = n_integers.map {|n|n**2}.inject(:+) square_of_sum - sum_of_squares end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_square_difference(n)\n integers = (1..n).to_a\n\n square_of_sum = integers.sum ** 2\n sum_of_squares = integers.map { |n| n ** 2 }.sum\n\n square_of_sum - sum_of_squares\nend", "def sum_square_difference(n)\n ((1..n).reduce(:+)**2) - (1..n).reduce{ |sum, i| sum + i**2 }\nend", "def sum_square_difference(n)\n # square_of_sum = (1..n).reduce(:+) ** 2\n # sum_of_squares = (1..n).reduce { |sum, num| sum + num * num }\n # square_of_sum - sum_of_squares\n # (1..n).reduce(:+)**2 - (1..n).reduce { |sum, num| sum + num * num }\n\n (1..n).sum**2 - (1..n).sum { |num| num**2 }\nend", "def difference_between_sum_sq_and_sq_sum(n)\n square_sum(n) - sum_squares(n)\nend", "def sum_square_difference(n)\n \n sum = 0 \n for i in 0..n\n sum += i\n end\n \n sq_sum = 0\n for i in 0..n\n sq_sum += (i**2)\n end \n \n (sum*sum) - sq_sum\nend", "def sum_square_difference(n)\n square_of_sums = (1..n).inject(:+) ** 2\n sum_of_squares = (1..n).inject {|sum, num| sum + (num ** 2)}\n square_of_sums - sum_of_squares\nend", "def sum_square_difference(n)\n square_of_sum = ((1..n).sum) ** 2\n sum_of_square = (1..n).map{|i| i * i}.sum\n p difference = square_of_sum - sum_of_square\nend", "def sum_square_diff(n)\r\n sq_of_sum = (1..n).to_a.sum ** 2\r\n sum_of_sq = (1..n).to_a.map{ |num| num *= num }.sum\r\n (sq_of_sum - sum_of_sq).abs\r\nend", "def sum_square_difference(n)\n sum = 0\n sums_squared = 0\n 1.upto(n) do |num|\n sum += num\n sums_squared += num**2\n end\n sum**2 - sums_squared\nend", "def sum_sq_diff(n)\n nums_in_range = (1..n)\n # square_sums = nums_in_range.sum ** 2\n square_sums = nums_in_range.sum.pow(2)\n sums_square = nums_in_range.map { |n| n ** 2 }.sum\n square_sums - sums_square\nend", "def sum_square_difference(n)\r\n square_total = 0\r\n sum_square = 0\r\n 1.upto(n) {|x| square_total += x}\r\n 1.upto(n) {|x| sum_square += (x**2)}\r\n square_sum = square_total**2\r\n square_sum - sum_square\r\nend", "def sum_square_difference(int)\n first_n_ints = (1..int).to_a\n\n sum_1 = first_n_ints.sum\n\n sum_2 = first_n_ints.map{|int| int**2}.sum\n\n (sum_1**2) - sum_2\nend", "def squares_diff(n)\n (1..n).inject(:+)**2 - (1..n).map{|i| i*i}.inject(:+)\nend", "def sum_square_difference(num)\n 1.upto(num).sum**2 - 1.upto(num).reduce(0) { |total, n| total + n**2 }\nend", "def sum_square_difference(num)\n (1..num).sum ** 2 - (1..num).map {|num| num ** 2 }.sum\nend", "def sum_square_difference(num)\n (1..num).inject(:+)**2 - (1..num).map{|x| x**2}.inject(:+)\nend", "def sum_square_difference(num)\n square_of_sum = 1.upto(num).to_a.reduce(:+) ** 2\n sum_of_squares = 1.upto(num).to_a.map{ |n| n ** 2 }.reduce(:+)\n square_of_sum - sum_of_squares\nend", "def diff_squares(num)\r\n sum_of_nums = (1..num).inject { |sum, x| sum + x }\r\n sum_of_sq = (1..num).inject { |sum, x| sum + x**2 }\r\n sum_of_nums**2 - sum_of_sq\r\nend", "def sum_square_difference(num)\n square_of_sum = ((1..num).sum)**2\n sum_of_squares = (1..num).map { |n| n**2}.sum\n square_of_sum - sum_of_squares\nend", "def sum_square_difference(num)\n\n sum_squared = (1..num).to_a.sum ** 2\n\n squares = []\n\n (1..num).each { |n| squares << n ** 2 }\n\n squared_sum = squares.sum\n\n sum_squared - squared_sum\nend", "def sum_square_difference(num)\n sum = sum(num)\n square = square(num)\n p sum - square\nend", "def sum_square_difference(integer)\n (1..integer).reduce(:+)**2 - 1.upto(integer).map { |i| i**2 }.reduce(:+)\nend", "def sum_square_difference(num)\n square_of_sum = (0..num).inject(:+) ** 2\n sum_of_square = (0..num).map { |num| num ** 2}.inject(:+)\n square_of_sum - sum_of_square\nend", "def sum_square_difference(integer)\n array = []\n 1.upto(integer) { |num| array << num }\n sum_squared = array.reduce(:+)**2\n\n array = []\n 1.upto(integer) { |num| array << num**2 }\n squared_sums = array.reduce(:+)\n\n sum_squared - squared_sums\nend", "def sum_square_difference(int)\n # square_of_sums = (0..int).inject(:+) ** 2\n # sum_of_squares = (0..int).inject(0) { |memo, value| memo + value ** 2 }\n # return square_of_sums - sum_of_squares\n\n (0..int).inject(:+) ** 2 - (0..int).inject(0) { |sum, n| sum + n ** 2 }\nend", "def sum_square_diff(num)\n sum_of_squares = 0\n square_of_sum = 0\n\n (1..num).each do |i|\n squared = i**2\n sum_of_squares += squared\n square_of_sum += i\n end\n\n square_of_sum **= 2\n\n difference = square_of_sum - sum_of_squares\n\n puts difference\nend", "def sum_square_difference(number)\n squared_sum = 1.upto(number).inject(:+)**2\n sum_squares = 0\n 1.upto(number).each {|num| sum_squares += num**2}\n squared_sum - sum_squares\nend", "def square_of_sums\n return (@n * (@n + 1) / 2)**2\n end", "def sum_of_squares(n)\n sum = 0\n (1..n).each {|i| sum = sum + (i*i)}\n sum\n end", "def sum_square_difference(num)\n square_of_the_sum = 0\n sum_of_the_squares = 0\n \n 1.upto(num) do |num|\n square_of_the_sum += num\n sum_of_the_squares += (num ** 2)\n end\n\n total = (square_of_the_sum ** 2) - sum_of_the_squares\n total\nend", "def sum_square_difference(a_num)\r\n first_block = (1..a_num).to_a.reduce(&:+)\r\n first_block **=2\r\n\r\n second_block = (1..a_num).to_a.map { |number| number ** 2 }\r\n second_block = second_block.reduce(&:+)\r\n\r\n first_block - second_block\r\nend", "def sum_of_squares n\n (n**3)/3 + (n**2)/2 + n/6 \nend", "def sum_square_difference(num)\n square_of_sum = 0\n sum_of_squares = 0\n\n 1.upto(num) do |i| \n square_of_sum += i\n sum_of_squares += i**2\n end\n\n square_of_sum**2 - sum_of_squares\nend", "def findDiffSquares(n)\n sum = 0\n (1..n).each { |i|\n (1..n).each { |j|\n sum += i*j unless i == j\n }\n }\n sum\nend", "def difference\n square_of_sums - sum_of_squares\n end", "def difference\n square_of_sums - sum_of_squares\n end", "def difference\n # square of sums will always be bigger\n square_of_sum - sum_of_squares\n end", "def sum_square_difference(num)\r\n arr = (1..num).to_a\r\n sum1 = arr.sum ** 2\r\n sum2 = arr.inject { |sum, number| sum + number**2 }\r\n sum1 - sum2\r\nend", "def sum_square_difference(num)\n sum = 0\n square_sum = 0\n\n 1.upto(num) do |n|\n sum += n\n square_sum += n**2\n end\n\n sum**2 - square_sum\nend", "def square_of_sum(n)\n sum = 0\n (1..n).each {|i| sum = sum + i}\n sum * sum\n end", "def sum_up_to_squared n=100\r\n (2 * n + 1) * (n + 1) * n / 6\r\nend", "def difference\n return square_of_sums - sum_of_squares\n end", "def solve( n = 100 )\n # Sum of squares is given by n(n + 1)(2n + 1) / 6, while square of sums\n # is [n(n + 1)][n(n + 1)] / 4. Subtracting and simplifying the result\n # gives n(n + 1)(n - 1)(3n + 2) / 12.\n n * (n + 1) * (n - 1) * (3*n + 2) / 12\n end", "def sum_squares(n)\nsums = [] \n for i in (1..n)\n i_squared = i**2\n sums.push i_squared \n end\n p sums.reduce(:+)\nend", "def sum_square_difference(num)\n arr = (1..num).to_a\n square_of_arr_summed = (arr.sum) ** 2\n square_of_each_num = arr.reduce(0) { |sum, n| sum + n**2 }\n\n # Alternatively\n # square_of_each_num = 0\n # arr.each { |element| square_of_each_num += element **2 }\n\n return square_of_arr_summed - square_of_each_num\nend", "def sum_of_squares\n return @n * (@n + 1) * (2 * @n + 1) / 6\n end", "def difference\n square_of_sum - sum_of_squares\n end", "def sum_of_squares(n)\n sum = 0\n for i in 1..n\n sum+= i*i\n end \n sum\nend", "def six\n square_of_sum(100) - sum_of_squares(100)\nend", "def sum_square_difference(integer)\n sum = 0\n square_sum = 0\n 1.upto(integer) { |i| sum += i }\n 1.upto(integer) { |i| square_sum += i**2 }\n sum**2 - square_sum\nend", "def p6\n\trange = (1..100).to_a\n\tsquare_of_sum = range.reduce(:+) ** 2\n\tsum_of_square = (range.map{|x| x ** 2}).reduce(:+)\n\tsquare_of_sum - sum_of_square\nend", "def sum_square_difference(num)\n total_square = 0\n num_square = 0\n\n 1.upto(num) do |number|\n total_square += number\n end\n\n 1.upto(num) do |fig|\n num_square += fig**2\n end\n\n product_total = total_square ** 2\n square_difference = product_total - num_square\n square_difference\nend", "def square_sum_up_to n=100\r\n (n * (n + 1) / 2)**2\r\nend", "def square_sums(n)\n Array(1..n).sum**2\nend", "def solution(num)\n sum_of_squares = 0\n\n (1..num).each do |number|\n sum_of_squares += number**2\n end\n\n square_of_sums = (1..num).inject(:+) ** 2\n\n p (square_of_sums - sum_of_squares).abs\nend", "def square_of_sum\n\t\t@n**2*(@n+1)**2/4\n\tend", "def sum_of_squares(n)\n (1..n).inject(0) do |total, i|\n total += i**2\n end\nend", "def squareOfSum n\n return triangularNumber(n)**2\nend", "def sum_of_the_squares\n sum = 0\n (1..self).each do |n|\n sum += n**2\n end\n sum\n end", "def sums num\n\tsum_of_squares = 0\n\tsum = 0\n\t1.upto num do |n|\n\t\tsum_of_squares += n*n\n\t\tsum += n\n\tend\n\tsum**2 - sum_of_squares \nend", "def sum_squares(n)\n (1..n).inject { |sum, i| sum += i**2 }\nend", "def sum_of_squares(numbers)\n numbers.map { |x| x * x }.reduce(0) { |acc, x| acc + x }\nend", "def squareSum(numbers)\n numbers.map { |n| n*n}.reduce(:+)\nend", "def squareSum(numbers)\n numbers.map { |n| n*n }.reduce(:+)\nend", "def sum_of_squares\n self.inject(0) { |sos, n| sos + n**2 }\n end", "def num_squares1(n)\n helper = [0, 1]\n (2..n).each do |i|\n helper << (1..Math.sqrt(i).to_i).map do |j|\n helper[i - j ** 2] + 1\n end.min\n end\n helper[n]\nend", "def sum_of_squares\n\t\t\tinject(0) do |sum, elem|\n\t\t\t\tsum + (elem ** 2)\n\t\t\tend\n\t\tend", "def num_squares2(n)\n helper = [0, 1]\n (2..n).each do |i| \n helper[i] = i\n (1..Math.sqrt(i).to_i).each do |j|\n helper[i] = [helper[i - j ** 2] + 1, helper[i]].min\n end \n end \n helper[n]\nend", "def sum_of_squares\n squares = differences_from_mean.map { |diff| diff ** 2 }\n squares.reduce(:+)\n end", "def square_of_n_integers n\n ((n/2) * (n+1))**2\nend", "def square_of_sums\n sum=((@num**2+@num)/2)**2\n end", "def sum_square_difference(i)\n x = 0 \n sum = 0\n square_sum = 0\n loop do\n x += 1\n sum += x\n square_sum += x**2\n break if x == i \n end\n sum**2-square_sum\nend", "def sum_of_squares\n @number_range.sum {|n| n**2}\n end", "def square_sum(numbers)\n squares = numbers.map{|number| number * number}\n squares.reduce(0){|num, sum| num + sum}\nend", "def squareSum(numbers)\n numbers.map { |i| i ** 2 }.reduce(:+)\nend", "def sum_of_squares\n end", "def sum_of_squares\n @range.sum { |n| n**2 }\n end", "def squareSum(numbers)\n numbers.inject(0) { |sum, n| sum + n*n }\nend", "def squareSum(numbers)\n numbers.reduce(0){|sum, x| sum + (x ** 2)}\nend", "def sum_of_squares\n range.reduce { |a, e| a + e**2 }\n end", "def subtract_product_and_sum(n)\r\n n=n.to_s.chars.map(&:to_i)\r\n if n[0] == 0\r\n n[1] = n[1]*-1 \r\n n = n[1..-1]\r\n end\r\n n.reduce(:*) - n.sum\r\nend", "def square_of_sums\n range.reduce(:+)**2\n end", "def sum_of_squares\n sum(square(sequence))\n end", "def sumSquareDifference( maxValue )\n sumSquares = 0\n sum = 0\n\n Range.new( 1, maxValue ).each do | value |\n sum += value\n sumSquares += value * value\n end\n\n squaresSum = sum * sum\n\n puts squaresSum - sumSquares\nend", "def square_of_sums\n square(sum(sequence))\n end", "def square_of_sum\n end", "def sum_of_the_squares max_number\n sum = 0\n (1..max_number).each { |i| sum += (i ** 2) }\n sum\nend", "def arith_sum_squares(max)\n max * (max+1) * (2*max+1) / 6\nend", "def sum_square_difference(max_num: 100)\n diff = 0\n num_set = (1..max_num).to_a.reverse\n set_sum = num_set.inject(:+)\n until num_set.length == 1\n foo = num_set.pop\n set_sum -= foo\n diff += 2 * foo * set_sum\n end\n puts diff\nend", "def num_squares3(n)\n n /= 4 while n % 4 == 0\n return 4 if n % 8 == 7\n (0..Math.sqrt(n).to_i).each do |a|\n b = Math.sqrt(n - a ** 2).to_i\n if a * a + b * b == n\n if a > 0 && b > 0\n return 2\n elsif a == 0 && b == 0\n return 0\n else\n return 1\n end\n end\n end\n return 3\nend", "def sum_of_squares values\n values.collect { |v| v**2 }.reduce(:+)\nend", "def sum_squares_excluding_smallest(*args)\n drop_the_smallest(*args).reduce(0) do |accum, n|\n accum += n * n\n end\nend", "def sumOfSquares(max)\n out = 0\n max.times do |i|\n out += (i+1)**2\n end\n out\nend", "def sum_of_squares(x)\n sum_of_squares = 0\n (1..x).each do |f|\n sum_of_squares += f**2\n end\n return sum_of_squares\nend", "def sum(n)\n end", "def sum_sq(n)\n cnt = 1\n sum = 0\n while cnt <= n\n sum += cnt * cnt\n cnt += 1\n end \n puts sum\nend", "def summation(n)\n sum = 0\n (1..n).each { |num| sum += num }\n return sum\nend", "def sum_of_squares(max)\n sum = 0\n (1..max).each do|current|\n sum = sum + current**2\n end\n return sum\nend", "def sum_of_square(range)\n\trange.inject(0) { |sum, i| sum + i**2 }\nend", "def square_of_sum\n @number_range.sum**2\n end" ]
[ "0.8546487", "0.8521754", "0.8498327", "0.84734714", "0.845629", "0.84002894", "0.8385255", "0.83743644", "0.83242947", "0.82743055", "0.8273235", "0.8097696", "0.80192274", "0.7929161", "0.78133136", "0.7796826", "0.7733372", "0.7713581", "0.7708296", "0.7690414", "0.76823163", "0.76317453", "0.7614007", "0.76057184", "0.76012546", "0.75828093", "0.7569572", "0.75670326", "0.7552375", "0.75494105", "0.7534143", "0.7518099", "0.75062346", "0.7471855", "0.7469481", "0.7469481", "0.7445507", "0.7441722", "0.7353987", "0.7310938", "0.72956866", "0.7287128", "0.72849125", "0.7279887", "0.72787577", "0.7275008", "0.7269917", "0.7262889", "0.72375983", "0.7237142", "0.7183951", "0.7161451", "0.71598023", "0.715829", "0.71548325", "0.7084308", "0.7047291", "0.69774586", "0.69477785", "0.6918778", "0.69044477", "0.68964607", "0.6888048", "0.68768984", "0.6868977", "0.6863475", "0.68426913", "0.6818222", "0.68104607", "0.6802387", "0.678408", "0.678286", "0.6761141", "0.6760798", "0.6760068", "0.67458177", "0.67357004", "0.6723628", "0.6722887", "0.67098206", "0.6686403", "0.6672724", "0.66433823", "0.6630893", "0.66109574", "0.65960145", "0.659062", "0.6578365", "0.65707004", "0.6514138", "0.64993346", "0.64921516", "0.6457195", "0.6456626", "0.6447907", "0.6436999", "0.6435885", "0.64239746", "0.6423141", "0.64204663" ]
0.85008293
2
Returns array of items from the search_result
def results raise NotImplementedError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results_from_search(query_results)\n ids = query_results.map do |result|\n result['id']\n end\n find_from_search(*ids)\n end", "def results\n numOfSearches = numEvents / @OFFSET #the number of searches we must make to return all values\n result = Array.new\n if (complete?)\n for i in 0..numOfSearches\n result.push( @client.get_request(\"/services/search/jobs/#{@sid}/results\", {'output_mode' => @OUTPUT_MODE, 'count' => @OFFSET, 'offset' => (@OFFSET * i)}))\n end\n end\n result\n end", "def get_search_results\n\t\twait_until_page_loads\n\t\t@se.find_elements(@locs[:results_item])\n\tend", "def results_list\n list = []\n begin\n self.spans(:class=>\"s3d-search-result-name\").each do |element|\n list << element.text\n end\n rescue\n list = []\n end\n return list\n end", "def results_list\n list = []\n begin\n self.spans(:class=>\"s3d-search-result-name\").each do |element|\n list << element.text\n end\n rescue\n list = []\n end\n list\n end", "def fetch_results_for(search_term)\n if params['tag'] #limited to args, sorted differently\n @show_search_title = true\n return(SearchResult.find_args_with_tag(params['tag'])) \n end\n \n return [] if search_term.blank?\n \n SearchResult.find(search_term, current_user)\n end", "def search_results search\n search = normalize search\n @searches[search.to_s]\n end", "def get_items(response, item_page)\n items = []\n response = response.to_h\n if response.key?('ItemSearchResponse') &&\n response['ItemSearchResponse'].key?('Items') &&\n response['ItemSearchResponse']['Items'].key?('Item')\n response['ItemSearchResponse']['Items']['Item'].each_with_index do |item, pos|\n items << { position: (item_page - 1) * ITEMS_PER_PAGE + pos + 1, data: item }\n end\n end\n items\n end", "def results\n\t\t\tArray(result)\n\t\tend", "def items\n parsed_contents['results'] if parsed_contents\n end", "def search_results\n builder = search_builder.with(search_state)\n builder.page = search_state.page\n builder.rows = search_state.per_page\n\n builder = yield(builder) if block_given?\n response = repository.search(builder)\n\n if response.grouped? && grouped_key_for_results\n response.group(grouped_key_for_results)\n elsif response.grouped? && response.grouped.length == 1\n response.grouped.first\n else\n response\n end\n end", "def process_search_results(content)\n extractions = _search_attributes.hmap do |name, expression|\n [name, content.extract(expression)]\n end\n\n [].tap do |results|\n extractions.values.map(&:size).max.times do |index|\n result = {}\n extractions.each do |key, value|\n result[key] = value[index]\n end\n results << new(result)\n end\n end\n end", "def search_result\n freelancers = find_all FREELANCERS\n end", "def array_result\n [@result['results']].flatten\n end", "def results\n begin\n self.to_json[\"SearchResponse\"][\"Web\"][\"Results\"].map do |result_hash|\n LiveAPI::Search::Result.new(result_hash)\n end\n rescue\n self.to_json[\"SearchResponse\"]\n end\n end", "def search (search_term)\n\n res = Amazon::Ecs.item_search(search_term , :search_index => 'All')\n items = res.marshal_dump\n items_return = []\n #puts res.marshal_dump\n Hash.from_xml(items)[\"ItemSearchResponse\"][\"Items\"][\"Item\"].each do |item|\n myitem = item[\"ItemAttributes\"]\n myitem.merge!(\"DetailPageURL\" => item[\"DetailPageURL\"])\n myitem.merge!(\"ASIN\" => item[\"ASIN\"])\n #m = find_prices(myitem[\"ASIN\"])\n #puts m\n #sleep(100)\n sleep 1\n myitem.merge!(\"Prices\" => self.find_prices(item[\"ASIN\"]) )\n #puts myitem[\"ASIN\"]\n #puts myitem\n\n #myitem.merge!(find_prices(myitem[\"ASIN\"]))\n items_return.push(myitem)\n end\n\n items_return\n end", "def items\n @lastresult[\"items\"]\n end", "def index\n @q = FoundItem.ransack(params[:q])\n @found_items = @q.result\n end", "def search_all_results(query)\n results = []\n\n page = 1\n\n loop do\n hits = search(query, page)\n\n results.concat(hits['results'])\n\n if hits['last_page'] == page || hits['last_page'] == 0\n break\n else\n page += 1\n end\n end\n\n results\n end", "def fetch_items\n items = @klass.order(\"#{sort_column} #{sort_direction}\")\n items = items.page(page).per_page(per_page)\n if @params[:sSearch].present?\n query = @fields.map { |field| \"#{field} ilike :search\" }.join(\" OR \")\n items = items.where(query, search: \"%#{@params[:sSearch]}%\")\n end\n return items\n end", "def prepared_results\n prepared = []\n results = WatirNokogiri::Document.new(html).lis(Selectors::FAST_SEARCH_MODAL[:result][:self])\n\n results.each { |result| prepared[] = { title: title(result), price: price(result) } }\n\n prepared\n end", "def process_query\n @results = str_to_obj.flatten.collect do |url|\n doc = Mechanize.new.get(url)\n els = doc.search(CGI.unescape(@xpath))\n els.map { |el| [el.text] }\n end\n @results = @results.flatten.map { |r| [r] }\n end", "def get_search_product_list\n\t\tresponse_search = Partay.get('http://shoponline.tescolotus.com/api/v1/search/products?query=Sugar&page=1&sortBy=Relevance', :headers => {'Content-Type' => 'application/json', 'language' => 'en-gb', 'region' => 'TH', 'userId' => access_token})\n\t\t@@product_list=Array.new\n\t\t3.times do |i|\n\t\t\t@@count ||=0\n\t\t\tsearch_result=JSON(response_search['productItems'][i])\n\t\t\tproduct_list_name =JSON(search_result)[\"product\"][\"shortDescription\"]\n\t\t\t@@product_list.push product_list_name\n\t\t\t@@count+= 1\n\t\tend\n\t\tself.product_name_list(@@product_list)\n\tend", "def parse_multiple_search_results(page)\n companies = []\n rows = page.body.split('<tr class=\\'alt')\n rows.shift\n rows.each do |row|\n company = {\n 'name' => '',\n 'id' => '',\n 'records' => ''\n }\n company['name'] = row.split('<a class=\\'nowrap\\' title=\\'')[1].split('\\' href=')[0]\n company['id'] = row.split('\\' href=\\'/id')[1].split('/')[0].to_i\n company['records'] = row.split('=showCompDir&\\'>')[1].split('</a>')[0]\n companies << company\n end\n return companies\nend", "def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'].gsub(/^#{landing_page_url}/, ''),\n name: org_name(item: item),\n sort_name: item['name'],\n url: item.fetch('links', []).first,\n language: org_language(item: item),\n fundref: fundref_id(item: item),\n abbreviation: item.fetch('acronyms', []).first\n }\n end\n results\n end", "def build_search_results_array(doc)\n names = return_names_array(doc)\n descrs = return_descriptions_array(doc)\n durs = return_durations_array(doc)\n diffs = return_difficulties_array(doc)\n links = return_links_array(doc)\n\n search_results = []\n\n names.each_with_index do |_name, i|\n search_results << { name: names[i], descr: descrs[i], dur: durs[i], diff: diffs[i], link: links[i] }\n end\n\n return search_results\n end", "def recipe_search_results_for(search, number=100)\n Faraday.get \"#{RECIPE_SEARCH_URL}#{search}&number=#{number}&apiKey=#{spoonacular_key}\"\n end", "def get_query_results(query)\n hits = execute_query(query).hpath('hits.hits').first\n return [] unless hits && !hits.empty?\n hits.map do |hit|\n hit['_source'].expand.merge(hit.only('_id', '_type', '_index')).kmap do |key|\n key.to_s.gsub('@', '_').to_sym\n end\n end\n end", "def index\n @q = Item.search(params[:q])\n @items = @q.result(distinct: true)\n end", "def search_results\r\n @browser.divs(class: 'rc').collect do |div|\r\n div.h3.a.text\r\n end\r\n end", "def items\n # [obj_or_array].flatten makes this always be an array (lastfm gives\n # the single object when it's not an array)\n [main_result[response_type]].flatten.compact rescue []\n end", "def search_results(load: true)\n Pseud.search(body: search_body, load: load)\n end", "def search(query, get_page = 1)\n [get_page, get_page + 1]\n .map { |page| JSON.parse(Search.request(query, page))[\"results\"] }\n .flatten\n end", "def search_results(limit)\n search_result_item_sections[0...limit].map do |section|\n {\n rate: section.rate,\n skills: section.skills\n }\n end\n end", "def results\n arr = []\n flag = 0 # iteration flag\n @obj['results'].each do |data|\n arr[flag] = Spreader::Bot.new(data)\n flag += 1\n end\n arr\n end", "def gather_search\n local_search = Search.search @query\n unless local_search.nil?\n local_search = FoodItem.fetch_local_items local_search['food_items']\n return local_search unless local_search.nil?\n end\n\n remote_search = search_apis @query # adds searches remote end for elements\n unless remote_search.nil?\n Search.add @query, remote_search # adds elements to search\n remote_search = add_multiple_food_items remote_search unless remote_search.nil?\n return remote_search unless remote_search.nil?\n end\n\n nil # fallback\n end", "def parse_results(json:)\n results = []\n return results unless json.present? && json.fetch('items', []).any?\n\n json['items'].each do |item|\n next unless item['id'].present? && item['name'].present?\n\n results << {\n ror: item['id'],\n name: item['name'],\n url: item.fetch('links', []).first,\n domain: org_website(item: item),\n country: org_country(item: item),\n abbreviation: item.fetch('acronyms', []).first,\n types: item.fetch('types', []),\n aliases: item.fetch('aliases', []),\n acronyms: item.fetch('acronyms', []),\n labels: item.fetch('labels', [{}]).map { |lbl| lbl[:label] }.compact\n }\n end\n results\n end", "def items\n if @items.nil?\n ids = tire_response.results.map { |item| item['id'] }\n items = klass.where(:id => ids).group_by(&:id)\n @items = ids.map{ |id| items[id.to_i] }.flatten.compact\n end\n @items\n end", "def to_a\n return @results\n end", "def obtain_items(column_value,nuix_case)\n\t\t# Run search based on given column value\n\t\tAnnotationCSVParser.log(\"Obtaining query hits...\")\n\t\treturn nuix_case.search(column_value)\n\tend", "def get_results()\n restriction_nodes = []\n result_nodes = []\n if !(@inputs.nil? || @inputs.empty? || @inputs.first.empty?)\n input_set = @inputs.first\n restriction_nodes= input_set.nodes\n result_nodes = input_set.breadth_first_search(true){|node| node.item.text.downcase.include?(@keyword_phrase.to_s.downcase)} \n end\n \n if !@inplace\n results = @server.match_all(parse_keyword_phrase(), restriction_nodes) \n result_nodes = results.map{|item| Xplain::Node.new(item: item)}\n end\n \n result_nodes\n \n end", "def search(q)\n results = []\n url = \"https://#{@subdomain}.sharefile.com/rest/search.aspx?op=search&query=#{q}&authid=#{@authid}&fmt=json\"\n response = JSON.parse(open(url).read)\n if response[\"error\"] == false #success\n response[\"value\"].each do |item|\n if item[\"type\"] == \"folder\"\n results << Folder.new(item[\"id\"], @authid, @subdomain, false, item)\n elsif item[\"type\"] == \"file\"\n results << File.new(item[\"id\"], @authid, @subdomain, item)\n end\n end\n return results\n else #error\n return response\n end\n end", "def results\n @results ||= with_hit.map(&:first)\n end", "def search\n result = q.present? ? TWITTER.search(q, options) : []\n result = result.take(count.to_i) if result.present? && count.present?\n result\n end", "def results(client)\n @client = client\n\n res = @client.search\n collections = load_all(res.data.hits.hit.map(&:id))\n if @client.parameters[:size] && @client.parameters[:start]\n round_correct_page\n\n Nazrin.paginated_array(\n collections,\n current_page: @current_page,\n per_page: @client.parameters[:size],\n total_count: res.data.hits.found,\n last_page: @last_page)\n else\n collections\n end\n end", "def ransack_result\n @search.result.page(params[:page])\n end", "def search(params={:SearchIndex => :Books, :ResponseGroup => :Medium})\n response = call(params.merge(:Operation => :ItemSearch))\n arrayfy(response['ItemSearchResponse']['Items']['Item']).map {|item| handle_type(item, :item)}\n end", "def search_result\n\t\t@questions = Question.search(params[:search]).for_index_set.page(params[:page]).per(10).order(:id)\n\tend", "def search\n @results = Cookbook.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n end", "def items\n if @items.nil?\n raise NoData.new(\"No data has been retrieved yet.\", self)\n else\n @items.collect do |hsh|\n item = self.class.item_class.new\n item.store_result(:attrs => hsh)\n item\n end\n end\n end", "def items_from_response\n ids = item_ids\n items = klass.where(:id => ids).group_by(&:id)\n ordered_items(ids, items)\n end", "def results\n meth = [kind.to_s, self.search_suffix].join.to_sym\n return([]) unless respond_to?(meth) # Ensure no hijackers.\n return([]) if q.nil?\n \n send(meth)\n end", "def search_results_from_ids(ids)\n where(:id => ids).preload(searchable_options[:preload]).to_a\n end", "def search(query)\n results(query).map { |r| result_class.new(r) }\n end", "def items\n # Since we're parsing xml, this will raise an error\n # if the response isn't xml.\n self.response = self.class.get(\"#{record_url}/items?view=full\")\n raise_error_if(\"Error getting items from Aleph REST APIs.\") {\n (response.parsed_response[\"get_item_list\"].nil? or response.parsed_response[\"get_item_list\"][\"items\"].nil?)\n }\n [response.parsed_response[\"get_item_list\"][\"items\"][\"item\"]].flatten\n end", "def search_for_google_books(search_term)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"\n response = RestClient.get(url)\n hash = JSON.parse(response)\n hash[\"items\"]\nend", "def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend", "def parse_results\n RETS4R::ResponseDocument::Search.parse(self.to_s).to_transaction\n end", "def items\n result = []\n each_item { |item| result.push(item) }\n result\n end", "def search_for_item\n Rails.logger.warn(\"starting search for item for #{request.headers['X-Origin-URI']}\")\n child_oid = request.headers['X-Origin-URI'].gsub(/^\\/iiif\\/2\\/(\\d+)\\/.*/, '\\1')\n # search_state[:q] = { child_oids_ssim: child_oid }\n search_state[:rows] = 1\n search_service_class.new(config: blacklight_config, search_state: search_state, user_params: search_state.to_h, **search_service_context)\n r, d = search_service.search_results do |builder|\n builder.where(child_oids_ssim: [child_oid])\n builder.processor_chain.delete(:filter_by_visibility)\n builder\n end\n [r, d.first]\n end", "def result\n return @result if defined?(@result)\n @search.populate_hits\n @result\n end", "def collect_results(body)\n a = []\n body.scan(EX_RESULT) { |s| a << [$2, $1] }\n a\nend", "def get_all_results\n\t\tresult_array = []\n\t\tskip = 0\n\t\ttake = 1000\n\t\tloop do\n\t\t\tcurrent_result = get_data_from_result(execute_request(take, skip)[1])\n\t\t\tresult_array.concat(current_result)\n\t\t\tskip = skip + take\n\t\t\tbreak if current_result.size != take\n\t\tend\n\t\treturn result_array\n\tend", "def parse_search_list(data)\n return [] unless data.is_a?(Hash) && data['results']\n data['results'].map do |app_data|\n App.new(\n id: app_data['trackId'],\n name: app_data['trackName'],\n description: app_data['description'],\n icon_url: app_data['artworkUrl60'],\n publisher_name: app_data['artistName'],\n publisher_id: app_data['artistId'],\n price: app_data['price'],\n version: app_data['version'],\n rating: app_data['averageUserRating']\n )\n end\n end", "def search_results(user_params)\n search_service(user_params).search_results\n end", "def search(query, options={})\n api_response = @api_client.make_api_request(:GET, \"artist/search\", {:q => query}, options)\n @api_client.artist_digestor.nested_list_from_xml(api_response.content.search_results, :search_result, :search_results)\n end", "def index\n @items = Item.search(params[:search]).page(params[:page]).per(40)\n end", "def raw_results\n results\n end", "def search_results\n Card.search(params[:search]).page(params[:page]).per_page(8)\n end", "def search_results\n @results = User.search(params[:search])\n end", "def index\n @found_items = FoundItem.all\n end", "def items\n @document.xpath('//results/page/items/*')\n end", "def populate_results(json)\n # page = json[\"page\"]\n # results = json[\"results\"].map{|r| SearchResult.new(r)}\n # start = (page - 1) * 10\n # @results[start, results.length] = results\n @results = json[\"results\"].map{|r| SearchResult.new(r)}\n end", "def get_search_values\n search_by_values = [[I18n.translate(\"part_number\",:scope => \"open_orders.index\"),\"pn\"],[I18n.translate(\"po_number\",:scope => \"open_orders.index\"),\"po\"],\n [I18n.translate(\"all_refill_order\",:scope => \"order_refill.index\"),\"all\"]]\n\n search_by_values\n end", "def get_result_list\n result_list = []\n @wait.until { wait_for_element(\"result_list\").length > 10 }\n find_elements(\"result_list\").each do |result|\n result_list.push(result.text)\n end\n result_list\n end", "def extract_matched_items(items)\n []\n end", "def search(search_options)\n Array(global_catalog_connection.search(search_options.merge(options)))\n end", "def index\n @searches = Sunspot.search(Drug, Review, Condition) do\n fulltext params[:search]\n end\n @results=@searches.results\n @drugresults=Array.new\n @conditionresults=Array.new\n @reviewresults=Array.new\n @results.each do |result|\n if result.instance_of?Drug\n @drugresults.push(result)\n elsif result.instance_of?Condition\n @conditionresults.push(result)\n else\n @reviewresults.push(result)\n end\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def get_search_results(search_id:, from_index:, to_index:)\n {\n method: \"DOM.getSearchResults\",\n params: { searchId: search_id, fromIndex: from_index, toIndex: to_index }.compact\n }\n end", "def search_results\n @products = Product.where(\"name LIKE ?\", \"%#{params[:keywords]}%\")\n end", "def items\n all(locator(:item)).map do |item|\n item.find(locator(:item_name)).text\n end\n end", "def search_results(*args)\n ranks_and_ids = search_result_ranks_and_ids(*args)\n search_results_from_ids(ranks_and_ids.map(&:last))\n end", "def result \n # Get appropriate search types\n case params[:search_type]\n when \"purchase_order_search\"\n @class = PurchaseOrder\n @css_class = \"purchaseorders\"\n @name = \"Purchase Orders\"\n when \"keycodes_search\"\n @class = Key\n @css_class = \"keycodes\"\n @name = \"Key Codes\"\n when \"end_user_search\"\n @class = EndUser\n @css_class = \"endusers\"\n @name = \"End Users\"\n when \"purchaser_search\"\n @class = Purchaser\n @css_class = \"purchasers\"\n @name = \"Purchaser\"\n when \"assignment_search\"\n @class = Relationship\n @css_class = \"assignments\"\n @name = \"Assignments\"\n end\n \n # Execute search and sort results based on selected model\n @search = @class.search(params[:q])\n @list = @search.result\n @search.build_condition if @search.conditions.empty?\n @search.build_sort if @search.sorts.empty?\n end", "def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end", "def results\n populate\n @results\n end", "def autocomplete_results\n return @results if @results\n return cached_results if cached?\n\n @results = search_words.flat_map do |word|\n completions_for(word).flat_map { |token| fetch_results(token) }\n end\n @results = sorted_results(@results).first(limit)\n cache_results(@results)\n @results\n end", "def searches\n search_objects.map{ |s| s.query }\n end", "def to_array\n @searches.map do |search|\n header = {}\n header.update(:index => search.indices.join(',')) unless search.indices.empty?\n header.update(:type => search.types.join(',')) unless search.types.empty?\n header.update(:search_type => search.options[:search_type]) if search.options[:search_type]\n header.update(:routing => search.options[:routing]) if search.options[:routing]\n header.update(:preference => search.options[:preference]) if search.options[:preference]\n body = search.to_hash\n [ header, body ]\n end.flatten\n end", "def results\n @results\n end", "def get_results\n response = @api.get(@cloud.url(:result, @process_id), no_callbacks: true, token: @cloud.access_token.token)\n @results = []\n response.each do |res|\n @results.push(CopyleaksApi::ResultRecord.new(res))\n end\n @results\n end", "def search_items(name, options = {})\n\t\t\tif (name.is_a?(Hash))\n\t\t\t\toptions = name\n\t\t\telse\n\t\t\t\toptions.merge!(:search => name)\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:type => @@search_types[:item])\n\t\t\treturn search(options)\n\t\tend", "def items\n response[\"items\"]\n end", "def conv_results_to_a_of_h( search_results )\n result_objects = []\n\n search_results[:data].each do |row|\n tmp = {}\n row.each_index do |index|\n tmp[ search_results[:headers][index] ] = row[index]\n end\n result_objects.push(tmp)\n end\n\n return result_objects\n end", "def index\n @search = Item.search(params[:q])\n @search.sorts = 'name asc' if @search.sorts.empty?\n @items = @search.result\n if params[:q].present?\n params[:q].each do |k, v| \n if v == 'name asc'\n @items = @search.result.sort { |p1, p2| p1.name.downcase <=> p2.name.downcase }\n elsif v == 'name desc'\n @items = @search.result.sort { |p2, p1| p1.name.downcase <=> p2.name.downcase }\n end\n end\n end\n end", "def get_results_from_ids\n @response = Entrez.ESummary(ncbi_database_name, id: @ids)\n # URL is too long, probably because there are too many results for NCBI server.\n raise SearchTooBroad.new(@ids) if @response.code == 414\n @results = parent::SearchResult.new_from_splitting_xml(xml)\n end", "def searches\n full = options[:full]\n item_list.map { |item|\n next unless item.is_a?(Search)\n entry = {\n query_params: item.sorted_query,\n updated_at: item.updated_at,\n created_at: item.created_at,\n }\n full && entry.merge!(\n id: item.id,\n user_id: item.user_id,\n user_type: item.user_type,\n )\n entry\n }.compact.as_json\n end", "def items\n @item_data ||= @active_domain.nil? ? EMPTY_ITEM_DATA : get_items(@query)\n @item_data[:items]\n end", "def results\n return @scope if @query_string.blank?\n\n matches = @query_string.split.map do |word|\n @scope.ransack(search_terms(word)).result.pluck(:id)\n end\n\n Spree::Variant.where(id: matches.inject(:&))\n end", "def search_bing\n search_results = bing_search.first_50\n #set_reports\n return search_results\n end", "def search_items(name, options = {})\n\t\t\tif (name.is_a?(Hash))\n\t\t\t\toptions = name\n\t\t\telse\n\t\t\t\toptions.merge!(:search => name)\n\t\t\tend\n\t\t\t\n\t\t\toptions.merge!(:type => @@search_types[:item])\n\t\t\t\n\t\t\tputs options.inspect if options[:debug]\n\t\t\treturn search(options)\n\t\tend", "def ar_search_results tags= {}\n if !@query || @query.empty? \n result= controller.ardata.labels[:ask_for_search_terms]\n elsif @search_results && @search_results.total_hits > 0\n\n result= sprintf(controller.ardata.labels[:search_results_summary], \n @search_results.total_hits, @query)\n \n items= @search_results.inject([]) do |elems_array, elem|\n elems_array << content_tag(tags[:item] || :li, ar_transform_search_result(elem))\n end\n\n result= \"#{result}\\n#{content_tag(tags[:items] || :ul, items.join(\"\\n\"))}\"\n else\n result= sprintf(controller.ardata.labels[:search_results_summary], 0, @query)\n end\n \n content_tag(tags[:enclose] || :p, result)\n end" ]
[ "0.72065085", "0.7196961", "0.69212794", "0.6906977", "0.6892322", "0.680267", "0.67759824", "0.67704743", "0.6734717", "0.67287344", "0.6688951", "0.6667835", "0.66037166", "0.6577004", "0.64987475", "0.6496369", "0.64909303", "0.6435062", "0.63871735", "0.6367216", "0.6351609", "0.63399404", "0.6330891", "0.63160074", "0.63069916", "0.6287461", "0.628461", "0.62821525", "0.62580246", "0.6251384", "0.6238641", "0.62328184", "0.62308776", "0.6225572", "0.62246346", "0.6219596", "0.6218904", "0.6213856", "0.6181908", "0.61619747", "0.6155884", "0.6152268", "0.61505616", "0.6146113", "0.61341566", "0.61299825", "0.61296374", "0.61235845", "0.61116606", "0.60972637", "0.6094774", "0.6090211", "0.6089139", "0.60722214", "0.6071988", "0.6060982", "0.6059798", "0.6057808", "0.6052634", "0.6050263", "0.60408896", "0.6037693", "0.60366654", "0.60314006", "0.60302496", "0.6029354", "0.60291797", "0.60288614", "0.60278994", "0.60249496", "0.60140973", "0.60136986", "0.60100245", "0.6003936", "0.5998434", "0.5982346", "0.5982335", "0.597528", "0.5960243", "0.5958066", "0.59561217", "0.5949446", "0.59464705", "0.5941024", "0.59410226", "0.5940312", "0.59370625", "0.5926827", "0.59199876", "0.59130424", "0.5912348", "0.5911954", "0.5910405", "0.5907479", "0.5907065", "0.59028745", "0.59027", "0.5896245", "0.58957404", "0.58954114", "0.58870167" ]
0.0
-1
GET /profesores GET /profesores.json
def index @profesores = Profesore.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @profesore = Profesore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesore }\n end\n end", "def index\n @profesors = Profesor.all\n # if @profesors!= nil\n#render json: @profesors\n#else\n# @profesors= '{\"exito\",false,\"no se encontraron profesores\"}'\n\n render json: @profesors\n # end\n end", "def show\n @proficiency = Proficiency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proficiency }\n end\n end", "def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end", "def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end", "def index\n @user_profs = UserProf.all\n end", "def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end", "def show\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \t\t\trender json: @usuario.pedidos.find(@pedido.id)\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \t\t\trender json: @negocio.pedidos.find(@pedido.id)\n \t\tend\n \tend", "def index\n @profils = Profil.all\n end", "def show\n @course = Course.find(params[:id])\n\tlista_profes = @course.profesors\n\tlista_alumnos = @course.alumns\n\tx = Array.new\n\ty = Array.new\n\tlista_profes.each do |p|\n\t\tx << p.user_id\n\tend\n\tlista_alumnos.each do |a|\n\t\ty << a.user_id\n\tend\n\t@profes = User.find(x)\n\t@alumnos = User.find(y)\n\t\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @course }\n end\n end", "def show\n @profesor = Profesor.find(params[:id])\n @grupos = Grupo.find_all_by_profesor_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profesor }\n end\n end", "def index\n @profesia = Profesium.all\n end", "def new\n @profesore = Profesore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesore }\n end\n end", "def show\n @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfilnegocio }\n end\n end", "def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end", "def set_profesor\n @profesor = Profesor.find(params[:id])\n end", "def set_profesor\n @profesor = Profesor.find(params[:id])\n end", "def alta_profesores_lista\n\t\t@profesores = []\n\t\t@tab = \"admin\"\n\t\tusuarios = User.select('id, matricula, nombre, apellido, admin, profesor').order(:matricula)\n\t\tusuarios.each do |usuario|\n\t\t\tif (usuario.matricula[0].chr == \"l\") || (usuario.matricula[0].chr == \"L\")\n\t\t\t#se checa primero que la matricula empiece con 'l'\n\t\t\t#'chr' se utiliza para leer el caracter tomando el ASCII\n\t\t\t\tif (!usuario.admin? && !usuario.profesor?)\n\t\t\t\t#checar que no sea admin ni profesor aun\n\t\t\t\t\t@profesores << usuario\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def index\n @profesors = Profesor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @profesors }\n end\n end", "def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end", "def index\r\n @sivic_profissaos = SivicProfissao.all\r\n end", "def show\n @profesor = Profesor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profesor }\n end\n end", "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end", "def get_profile_info\n res = {}\n res[:user] = User.select(:login, :city_id, :email, :admin).where(id: session[:user_id]).take\n res[:character] = Character.select(:id, :title).where(id: @current_user.character_id).take\n render json: res\n end", "def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end", "def friend_requests\n friends = current_user.friends.where accepted: false\n profiles = friends.map{ |friend| Profile.find(friend.profile_id)}\n render json: profiles\n end", "def index\n @profesors = Profesor.where(:year => session[:current_year])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @profesors }\n end\n end", "def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end", "def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end", "def show \n if @profesor!=nil\n render json: @profesor\n else \n @profesor='{\"hola\"}'\n end\n render json: @profesor\nend", "def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end", "def alta_profesores\n\t\t@tab = \"admin\"\n\t \tprof = params[:miembro]\n\t \t\n\t \t\tx = User.find(prof)\n\t \t\tx.profesor = true\t#se le dan derechos de profesor\n\t \t\tx.admin = false\n\t \t\tx.estudiante = false\n\t \t\tx.save\n\t \t\n\t \trespond_to do |format|\n\t\t format.html { redirect_to(alta_profesores_lista_path)}\n\t\t format.xml { head :ok }\n\t\tend\n\tend", "def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end", "def show\n @perfil = Profissional.select(:id, :nome_comercial, :nome_completo).joins(:profissoes_profissionais, :areas_profissionais, :servicos).select(:profissao_id)\n end", "def index\n @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def grab_professors\n professor_size = User.where(:professor => true).length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n if current_offset + direction < professor_size && current_offset + direction >= 0\n offset = current_offset + direction\n @professors = User.where(:professor => true).offset(offset).take(10)\n render :json => @professors\n else\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end\n\n }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @usuario_partida = UsuarioPartida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario_partida }\n end\n end", "def get_todo_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.todos\n\n render status: 200, json: @restaurants\n end", "def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @asignatura_list = Asignatura.all\n @profesor = Profesor.find(params[:id])\n\n end", "def set_profane\n @profane = Profane.find(params[:id])\n end", "def profile\n p @user.as_json\n render json: @user.as_json\n end", "def index\n @profits = Profit.all\n end", "def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end", "def show_current\n user = current_user\n profile = Profile.find_by user_id: user.id\n\n render json: profile\n end", "def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @frequencia_profissao = Frequencia::Profissao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb.erb\n format.xml { render :xml => @frequencia_profissao }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n\n render json: @usuario\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end", "def index\n @protectoras = Protectora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @protectoras }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end", "def professional_info\n respond_with_entity(api.get('/api/v1/profile/professional_info'),\n NexaasID::Entities::Profile::ProfessionalInfo)\n end", "def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end", "def show\n @profile = Profile.find_by_user_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile.to_json(:include => [:faculty, :course]) }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end", "def list_pengaduan_proses\n pengaduan = Pengaduan.all.where(status: 'proses').where(user_id: @user.id).order(created_at: :desc)\n render json: {status: true, total: pengaduan.count, data: pengaduan}\n end", "def show\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @propuesta }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end", "def index\n @provedores = Provedor.all\n end", "def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end", "def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end", "def show\n @prof_inspection = ProfInspection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prof_inspection }\n end\n end", "def index\n @student_profiles = StudentProfile.all \n render json: @student_profiles\n end", "def index\n @profiles = current_user.profiles\n end", "def index\n @profiles = current_user.profiles\n end", "def create\n @profesore = Profesore.new(params[:profesore])\n\n respond_to do |format|\n if @profesore.save\n format.html { redirect_to @profesore, notice: 'Profesore was successfully created.' }\n format.json { render json: @profesore, status: :created, location: @profesore }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profesore.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @frequencia_profissoes = Frequencia::Profissao.order('updated_at ASC').paginate :page => params[:page], :per_page => 10\n @total = Frequencia::Profissao.all.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @frequencia_profissoes }\n end\n end", "def profile\n render_json 0,\"ok\",current_member.as_profile\n end", "def update\n @profesor = Profesor.find(params[:id])\n\n if @profesor.update(profesor_params)\n head :no_content\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def show\n p params\n p \"just herer for checking\"\n #@profile = Profile.find(params[:id])\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @uploadprof = Uploadprof.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uploadprof }\n end\n end", "def profesor_params\n params.require(:profesor).permit(:nombres, :apellidos, :email, :tipo)\n end", "def index\n @propuestas = Propuesta.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @propuestas }\n end\n end", "def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\n end\n end", "def set_prof\n @prof = Prof.find(params[:id])\n end", "def set_prof\n @prof = Prof.find(params[:id])\n end", "def create\n @prof = Prof.new(prof_params)\n\n respond_to do |format|\n if @prof.save\n format.html { redirect_to @prof, notice: 'Prof was successfully created.' }\n format.json { render :show, status: :created, location: @prof }\n else\n format.html { render :new }\n format.json { render json: @prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n if Perfilusuario.where(:id => current_user.id).exists?\n @valor = 1\n @telefonos = Telefonousuario.where(:idUser => current_user.id).order(\"tipo\")\n @emails = Emailusuario.where(:idUser => current_user.id)\n @perfilusuarios = Perfilusuario.find(current_user.id)\n @user = User.find(current_user.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfilusuarios }\n format.json { render json: @telefonos }\n format.json { render json: @emails }\n format.json { render json: @user }\n \n end\n else\n @valor = 0\n end\n \n\n end", "def show\n render json: @skill_user_profile\n end", "def index\n @usuarios = Usuario.paginate(page: params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end", "def show\n @persona = Persona.find(params[:id])\n @users = User.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @persona }\n end\n end", "def set_profesore\r\n @profesore = Profesore.find(params[:id])\r\n end", "def show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\n end\n end", "def index\n professors = Professor.includes(:courses).all\n\n render json: professors.to_json(include: :courses)\n end", "def index\n @profilsekolahs = Profilsekolah.all\n end", "def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def destroy\n @profesore = Profesore.find(params[:id])\n @profesore.destroy\n\n respond_to do |format|\n format.html { redirect_to profesores_url }\n format.json { head :no_content }\n end\n end", "def show\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n @producto = Producto.find(params[:id])\n render json: @usuario.productos.find(@producto.id)\n else\n \t @producto = Producto.find(params[:id])\n render json: @producto\n end\n end" ]
[ "0.69867605", "0.66545045", "0.6432097", "0.6286862", "0.61497325", "0.6138691", "0.6107574", "0.60884714", "0.60807925", "0.6051749", "0.6035779", "0.60297316", "0.60257673", "0.6005934", "0.6001218", "0.5982145", "0.5970275", "0.5970275", "0.5961725", "0.5950382", "0.59289867", "0.5907443", "0.5895923", "0.5893282", "0.5889648", "0.5878459", "0.5861054", "0.5846701", "0.58411133", "0.5839602", "0.58277607", "0.58277607", "0.5826405", "0.5824053", "0.5815061", "0.58111674", "0.5804436", "0.5804063", "0.5791711", "0.5789031", "0.5786189", "0.5779512", "0.57652867", "0.5755534", "0.5736013", "0.5728871", "0.5728512", "0.57107246", "0.5699291", "0.56981635", "0.56951296", "0.5694342", "0.56826615", "0.56695426", "0.56695426", "0.56695426", "0.5668462", "0.5668174", "0.56668895", "0.5657351", "0.56507105", "0.5650107", "0.5648849", "0.56364655", "0.5636274", "0.56352407", "0.5631901", "0.5631901", "0.5616092", "0.56132376", "0.56074595", "0.56074595", "0.5604847", "0.5603179", "0.5603135", "0.5603135", "0.5599624", "0.5597545", "0.55890477", "0.5586411", "0.55787355", "0.55770147", "0.5572237", "0.55721754", "0.55660295", "0.5561796", "0.5561796", "0.5557368", "0.5550264", "0.55477524", "0.5546248", "0.55446047", "0.55388284", "0.5534258", "0.5526045", "0.5525626", "0.5525513", "0.55234253", "0.55177474", "0.55174136" ]
0.6623992
2
GET /profesores/1 GET /profesores/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @profesore = Profesore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesore }\n end\n end", "def show\n @proficiency = Proficiency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proficiency }\n end\n end", "def index\n @profesors = Profesor.all\n # if @profesors!= nil\n#render json: @profesors\n#else\n# @profesors= '{\"exito\",false,\"no se encontraron profesores\"}'\n\n render json: @profesors\n # end\n end", "def show\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end", "def index\r\n @profesores = Profesore.all\r\n end", "def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end", "def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end", "def new\n @profesore = Profesore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesore }\n end\n end", "def show\n @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfilnegocio }\n end\n end", "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end", "def show\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produccion }\n end\n end", "def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server knows about the secret 'pegasuscode'; the data is encoded using this secret, only server knows it so when server gets the information back, it must be the same information server encoded using the secret. Otherwise, it will break.\n # server uses the secret to encode and decode information\n decoded_token = JWT.decode(token, 'pegasuscode', true, { algorithm: 'HS256' })\n\n user_id = decoded_token[0][\"user_id\"] # user id\n\n user = User.find(user_id)\n\n # get the user back\n render json: user\n end", "def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def set_profesor\n @profesor = Profesor.find(params[:id])\n end", "def set_profesor\n @profesor = Profesor.find(params[:id])\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def set_profane\n @profane = Profane.find(params[:id])\n end", "def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end", "def show \n if @profesor!=nil\n render json: @profesor\n else \n @profesor='{\"hola\"}'\n end\n render json: @profesor\nend", "def show\n @profesor = Profesor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profesor }\n end\n end", "def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end", "def show\n @course = Course.find(params[:id])\n\tlista_profes = @course.profesors\n\tlista_alumnos = @course.alumns\n\tx = Array.new\n\ty = Array.new\n\tlista_profes.each do |p|\n\t\tx << p.user_id\n\tend\n\tlista_alumnos.each do |a|\n\t\ty << a.user_id\n\tend\n\t@profes = User.find(x)\n\t@alumnos = User.find(y)\n\t\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=> @course }\n end\n end", "def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end", "def show\n @profesor = Profesor.find(params[:id])\n @grupos = Grupo.find_all_by_profesor_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profesor }\n end\n end", "def profile\n p @user.as_json\n render json: @user.as_json\n end", "def show\n @prof_inspection = ProfInspection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prof_inspection }\n end\n end", "def index\n @profils = Profil.all\n end", "def index\n @user_profs = UserProf.all\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puntaje }\n end\n end", "def show\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @propuesta }\n end\n end", "def index\n @profesia = Profesium.all\n end", "def show\n @frequencia_profissao = Frequencia::Profissao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb.erb\n format.xml { render :xml => @frequencia_profissao }\n end\n end", "def profile\n @oneuser = User.find_by(username: params[:username]) \n profile = user_profile(@oneuser.id, @oneuser.username, @oneuser.email, @oneuser.first_name, @oneuser.last_name, @oneuser.avatar_img, @oneuser.created_at) \n render json: profile\n end", "def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end", "def show\n @uploadprof = Uploadprof.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uploadprof }\n end\n end", "def profile\n render_json 0,\"ok\",current_member.as_profile\n end", "def show\n @usuario_partida = UsuarioPartida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usuario_partida }\n end\n end", "def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def set_prof\n @prof = Prof.find(params[:id])\n end", "def set_prof\n @prof = Prof.find(params[:id])\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def show\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \t\t\trender json: @usuario.pedidos.find(@pedido.id)\n \t\telse\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \t\t\trender json: @negocio.pedidos.find(@pedido.id)\n \t\tend\n \tend", "def show_current\n user = current_user\n profile = Profile.find_by user_id: user.id\n\n render json: profile\n end", "def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end", "def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end", "def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end", "def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def show\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @propose }\n end\n end", "def show\n @usuario = Usuario.find(params[:id])\n\n render json: @usuario\n end", "def show\n @profile = Profile.find_by_user_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile.to_json(:include => [:faculty, :course]) }\n end\n end", "def get_profile_info\n res = {}\n res[:user] = User.select(:login, :city_id, :email, :admin).where(id: session[:user_id]).take\n res[:character] = Character.select(:id, :title).where(id: @current_user.character_id).take\n render json: res\n end", "def profile\n _uuid = uuid.gsub(/-/, '')\n url = \"https://sessionserver.mojang.com/session/minecraft/profile/#{_uuid}\"\n response = Net::HTTP.get_response(URI.parse(url))\n json = JSON.parse(response.body)\n end", "def show\n @patrocinio = Patrocinio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end", "def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end", "def show\n @uniprot = Uniprot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uniprot }\n end\n end", "def profile\n if object = send(:\"current_#{resource_name}\")\n self.resource = resource_class.to_adapter.get!(object.to_key)\n respond_with self.resource\n else\n render json: '', status: 404\n end\n end", "def show\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje }\n end\n end", "def show\n @produkt = Produkt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produkt }\n end\n end", "def new\n @proficiency = Proficiency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proficiency }\n end\n end", "def index\n @profesors = Profesor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @profesors }\n end\n end", "def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end", "def show\n p params\n p \"just herer for checking\"\n #@profile = Profile.find(params[:id])\n @user = User.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @perfil = Profissional.select(:id, :nome_comercial, :nome_completo).joins(:profissoes_profissionais, :areas_profissionais, :servicos).select(:profissao_id)\n end", "def show\n @pologeno = Pologeno.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pologeno }\n end\n end", "def show\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competency_pertenece_asignatura }\n end\n end", "def get_todo_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.todos\n\n render status: 200, json: @restaurants\n end", "def show\n @partecipante = Partecipante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @partecipante }\n end\n end", "def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end", "def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end", "def show\n @usuario = Usuario.find(params[:id])\n render json: @usuario\n end", "def show\n @asignatura_list = Asignatura.all\n @profesor = Profesor.find(params[:id])\n\n end", "def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @pay_profile = PayProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pay_profile }\n end\n end", "def show\n @produtc = Produtc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produtc }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def create\n @prof = Prof.new(prof_params)\n\n respond_to do |format|\n if @prof.save\n format.html { redirect_to @prof, notice: 'Prof was successfully created.' }\n format.json { render :show, status: :created, location: @prof }\n else\n format.html { render :new }\n format.json { render json: @prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_user_detail\n user_id = params[:id]\n user = User.find(user_id)\n\n render json: UserSerializer.new(user).profile_detail_hash\n end", "def show\n @utente = Utente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utente }\n end\n end", "def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end", "def show\n @promocion = Promocion.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @promocion }\n end\n end", "def show\n render json: @skill_user_profile\n end", "def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end", "def index\n @proteins = Protein.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proteins }\n end\n end", "def index\r\n @sivic_profissaos = SivicProfissao.all\r\n end", "def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end", "def show\n @perfil_transaccione = PerfilTransaccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @perfil_transaccione }\n end\n end", "def index\n @profesors = Profesor.where(:year => session[:current_year])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @profesors }\n end\n end", "def index\n @profiles = Profile.all\n @original_niche = get_subscriber_details(@profiles, \"niche\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end", "def find_profile\n\t\t# Find particular Profile \n\t\t@profile = Profile.where(id:params[:id])[0]\n\t\trender json: {success: false, message: 'Invalid Profile ID !'}, status: 400 if @profile.nil?\n\tend", "def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end", "def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end" ]
[ "0.7174125", "0.6799708", "0.6617429", "0.65384585", "0.63686675", "0.63504875", "0.6331206", "0.6256576", "0.62244624", "0.6223824", "0.61442184", "0.61442184", "0.613235", "0.611163", "0.61063224", "0.61063224", "0.61063224", "0.6099474", "0.60792935", "0.60792935", "0.60645527", "0.60601485", "0.6058992", "0.60543966", "0.60543627", "0.6050392", "0.6036089", "0.6024569", "0.6018889", "0.60156024", "0.60129213", "0.6010626", "0.5999189", "0.5994162", "0.5994162", "0.5988555", "0.597513", "0.5974541", "0.5973035", "0.5963686", "0.59609056", "0.59604084", "0.59597987", "0.5956592", "0.5956509", "0.5956509", "0.59510016", "0.5941745", "0.59365594", "0.59347063", "0.5930419", "0.59292823", "0.5922635", "0.59214866", "0.5920105", "0.5906769", "0.5903817", "0.5895601", "0.58820665", "0.587668", "0.5874295", "0.58687013", "0.5864448", "0.58644015", "0.58523387", "0.58484286", "0.5848226", "0.5846622", "0.58446634", "0.5842821", "0.5841732", "0.5841075", "0.5839791", "0.58372986", "0.58341056", "0.5831434", "0.5826224", "0.5826224", "0.5824047", "0.58037335", "0.5802318", "0.57964116", "0.57949007", "0.57882345", "0.5787392", "0.5784849", "0.57840073", "0.5783439", "0.57832825", "0.5781677", "0.5776771", "0.5774886", "0.5765249", "0.5762316", "0.5757326", "0.57496274", "0.5748085", "0.5744297", "0.57400525", "0.573764", "0.57375795" ]
0.0
-1
POST /profesores POST /profesores.json
def create @profesore = Profesore.new(profesore_params) respond_to do |format| if @profesore.save format.html { redirect_to @profesore, notice: 'Profesore was successfully created.' } format.json { render :show, status: :created, location: @profesore } else format.html { render :new } format.json { render json: @profesore.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @profesor = Profesor.new(profesor_params)\n\n if @profesor.save\n render json: @profesor, status: :created, location: @profesor\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def create\n @prof = Prof.new(prof_params)\n\n respond_to do |format|\n if @prof.save\n format.html { redirect_to @prof, notice: 'Prof was successfully created.' }\n format.json { render :show, status: :created, location: @prof }\n else\n format.html { render :new }\n format.json { render json: @prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profesore = Profesore.new(params[:profesore])\n\n respond_to do |format|\n if @profesore.save\n format.html { redirect_to @profesore, notice: 'Profesore was successfully created.' }\n format.json { render json: @profesore, status: :created, location: @profesore }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profesore.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_prof = UserProf.new(user_prof_params)\n\n respond_to do |format|\n if @user_prof.save\n format.html { redirect_to @user_prof, notice: 'User prof was successfully created.' }\n format.json { render :show, status: :created, location: @user_prof }\n else\n format.html { render :new }\n format.json { render json: @user_prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def profesor_params\n params.require(:profesor).permit(:nombres, :apellidos, :email, :tipo)\n end", "def create\n @profane = Profane.new(profane_params)\n\n respond_to do |format|\n if @profane.save\n format.html { redirect_to @profane, notice: 'Profane was successfully created.' }\n format.json { render :show, status: :created, location: @profane }\n else\n format.html { render :new }\n format.json { render json: @profane.errors, status: :unprocessable_entity }\n end\n end\n end", "def profesor_params\n params.require(:profesor).permit(:nombre, :apellido, :email, :inicioatencion, :finatencion)\n end", "def profesore_params\r\n params.require(:profesore).permit(:rut, :nombre, :apellido_paterno, :apellido_materno, :correo, :descripcion, :usuario_id, :estado)\r\n end", "def create\n @profesor = Profesor.new(params[:profesor])\n\n respond_to do |format|\n if @profesor.save\n flash[:notice] = \" El Profesor #{@profesor.nombre_completo} fue creado exitosamente.\"\n format.html { redirect_to(@profesor) }\n format.xml { render :xml => @profesor, :status => :created, :location => @profesor }\n else\n flash[:error] = \"Hubo un error creando el profesor.\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profesor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profesor_grado = ProfesorGrado.new(profesor_grado_params)\n\n respond_to do |format|\n if @profesor_grado.save\n format.html { redirect_to @profesor_grado, notice: 'Profesor grado was successfully created.' }\n format.json { render :show, status: :created, location: @profesor_grado }\n else\n format.html { render :new }\n format.json { render json: @profesor_grado.errors, status: :unprocessable_entity }\n end\n end\n end", "def sivic_profissao_params\r\n params.require(:sivic_profissao).permit(:profissao)\r\n end", "def create\n @profesor = Profesor.new(params[:profesor])\n\n respond_to do |format|\n if @profesor.save\n format.html { redirect_to(@profesor, :notice => 'Profesor was successfully created.') }\n format.xml { render :xml => @profesor, :status => :created, :location => @profesor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profesor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profesor = Profesor.new(params[:profesor])\n\n respond_to do |format|\n if @profesor.save\n format.html { redirect_to(@profesor, :notice => 'Profesor was successfully created.') }\n format.xml { render :xml => @profesor, :status => :created, :location => @profesor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profesor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def profesion_params\n params.require(:profesion).permit(:name)\n end", "def create\r\n @sivic_profissao = SivicProfissao.new(sivic_profissao_params)\r\n\r\n respond_to do |format|\r\n if @sivic_profissao.save\r\n format.html { redirect_to @sivic_profissao, notice: 'Sivic profissao was successfully created.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_profissao }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_profissao.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @frequencia_profissao = Frequencia::Profissao.new(params[:frequencia_profissao])\n\n respond_to do |format|\n if @frequencia_profissao.save\n format.html { redirect_to(@frequencia_profissao, :notice => 'Profissão salva com sucesso.') }\n format.xml { render :xml => @frequencia_profissao, :status => :created, :location => @frequencia_profissao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @frequencia_profissao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profil = Profil.new(profil_params)\n @profil.user_id = current_user.id\n @user = current_user\n\n # Only increment profilestatus if not done yet\n if Profil.where(user_id: current_user).blank?\n @user.increment!(:profilstatus)\n end\n\n respond_to do |format|\n if @profil.save\n format.html { redirect_to @profil, notice: 'Profil erfolgreich erstellt.' }\n format.json { render :show, status: :created, location: @profil }\n else\n format.html { render :new }\n format.json { render json: @profil.errors, status: :unprocessable_entity }\n end\n end\n end", "def alta_profesores\n\t\t@tab = \"admin\"\n\t \tprof = params[:miembro]\n\t \t\n\t \t\tx = User.find(prof)\n\t \t\tx.profesor = true\t#se le dan derechos de profesor\n\t \t\tx.admin = false\n\t \t\tx.estudiante = false\n\t \t\tx.save\n\t \t\n\t \trespond_to do |format|\n\t\t format.html { redirect_to(alta_profesores_lista_path)}\n\t\t format.xml { head :ok }\n\t\tend\n\tend", "def create\n @perfisusuario = Perfisusuario.new(perfisusuario_params)\n\n respond_to do |format|\n if @perfisusuario.save\n format.html { redirect_to perfisusuarios_url, notice: 'Perfil de Usuário criado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @perfisusuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def agregar_profesor\n @grupo = Grupo.find(params[:id])\n if request.get?\n @profesores = Profesor.search(params[:buscar])\n end\n if request.put?\n @profesor = Profesor.find(params[:profesor_id])\n @grupo.profesor = @profesor\n flash[:notice] = \"Se modificó el profesor al grupo #{@grupo.nombre_completo}\" if @grupo.save\n redirect_to grupo_path(@grupo)\n end\n end", "def create\n @uploadprof = Uploadprof.new(params[:uploadprof])\n\n respond_to do |format|\n if @uploadprof.save\n format.html { redirect_to @uploadprof, notice: 'Uploadprof was successfully created.' }\n format.json { render json: @uploadprof, status: :created, location: @uploadprof }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uploadprof.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.new(params[:profesor_pertenece_asignatura])\n puts params.inspect + \"AVISOOOOO++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"\n respond_to do |format|\n if @profesor_pertenece_asignatura.save\n format.html { redirect_to @profesor_pertenece_asignatura, notice: 'Profesor pertenece asignatura was successfully created.' }\n format.json { render json: @profesor_pertenece_asignatura, status: :created, location: @profesor_pertenece_asignatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profesor_pertenece_asignatura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profil = Profil.new(profil_params)\n @profil.user_id = current_user.id\n\n respond_to do |format|\n if @profil.save\n format.html { redirect_to @profil, notice: 'Profil was successfully created.' }\n format.json { render :show, status: :created, location: @profil }\n\n #Nachdem ein Profil erstellt wurde speichert man die Profil ID in den user\n @user = User.find_by id: current_user.id\n @user.profil_id = @profil.id\n @user.save\n else\n format.html { render :new }\n format.json { render json: @profil.errors, status: :unprocessable_entity }\n end\n end\n end", "def prof_params\n params.require(:prof).permit(:name, :dept)\n end", "def create\n @socio_carteira_prof = SocioCarteiraProf.new(socio_carteira_prof_params)\n\n respond_to do |format|\n if @socio_carteira_prof.save\n format.html { redirect_to @socio_carteira_prof, notice: 'Socio carteira prof was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_carteira_prof }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_carteira_prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @profesore = Profesore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesore }\n end\n end", "def profesor_grado_params\n params.require(:profesor_grado).permit(:profesor_id, :trabajo_grado_id)\n end", "def profesium_params\n params.require(:profesium).permit(:profesia_cislo, :nazov_profesie)\n end", "def prof_params\n params.require(:prof).permit(:div, :title, :grade, :grades, :subject, :proffesion, :day, :time, :classroom)\n end", "def set_profesor\n @profesor = Profesor.find(params[:id])\n end", "def set_profesor\n @profesor = Profesor.find(params[:id])\n end", "def user_prof_params\n params.require(:user_prof).permit(:name, :age, :male)\n end", "def index\n @profesors = Profesor.all\n # if @profesors!= nil\n#render json: @profesors\n#else\n# @profesors= '{\"exito\",false,\"no se encontraron profesores\"}'\n\n render json: @profesors\n # end\n end", "def create\n @prospie = Prospie.new (prospie_params)\n @prospie.user = current_user\n\n respond_to do |format|\n if @prospie.save\n format.html { redirect_to @prospie, notice: 'Prospie was successfully created.' }\n format.json { render :show, status: :created, location: @prospie }\n else\n format.html { render :new }\n format.json { render json: @prospie.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end", "def create\n @usuario_perfil = UsuarioPerfil.new(usuario_perfil_params)\n\n respond_to do |format|\n if @usuario_perfil.save\n format.html { redirect_to @usuario_perfil, notice: 'Usuario perfil was successfully created.' }\n format.json { render :show, status: :created, location: @usuario_perfil }\n else\n format.html { render :new }\n format.json { render json: @usuario_perfil.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:propietario]\n @negocio_propio = Negocio.find(params[:negocio_id])\n @propietario = Usuario.find(params[:usuario_id])\n authorize! :update, @propietario\n if @propietario.negocios_propios << @negocio_propio\n render json: @propietario.negocios_propios, status: :created\n else\n render json: @propietario.negocios_propios.errors, status: :unprocessable_entity\n end\n else\n @negocio = Negocio.new(parametros_negocio)\n authorize! :create, Negocio\n if @negocio.save\n render json: @negocio, status: :created\n else\n render json: @negocio.errors, status: :unprocessable_entity\n end\n end\n end", "def create \n examenes = params[:examenes]\n byebug \n\n if !params[:perfil][:nombre].nil? || !params[:perfil][:nombre].blank?\n @perfil = Perfil.new(perfil_params) \n @perfil.save\n \n respond_to do |format|\n if @perfil.save\n \n examenes.each do |examen|\n @perfil_examenes = PerfilExamene.new\n @perfil_examenes.perfil_id = @perfil.id\n @perfil_examenes.tipo_examen_id = examen\n @perfil_examenes.save\n end \n \n byebug\n\n format.html { redirect_to perfils_path, notice: 'El Perfil fue creado exitosamente' }\n format.json { render json: { :examenes => examen } }\n else\n \n format.html { render :new }\n format.json { render json: { :examenes => examen } }\n end\n end\n else\n \n respond_to do |format| \n format.html { redirect_to perfils_path, notice: 'El Perfil no fue creado correctamente vuelva a intentarlo' }\n format.json { render json: { :examenes => examen } } \n end\n end \n\n end", "def update\n @profesor = Profesor.find(params[:id])\n\n if @profesor.update(profesor_params)\n head :no_content\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def create\n @profesium = Profesium.new(profesium_params)\n\n respond_to do |format|\n if @profesium.save\n format.html { redirect_to @profesium, notice: 'Profesium was successfully created.' }\n format.json { render :show, status: :created, location: @profesium }\n else\n format.html { render :new }\n format.json { render json: @profesium.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end", "def create\n @profile = current_user.build_profile(pro_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { redirect_to new_profile_path, alert: 'Please fill all fields' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n if session[:user]['perfil'] == 'Administrador'\n @user = User.new\n @user.nome = params[:user][:nome]\n @user.login = params[:user][:login]\n @user.email = params[:user][:email]\n @user.profile_id = params[:user][:profile_id]\n\n respond_to do |format|\n if @user.save\n\n # Vincula perfis aos usuário\n # vincular_user_profiles\n\n # Vincula os módulos e dominios ao usuário\n vincular_modulos_ao_usuario\n\n flash[:notice] = 'Usuário criado com sucesso.'\n format.html {redirect_to '/users'}\n format.json {render :show, status: :created, location: @user}\n else\n format.html {render :new}\n format.json {render json: @user.errors, status: :unprocessable_entity}\n end\n end\n else\n respond_to do |format|\n flash[:warning] = 'Você não possui permissão para acessar esse recurso.'\n format.html {redirect_to '/'}\n format.json {head :no_content}\n end\n end\n end", "def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end", "def profil_params\n params.require(:profil).permit(:name, :age, :hobbies, :sexe, :catname, :colorcat, :coloreyes, :hair, :message, :picture, :city)\n end", "def create\n @perfil = Perfil.new(perfil_params)\n @perfil.usuario = current_usuario\n\n respond_to do |format|\n if @perfil.save\n format.html { redirect_to perfil_usuario_path, notice: 'Perfil criado com sucesso!' }\n format.json { render :show, status: :created, location: @perfil }\n else\n format.html { render :new }\n format.json { render json: @perfil.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile_params\n\t\t\tparams.require(:profile).permit(:tipo)\n\t\tend", "def profile_params\n params.require(:profile).permit(:cedula, :primer_nombre,:segundo_nombre, :primer_apellido, :segundo_apellido, :email, :telefono, :fecha_nac,:fecha_ing, :family_id,:photo,:sexo)\n end", "def create\n @profilsekolah = Profilsekolah.new(profilsekolah_params)\n\n respond_to do |format|\n if @profilsekolah.save\n format.html { redirect_to @profilsekolah, notice: 'Profilsekolah was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profilsekolah }\n else\n format.html { render action: 'new' }\n format.json { render json: @profilsekolah.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @perfil_egresado = PerfilEgresado.new(perfil_egresado_params)\n\n respond_to do |format|\n if @perfil_egresado.save\n format.html { redirect_to @perfil_egresado, notice: 'Perfil egresado was successfully created.' }\n format.json { render :show, status: :created, location: @perfil_egresado }\n else\n format.html { render :new }\n format.json { render json: @perfil_egresado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @usuario_proyecto = UsuarioProyecto.new(usuario_proyecto_params)\n\n respond_to do |format|\n if @usuario_proyecto.save\n format.html { redirect_to @usuario_proyecto, notice: 'Usuario proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @usuario_proyecto }\n else\n format.html { render :new }\n format.json { render json: @usuario_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @proposta = Propostum.new(propostum_params)\n\n respond_to do |format|\n if @proposta.save\n format.html { redirect_to @proposta, notice: 'Propostum was successfully created.' }\n format.json { render :show, status: :created, location: @proposta }\n else\n format.html { render :new }\n format.json { render json: @proposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def provedor_params\n params.require(:provedor).permit(:uf, :municipio, :microRegiao, :razaoSocial, :numAto, :termo, :endereco, :telefone)\n end", "def set_profane\n @profane = Profane.find(params[:id])\n end", "def create\n if not ( paziente_signed_in? or administrator_signed_in?)\n redirect_to root_path and return\n end\n @profilopazienti = Profilopazienti.new(profilopazienti_params)\n\n respond_to do |format|\n if @profilopazienti.save\n format.html { redirect_to @profilopazienti, notice: \"Profilopazienti was successfully created.\" }\n format.json { render :show, status: :created, location: @profilopazienti }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @profilopazienti.errors, status: :unprocessable_entity }\n end\n end\n end", "def profil_params\n params.require(:profil).permit(:profilname, :email, :bio, :profiltyp, :land, :ort, :sprache, :alter, :vorname, :nachname)\n end", "def create\n @provincium = Provincium.new(provincium_params)\n\n respond_to do |format|\n if @provincium.save\n format.html { redirect_to @provincium, notice: 'Provincium was successfully created.' }\n format.json { render :show, status: :created, location: @provincium }\n else\n format.html { render :new }\n format.json { render json: @provincium.errors, status: :unprocessable_entity }\n end\n end\n end", "def profissional_params\n params.require(:profissional).permit(:areas_profissional_id, :profissoes_profissional_id, :nome_completo, :nome_comercial, :whatsapp, :celular, :email, :rua, :cep, :estado, :bairro, :cidade, :ativo)\n end", "def create\n\n @profile = Profile.new(profile_params)\n\n cedula = params[:profile][:cedula]\n if Profile.where(cedula: cedula.strip).length>0\n redirect_to(:back,alert: \"Lo sentimos, ya existe un perfil con esta cedula.\") \n return\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'El perfil fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n @userArr = User.where(cedula: cedula.strip)\n if(@userArr.length>0)\n @userArr[0].profile=@profile\n @userArr[0].save\n end \n end", "def create\n @user_proyecto = UserProyecto.new(user_proyecto_params)\n\n respond_to do |format|\n if @user_proyecto.save\n format.html { redirect_to @user_proyecto, notice: 'User proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @user_proyecto }\n else\n format.html { render :new }\n format.json { render json: @user_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n pessoa = Pessoa.new(pessoa_params) \n \n if pessoa.save\n render json: {status: 'SUCCESSO', message:'Usuário cadastrado com sucesso!', data:pessoa},status: :ok\n else\n render json: {status: 'ERRO', message:'Usuário não pode ser cadastrado. Tente novamente mais tarde.', data:pessoa.errors},status: :unprocessable_entity\n end\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @profesore.update(profesore_params)\r\n format.html { redirect_to @profesore, notice: 'Profesore was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @profesore }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @profesore.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @proyectos_user = ProyectosUser.new(proyectos_user_params)\n\n respond_to do |format|\n if @proyectos_user.save\n format.html { redirect_to @proyectos_user, notice: 'Proyectos user was successfully created.' }\n format.json { render action: 'show', status: :created, location: @proyectos_user }\n else\n format.html { render action: 'new' }\n format.json { render json: @proyectos_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def proficiency_params\n params.require(:proficiency).permit(:level, :user_id, :language_id)\n end", "def profane_params\n params.require(:profane).permit(:text)\n end", "def create\n @permiso = Permiso.new(permiso_params)\n\n respond_to do |format|\n if @permiso.save\n format.html { redirect_to permisos_path, notice: 'Permiso fue creado con éxito.' }\n format.json { render :show, status: :created, location: @permiso }\n else\n format.html { render :new }\n format.json { render json: @permiso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produto = Produto.new(params[:produto])\n @produto.empresa = session[:usuario].empresa\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prof.update(prof_params)\n format.html { redirect_to @prof, notice: 'Prof was successfully updated.' }\n format.json { render :show, status: :ok, location: @prof }\n else\n format.html { render :edit }\n format.json { render json: @prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @perfilnegocio = Perfilnegocio.new(params[:perfilnegocio])\n\n respond_to do |format|\n if @perfilnegocio.save\n format.html { redirect_to @perfilnegocio, notice: 'Perfilnegocio was successfully created.' }\n format.json { render json: @perfilnegocio, status: :created, location: @perfilnegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @perfilnegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profane.update(profane_params)\n format.html { redirect_to @profane, notice: 'Profane was successfully updated.' }\n format.json { render :show, status: :ok, location: @profane }\n else\n format.html { render :edit }\n format.json { render json: @profane.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile_params\n params.require(:profile).permit(:foto, :nombre, :apellido, :direccion, :estado, :zip, :user_id)\n end", "def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tuhu_prodoct = Tuhu::Prodoct.new(tuhu_prodoct_params)\n\n respond_to do |format|\n if @tuhu_prodoct.save\n format.html { redirect_to @tuhu_prodoct, notice: 'Prodoct was successfully created.' }\n format.json { render :show, status: :created, location: @tuhu_prodoct }\n else\n format.html { render :new }\n format.json { render json: @tuhu_prodoct.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @proficiency = Proficiency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proficiency }\n end\n end", "def create\n @produccion = Produccion.new(params[:produccion])\n\n respond_to do |format|\n if @produccion.save\n format.html { redirect_to @produccion, notice: 'Produccion was successfully created.' }\n format.json { render json: @produccion, status: :created, location: @produccion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produccion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sessao = Sessao.new(sessao_params)\n psicologos_for_select\n pacientes_for_select\n respond_to do |format|\n @sessao.user = current_user\n if @sessao.save\n format.html { redirect_to @sessao, notice: \"Sessao was successfully created.\" }\n format.json { render :show, status: :created, location: @sessao }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sessao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, :notice => 'Корисничкиот профил е успешно создаден.' }\n format.json { render :json => @user_profile, :status => :created, :location => @user_profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user_profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @pagina_principal = PaginaPrincipal.new(pagina_principal_params)\n\n respond_to do |format|\n if @pagina_principal.save\n format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully created.' }\n format.json { render :show, status: :created, location: @pagina_principal }\n else\n format.html { render :new }\n format.json { render json: @pagina_principal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n byebug\n @skill_user_profile = SkillUserProfile.new(skill_user_profile_params)\n\n if @skill_user_profile.save\n render json: @skill_user_profile, status: :created, location: @skill_user_profile\n else\n render json: @skill_user_profile.errors, status: :unprocessable_entity\n end\n end", "def create\n @priest_user = PriestUser.new(priest_user_params)\n\n respond_to do |format|\n if @priest_user.save\n format.html { redirect_to @priest_user, notice: 'Priest user was successfully created.' }\n format.json { render :show, status: :created, location: @priest_user }\n else\n format.html { render :new }\n format.json { render json: @priest_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.find(session[:user_id])\n @proyecto = Proyecto.new(proyecto_params)\n @user.proyectos << @proyecto\n @proyecto.update(empresa_id: @user.id)\n #it gets values from skill \n params[:proskill][:skill_ids] ||= []\n skills = params[:proskill][:skill_ids]\n skills.each do |skill|\n @proskill = Proskill.new(skill_id: skill, proyecto_id: @proyecto.id)\n @proskill.save\n end\n\n respond_to do |format|\n if @proyecto.save\n format.html { redirect_to @proyecto, notice: 'Proyecto was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto }\n else\n format.html { render :new }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @predio = Predio.new(predio_params)\n\n respond_to do |format|\n if @predio.save\n format.html { redirect_to @predio, notice: 'Predio foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @predio }\n else\n format.html { render :new }\n format.json { render json: @predio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @suceso_perro = SucesoPerro.new(suceso_perro_params)\n\n respond_to do |format|\n if @suceso_perro.save\n format.html { redirect_to @suceso_perro, notice: 'Suceso perro was successfully created.' }\n format.json { render :show, status: :created, location: @suceso_perro }\n else\n format.html { render :new }\n format.json { render json: @suceso_perro.errors, status: :unprocessable_entity }\n end\n end\n end", "def professor_params\n params.require(:professor).permit(:nome, :sobrenome, :modalidades_id, :graduacao,:users_id)\n end", "def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\r\n @profesores = Profesore.all\r\n end", "def profilopazienti_params\n params.require(:profilopazienti).permit(:nome, :cognome, :eta, :descrizione, :paziente_id)\n end", "def create\n @usuario_projeto = UsuarioProjeto.new(usuario_projeto_params)\n\n respond_to do |format|\n if @usuario_projeto.save\n format.html { redirect_to @usuario_projeto, notice: 'Usuario projeto was successfully created.' }\n format.json { render :show, status: :created, location: @usuario_projeto }\n else\n format.html { render :new }\n format.json { render json: @usuario_projeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # verificar si el usuario esta logeado\n if user_signed_in?\n # si es nil el valor enviado como parametro se obtiene de session\n params[:profile] ||= session[:profile]\n # Referenciar el usuario en session\n @profile = Profile.new(params[:profile])\n if @profile.save\n session[:profile] = nil\n redirect_to @profile, notice: 'Su perfil fue creado satisfactoriamente.'\n end\n else \n # Guardar el perfil creado en session\n session[:profile] = Profile.new(params[:profile])\n # No esta autenticado el usuario, redireccionar para crear cuenta\n redirect_to new_user_registration_path\n end\n end", "def destroy\r\n @profesore.destroy\r\n respond_to do |format|\r\n format.html { redirect_to profesores_url, notice: 'Profesore was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def create\n @professional_profile = ProfessionalProfile.new(professional_profile_params)\n @professional_profile.user = current_user\n\n respond_to do |format|\n if @professional_profile.save\n format.html { redirect_to @professional_profile, notice: 'Professional profile was successfully created.' }\n format.json { render :show, status: :created, location: @professional_profile }\n else\n format.html { render :new }\n format.json { render json: @professional_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prominent = Prominent.new(prominent_params)\n\n respond_to do |format|\n if @prominent.save\n format.html { redirect_to @prominent, notice: 'Prominent was successfully created.' }\n format.json { render :show, status: :created, location: @prominent }\n else\n format.html { render :new }\n format.json { render json: @prominent.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profesore\r\n @profesore = Profesore.find(params[:id])\r\n end", "def create\n @preferences = Preference.all\n @age_preferences = AgePreference.all\n @profil = Profil.new(profil_params)\n @profil.lover_id = session[:id]\n @profil.sexe = params[:sexe]\n @profil.preference_id = params[:preference]\n @profil.age_preference_id = params[:age_preference]\n\n respond_to do |format|\n if @profil.save\n session[:idprofil] = @profil.id\n format.html { redirect_to space_path, notice: 'Profil was successfully created.' }\n else\n format.html { redirect_to space_path, notice: 'Profil was successfully created.' }\n #return @profil.errors\n\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def propostum_params\n params.require(:propostum).permit(:nome, :descricao, :valor, :inicio, :fim, :cidade)\n end", "def profile_params\n params.require(:profile).permit(PERMIT_FIELDS)\n end" ]
[ "0.736268", "0.6978027", "0.6969686", "0.6839492", "0.68077594", "0.6781387", "0.6726943", "0.6448134", "0.6400282", "0.6335833", "0.63357866", "0.62787294", "0.62787294", "0.6252644", "0.6141328", "0.6139076", "0.6131122", "0.60647273", "0.6055458", "0.60545486", "0.6028342", "0.60147566", "0.6008345", "0.5946218", "0.5936477", "0.585858", "0.5856875", "0.584818", "0.584332", "0.58281785", "0.58281785", "0.5819571", "0.5803642", "0.5775068", "0.5720117", "0.56891716", "0.56728345", "0.5667074", "0.56622195", "0.56485695", "0.5648335", "0.56432766", "0.5640572", "0.5623782", "0.56194454", "0.5612325", "0.5611495", "0.55964136", "0.55925614", "0.5582576", "0.558116", "0.5580106", "0.556889", "0.55644685", "0.55590874", "0.5556416", "0.5543629", "0.55372673", "0.55362487", "0.5534208", "0.55298865", "0.55185694", "0.55132717", "0.551297", "0.5499125", "0.54924184", "0.54875726", "0.5473265", "0.54716194", "0.5471144", "0.5464977", "0.5464722", "0.5436569", "0.54358834", "0.5434079", "0.5431967", "0.5430159", "0.5428442", "0.54197633", "0.54135215", "0.5410974", "0.5408478", "0.54049176", "0.5397173", "0.5396155", "0.53951275", "0.5388365", "0.5384545", "0.53825814", "0.53796136", "0.53792137", "0.537693", "0.5375535", "0.5366747", "0.5364523", "0.536226", "0.53590715", "0.53585577", "0.5352469", "0.53519344" ]
0.6744405
6
PATCH/PUT /profesores/1 PATCH/PUT /profesores/1.json
def update respond_to do |format| if @profesore.update(profesore_params) format.html { redirect_to @profesore, notice: 'Profesore was successfully updated.' } format.json { render :show, status: :ok, location: @profesore } else format.html { render :edit } format.json { render json: @profesore.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @profesor = Profesor.find(params[:id])\n\n if @profesor.update(profesor_params)\n head :no_content\n else\n render json: @profesor.errors, status: :unprocessable_entity\n end\n end", "def update\n @profesore = Profesore.find(params[:id])\n\n respond_to do |format|\n if @profesore.update_attributes(params[:profesore])\n format.html { redirect_to @profesore, notice: 'Profesore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profesore.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profane.update(profane_params)\n format.html { redirect_to @profane, notice: 'Profane was successfully updated.' }\n format.json { render :show, status: :ok, location: @profane }\n else\n format.html { render :edit }\n format.json { render json: @profane.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prof.update(prof_params)\n format.html { redirect_to @prof, notice: 'Prof was successfully updated.' }\n format.json { render :show, status: :ok, location: @prof }\n else\n format.html { render :edit }\n format.json { render json: @prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profesor = Profesor.find(params[:id])\n\n respond_to do |format|\n if @profesor.update_attributes(params[:profesor])\n format.html { redirect_to root_path, notice: 'Profesor actualizado' }\n format.js { redirect_to root_path }\n else\n format.html { render action: \"edit\" }\n format.js { render json: @profesor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_prof.update(user_prof_params)\n format.html { redirect_to @user_prof, notice: 'User prof was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_prof }\n else\n format.html { render :edit }\n format.json { render json: @user_prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_profissao.update(sivic_profissao_params)\r\n format.html { redirect_to @sivic_profissao, notice: 'Sivic profissao was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_profissao.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @frequencia_profissao = Frequencia::Profissao.find(params[:id])\n\n respond_to do |format|\n if @frequencia_profissao.update_attributes(params[:frequencia_profissao])\n format.html { redirect_to(@frequencia_profissao, :notice => 'Profissão atualizada com sucesso') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @frequencia_profissao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @profesor = Profesor.find(params[:id])\n\n respond_to do |format|\n if @profesor.update_attributes(params[:profesor])\n format.html { redirect_to(@profesor, :notice => 'Profesor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profesor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @profesor = Profesor.find(params[:id])\n\n respond_to do |format|\n if @profesor.update_attributes(params[:profesor])\n flash[:notice] = \"Los datos del Profesor #{@profesor.nombre_completo} se han actualizado.\"\n format.html { redirect_to(@profesor) }\n format.xml { head :ok }\n else\n flash[:error] = \"Hubo un error editando el profesor.\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profesor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @proficiency = Proficiency.find(params[:id])\n\n respond_to do |format|\n if @proficiency.update_attributes(params[:proficiency])\n format.html { redirect_to @proficiency, notice: 'Proficiency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proficiency.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profil.update(profil_params)\n format.html { redirect_to @profil, notice: 'Profil was successfully updated.' }\n format.json { render :show, status: :ok, location: @profil }\n else\n format.html { render :edit }\n format.json { render json: @profil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n\n respond_to do |format|\n if @profesor_pertenece_asignatura.update_attributes(params[:profesor_pertenece_asignatura])\n format.html { redirect_to @profesor_pertenece_asignatura, notice: 'Profesor pertenece asignatura was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profesor_pertenece_asignatura.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @perfisusuario.update(perfisusuario_params)\n format.html { redirect_to perfisusuarios_url, notice: 'Perfil de Usuário editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @perfisusuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profil.update(profil_params)\n format.html { redirect_to @profil, notice: 'Profil erfolgreich aktualisiert.' }\n format.json { render :show, status: :ok, location: @profil }\n else\n format.html { render :edit }\n format.json { render json: @profil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profilsekolah.update(profilsekolah_params)\n format.html { redirect_to @profilsekolah, notice: 'Profilsekolah was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profilsekolah.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @perfilnegocio = Perfilnegocio.find(params[:id])\n\n respond_to do |format|\n if @perfilnegocio.update_attributes(params[:perfilnegocio])\n format.html { redirect_to @perfilnegocio, notice: 'Perfilnegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @perfilnegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @profil.sexe = params[:sexe]\n @profil.preference_id = params[:preference]\n @profil.age_preference_id = params[:age_preference]\n if @profil.update(profil_params)\n format.html { redirect_to space_myprofil_path, notice: 'Profil was successfully updated.' }\n format.json { render :show, status: :ok, location: @profil }\n else\n format.html { render :edit }\n format.json { render json: @profil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profesor_grado.update(profesor_grado_params)\n format.html { redirect_to @profesor_grado, notice: 'Profesor grado was successfully updated.' }\n format.json { render :show, status: :ok, location: @profesor_grado }\n else\n format.html { render :edit }\n format.json { render json: @profesor_grado.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_carteira_prof.update(socio_carteira_prof_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_carteira_prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @propose = Propose.find(params[:id])\n\n respond_to do |format|\n if @propose.update_attributes(params[:propose])\n format.html { redirect_to @propose, notice: 'Propuesta actualizada' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @propose.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profesium.update(profesium_params)\n format.html { redirect_to @profesium, notice: 'Profesium was successfully updated.' }\n format.json { render :show, status: :ok, location: @profesium }\n else\n format.html { render :edit }\n format.json { render json: @profesium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n if @pessoa.update_attributes(params[:pessoa])\n format.html { redirect_to pessoas_path, notice: 'Pessoa atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n if @produccion.update_attributes(params[:produccion])\n format.html { redirect_to @produccion, notice: 'Se ha modificado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produccion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_profession.update(user_profession_params)\n format.html { redirect_to @user_profession, notice: 'User profession was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user_profession.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Din profil uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(pro_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @uploadprof = Uploadprof.find(params[:id])\n\n respond_to do |format|\n if @uploadprof.update_attributes(params[:uploadprof])\n format.html { redirect_to @uploadprof, notice: 'Uploadprof was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uploadprof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n if @produccion.update_attributes(params[:produccion])\n format.html { redirect_to @produccion, notice: 'Produccion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produccion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @predio.update(predio_params)\n format.html { redirect_to @predio, notice: 'Predio foi alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @predio }\n else\n format.html { render :edit }\n format.json { render json: @predio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @personal_rubro.update(personal_rubro_params)\n format.html { redirect_to @personal_rubro, notice: 'Personal rubro was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal_rubro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n if @ventas_presupuesto.update_attributes(params[:ventas_presupuesto])\n format.html { redirect_to @ventas_presupuesto, notice: 'Presupuesto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ventas_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if session[:user]['perfil'] == 'Administrador'\n respond_to do |format|\n @user.nome = params[:user][:nome]\n @user.login = params[:user][:login]\n @user.email = params[:user][:email]\n @user.profile_id = params[:user][:profile_id]\n\n @user.password = User.encripitar_senha(params[:user][:password])\n @user.telefone = params[:user][:telefone]\n\n # Vincula perfis aos usuário\n # vincular_user_profiles\n\n # Vincula os módulos e dominios ao usuário\n vincular_modulos_ao_usuario\n\n if @user.save\n flash[:notice] = 'Usuário atualizado com sucesso.'\n format.html {redirect_to '/users/'}\n format.json {render :show, status: :ok, location: @user}\n else\n format.html {render :edit}\n format.json {render json: @user.errors, status: :unprocessable_entity}\n end\n end\n else\n respond_to do |format|\n flash[:warning] = 'Você não possui permissão para acessar esse recurso.'\n format.html {redirect_to '/'}\n format.json {head :no_content}\n end\n end\n # vincular_user_profiles\n end", "def update\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n if @fulcliente.update_attributes(params[:fulcliente])\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(profile_attributes)\n format.html { redirect_to root_path, notice: 'Анкета успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def agregar_profesor\n @grupo = Grupo.find(params[:id])\n if request.get?\n @profesores = Profesor.search(params[:buscar])\n end\n if request.put?\n @profesor = Profesor.find(params[:profesor_id])\n @grupo.profesor = @profesor\n flash[:notice] = \"Se modificó el profesor al grupo #{@grupo.nombre_completo}\" if @grupo.save\n redirect_to grupo_path(@grupo)\n end\n end", "def update\n @prof_inspection = ProfInspection.find(params[:id])\n\n respond_to do |format|\n if @prof_inspection.update_attributes(params[:prof_inspection])\n format.html { redirect_to client_prof_inspections_path, notice: I18n.t(:record_updated)}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prof_inspection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(requisito_params)\n format.html { redirect_to @objeto, notice: \"Requisito was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @provisor.update(provisor_params)\n format.html { redirect_to @provisor, notice: t('helpers.success-upd') }\n format.json { render :show, status: :ok, location: @provisor }\n else\n format.html { render :edit }\n format.json { render json: @provisor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n end", "def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end", "def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profil_artiste.update(profil_artiste_params)\n format.html { redirect_to @profil_artiste, notice: 'Profil artiste was successfully updated.' }\n format.json { render :show, status: :ok, location: @profil_artiste }\n else\n format.html { render :edit }\n format.json { render json: @profil_artiste.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @persona_proyecto.update(persona_proyecto_params)\n format.html { redirect_to @persona_proyecto, notice: 'Persona proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @persona_proyecto }\n else\n format.html { render :edit }\n format.json { render json: @persona_proyecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task = Task.find(params[:id])\n if (access)\n @task.proficiency = params[:proficiency][:proficiency]\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to edit_task_path(@task), notice: 'Task was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @mini_pago = MiniPago.find(params[:id])\n\n respond_to do |format|\n if @mini_pago.update_attributes(params[:mini_pago])\n format.html { redirect_to @mini_pago, notice: 'Mini pago was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mini_pago.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @repuestum = Repuestum.find(params[:id])\n\n respond_to do |format|\n if @repuestum.update_attributes(params[:repuestum])\n format.html { redirect_to @repuestum, notice: 'Repuestum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @repuestum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @preparar_mate = @producto.preparar_mates.find(params[:id])\n respond_to do |format|\n if @preparar_mate.update(preparar_mate_params)\n format.html { redirect_to empresa_producto_preparar_mates_path, notice: 'Preparar mate was successfully updated.' }\n format.json { render :show, status: :ok, location: @preparar_mate }\n else\n format.html { render :edit }\n format.json { render json: @preparar_mate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to(@premio, :notice => 'Premio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @profile.update(profile_params)\n respond_with(@profile)\n end", "def update\n respond_to do |format|\n if @propuesta.update(propuesta_params)\n format.html { redirect_to @propuesta, notice: 'Propuesta was successfully updated.' }\n format.json { render :show, status: :ok, location: @propuesta }\n else\n format.html { render :edit }\n format.json { render json: @propuesta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \t\tif params[:usuario_pedido]\n \t\t\t@usuario = Usuario.find(params[:usuario_id])\n \tusuario_pedido = @usuario.pedidos.find(@pedido.id)\n \t\tif usuario_pedido.update(parametros_actualizar_usuario_negocio)\n \t\thead :no_content\n \t\telse\n \t\trender json: @usuario_pedido.errors, status: :unprocessable_entity\n \t\tend\n else\n \t\t\t@negocio = Negocio.find(params[:negocio_id])\n \tnegocio_pedido = @negocio.pedidos.find(@pedido.id)\n \tif negocio_pedido.update(parametros_actualizar_pedido_negocio)\n \thead :no_content\n \telse\n \trender json: @negocio_pedido.errors, status: :unprocessable_entity\n \tend\n \tend\n end", "def update\n @proef = Proef.find(params[:id])\n\n respond_to do |format|\n if @proef.update_attributes(params[:proef])\n format.html { redirect_to @proef, notice: 'Test werd succesvol gewijzigd.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proprietario.update(proprietario_params)\n format.html { redirect_to edit_imovel_path(@proprietario.imovel_id), notice: 'Proprietario was successfully updated.' }\n format.json { render :show, status: :ok, location: @proprietario }\n else\n format.html { render :edit }\n format.json { render json: @proprietario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n if @tipo_pensum.update_attributes(params[:tipo_pensum])\n format.html { redirect_to @tipo_pensum, notice: 'Tipo pensum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_pensum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to(@profile, \n :notice => 'Perfil actualizado correctamente.') }\n else\n format.html {render :action => \"edit\"}\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @provincium.update(provincium_params)\n format.html { redirect_to @provincium, notice: 'Provincium was successfully updated.' }\n format.json { render :show, status: :ok, location: @provincium }\n else\n format.html { render :edit }\n format.json { render json: @provincium.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @puntaje = Puntaje.find(params[:id])\n\n respond_to do |format|\n if @puntaje.update_attributes(params[:puntaje])\n format.html { redirect_to @puntaje, notice: 'Puntaje was successfully updated.' }\n format.json { head :no_content }\n else\n atributos\n format.html { render action: \"edit\" }\n format.json { render json: @puntaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @persona = Persona.find(params[:id])\n #@persona = Persona.find(:all, :conditions => {:screen_name => params[:id] }).first\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to persona_path(@persona.screen_name), notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prominent.update(prominent_params)\n format.html { redirect_to @prominent, notice: 'Prominent was successfully updated.' }\n format.json { render :show, status: :ok, location: @prominent }\n else\n format.html { render :edit }\n format.json { render json: @prominent.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @perfil.update(perfil_params)\n format.html { redirect_to perfil_usuario_path, notice: 'Perfil atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @perfil }\n else\n format.html { render :edit }\n format.json { render json: @perfil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def update\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n if @personaje_mision.update_attributes(params[:personaje_mision])\n format.html { redirect_to @personaje_mision, notice: 'Personaje mision was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje_mision.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pagina_principal.update(pagina_principal_params)\n format.html { redirect_to @pagina_principal, notice: 'Pagina principal was successfully updated.' }\n format.json { render :show, status: :ok, location: @pagina_principal }\n else\n format.html { render :edit }\n format.json { render json: @pagina_principal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @politico.update(politico_params) and @politico.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @politico, notice: 'Politico was successfully updated.' }\n format.json { render :show, status: :ok, location: @politico }\n else\n format.html { render :edit }\n format.json { render json: @politico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pessoa.update(pessoa_params)\n format.html { redirect_to @pessoa, notice: 'Cadastro alterado com sucesso!.' }\n format.json { render :show, status: :ok, location: @pessoa }\n else\n format.html { render :edit }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n if @tipo_usuario.update_attributes(params[:tipo_usuario])\n format.html { redirect_to @tipo_usuario, notice: 'Tipo usuario fue actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @propperty.update(propperty_params)\n format.html { redirect_to @propperty, notice: 'Propperty was successfully updated.' }\n format.json { render :show, status: :ok, location: @propperty }\n else\n format.html { render :edit }\n format.json { render json: @propperty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to root_url, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @provin.update(provin_params)\n format.html { redirect_to @provin, notice: 'Provin was successfully updated.' }\n format.json { render :show, status: :ok, location: @provin }\n else\n format.html { render :edit }\n format.json { render json: @provin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proyecto.update(proyecto_params)\n format.html { redirect_to current_user, notice: 'Proyecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto }\n flash[:success] = \"Proyecto actualizado\"\n\n # @modificacion = Modificacion.new(:proyecto_id => @proyecto.id, usuario_id => params[:id] )\n\n else\n format.html { render :edit }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n flash[:danger] = \"Error al actualizar el proyecto\"\n end\n end\n end", "def update\n respond_to do |format|\n if @proposta.update(propostum_params)\n format.html { redirect_to @proposta, notice: 'Propostum was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposta }\n else\n format.html { render :edit }\n format.json { render json: @proposta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n if @owner.update_attributes(params[:owner])\n format.html { redirect_to owners_path, notice: 'Oferta a fost updatata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n if params[:id]==\"edit_familias_propiedades\"\n edit_familias_propiedades\n return\n end\n \n #if params[:familia][\"articulos_grupopropiedades_attributes\"]\n# componer_articulo\n# return\n #end \n \n respond_to do |format|\n if @familia.update(familia_params) \n \n format.html { redirect_to familias_path(:id => @familia.padre_id), notice: 'Familia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @familia.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n @persona_tipo = PersonaTipo.find(params[:id])\n\n respond_to do |format|\n if @persona_tipo.update_attributes(params[:persona_tipo])\n format.html { redirect_to @persona_tipo, notice: 'Tipo de participante actualizado correctamente.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona_tipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @persona = Persona.find(params[:id])\n\n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.html { redirect_to personas_path, notice: 'Persona was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @person = @profissional.person\n if @person.update(profissional_params[:person_attributes])\n if profissional_params[:specialization].present?\n @profissional.update_attributes(:specialization => profissional_params[:specialization])\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { render :show, status: :ok, location: @profissional }\n else\n format.html { render :edit }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end", "def update\n respond_to do |format|\n if @usuario_perfil.update(usuario_perfil_params)\n format.html { redirect_to @usuario_perfil, notice: 'Usuario perfil was successfully updated.' }\n format.json { render :show, status: :ok, location: @usuario_perfil }\n else\n format.html { render :edit }\n format.json { render json: @usuario_perfil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @personal_profile.update(personal_profile_params)\n format.html { redirect_to resume_path, notice: 'Your Personal profile was successfully updated.' }\n format.json { render :show, status: :ok, location: resume_path }\n else\n format.html { render :edit }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @perfile = Perfile.find(params[:id])\n @perfile.direccionusuario_attributes.where(:id => current_user.id)\n respond_to do |format|\n if @perfile.perfileusuarios_attributes(params[:perfile]) and @perfile.direccionusuario.direccionusuario_attributes(params[:perfilusuario])\n format.html { redirect_to @perfile, notice: 'Perfile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @perfile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proyectos_user.update(proyectos_user_params)\n format.html { redirect_to @proyectos_user, notice: 'Proyectos user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @proyectos_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to user_path, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7306273", "0.71561486", "0.71470904", "0.7043676", "0.69982314", "0.66852075", "0.6683979", "0.66494066", "0.66437566", "0.6633193", "0.65943795", "0.652536", "0.6429707", "0.64292014", "0.64255553", "0.640166", "0.63983846", "0.6380514", "0.63465506", "0.63442314", "0.63338894", "0.63228315", "0.6268951", "0.6255891", "0.6227843", "0.6197992", "0.6187567", "0.61563593", "0.615228", "0.6151134", "0.6144455", "0.6136849", "0.61340594", "0.6123608", "0.6120684", "0.6114795", "0.61063194", "0.6104469", "0.6101554", "0.6090364", "0.60796636", "0.6077998", "0.60757375", "0.6071796", "0.60633075", "0.6060461", "0.6052312", "0.6048837", "0.60462797", "0.60427254", "0.6042367", "0.60293984", "0.6027633", "0.60239357", "0.60198426", "0.6017654", "0.6016715", "0.60125464", "0.6009113", "0.60083276", "0.60072273", "0.60065234", "0.599772", "0.5997326", "0.59958345", "0.5991703", "0.5984929", "0.59836435", "0.5983412", "0.5983075", "0.5979793", "0.59751815", "0.5963455", "0.59586924", "0.5954972", "0.59537023", "0.5951059", "0.5951059", "0.5951059", "0.5951059", "0.5944202", "0.5943829", "0.5939149", "0.5937396", "0.5931768", "0.59311146", "0.5930906", "0.5928336", "0.59268606", "0.5925081", "0.5924395", "0.59240514", "0.5923346", "0.59231067", "0.5922435", "0.5919738", "0.5919527", "0.591905", "0.5916494", "0.59159154" ]
0.6981697
5
DELETE /profesores/1 DELETE /profesores/1.json
def destroy @profesore.destroy respond_to do |format| format.html { redirect_to profesores_url, notice: 'Profesore was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @profesore = Profesore.find(params[:id])\n @profesore.destroy\n\n respond_to do |format|\n format.html { redirect_to profesores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prof.destroy\n respond_to do |format|\n format.html { redirect_to profs_url, notice: 'Prof was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profesor = Profesor.find(params[:id])\n @profesor.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Profesor eliminado correctamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profesor.destroy\n\n head :no_content\n end", "def destroy\n @profane.destroy\n respond_to do |format|\n format.html { redirect_to profanes_url, notice: 'Profane was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profesium.destroy\n respond_to do |format|\n format.html { redirect_to profesia_url, notice: 'Profesium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_profissao.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_profissaos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @proficiency = Proficiency.find(params[:id])\n @proficiency.destroy\n\n respond_to do |format|\n format.html { redirect_to proficiencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # Delete profile\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_prof.destroy\n respond_to do |format|\n format.html { redirect_to user_profs_url, notice: 'User prof was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profesor_grado.destroy\n respond_to do |format|\n format.html { redirect_to profesor_grados_url, notice: 'Profesor grado was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profesor = Profesor.find(params[:id])\n @profesor.destroy\n\n respond_to do |format|\n format.html { redirect_to(profesors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profesor = Profesor.find(params[:id])\n @profesor.destroy\n\n respond_to do |format|\n format.html { redirect_to(profesors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @frequencia_profissao = Frequencia::Profissao.find(params[:id])\n @frequencia_profissao.destroy\n\n respond_to do |format|\n format.html { redirect_to(frequencia_profissoes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.find(params[:id])\n @profesor_pertenece_asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to profesor_pertenece_asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profilsekolah.destroy\n respond_to do |format|\n format.html { redirect_to profilsekolahs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @uploadprof = Uploadprof.find(params[:id])\n @uploadprof.destroy\n\n respond_to do |format|\n format.html { redirect_to uploadprofs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n @profile.requests.destroy_all\n @profile.member.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'El perfil fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visitante_credenciado = VisitanteCredenciado.find(params[:id])\n @visitante_credenciado.destroy\n\n respond_to do |format|\n format.html { redirect_to visitante_credenciados_url }\n format.json { head :no_content }\n end\n \n end", "def destroy\n @prof_inspection = ProfInspection.find(params[:id])\n @prof_inspection.destroy\n\n respond_to do |format|\n format.html { redirect_to client_prof_inspections_url }\n format.json { head :ok }\n end\n end", "def destroy\n @socio_carteira_prof.destroy\n respond_to do |format|\n format.html { redirect_to socio_carteira_profs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @premio = Premio.find(params[:id])\n @premio.destroy\n\n respond_to do |format|\n format.html { redirect_to premios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @premio = Premio.find(params[:id])\n @premio.destroy\n\n respond_to do |format|\n format.html { redirect_to premios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @perfisusuario.destroy\n respond_to do |format|\n format.html { redirect_to perfisusuarios_url, notice: 'Perfil de Usuário excluído com sucesso.' }\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 @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @interest_profiler.destroy\n respond_to do |format|\n format.html { redirect_to interest_profilers_url, notice: 'Interest profiler was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vet_profile.destroy\n respond_to do |format|\n format.html { redirect_to vet_profiles_url, notice: 'Vet profile was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @perfilnegocio = Perfilnegocio.find(params[:id])\n @perfilnegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to perfilnegocios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pro_far = ProFar.where([\"producto_id = ? and farmacium_id = ?\", params[:id], session[:farmacia_id]]).first\n @pro_far.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end", "def destroy\n #--ADICIONADO\n @cliente.perfilclientes.destroy\n #--ADICIONADO\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provisor.destroy\n respond_to do |format|\n format.html { redirect_to provisors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @personal_rubro.destroy\n respond_to do |format|\n format.html { redirect_to personal_rubros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visitante.destroy\n respond_to do |format|\n format.html { redirect_to visitantes_url, notice: 'Visitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @produccion = Produccion.find(params[:id])\n @produccion.destroy\n\n respond_to do |format|\n format.html { redirect_to produccions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @persona = Persona.find(params[:id])\n @persona.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end\n \n end", "def destroy\n @travel_agent_profile = TravelAgentProfile.find(params[:id])\n @travel_agent_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to travel_agent_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @odontologia1 = Odontologia1.find(params[:id])\n @odontologia1.destroy\n\n respond_to do |format|\n format.html { redirect_to odontologia1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_path, :notice => \"profile was successfully delete.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroaspecto = Retroaspecto.find(params[:id])\n @retroaspecto.destroy\n\n respond_to do |format|\n format.html { redirect_to retroaspectos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @curso = Curso.where(\"profesor_id =?\", params[:id])\n @curso.each do |c| \n c.destroy\n end \n\n @profesor = Profesor.find(params[:id])\n @profesor.destroy\n redirect_to(profesors_url) \n\n end", "def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @patrocinio = Patrocinio.find(params[:id])\n @patrocinio.destroy\n\n respond_to do |format|\n format.html { redirect_to patrocinios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Perfil destruido correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\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 @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 @produccion = Produccion.find(params[:id])\n @produccion.destroy\n\n respond_to do |format|\n format.html { redirect_to producciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @permiso.destroy\n respond_to do |format|\n format.html { redirect_to permisos_url, notice: 'Permiso fue eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @pessoa = Pessoa.find(params[:id])\n @pessoa.destroy\n\n respond_to do |format|\n format.html { redirect_to pessoas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @promocion = Promocion.find(params[:id])\n @promocion.destroy\n\n respond_to do |format|\n format.html { redirect_to promocions_url }\n #format.json { head :ok }\n end\n end", "def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @suplente = Suplente.find(params[:id])\n @suplente.destroy\n\n respond_to do |format|\n format.html { redirect_to suplentes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meetup_profile = MeetupProfile.find(params[:id])\n @meetup_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def destroy\n @basico_persona_juridica.destroy\n respond_to do |format|\n format.html { redirect_to basico_persona_juridicas_url, notice: 'Persona juridica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @proceso_examan.destroy\n respond_to do |format|\n format.html { redirect_to proceso_examen_url, notice: 'Proceso examan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @protectora = Protectora.find(params[:id])\n @protectora.destroy\n\n respond_to do |format|\n format.html { redirect_to protectoras_url }\n format.json { head :ok }\n end\n end", "def destroy\n @auditoria = Auditoria.find(params[:id])\n @auditoria.destroy\n\n respond_to do |format|\n format.html { redirect_to auditorias_url }\n format.json { head :ok }\n end\n end", "def destroy\n @usuario_perfil.destroy\n respond_to do |format|\n format.html { redirect_to usuario_perfils_url, notice: 'Usuario perfil was successfully destroyed.' }\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 @mini_pago = MiniPago.find(params[:id])\n @mini_pago.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_pagos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario_cartum = UsuarioCartum.find(params[:id])\n @usuario_cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to usuario_carta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = current_user.profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profil_artiste.destroy\n respond_to do |format|\n format.html { redirect_to profil_artistes_url, notice: 'Profil artiste was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ativo_outro = AtivoOutro.find(params[:id])\n @ativo_outro.destroy\n\n respond_to do |format|\n format.html { redirect_to ativo_outros_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @estado_despacho.destroy\n respond_to do |format|\n format.html { redirect_to estado_despachos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Profile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @predio.destroy\n respond_to do |format|\n format.html { redirect_to predios_url, notice: 'Predio foi deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @profile = Profile.find(params[:id])\n # authorize! :destroy, @profile\n\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @perfil.destroy\n perfil_examenes = PerfilExamene.where(:perfil_id => @perfil.id)\n perfil_examenes.destroy_all\n respond_to do |format|\n format.html { redirect_to perfils_url, notice: 'El Perfil fue eliminado correctamente' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7433161", "0.734054", "0.7257294", "0.7139833", "0.70677567", "0.70207715", "0.6969561", "0.69410104", "0.69283", "0.692763", "0.6902504", "0.6772318", "0.6772318", "0.6770505", "0.6766542", "0.67514807", "0.67389476", "0.6692243", "0.6692243", "0.6561049", "0.6557639", "0.6552521", "0.6532852", "0.6520777", "0.65168816", "0.65168816", "0.6499985", "0.64959127", "0.6490769", "0.6461664", "0.64422995", "0.64421815", "0.6411937", "0.6388331", "0.6386633", "0.6371348", "0.6366985", "0.63662535", "0.6360434", "0.63550705", "0.6346807", "0.6345765", "0.63453656", "0.6332378", "0.6330287", "0.6329982", "0.6329982", "0.6329838", "0.6329309", "0.63271034", "0.6325442", "0.6321968", "0.63206875", "0.63101923", "0.6308558", "0.6303149", "0.6299561", "0.6298293", "0.62975407", "0.6295749", "0.6295432", "0.6295432", "0.6295432", "0.6295033", "0.6294388", "0.6293673", "0.6292473", "0.628722", "0.628722", "0.628722", "0.628722", "0.628722", "0.628722", "0.628722", "0.628722", "0.6287078", "0.6286338", "0.6279869", "0.6279367", "0.6275018", "0.62748826", "0.6270405", "0.62680024", "0.6264786", "0.626463", "0.6258835", "0.6250049", "0.6249183", "0.62484735", "0.62452114", "0.6244328", "0.6236621", "0.6236329", "0.6234851", "0.6234235", "0.62335646", "0.62242573", "0.62240905", "0.62240124", "0.6222868" ]
0.72385556
3
Use callbacks to share common setup or constraints between actions.
def set_profesore @profesore = Profesore.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\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 event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\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 setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.5330087", "0.5311993", "0.5297402", "0.5296789", "0.52957207", "0.52596015", "0.5245442", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5235431", "0.5231888", "0.5226663", "0.52220625", "0.5217086", "0.52137345", "0.5208314", "0.5205469", "0.5175606", "0.5174914", "0.5173361", "0.51662856", "0.5161792", "0.51572216", "0.5153063", "0.5152982", "0.5152632", "0.51435786", "0.5139829", "0.51346594", "0.511372", "0.511372", "0.51136476", "0.51083213", "0.5108011", "0.5091935", "0.5089297", "0.5081576", "0.50807106", "0.50656676", "0.50548106", "0.50537366", "0.505074", "0.505074", "0.5033361", "0.5025158", "0.5020441", "0.5015611", "0.50142473", "0.5000281", "0.50001067", "0.49989453", "0.4989465", "0.4989465", "0.4985425", "0.49805096", "0.49795893", "0.49783278", "0.49676263", "0.49656346", "0.49579078", "0.4955427", "0.49554235", "0.49536413", "0.49523768", "0.49457142", "0.49433607", "0.4933641", "0.49320185", "0.49265638", "0.49262375", "0.49259067", "0.4922456", "0.49201223", "0.49165115", "0.49158815", "0.49151883", "0.49149552", "0.4914386" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def profesore_params params.require(:profesore).permit(:rut, :nombre, :apellido_paterno, :apellido_materno, :correo, :descripcion, :usuario_id, :estado) 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
Refresh one feed source and return the updated feed items
def refresh FeedSource.find(params[:feed_source_id]).refresh feed_sources = params[:feed_sources] @feed_source_titles = {} FeedSource.find(feed_sources).each { |source| @feed_source_titles[source.id] = source.title} @feed_items = FeedItem.where("feed_source_id IN (?)", feed_sources).order(pub_date: :desc).limit(20).offset(0) @feed_items = @feed_items.sort_by{ |item| item.pub_date.to_i }.reverse render :index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_feed(feed)\n FeedRefreshManager.refresh feed, self\n end", "def refresh\n Feed.update_all\n # @feeds = Feed.all\n # feed_array = []\n # @feeds.each do |f|\n # EntryFeed.create_from_feed(f)\n # end\n\n redirect_to blogs_path\n flash[:notice] = \"Blogs successfully updated\"\n end", "def feed_items(feed_title) \n # update last_viewed_at \n @client.query \"UPDATE feeds SET last_viewed_at = now() where title = '#{e feed_title}'\"\n query = \"SELECT items.title, guid, feed, feed_title, pub_date, word_count, starred, unread from items where items.feed_title = '#{e feed_title}' order by pub_date asc\"\n @client.query(query)\n end", "def refresh\n # FIXME\n end", "def update\n @feed = current_user.feeds.find params[:id]\n current_user.refresh_feed @feed\n\n head :ok\n rescue => e\n handle_error e\n end", "def refresh\n fetch_api_data\n self\n end", "def feed!\n http_fetch(feed_url)\n end", "def update_from_feed(auth_feed=nil)\n # If there are existing entries, then create a feed \n # object using the most recent entry's data and use Feedzirra's update method\n # to only fetch those new entries\n if entries.any?\n feed = Feedzirra::Feed.update(create_feed_for_update)\n add_entries(feed.new_entries) if valid_parse_result(feed) && !feed.is_a?(Array) && feed.updated?\n else\n # Fetch whole feed (may not be entire feed - depends on source)\n feed = auth_feed || Feedzirra::Feed.fetch_and_parse(feed_url_s)\n # Can return error status code on parse error\n add_entries(feed.entries) if valid_parse_result(feed)\n end\n # Save latest feed attributes for updates\n if valid_parse_result(feed)\n update_attributes(:etag => feed.etag, :last_modified => feed.last_modified, :feed_url_s => feed.feed_url)\n end\n end", "def refresh(force=false)\n # check headers and etag and last modified\n raise \"Missing feed_url\" if feed_url.nil?\n ff = Feedbase::FetchFeed.new(feed_url)\n headers = ff.headers\n if !force \n if last_etag && (headers[:etag] == last_etag)\n puts \"-- #{feed_url} -- ETag cache hit\"\n return\n end\n end\n data = ff.fetch \n params = data[:feed_params].merge(:alpha_title => make_alpha_title(data[:feed_params][:title])) \n if params[:feed_url] != self[:feed_url]\n if x = self.class.filter(:feed_url => params[:feed_url]).first\n raise Redirected.new(\"Redirected to existing feed: #{x.feed_url}\")\n end\n end\n params.delete(:feed_url) \n begin Sequel::DatabaseError\n update params\n rescue StandardError # PGError\n puts \"The offending record is #{self.inspect}\"\n raise\n end\n\n Feedbase::FeedDownload.create({feed_id: feed_id}.merge(data[:download_params])) \n items_created = data[:items].\n select {|item| Feedbase::Item[:guid => item[:guid]].nil?}.\n map { |item|\n params = {\n feed_id: feed_id,\n title: item[:title].encode(\"utf-8\"), \n guid: item[:guid], \n link: item[:link],\n content: item[:content],\n author: item[:author],\n word_count: item[:word_count],\n pub_date: item[:pub_date]\n }\n Feedbase::Item.create params\n }\n # caller can extract an item count from this\n items_created\n end", "def update_from_feed()\n\t\t\n\t@links = Link.all \n\n\t@links.each do |link| \n\n\t\tfeed = Feedzirra::Feed.fetch_and_parse(link.url)\n\n\t\tputs \"pulling feeds\"\n\t\tfeed.entries.each do |entry|\n\n\t\t\tif entry.published > link.updated_at\n\n\t\t\t\tif entry.url =~ /^#{URI::regexp}$/\n\t\t\t\t\tfind_keywords(entry.url, link.tags)\n\t\t\t\t\tputs entry.url\t\n\t\t\t\telse\n\t\t\t\t\tputs \"bad url\"\n\t\t\t\t\tputs entry.url\t\n\t\t\t\tend\n\t\t\t\t\t\n\t\t\tend\n\t\tend\n\n\tend\n\nend", "def refresh\n load if changed?\n end", "def refresh\n do_refresh\n end", "def refresh\n do_refresh\n end", "def refresh\n response = Clever.request :get, url\n refresh_from response[:data]\n self\n end", "def update!\n raise(RuntimeError, \"can't fetch without a uri.\") unless @uri\n\n res = @http.get(@uri, \"Accept\" => \"application/atom+xml\")\n\n if @etag and res['etag'] == @etag\n # we're already all up to date\n return self\n elsif res.code == \"410\"\n raise Atom::FeedGone, \"410 Gone (#{@uri})\"\n elsif res.code != \"200\"\n raise Atom::HTTPException, \"Unexpected HTTP response code: #{res.code}\"\n end\n\n # we'll be forgiving about feed content types.\n res.validate_content_type([\"application/atom+xml\",\n \"application/xml\",\n \"text/xml\"])\n\n @etag = res[\"ETag\"] if res[\"ETag\"]\n\n xml = res.body\n\n coll = REXML::Document.new(xml)\n\n update_el = REXML::XPath.first(coll, \"/atom:feed/atom:updated\", { \"atom\" => Atom::NS } )\n\n # the feed hasn't been updated, don't do anything.\n if update_el and self.updated and self.updated >= Time.parse(update_el.text)\n return self\n end\n\n coll = self.class.parse(coll.root, self.base.to_s)\n merge! coll\n\n if abs_uri = next_link\n @next = self.class.new(abs_uri.to_s, @http)\n end\n\n if abs_uri = previous_link\n @prev = self.class.new(abs_uri.to_s, @http)\n end\n\n self\n end", "def update!\n # Don't do anything if this option is set\n return if self.configurations[:disable_update_from_remote]\n\n if !FeedTools.feed_cache.nil? &&\n !FeedTools.feed_cache.set_up_correctly?\n FeedTools.feed_cache.initialize_cache()\n end\n if !FeedTools.feed_cache.nil? &&\n !FeedTools.feed_cache.set_up_correctly?\n raise \"Your feed cache system is incorrectly set up. \" +\n \"Please see the documentation for more information.\"\n end\n if self.http_headers.blank? && !(self.cache_object.nil?) &&\n !(self.cache_object.http_headers.nil?)\n @http_headers = YAML.load(self.cache_object.http_headers)\n @http_headers = {} unless @http_headers.kind_of? Hash\n elsif self.http_headers.blank?\n @http_headers = {}\n end\n if self.expired? == false\n @live = false\n else\n load_remote_feed!\n \n # Handle autodiscovery\n if self.http_headers['content-type'] =~ /text\\/html/ ||\n self.http_headers['content-type'] =~ /application\\/xhtml\\+xml/\n\n autodiscovered_url = nil\n ['atom', 'rss', 'rdf'].each do |type|\n autodiscovered_url =\n FeedTools::HtmlHelper.extract_link_by_mime_type(self.feed_data,\n \"application/#{type}+xml\")\n break unless autodiscovered_url.nil?\n end\n \n if autodiscovered_url != nil\n begin\n autodiscovered_url = FeedTools::UriHelper.resolve_relative_uri(\n autodiscovered_url, [self.href])\n rescue Exception\n end\n if self.href == autodiscovered_url\n raise FeedAccessError,\n \"Autodiscovery loop detected: #{autodiscovered_url}\"\n end\n self.feed_data = nil\n \n self.href = autodiscovered_url\n if FeedTools.feed_cache.nil?\n self.cache_object = nil\n else\n self.cache_object =\n FeedTools.feed_cache.find_by_href(autodiscovered_url)\n end\n self.update!\n else\n html_body = FeedTools::XmlHelper.try_xpaths(self.xml_document, [\n \"html/body\"\n ])\n if html_body != nil\n raise FeedAccessError,\n \"#{self.href} does not appear to be a feed.\"\n end\n end\n else\n ugly_redirect = FeedTools::XmlHelper.try_xpaths(self.xml_document, [\n \"redirect/newLocation/text()\"\n ], :select_result_value => true)\n if !ugly_redirect.blank?\n if self.href == ugly_redirect\n raise FeedAccessError,\n \"Ugly redirect loop detected: #{ugly_redirect}\"\n end\n self.feed_data = nil\n self.href = ugly_redirect\n if FeedTools.feed_cache.nil?\n self.cache_object = nil\n else\n self.cache_object =\n FeedTools.feed_cache.find_by_href(ugly_redirect)\n end\n self.update!\n end\n end\n \n # Reset everything that needs to be reset.\n @xml_document = nil\n @encoding_from_feed_data = nil\n @root_node = nil\n @channel_node = nil\n @id = nil\n @title = nil\n @subtitle = nil\n @copyright = nil\n @link = nil\n @time_to_live = nil\n @entries = nil\n \n if self.configurations[:lazy_parsing_enabled] == false\n self.full_parse()\n end\n end\n end", "def refresh\n response = Clever.request :get, url, nil, headers\n refresh_from response[:data]\n\n @links = response[:links].map do\n |link| { :\"#{link[:rel]}\" => link[:uri] }\n end.reduce({}, :merge)\n self\n end", "def reload\n reset\n fetch\n end", "def reload\n reset\n fetch\n end", "def cache_feeds\n puts \"Caching feeds... (can be slow)\"\n feeds = Conf.feeds.map do |uri|\n # silly to need this, but if the feed fails to fetch,\n # don't kill the ruby thread ...\n begin\n feed = FeedTools::Feed.open( uri )\n { :uri => uri, :title => feed.title, \n :items => feed.items.map { |item| { :title => item.title, :author => item.author.name, :published => item.published, :link => item.link } } }\n rescue FeedTools::FeedAccessError\n puts uri\n next\n end\n end\n feeds.each { |feed|\n new = CachedFeed.find_or_initialize_by_uri( feed[:uri] )\n new.parsed_feed = feed\n new.save!\n }\n end", "def feed\n @feeddata\n end", "def refresh\n do_refresh\n self\n end", "def refresh\n @data = read_data\n end", "def refresh \n @result, @processedMovies, @errors = Movie.refresh_listings\n end", "def reload\n resp = api_client.get(url)\n refresh(JSON.load(resp.body))\n end", "def refresh\n end", "def update_from_feed(feed_url)\n\t\tputs \"pulling feeds\"\n\t\tfeed = Feedzirra::Feed.fetch_and_parse(feed_url)\n\t\t# feed.last_modified - if it's been modified since last time\n\t\tfeed.entries.each do |entry|\n\t\t\t# if the post occured after it was last checked\n\t\t\tfind_keywords(entry.url)\n\t\t\tputs entry.url\n\t\t\t# call the keyword check and save on the actual post url\t\n\t\tend\nend", "def index\n @feed_sources = FeedSource.all\n end", "def refresh_all\n success_count = 0\n error_count = 0\n Topic.find_all_external.each do |topic|\n permalink = topic.permalink\n begin\n refresh_topic(topic)\n success_count += 1\n rescue\n log.error \"Error refreshing news for '#{permalink}': #{$!}\"\n error_count += 1\n end\n end #each\n if error_count > 0\n STDERR.puts \"*** #{error_count} errors occurred while refreshing \" +\n \"the news data.\"\n STDERR.puts \"See the intranet log for details.\"\n end #if\n log.info \"#{success_count} news topics were updated successfully.\"\n end", "def refresh!\n load if changed?\n end", "def refresh\n\t\t\t#tl = MTodoList.where(basecamp_id: @id).first_or_initialize\n\t\t\ttl = @@store[@id]\n\t\t\tif tl != nil\n\t\t\t\toptions = {:headers => {\"If-Modified-Since\" => tl[:etag] ,\"If-None-Match\" => tl[:etag], 'User-Agent' => 'Lofty Word Hotlist (chris.cacciatore@gmail.com)'}}\n\t\t\telse\n\t\t\t\toptions = {}\n\t\t\tend\n\t\t\tresponse = Logan::Client.get \"/projects/#{@project_id}/todolists/#{@id}.json\", options\n\t\t\tif response.headers[\"status\"].strip == \"304 Not Modified\" && @@store[@id] != nil\n\t\t\t\tinitialize(@@store[@id][:payload])\n\t\t\telse\n\t\t\t\tinitialize(response.parsed_response)\n\t\t\t\t@@store[@id] = {\n\t\t\t\t\t:payload => response.parsed_response,\n\t\t\t\t\t:etag => response.headers['etag']\n\t\t\t\t}\n\t\t\tend\n\t\tend", "def refresh\r\n end", "def reload!\n fetch_data!\n end", "def fetch(source)\n Feedjira::Feed.fetch_and_parse source\n end", "def refresh!\n updated_contents = File.read(@path)\n updated_yml = YAML.load(updated_contents)\n\n updated_items = fetch_items(updated_yml)\n original_items = items.flatten\n\n updated_items.flatten.each do |updated_item|\n original_item = original_items.find do |oi|\n oi.full_src == updated_item.full_src\n end\n\n # If this is a new item, we're good\n next if !original_item\n\n # Otherwise, we'll need to see if this file changed\n if !original_item.identical?(updated_item)\n original_item.delete!\n end\n end\n\n @items = updated_items\n\n prepare!\n end", "def refresh\n end", "def refresh\n end", "def refresh!\n self.data = client.get(path).data\n end", "def refresh\n open(@url) do |http|\n parse(http.read)\n end\n end", "def refresh\n open(@url) do |http|\n parse(http.read)\n end\n end", "def refresh\n open(@url) do |http|\n parse(http.read)\n end\n end", "def refresh!\n unpack(agent.get(url))\n self\n end", "def feed_items\n feed_item\n end", "def fetch_feed\n endpoint = @current_feed.values.first\n\n begin\n document = SimpleRSS.parse(URI.open(endpoint, 'User-Agent' => 'Ruby-wget'))\n rescue StandardError => e\n puts \"Error: <#{e}> while trying to call <#{@current_feed_link}>\"\n # effectively skip document\n document = { title: Rss::NO_VALUE, items: {} }\n end\n\n # Ensuring string access instead of symbol access.\n # I know there's probably a better way to do this...\n # but I can't remember if with_indifferent_access is\n # a rails thing...\n @cache[@current_feed.keys.first] = JSON.parse(document.items.to_json)\n end", "def fetch!\n parsed_feed = FeedNormalizer::FeedNormalizer.parse open(self.feed_url)\n \n self.update_attributes( :title => parsed_feed.title,\n :url => parsed_feed.url\n #:etag => parsed_feed.etag\n #:last_modified => parsed_feed.last_modified\n )\n \n parsed_feed.entries.each do |entry|\n self.entries.create(:url => entry.url,\n :title => entry.title,\n :author => entry.author,\n #:summary => entry.summary,\n :content => entry.content\n #:published => entry.published\n #:categories => entry.categories\n ) if !Entry.find_by_url(entry.url)\n end\n end", "def fetch_next_week_events\n return [] unless sources.try(:first).present?\n\n source = sources.first\n source.refresh_token_if_expired\n\n gdata = Googledata.new\n gdata.pull(source.oauth_token)\n end", "def refresh\n json = JSON(Net::HTTP.get(URI.parse(base_url)))\n unpack(json)\n end", "def refresh; end", "def poll\n current = WebClient.new(api_key: @api_key).get(@feed.api_id)\n if Utils.diff(@feed.latest, current)\n Entry.new(feed_id: @feed.id, content: current).save!\n end\n\n @feed.latest\n end", "def show\n\n update_feed(@feed)\n\n @items = @feed.items.order('pub_date DESC').page params[:page]\n\n end", "def refresh!\n description.update!(send_messages([ refresh_command ]).documents[0])\n end", "def refresh\n puts \" -- refresh subscriptions(#{@subscriptions.size}):\"\n\n run_callback_server # call it once to make sure it runs\n \n @subscriptions.each do |sub| \n puts \" - #{sub.name}\"\n params = { \"attributes[accept]\" => 'application/json' }\n\n query = \"/gnp;#{sub.name};#{sub.entry_uri}\"\n params[\"attributes[callback_url]\"] = \"#{callback_server.base_url}#{query}\"\n\n [:operations, :uri_regexp, :condition_script].each do |key|\n (v = sub.send key) and params[\"attributes[#{key}]\"] = v\n end\n\n url = \"#{@target_url}#{sub.uri}.xml\"\n http_put(url, params) # {|req| req.content_type = 'application/xml'}\n end\n end", "def refresh\n\tto_delete = retrieve_deleted\n \n\trespond_to do |format|\n\t\tformat.js do \n\t\t\t@feed_items = current_user.feed\n\t\t\t\n\t\t\tif params[:num].to_i == @feed_items.count\n\t\t\t render text: \"cancel\"\n\t\t\telse\n\t\t\t render partial:'shared/feed'\n\t\t\tend\n\t\tend\n\t\t\t\n\t\tformat.mobile do\n\t\t\t@new_feed_items = current_user.feed_after(session[:feed_latest])\n\t\t\t\n\t\t\tif !@new_feed_items.empty?\n\t\t\t\tsession[:feed_latest] = @new_feed_items.maximum(\"updated_at\")\n\t\t\t\n\t\t\t\tupdates = []\n\t\t\t\t\n\t\t\t\t@new_feed_items.each do |update|\n\t\t\t\t\tupdates << update.to_mobile\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tjson_response = {status: \"success\", feed_items: updates, to_delete: to_delete}\n\t\t\t\t\n\t\t\t\trender json: json_response\n\t\t\telsif !to_delete.empty?\n\t\t\t\tjson_response = {status: \"success\", feed_items: [], to_delete: to_delete}\n\t\t\t\t\n\t\t\t\trender json: json_response\n\t\t\telse\n\t\t\t\tjson_response = {status: \"failure\", feed_items: [], to_delete: to_delete}\n\t\t\t\t\n\t\t\t\trender json: json_response\n\t\t\tend\n\t\tend\n\tend\n end", "def update_all_feeds\n Feed.all.each do |feed_entry|\n begin\n feed = Feedzirra::Feed.fetch_and_parse(feed_entry.feed_url)\n rescue Exception => e\n Rails.logger.error \"Feedzirra threw an error on feed_entry #{feed_entry.id}: #{e.inspect}\"\n end\n if !feed.blank? && !feed.is_a?(Fixnum) && !feed.entries.blank?\n feed.entries.each do |entry|\n begin\n entry.summary = @html_sanitizer.sanitize(entry.summary) unless entry.summary.blank?\n next if entry.title.blank? || entry.summary.blank? || entry.url.blank? || entry.id.blank? || entry.published.blank?\n guid = Base64.urlsafe_encode64(OpenSSL::Digest::MD5.digest(entry.id))\n unless FeedEntry.exists?(guid: guid)\n FeedEntry.create(title: clean_string(entry.title), summary: clean_string(entry.summary), url: clean_string(entry.url), published_at: entry.published, guid: guid, fetched: false)\n end\n rescue Exception => e\n Rails.logger.error \"Caught an error on inserting feed_entry #{entry.id}: #{e.inspect}\"\n end\n end\n end\n end\n end", "def refresh!; end", "def update_podcast_feeds()\n @ole.UpdatePodcastFeeds()\n end", "def feed\n @posts = Post.feed_of(params[:id])\n end", "def get_new_articles\n # Download the RSS feed and save to self.doc\n get_source\n \n # Keep track of which articles are in the feed \n articles = []\n \n article_links = (self.doc/'li.mjItemMain').collect do |mjItem|\n mjItem.at('a.mjLinkItem')\n end\n \n # For each item in the RSS feed \n article_links.each_with_index do |link, index|\n \n # Create or update the article in the db\n articles << Article.factory(\n :category => self.category,\n :description => '',\n :feed => self,\n :url => \"http://online.wsj.com#{link.attributes['href']}\",\n :priority => index\n )\n end\n \n articles\n end", "def reload_data\n reset_collection_data\n reload_collection_data\n end", "def feed\n\n end", "def refresh!\n self.class.find(id)\n end", "def refresh!\n self.class.find(id)\n end", "def update_db(rss_url, new_source, collection, response, rss_url_nice = rss_url)\n rss = MRSS.parse(response)\n\n begin @dbi.transaction do\n # update source\n if new_source\n @dbi.execute \"INSERT INTO sources (collection, rss, last, title, link, description) VALUES (?, ?, ?, ?, ?, ?)\",\n collection, rss_url, response['Last-Modified'], rss.title, rss.link, rss.description\n info rss_url_nice + \"Added as source\"\n else\n @dbi.execute \"UPDATE sources SET last=?, title=?, link=?, description=? WHERE collection=? AND rss=?\",\n response['Last-Modified'], rss.title, rss.link, rss.description, collection, rss_url\n debug rss_url_nice + \"Source updated\"\n end\n\n # update items\n items_new, items_updated = 0, 0\n rss.items.each { |item|\n description = item.description\n\n # Link mangling\n begin\n link = URI::join((rss.link.to_s == '') ? URI.parse(rss_url).to_s : rss.link.to_s, item.link || rss.link).to_s\n rescue URI::Error\n link = item.link\n end\n\n # Push into database\n db_title, = *@dbi.execute(\"SELECT title FROM items WHERE rss=? AND link=?\", rss_url, link).fetch\n\n if db_title.nil? || db_title.empty? # item is new\n begin\n @dbi.execute \"INSERT INTO items (rss, title, link, date, description) VALUES (?, ?, ?, ?, ?)\",\n rss_url, item.title, link, item.date.to_s, description\n items_new += 1\n #rescue DBI::ProgrammingError\n # puts description\n # puts \"#{$!.class}: #{$!}\\n#{$!.backtrace.join(\"\\n\")}\"\n end\n else\n @dbi.execute \"UPDATE items SET title=?, description=?, date=? WHERE rss=? AND link=?\",\n item.title, description, item.date.to_s, rss_url, link\n items_updated += 1\n end\n\n # Remove all enclosures\n @dbi.execute \"DELETE FROM enclosures WHERE rss=? AND link=?\", rss_url, link\n\n # Re-add all enclosures\n item.enclosures.each do |enclosure|\n href = URI::join((rss.link.to_s == '') ? link.to_s : rss.link.to_s, enclosure['href']).to_s\n @dbi.execute \"INSERT INTO enclosures (rss, link, href, mime, title, length) VALUES (?, ?, ?, ?, ?, ?)\",\n rss_url, link, href, enclosure['type'], enclosure['title'],\n !enclosure['length'] || enclosure['length'].empty? ? 0 : enclosure['length']\n end\n }\n info rss_url_nice + \"#{ items_new } new items, #{ items_updated } updated\"\n end; end\n end", "def feed\n @feed_items = @repository.recent_feed_items\n respond_to do |format|\n format.html # feed.html.erb\n format.json { render json: @feed_items }\n end\n end", "def update \n items = changed_since(last_run)\n resources = []\n items.each do |item|\n resource = construct_resource(item)\n resource.populate\n resources << resource\n end\n return resources\n end", "def load_remote_feed!\n @live = true\n if self.http_headers.nil? && !(self.cache_object.nil?) &&\n !(self.cache_object.http_headers.nil?)\n @http_headers = YAML.load(self.cache_object.http_headers)\n end\n \n if (self.href =~ /^feed:/) == 0\n # Woah, Nelly, how'd that happen? You should've already been\n # corrected. So let's fix that url. And please,\n # just use less crappy browsers instead of badly defined\n # pseudo-protocol hacks.\n self.href = FeedTools::UriHelper.normalize_url(self.href)\n end\n \n # Find out what method we're going to be using to obtain this feed.\n begin\n uri = URI.parse(self.href)\n rescue URI::InvalidURIError\n raise FeedAccessError,\n \"Cannot retrieve feed using invalid URL: \" + self.href.to_s\n end\n retrieval_method = \"http\"\n case uri.scheme\n when \"http\"\n retrieval_method = \"http\"\n when \"ftp\"\n retrieval_method = \"ftp\"\n when \"file\"\n retrieval_method = \"file\"\n when nil\n raise FeedAccessError,\n \"No protocol was specified in the url.\"\n else\n raise FeedAccessError,\n \"Cannot retrieve feed using unrecognized protocol: \" + uri.scheme\n end\n \n # No need for http headers unless we're actually doing http\n if retrieval_method == \"http\"\n begin\n @http_response = (FeedTools::RetrievalHelper.http_get(\n self.href, :feed_object => self) do |url, response|\n # Find out if we've already seen the url we've been\n # redirected to.\n follow_redirect = true\n\n begin\n cached_feed = FeedTools::Feed.open(url,\n :disable_update_from_remote => true)\n if cached_feed.cache_object != nil &&\n cached_feed.cache_object.new_record? != true\n if !cached_feed.expired? &&\n !cached_feed.http_headers.blank?\n # Copy the cached state\n self.href = cached_feed.href\n \n @feed_data = cached_feed.feed_data\n @feed_data_type = cached_feed.feed_data_type\n \n if @feed_data.blank?\n raise \"Invalid cache data.\"\n end\n \n @title = nil; self.title\n self.href\n @link = nil; self.link\n \n self.last_retrieved = cached_feed.last_retrieved\n self.http_headers = cached_feed.http_headers\n self.cache_object = cached_feed.cache_object\n @live = false\n follow_redirect = false\n end\n end\n rescue\n # If anything goes wrong, ignore it.\n end\n follow_redirect\n end)\n case @http_response\n when Net::HTTPSuccess\n @feed_data = self.http_response.body\n @http_headers = {}\n self.http_response.each_header do |key, value|\n self.http_headers[key.downcase] = value\n end\n self.last_retrieved = Time.now.gmtime\n @live = true\n when Net::HTTPNotModified\n @http_headers = {}\n self.http_response.each_header do |key, value|\n self.http_headers[key.downcase] = value\n end\n self.last_retrieved = Time.now.gmtime\n @live = false\n else\n @live = false\n end\n rescue Exception => error\n @live = false\n if self.feed_data.nil?\n raise error\n end\n end\n elsif retrieval_method == \"https\"\n # Not supported... yet\n elsif retrieval_method == \"ftp\"\n # Not supported... yet\n # Technically, CDF feeds are supposed to be able to be accessed\n # directly from an ftp server. This is silly, but we'll humor\n # Microsoft.\n #\n # Eventually. If they're lucky. And someone demands it.\n elsif retrieval_method == \"file\"\n # Now that we've gone to all that trouble to ensure the url begins\n # with 'file://', strip the 'file://' off the front of the url.\n file_name = self.href.gsub(/^file:\\/\\//, \"\")\n if RUBY_PLATFORM =~ /mswin/\n file_name = file_name[1..-1] if file_name[0..0] == \"/\"\n end\n begin\n open(file_name) do |file|\n @http_response = nil\n @http_headers = {}\n @feed_data = file.read\n @feed_data_type = :xml\n self.last_retrieved = Time.now.gmtime\n end\n rescue\n @live = false\n # In this case, pulling from the cache is probably not going\n # to help at all, and the use should probably be immediately\n # appraised of the problem. Raise the exception.\n raise\n end\n end\n unless self.cache_object.nil?\n begin\n self.save\n rescue\n end\n end\n end", "def feed\n end", "def refresh!(async: false)\n return clone!(async: async) unless exists?\n pull!(async: async)\n end", "def set_feed_source\n @feed_source = FeedSource.find(params[:id])\n end", "def refresh(params={})\n body = refresh_body(params)\n raw_request = post(body)\n\n parse(raw_request)\n end", "def refresh_rates\n read_from_url\n end", "def refresh\n Vedeu.trigger(:_refresh_, current)\n end", "def reload\n refresh\n end", "def reload\n refresh\n end", "def feed_items\n []\n end", "def refresh!(expiry = DEFAULT_EXPIRY)\n # If we are not already updating and the cache is empty\n if !@updating && !ready?\n #puts \"Updating...\"\n @updating = true\n\n # Fetch each API\n BULK_APIS.each do |name, api_url|\n raw_response = request(api_url)\n redis.set(redis_key(name), raw_response) \n redis.expire(redis_key(name), expiry)\n end\n @updating = false \n true\n else\n return raise PoeWatch::Api::Error.new(\"An update is already in progress\") if @updating\n # puts \"Already up to date\"\n end\n end", "def fetch\n @raw_feed = HTTParty.get(@url).response.body unless @raw_feed\n end", "def perform\n Source.all.reduce(0) do |count, source|\n begin\n raw_feed = Feedjira::Feed.fetch_and_parse(source.url)\n rescue Feedjira::FetchFailure, Faraday::ConnectionFailed => e\n logger.info(\"Unable to fetch #{source.url}: #{e.message}\")\n next count\n rescue Feedjira::NoParserAvailable => e\n logger.info(\"No parser available for source #{source.url}: #{e.message}\")\n next count\n end\n\n refresh_source(source, raw_feed)\n\n entries_to_save = raw_feed.entries.reject do |entry|\n Post.where(internal_id: entry.entry_id).exists?\n end\n\n posts = entries_to_save.map do |entry|\n PostBuilder.build(entry, source)\n end\n\n source.subscribers.each do |user|\n posts.each do |post|\n post.populize_entry(user)\n end\n end\n\n count + entries_to_save.size\n end\n end", "def refresh; schedule_update end", "def refresh_posts( tagger, all_tags = nil )\n require 'news/feed'\n\n all_tags ||= Tag.find(:all)\n\n puts \"refreshing posts with: #{self.klass}\"\n feed = self.klass.constantize.new( curb_get(self.url), self.content_type )\n\n feed.items.each_with_index do|item,count|\n timer = Time.now\n puts \"loading post: #{item.title}...\"\n post = Post.new(:title => item.title,\n :link => item.links.first,\n :image => item.image,\n :body => item.body,\n :author => item.authors.first,\n :published_at => item.published,\n :feed_id => self.id,\n :tag_list => item.categories )\n post.summarize!\n # check for images in the body pick the first one as the icon to use and use rmagick to scan it down\n post.retag(tagger,all_tags) if post.tag_list.empty?\n puts post.permalink\n other = Post.find_by_title(post.title)\n if post.valid? and (other.nil? or other.published_at != post.published_at)\n post.save!\n puts \"post: #{item.title}, loaded in #{Time.now - timer} with tags: #{post.tag_list.inspect}, item: #{count} of #{feed.items.size}\"\n else\n puts \"skipping: #{item.title}, item: #{count} of #{feed.items.size}\"\n end\n end\n end", "def refresh()\n @knights = Knight.all\n @events = Event.all\n @kingdoms = Kingdom.all\n run_results()\n end", "def index\n @feeds = Feed.all.order(\"updated_at DESC\")\n end", "def refresh_data\n raise NotImplementedError\n end", "def refresh\n raise NotImplementedError.new('I do not know how to refresh myself, please implement it in subclass.')\n end", "def fetch\n puts \"Fetching feed: #{self.feed_url}\"\n Feedzirra::Feed.add_common_feed_entry_element('georss:point', :as => :point)\n Feedzirra::Feed.add_common_feed_entry_element('geo:lat', :as => :geo_lat)\n Feedzirra::Feed.add_common_feed_entry_element('geo:long', :as => :geo_long)\n Feedzirra::Feed.add_common_feed_element('generator', :as => :generator)\n\n feed = Feedzirra::Feed.fetch_and_parse(self.feed_url)\n\n self.update_attributes(\n :title => feed.title,\n :url => feed.url,\n :description => feed.description,\n :generator => feed.generator,\n :last_fetched => DateTime.now\n )\n\n feed.entries.each do |e|\n \n if e.geo_lat && e.geo_long\n latlon = [e.geo_lat, e.geo_long]\n elsif e.point\n latlon = e.point.split(' ')\n else\n next\n end\n \n attrs = {\n :title => e.title,\n :url => e.url,\n :author => e.author,\n :summary => e.summary,\n :content => e.content,\n :published => e.published,\n :guid => e.id,\n :lon => latlon[1].to_f,\n :lat => latlon[0].to_f\n }\n \n # Create a new post or update an existing one\n post = Post.find_or_initialize_by_url(e.url)\n post.feed = self\n post.assign_attributes(attrs)\n post.save\n end\n end", "def refresh_all\n\t\tputs \"Refresh all the entries within the local site store ... \"\n\t\tchanges=Hash.new\n\t\tchanges=bulk_refresh(@known_sites.keys)\n\t\t@known_sites.merge!(changes)\n\t\tputs \"Done refresh all entries.\"\n\t\treturn changes\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\tend", "def reload\n @items = nil\n\n attributes = self.class.client.get_list(id: id)\n initialize(attributes)\n\n self\n end", "def index\n @feed_items = FeedItem.all\n end", "def index_all\n # If feed subscriptions have not changed, return a 304\n if stale? etag: EtagCalculator.etag(current_user.subscriptions_updated_at),\n last_modified: current_user.subscriptions_updated_at\n @folder = nil\n @feeds = current_user.subscribed_feeds include_read: @include_read, page: params[:page]\n index_feeds\n end\n end", "def feed_updated\n @articles_published.first.updated_at.xmlschema if @articles_published.length > 0\n end", "def update()\n say('Updating...')\n\n # checking if we need to wait longer before updating\n delay = $redis.get(\"delay\")\n if(delay != '' && delay != nil)\n say(\"Error: must wait #{delay.to_i - Time.now.to_i} more seconds before updating! (#{delay})\")\n return\n end\n\n # check what lists we have access to\n available_lists = get_lists()\n say(\"Available lists: #{available_lists.inspect}\")\n\n # only download from lists we care about and have access to\n lists = (available_lists & $lists)\n\n get_data(lists)\n end", "def update_source(source, instance)\n begin\n data = instance.fetch\n publish_data(source, data)\n ensure\n @after_update_callback.call\n end\n rescue Exception => ex\n puts \"Failed to update #{source}: #{ex.message}\"\n puts ex.backtrace\n @error_callback.call(ex)\n end", "def refresh(*args)\n alloc(*args).refresh\n end", "def getItems\n url = 'http://b.hatena.ne.jp/sh19e/atomfeed'\n while url\n nodes = []\n puts url\n hatena = Hatena.new(url)\n nodes.unshift(hatena.getXML).flatten!\n model = Mymodel.new\n model.insertData(nodes)\n if model.isUpdate?\n puts \"Database is updated\"\n break\n end\n url = hatena.next?\n exit 1\n end\nend", "def refresh!\n update_attributes(\n books: update_data,\n books_count: update_data.length\n )\n end", "def refresh_items\n rows.clear\n\n items.each do |item|\n rows << [item]\n end\n end", "def feed\n offset, limit = pagination_values\n id = params.require(:id)\n feed_users_ids = UserFollowing.where(user_id: id).pluck(:following_id) << id\n feed_posts = Post.select(:id, :description, :author_id, :created_at, :updated_at).where(author: feed_users_ids).order(created_at: :desc).offset(offset).limit(limit)\n if stale? feed_posts\n render json: PostSerializer.array_to_json(feed_posts, {success: true, offset: offset, limit: limit}) , status: :ok\n end\n end", "def refresh!\n raise NotImplementedError, \"#refresh! is not implemented on #{@provider}:#{@type}\"\n end", "def update_sources\n return if @source_urls.nil?\n @source_urls.each do |source_url|\n source = config.sources_manager.source_with_name_or_url(source_url)\n dir = source.specs_dir\n UI.puts \"Updating a source at #{dir} for #{source}\"\n git!(%W(-C #{dir} pull))\n end\n end", "def load_feed\n \n @url_data_params ||= {}\n response = FellowshipOne::api_request(:get, @url_data_path, @url_data_params)\n data = JSON.parse(response.body)\n @headers = response.headers\n @cacher.save_data(@class_key, data) unless @cacher.nil?\n\n return data\n end" ]
[ "0.73419046", "0.6547046", "0.6506305", "0.6465421", "0.64161277", "0.6409836", "0.6389569", "0.6370014", "0.63508123", "0.63415533", "0.6319646", "0.6308639", "0.6308639", "0.6303377", "0.62841046", "0.62739736", "0.6230807", "0.6220272", "0.6220272", "0.6210587", "0.61971664", "0.6152941", "0.615167", "0.61497784", "0.61359155", "0.6120495", "0.61023414", "0.60840863", "0.60592896", "0.60578537", "0.6056218", "0.60458225", "0.60418105", "0.6041396", "0.6033871", "0.6024886", "0.6024886", "0.5992875", "0.59731495", "0.59731495", "0.59731495", "0.59544826", "0.59436584", "0.5935309", "0.5923644", "0.5917423", "0.590802", "0.5899907", "0.5888856", "0.58872837", "0.5879468", "0.5871858", "0.5852549", "0.58497304", "0.5838953", "0.58369094", "0.58254826", "0.5824227", "0.58169836", "0.58142024", "0.57947475", "0.57947475", "0.57790583", "0.5773493", "0.57717377", "0.57626915", "0.57585245", "0.57531464", "0.57427144", "0.57420355", "0.57392454", "0.5728698", "0.5719284", "0.5719284", "0.5717613", "0.57150626", "0.57134056", "0.5711377", "0.5710993", "0.5710531", "0.570972", "0.56975543", "0.5694705", "0.5683243", "0.5682802", "0.5673227", "0.5665958", "0.56296957", "0.56234926", "0.5605044", "0.55965793", "0.558542", "0.5584257", "0.5582176", "0.55821013", "0.5575403", "0.55702627", "0.5569838", "0.5569569", "0.5564403" ]
0.82401633
0
Store page title options that are used on I18n interpolation.
def page_title_options @page_title_options ||= {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title=(t)\n @options[:title] = t\n end", "def page_title(options = {})\n return \"\" if @page.title.blank?\n\n options = {\n prefix: \"\",\n suffix: \"\",\n separator: \"\"\n }.update(options)\n title_parts = [options[:prefix]]\n title_parts << if response.status == 200\n @page.title\n else\n response.status\n end\n title_parts << options[:suffix]\n title_parts.reject(&:blank?).join(options[:separator]).html_safe\n end", "def title\n options.fetch(:title)\n end", "def render_page_title options={}\n default_options = {\n :prefix => \"\",\n :seperator => \"|\"\n }\n default_options.update(options)\n unless current_page.title.blank?\n h(\"#{default_options[:prefix]} #{default_options[:seperator]} #{current_page.title}\")\n else\n h(\"\")\n end\n end", "def page_title\n if @title.present?\n I18n.t('page_title', :page_title => @title, :blog_title => blog_title)\n else\n I18n.t('home_title', :blog_title => blog_title)\n end\n end", "def page_title!(title)\n @_page_title = title\n end", "def set_page_title(title)\n @page_title = title\n end", "def title\n return @options[:title]\n end", "def page_title(value = nil, default: true, **opt)\n @page_title = nil if opt.present?\n @page_title = page_value(value, **opt) if value\n @page_title ||= page_value(:title, **opt, default: default)\n end", "def page_title\n @page_title ||= format_string(page[\"title\"]) || site_title\n end", "def set_page_title(title, opts={})\n @page_title = title\n @page_title_override = title if opts[:override]\n @_no_auto_title = true if opts[:no_auto_title]\n end", "def set_titles\n DynamicUrl.all.each do |url|\n if request.host == url.url\n @title = url.title\n @subtitle = url.subtitle\n end\n end\n\n # set default title if title could not be fetched\n @title ||= MySettings.title\n @subtitle ||= MySettings.subtitle\n end", "def title(page_title)\n content_for(:title) do\n \"#{page_title} - #{MySettings.company_full_name}\"\n end\n end", "def set_page_title(title)\n\t\t@page_title = @current_action.titleize + title\n\tend", "def title(page_title, show_title: true)\n content_for(:title) { h(page_title.to_s) }\n @show_title = show_title\n end", "def page_title(title=nil)\n # DEPRECATED: setting title\n if title\n page_title!(title)\n else\n @_page_title\n end\n end", "def title(value = nil)\n value ? options[:title] = value : options[:title]\n end", "def title=(title)\n title = nil unless title.present?\n settings.title = title\n end", "def page_title\n @page_title || TaliaCore::SITE_NAME\n end", "def page_title(title = nil)\n if title\n content_for(:page_title) { title }\n else\n content_for?(:page_title) ? content_for(:page_title) : APP_CONFIG[:site_name] # or a hard-coded default\n end\n end", "def title(page_title, show_title = true)\n content_for(:title) { h(page_title.to_s) }\n @show_title = show_title\n end", "def page_title=(title)\n @content_for_page_title = title\n end", "def set_page_title(hash, order = nil, type = :title)\n @page_title = page_meta_string_builder(type, hash, order)\n end", "def title(title, global=true)\n global ? (before << \"Backend.app.setTitle(#{title.to_json});\") : config[:title] = title\n end", "def title\n @title ||= Utilities.longest_common_substring_in_array(titles.values) \n @title = titles[:og_title] unless title_ok?\n @title = titles[:html_title] unless title_ok?\n @title = titles[:from_doc] unless title_ok?\n\n @title\n end", "def page_meta_title(value = nil, default: true, **opt)\n @page_meta_title = nil if opt.present?\n @page_meta_title = page_value(value, **opt) if value\n @page_meta_title ||= page_value(:label, **opt, default: default)\n end", "def title(page_title)\n\t\t\tmode = \"[DEV] \" unless ::Rails.env.production?\n\t\t\tcontent_for(:title) { mode.to_s + page_title + \" | \" }\n\t\tend", "def title_help \n\n\t\t#Define general page title\n\t\tbase_title = \"Rex Ruby on Rails Learning | PagesHelper\"\n\t\tif(@title.nil?)\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title = \"Rex Ruby on Rails Learning | #{@title} | PagesHelper\"\n\t\tend\n\tend", "def page_title\n title = \"Amplify\"\n title.prepend(\"#{@page_title} | \") if @page_title\n title\n end", "def title=(title)\n title = nil if title.blank?\n @settings.title = title\n end", "def manageable_page_title(title = nil)\n @title = title unless title.nil?\n @title || \"Untitled Page\"\n end", "def title\n @title ||= hash.fetch('title') { |key|\n raise \"Page id=#{id} is missing #{key}\"\n }\n end", "def set_page_title\n case @title\n when 'Winter', 'Spring', 'Summer', 'Fall'\n parent_content = Content.new(@parent_path)\n @page_title = @title + ' ' + parent_content.title\n else\n @page_title = @title\n end\n end", "def title(page_title)\n @title = page_title\n content_for(:title) { page_title }\n end", "def title(page_title = nil)\n if page_title\n content_for(:title) do\n page_title\n end\n else\n content_for(:title) do\n \"DateIdeas.ca\"\n end\n end\n end", "def assign_page_title\n @page_title ||= resource_wizard_step_title(resource, step)\n end", "def page_title\n \"#{human_readable_type} | #{title.first} | ID: #{id} | #{I18n.t('hyrax.product_name')}\"\n end", "def __init_title_dic\n {\n upd: ['Update', 10, __sid(:site)],\n system: ['System', 13, __sid(:val)],\n mcr: ['MACRO', 3, __sid(:args, :async)],\n exec: ['EXEC', 13, __sid(:site, :args)],\n cfg: ['Config', 14, __sid(:site, :args)],\n sleep: ['Sleeping(sec)', 6, __sid(:val)],\n select: ['SELECT', 3, __sid(:site, :var)],\n wait: ['Waiting', 6, __sid(:retry)]\n }.update(Title_Dic)\n end", "def title_raw\n conf['title'] || proj.title\n end", "def set_title(title)\n @title = title\n end", "def set_page_title\n\t\t@page_title = \"#{self.action_name.capitalize}: Abstract /\" <<\n\t\t\t\" #{Abstract.sections.find{|a|a[:controller] == self.class.name.demodulize}[:label]}\"\n\tend", "def set_title_locally(title)\n @title = title\n end", "def title(page_title = '')\n\t\tbase_title = \"AB Online Shop\"\n\t\tif page_title.empty?\n\t\t\tbase_title\n\t\telse\n\t\t\tpage_title + \" | \" + base_title\n\t\tend\n\tend", "def title(title)\n @title = title\n end", "def title_page page, title\n raise ArgumentError, 'Argument is not an integer' unless page.is_a? Integer\n raise ArgumentError, 'Argument is cannot contain a single or double quote' if title =~ /['\"]/\n\n @command << %Q{select #{page}; set-page-title \"#{title}\";}\n end", "def title(page_title)\n \tcontent_for(:title) { page_title }\n \tend", "def full_title(page_title = '', options = {})\n if options == 'admin'\n base_title = \"GeniusPass (Admin)\"\n else\n base_title = \"GeniusPass\"\n end\n\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end", "def set_page_title\n @page_title = \"Race Results Management\"\n end", "def page_title; end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def page_title(options = {})\n object = options.fetch(:object, @meta)\n options.delete(:object)\n options = Refinery::Pages.page_title.merge(options)\n\n title = []\n objects = (options[:chain_page_title] and object.respond_to?(:ancestors)) ? [object.ancestors, object] : [object]\n\n objects.flatten.compact.each do |obj|\n obj_title = obj.title if obj.title\n\n # Only link when the object responds to a url method.\n if options[:link] && obj.respond_to?(:url)\n title << link_to(obj_title, obj.url)\n else\n title << obj_title\n end\n end\n\n final_title = title.pop\n if (options[:page_title][:wrap_if_not_chained] and title.empty?) and options[:page_title][:tag].present?\n css = \" class='#{options[:page_title][:class]}'\" if options[:page_title][:class].present?\n final_title = \"<#{options[:page_title][:tag]}#{css}>#{final_title}</#{options[:page_title][:tag]}>\"\n end\n\n if title.empty?\n final_title.to_s.html_safe\n else\n tag = \"<#{options[:ancestors][:tag]} class='#{options[:ancestors][:class]}'>\"\n tag << title.join(options[:ancestors][:separator])\n tag << options[:ancestors][:separator]\n tag << \"</#{options[:ancestors][:tag]}>#{final_title}\"\n tag.html_safe\n end\n end", "def title(page_title)\n\t content_for(:title) { page_title }\n\tend", "def page_title(page_title)\n content_for_layout :page_title, page_title\n end", "def page_title(*args, &block)\n options = Hash === args.last ? args.last : {}\n before_filter(options) {|c| c.page_title(*args, &block) }\n end", "def page_title\n @page_title = \"Nursing System\"\n end", "def title_tag_content(page_title: '')\n base_title = COMPETITIONS_CONFIG[:application_name]\n page_title.empty? ? base_title : \"#{page_title} | #{base_title}\"\n end", "def page_title(title)\n content_for_wrapper(:page_title, title)\n end", "def title_with_multilingual=(val)\n self.title_without_multilingual = val.is_a?(Hash) ? val['English'] : val\n end", "def title(value = nil, options = nil)\n end", "def page_title( this_title = nil )\n content_for( :title ) { \"#{ SITE_ID }: #{ this_title.nil? ? I18n.t( controller.controller_name + '.title' ) : this_title }\" }\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def title(page_title)\n content_for(:title) { page_title }\n end", "def page_title(page_title = nil)\n @page_title ||= page_title\n @page_title.nil? ? \"Carers: #{action_name}\" : \"#{@page_title} @ Lort Smith\"\n end", "def title=(value)\n\t\t\t@title = value\n\t\tend", "def title(title = nil)\n @title = title if title\n @title\n end", "def title(title = nil)\n raise TypeError, \"expecting a String or an Array\" unless [String,Array].include?(title.class) || title.nil?\n separator = \" ~ \"\n @page_title = title if title\n if @page_title\n title = @page_title.to_a.flatten\n [@page_title, site_name].flatten.reverse.join(separator)\n else\n site_name\n end\n end", "def page_title\n end", "def title(page_title)\n content_for :page_title, page_title.to_s.html_safe\n end", "def title=(title)\n @title = @template.instance_variable_set(\"@title\", title)\n end", "def title\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_title + TITLE_SEPARATOR + site_title_extention_or_description\n else\n page_title || site_title\n end\n end\n\n return page_number + @title if page_number\n\n @title\n end", "def title(page_title)\n content_for :title do\n page_title\n end\n end", "def page_title\n title = t(\"#{controller_name}.#{action_name}.title\")\n html = <<-HTML\n <div class=\"page-header\">\n <h1>#{title}</h1>\n </div>\n HTML\n html.html_safe\n end", "def header_text(page_title)\n page_title || @@base_title\n end", "def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : nil\n end", "def page_title title= nil\n\t\tif title\n\t\t\tcontent_for(:page_title) { \"#{title} - 2da.re\" }\n\t\t\treturn title\n\t\telse\n\t\t\tcontent_for?(:page_title) ? content_for(:page_title) : \"Ready 2da.re?\"\n\t\tend\n\tend", "def set_page_title\n if params['listing_user_id']\n @page_title = \"My Tours\"\n else\n @page_title = \"All Tours\"\n end\n end", "def title(phrase, container = nil)\n @page_title ||= phrase\n content_tag(container, @page_title) if container\n end", "def title\n @global_page.title\n end", "def page_title\n page.title\n end", "def set_title(params)\n @title.merge_with_hash(params)\n end", "def title(title)\n @title=title\n end", "def title\n base_title = \"CloudSpokes Coding Challenges\"\n if @page_title.nil?\n base_title\n else\n \"#{base_title} - #{@page_title}\"\n end\n end", "def title; self.config['title']; end", "def page_title\n layout = controller.send(:_layout)\n base_title = I18n.t(\"layouts.#{layout}.title\", default: :'layouts.application.title')\n\n i18n_scope = \"#{params[:controller].gsub('/', '.')}.#{action_name}\"\n i18n_parts = [\n content_for(:page_title),\n I18n.t(:page_title, default: \"\", scope: i18n_scope).presence,\n I18n.t(:title, default: \"\", scope: i18n_scope).presence\n ]\n title_content = i18n_parts.compact.first\n [base_title, title_content].compact.join(' - ')\n end", "def title=(value)\n super(value)\n self.set_prefix\n return self.title\n end", "def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end", "def page_title(page_title = 'Page Title', html_options = {}, &block)\n html_options.has_key?(:class) ? html_options[:class] += ' page_title' : html_options[:class] = 'page_title'\n\n if block_given?\n actions = capture(&block)\n content_tag(:h2, content_tag(:span, h(page_title) << actions), html_options)\n else\n content_tag(:h2, content_tag(:span, h(page_title)), html_options)\n end\n end", "def page_title\n return \"#{this_webapp.webapp_name} - #{@page_title}\" if @page_title\n return \"#{this_webapp.webapp_name}\"\n end", "def setTitle(title)\r\n\t\t\t\t\t@title = title\r\n\t\t\t\tend", "def render_title_tag options={}\n default_options = {\n :prefix => \"\",\n :seperator => \"|\"\n }\n options = default_options.merge(options)\n title = render_page_title(options)\n %(<title>#{title}</title>)\n end", "def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend", "def title(page_title)\n content_for(:title) { page_title }\n end" ]
[ "0.731271", "0.73069143", "0.7233398", "0.72106487", "0.716158", "0.7127059", "0.709165", "0.7079146", "0.7051273", "0.7026661", "0.69825894", "0.6956374", "0.68932176", "0.6877517", "0.68723416", "0.6852441", "0.68501896", "0.68482125", "0.6831096", "0.67903167", "0.6788046", "0.6786792", "0.67839396", "0.6774203", "0.67703056", "0.67603725", "0.6753015", "0.6752929", "0.6743295", "0.6729598", "0.6724402", "0.67233866", "0.6720648", "0.6717282", "0.67086464", "0.6697772", "0.66528213", "0.6640189", "0.6617847", "0.66168505", "0.66102564", "0.6608493", "0.66040134", "0.66019166", "0.6580246", "0.65729755", "0.657144", "0.65659827", "0.656548", "0.6559499", "0.6559499", "0.6559499", "0.6559499", "0.6559499", "0.6559499", "0.6559499", "0.65587634", "0.6557542", "0.65479344", "0.6545365", "0.653917", "0.6534501", "0.6532092", "0.65290475", "0.6525887", "0.6520085", "0.6516163", "0.6516163", "0.6516163", "0.6516163", "0.6514573", "0.6513614", "0.65107584", "0.6504924", "0.6499579", "0.6497908", "0.64959824", "0.6488595", "0.6486246", "0.64814234", "0.64800376", "0.647562", "0.64713967", "0.64706403", "0.64668685", "0.6463012", "0.6461596", "0.6459439", "0.64395404", "0.64217234", "0.6418355", "0.6412814", "0.64128053", "0.64075243", "0.6405775", "0.6397375", "0.63950443", "0.63870513", "0.6386053", "0.6382148" ]
0.84882396
0
GET /results GET /results.json
def index @results = Result.all @results = Result.paginate(:per_page => 15, :page => params[:page]) respond_to do |format| format.html # index.html.erb format.json { render json: @results } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end", "def results\n with_monitoring do\n response = perform(:get, results_url, query_params)\n Search::ResultsResponse.from(response)\n end\n rescue => e\n handle_error(e)\n end", "def index\n get_results\n end", "def get_results\n\t\trace_id = params[:id]\n\t\t\n\t\trace = Race.find_by_id(race_id)\n\t\tresults = Result.get_race_results(race_id)\n\t\t\n\t\trender :json=>{:results=>results}\n\tend", "def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end", "def index\n @results = Result.all\n end", "def index\n @results = Result.all\n end", "def results\n response['data']\n end", "def results\n begin\n self.to_json[\"SearchResponse\"][\"Web\"][\"Results\"].map do |result_hash|\n LiveAPI::Search::Result.new(result_hash)\n end\n rescue\n self.to_json[\"SearchResponse\"]\n end\n end", "def index\n @am_results = AmResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @am_results }\n end\n end", "def index\n @results = Result.all\n\n end", "def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end", "def results\n respond_to do |format|\n format.html do\n content = get_content('opportunities/results.yml')\n results = Search.new(params, limit: 500).run\n @subscription = SubscriptionForm.new(results).data\n @page = PagePresenter.new(content)\n @results = OpportunitySearchResultsPresenter.new(content, results)\n render layout: 'results'\n end\n format.any(:atom, :xml) do\n results = Search.new(params, limit: 500,\n results_only: true,\n sort: 'updated_at').run\n @query = AtomOpportunityQueryDecorator.new(results, view_context)\n render :index, formats: :atom\n end\n end\n end", "def index\n @results = Result.all\n end", "def index\n @results = Result.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @results }\n end\n end", "def results\n index.results\n end", "def\tsearch\n\t\tresult = query_google_places\n\t\trender :json => result\n\tend", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n @results = Result.where(:student_id => @student.id)\n .order('result_date desc')\n .paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @results }\n end\n end", "def results\n # lat, lng, and term from user.js AJAX get request\n p params\n @lat = params[:lat]\n @long = params[:lng]\n term = params[:term]\n yelp_params = { term: term, limit: 5, sort: 1}\n coordinates = { latitude: @lat, longitude: @long }\n new_search = Yelp.client.search_by_coordinates(coordinates, yelp_params)\n # TODO - refactor into a separate function\n p new_search\n new_search.businesses.each do |business|\n \t result_name = business.name\n result_distance = business.distance\n \t result_address = business.location.address\n \t result_lat = business.location.coordinate.latitude\n \t result_long = business.location.coordinate.longitude\n \t # result_review = business.review_count\n \t # result_rating = business.rating\n end \n render json: new_search\n end", "def search\n terms = @authority.search(url_search)\n render json: terms\n end", "def index\n @response = search_service.search_results\n\n respond_to do |format|\n format.html { store_preferred_view }\n format.rss { render layout: false }\n format.atom { render layout: false }\n format.json do\n @presenter = Blacklight::JsonPresenter.new(@response,\n blacklight_config)\n end\n additional_response_formats(format)\n document_export_formats(format)\n end\n end", "def filtered_results\n results = PropertyResults.paginated_results(params[:facets], params[:page], params[:per_page], params[:offset], params[:query])\n respond_to do |format|\n format.json { render json: results.to_json }\n end\n end", "def search\n results = @test.search(test_params)\n return render json: {results: results, total: results.total_entries}\n end", "def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end", "def index\n @contacts = Contact.all\n @calltypes = CallType.all\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @results }\n end\n end", "def search_result\n @search = params[:search]\n query = params[:search] #Query variable is the string a user enters in the search bar.\n url = Addressable::URI.parse('https://api.themoviedb.org/3/search/tv?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n url.query_values = url.query_values.merge(query: query)\n response = HTTParty.get(url)\n @results = JSON.parse(response.body, symbolize_names: true) \n end", "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def search(query, results = nil)\n params = { :query => query }\n params[:results] = results unless results.nil?\n get :webSearch, params\n end", "def index\n @results = FourSquare.new(foursquare_params).search\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end", "def all\n response = RestClient.get(@all_url, params)\n parsed = JSON.parse(response)\n \n parsed['results']['result']\n end", "def index\n @search = Problem.search(params[:q])\n @problems = @search.result.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @problems }\n end\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def print_results(response)\n puts response.to_json\nend", "def index\n @user = current_user\n @search = @user.loops.search(params[:q]) \n @loops = @search.result \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loops }\n end\n end", "def results\n get_results(true)\n render :partial => (params[:result_partial] || 'results')\n end", "def index\n query = params[:q]\n @courses = query ? Course.search(query) : Course.all.order(:id)\n\n render json: @courses\n end", "def search\n @tweets = TwitterClient.search(params[:query], result_type: 'recent').take(20)\n render json: @tweets\n end", "def index\n @searches = @user.searches\n respond_to do |format|\n format.html { }\n format.json { @presenter = json_presenter(@searches) }\n end\n end", "def index\n @campaign_results = CampaignResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaign_results }\n end\n end", "def search_result\n query = search_params.presence && search_params\n results = query.present? ? helpers.search_query(query) :helpers.create_query(current_user)\n render json: {:data => results, :total => results.results.total}\n end", "def show\n @result = Result.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def show\n @result = Result.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def show\n @result = Result.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def show\n @result = Result.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def results\n @results\n end", "def results_info\n render json: {results: @experiment.results, error_reason: @experiment.error_reason}\n end", "def index\n @hits = Hit.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hits }\n end\n end", "def index\n @players = Player.search(params[:team_id], params[:player_forename], params[:player_surename])\n\n respond_to do |format|\n format.html # index.html.erb\n hash = {:players => @players}\n format.json { render :json => hash }\n end\n end", "def result_params\n params[:results]\n end", "def index\n @survey = Survey.find(params[:survey_id])\n @results = @survey.results.all\n end", "def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end", "def index\n @results = Admin::Result.index.paginate(page: params[:page], per_page: 20)\n end", "def results\n fetch unless @results\n @results\n end", "def index\n\n @properties = Property.search( params[:query] || \"\" )\n\n respond_to do |format|\n\n format.html\n format.json { render json: @properties }\n\n end\n\n end", "def index\n @vodcasts = Vodcast.search(params[:search])\n \n if @vodcasts.count == 0\n if params[:search]\n flash.now[:notice] = \"No results\"\n else\n flash.now[:notice] = \"No vodcasts\"\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vodcasts }\n \n # external access(HTTP Service):\n # http://davidsulc.com/blog/2011/04/10/implementing-a-public-api-in-rails-3/\n # http://davidsulc.com/blog/2011/04/17/consuming-a-public-rails-api-with-jquery/\n format.js { render json: @vodcasts, callback: params[:callback] }\n end\n end", "def index\n @ptest_results = PtestResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ptest_results }\n end\n end", "def search\n render json: User.first(10)\n end", "def index\n @search = NiconicoMovie.search(params[:q])\n @niconicomovies = @search.result.order(\"id DESC\").page(params[:page]).per(25)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @niconicomovies }\n end\n end", "def index\n @stock_results = StockResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_results }\n end\n end", "def search\n @collections, @total_count = Admin::Collection.search(params[:search], params[:pagination], params[:sorting])\n\n render json: { collections: @collections, totalCount: @total_count }\n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def index \n artists = Artist.all \n render json: artists \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 # (@response, @document_list) = search_results(params)\n set_cached_latest\n\n respond_to do |format|\n format.html { store_preferred_view }\n format.rss { render layout: false }\n format.atom { render layout: false }\n format.js\n format.json do\n render json: render_search_results_as_json\n # @presenter = Blacklight::JsonPresenter.new(@response,\n # @document_list,\n # facets_from_request,\n # blacklight_config)\n end\n # additional_response_formats(format)\n # document_export_formats(format)\n end\n end", "def index\n\n @search = House.search()\n @houses = House.order(\"country\").order(\"name\").page params[:page]\n\n if params[:q]\n @search = House.search(params[:q])\n @houses = @search.result.order(\"country\").order(\"name\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @houses }\n end\n end", "def search\n # bail out if doing an unauthenticated API request\n failures = []\n respond_to do |format|\n format.html do\n @test_instances, failures = \n TestInstance.query(params[:query_text]) if params[:query_text]\n if @test_instances\n @test_instances = @test_instances.page(params[:page])\n end\n unless failures.empty?\n flash.now[:warning] = 'Invalid search parameters: ' + \n failures.join(', ') + '.'\n end\n @show_instructions = @test_instances.nil?\n end\n format.json do\n if authenticated?\n @test_instances, failures = \n TestInstance.query(params[:query_text]) if params[:query_text]\n if @test_instances\n render json: {\"results\" => @test_instances,\n \"failures\" => failures}.to_json\n else\n render json: {\"results\" => [], \"failures\" => failures}.to_json\n end\n else\n fail_authenticate_json\n end\n end\n end\n end", "def results\n d = data\n if d != nil and d.has_key?('results')\n return d['results']\n end\n nil\n end", "def index\n @reloud_checks = ReloudCheck.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reloud_checks }\n end\n end", "def index\n @survey_results = HTTParty.get('https://shielded-wave-66393.herokuapp.com',\n :headers =>{'Content-Type' => 'application/json'} )\n @survey_results = SurveyResults.all_(current_customer)\n end", "def index\n results = []\n if params[:bbox]\n results = VAFacility.query(bbox: params[:bbox], type: params[:type], services: params[:services])\n end\n resource = Common::Collection.new(::VAFacility, data: results)\n resource = resource.paginate(pagination_params)\n render json: resource.data,\n serializer: CollectionSerializer,\n each_serializer: VAFacilitySerializer,\n meta: resource.metadata\n end", "def get_results\n\n # An internal counter to get the next\n # set of results from the API\n @result_count = 0\n\n # An array into which the API results can\n # be collected\n @results = []\n\n # Get the first set of results from the API\n json_response = self.query\n\n while true\n\n # Exit the loop if the API doesn't return\n # any results and set the \"skip\" attribute\n # to nil\n if json_response['result_count'] == 0\n self.skip= nil\n break\n end\n\n # Add the count of the returned results to the\n # internal result counter's current value\n @result_count += json_response['result_count']\n\n # Append the current results to the results\n # array\n @results << json_response['results']\n\n # Set the \"skip\" attribute to the value\n # on the internal result counter\n self.skip= @result_count\n\n # Get the next set of results from the API\n json_response = self.query\n\n # A simple progress bar\n print \"#\"\n\n end\n\n # Print the total result count to the console\n puts \"\\nFound #{@result_count} results.\"\n\n return @results\n\n end", "def index\n @routes = Route.where(:verified => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @routes }\n end\n end", "def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end", "def index\n @users = User.search(params[:search]).order(\"kilometers DESC\").paginate(:per_page => 100, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def search\n spotyfy_client = SpotyfyClient.new(params[:search])\n spotyfy_client.perform\n items = SpotyfyService.parse_hash(spotyfy_client.body)\n render :json => items.to_json\n end", "def search_results\n @results = User.search(params[:search])\n end", "def index\n @results = @search.result.paginate(page: params[:page], per_page: 9).order(created_at: :desc)\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 @quantities = Quantity.search(params[:search])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quantities }\n end\n end", "def show\n set_meta_tags title: @application.name + ' | Collections - Repositories'\n @access_tokens = @application.access_tokens.where(resource_owner: current_user)\n @token = @access_tokens.last\n if params[:q].present?\n url = \"#{@application.url}?q=#{url_encode(params[:q])}&limit=#{params[:limit]}\"\n begin\n response = RestClient.get(url, {:Authorization => \"#{@token.try(:token_type)} #{@token.try(:token)}\"})\n rescue Errno::ECONNREFUSED\n puts \"Server at #{url} is refusing connection.\"\n flash.now[:warning] = \"Results from #{@application.name} missing. Can't connect to server.\"\n end\n @results = JSON.parse(response) if response\n end\n end", "def results\n @results ||= {}\n end", "def index\n @jobsearches = Jobsearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @jobsearches }\n end\n end", "def index\n @military_battle_faction_results = Military::BattleFactionResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_faction_results }\n end\n end", "def index\n @search = Species.includes(:animals).organization(current_user).search(params[:q])\n @species = @search.result.paginate(page: params[:page], per_page: 10).order('updated_at DESC')\n\n respond_with(@species)\n end", "def index\n authorize RosterList\n params[:page] ||= 1\n meta = {}\n # RosterList.all.each { |r| r.fill_in_data }\n all_result = search_query\n meta['total_count'] = all_result.count\n result = all_result.page( params[:page].to_i).per(20)\n\n # meta['total_count'] = result.total_count\n meta['total_page'] = result.total_pages\n meta['current_page'] = result.current_page\n # result.each { |r| r.fill_in_data }\n\n final_result = format_result(result.as_json(include: [], methods: []))\n\n response_json final_result, meta: meta\n end", "def index\n # Generate sunspot search\n @records = record_default_search\n\n respond_with(@records)\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 search\n games_data = BoardGameAtlas::API.search(params[:name])\n render json: { games: games_data.map }\n end", "def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end", "def index\n @shops = Shop.all\n @search = Shop.search(params[:q])\n @shops = @search.result.page(params[:page]).per(30)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shops }\n end\n\n end", "def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end", "def get_results\n\t\tstage_id = params[:id]\n\t\t\n\t\tresults = Result.get_results('stage', stage_id, {}, true)\n\t\tstage = Stage.find_by_id(stage_id)\n\t\t\n\t\tdata = []\n\t\tresults.each do |ndx, result|\n\t\t\tdata.push({\n\t\t\t\t:rider_name => result[:rider_name],\n\t\t\t\t:kom_points => result[:kom_points],\n\t\t\t\t:sprint_points => result[:sprint_points],\n\t\t\t\t:disqualified => result[:disqualified],\n\t\t\t\t:rank => result[:rank],\n\t\t\t\t:time_formatted => result[:time_formatted],\n\t\t\t\t:bonus_time_formatted => result[:bonus_time_formatted],\n\t\t\t\t:gap_formatted => result[:gap_formatted]\n\t\t\t})\n\t\tend\n\t\t\n\t\tif (!@user.nil? && !@user.time_zone.nil?)\n\t\t\tstage_starts_on = stage.starts_on.gmtime.localtime(@user.time_zone)\n\t\telse\n\t\t\tstage_starts_on = stage.starts_on.gmtime\n\t\tend\n\t\tstage_data = {\n\t\t\t:name => stage.name,\n\t\t\t:description => stage.description,\n\t\t\t:profile => (stage.profile.nil? || stage.profile.empty?)?nil:stage.profile,\n\t\t\t:starts_on => stage_starts_on.strftime('%b %e, %Y, %H:%M'),\n\t\t\t:start_location => stage.start_location,\n\t\t\t:end_location => stage.end_location,\n\t\t\t:distance => stage.distance_km\n\t\t}\n\t\t\n\t\trender :json=>{:results=>data, :stage=>stage_data}\n\tend", "def search\n response = make_request\n begin\n response_hash = JSON.parse(response.body)\n rescue JSON::ParserError\n raise RequestException\n else\n response_hash\n end\n end", "def index\n @saved_searches = SavedSearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @saved_searches }\n end\n end", "def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end", "def raw_results\n results\n end", "def index\n @restaurants = Restaurant.where(\"name like ?\", \"%#{params[:q]}%\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @restaurants.map(&:attributes) }\n end\n end", "def search\n render json: Consultation.first(10)\n end" ]
[ "0.76288646", "0.74009883", "0.73304945", "0.7310312", "0.71980476", "0.7026232", "0.7026232", "0.70244294", "0.69998676", "0.6964366", "0.69346374", "0.69158345", "0.6851679", "0.6832736", "0.67981136", "0.67470914", "0.6732289", "0.67216444", "0.6684441", "0.66760254", "0.66753125", "0.6657754", "0.66169506", "0.66046524", "0.65853405", "0.6562349", "0.6557281", "0.6555126", "0.65303653", "0.6521829", "0.6513391", "0.6509285", "0.65066195", "0.65065104", "0.65002006", "0.6493112", "0.649091", "0.64811075", "0.6477981", "0.6472002", "0.6452172", "0.6451835", "0.64349365", "0.64349365", "0.64349365", "0.64349365", "0.64343876", "0.6431101", "0.6428528", "0.6426777", "0.6412162", "0.64059293", "0.63856024", "0.63781077", "0.6373569", "0.6372391", "0.6368065", "0.6351006", "0.63509417", "0.6344849", "0.6339927", "0.6335371", "0.63332945", "0.6329631", "0.632093", "0.6317796", "0.6316169", "0.6312541", "0.6307252", "0.63066375", "0.6300273", "0.62997603", "0.62874234", "0.6276085", "0.62742734", "0.6270461", "0.62621975", "0.62604105", "0.62471575", "0.6244876", "0.62364006", "0.62337947", "0.6230266", "0.6211919", "0.6205737", "0.62056184", "0.62020665", "0.6200815", "0.6199155", "0.6194287", "0.61898065", "0.61864156", "0.6177936", "0.6169658", "0.6168571", "0.61677885", "0.6166858", "0.61635154", "0.6157246", "0.6156436" ]
0.7303821
4
GET /results/1 GET /results/1.json
def show @result = Result.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @result } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end", "def index\n get_results\n end", "def get_results\n\t\trace_id = params[:id]\n\t\t\n\t\trace = Race.find_by_id(race_id)\n\t\tresults = Result.get_race_results(race_id)\n\t\t\n\t\trender :json=>{:results=>results}\n\tend", "def index\n @results = Result.all\n @results = Result.paginate(:per_page => 15, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @results }\n end\n end", "def results\n response['data']\n end", "def index\n @results = Result.all\n end", "def index\n @results = Result.all\n end", "def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end", "def index\n @results = Result.all\n\n end", "def results\n with_monitoring do\n response = perform(:get, results_url, query_params)\n Search::ResultsResponse.from(response)\n end\n rescue => e\n handle_error(e)\n end", "def show\n @result1 = Result1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result1 }\n end\n end", "def index\n @am_results = AmResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @am_results }\n end\n end", "def index\n @results = Result.all\n end", "def index\n @results = Result.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @results }\n end\n end", "def results\n index.results\n end", "def result\n results.first\n end", "def show\n @scenario = Scenario.find(params[:scenario_id])\n @result = @scenario.results.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result }\n end\n end", "def print_results(response)\n puts response.to_json\nend", "def result\n results[0]\n end", "def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end", "def results_info\n render json: {results: @experiment.results, error_reason: @experiment.error_reason}\n end", "def index\n @hits = Hit.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hits }\n end\n end", "def get\n @research_output = @service.get({type: params[:graph], detail: params[:detail], id: params[:id]},\n host: request.env[\"HTTP_HOST\"], limit: params[:num_results], offset: params[:start_offset], :per_project => params[:per_project], format: params[:format])\n\n respond_with @research_output\n end", "def index\n @results = Result.where(:student_id => @student.id)\n .order('result_date desc')\n .paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @results }\n end\n end", "def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def index\n @survey = Survey.find(params[:survey_id])\n @results = @survey.results.all\n end", "def results\n begin\n self.to_json[\"SearchResponse\"][\"Web\"][\"Results\"].map do |result_hash|\n LiveAPI::Search::Result.new(result_hash)\n end\n rescue\n self.to_json[\"SearchResponse\"]\n end\n end", "def results\n respond_to do |format|\n format.html do\n content = get_content('opportunities/results.yml')\n results = Search.new(params, limit: 500).run\n @subscription = SubscriptionForm.new(results).data\n @page = PagePresenter.new(content)\n @results = OpportunitySearchResultsPresenter.new(content, results)\n render layout: 'results'\n end\n format.any(:atom, :xml) do\n results = Search.new(params, limit: 500,\n results_only: true,\n sort: 'updated_at').run\n @query = AtomOpportunityQueryDecorator.new(results, view_context)\n render :index, formats: :atom\n end\n end\n end", "def results\n get_results(true)\n render :partial => (params[:result_partial] || 'results')\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n @three_results = ThreeResult.all\n end", "def show\n @result_item = ResultItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @result_item }\n end\n end", "def get_api_results(_url)\n JSON.parse File.read('spec/inspector/stubbed_example.json')\n end", "def index\n @ptest_results = PtestResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ptest_results }\n end\n end", "def all\n response = RestClient.get(@all_url, params)\n parsed = JSON.parse(response)\n \n parsed['results']['result']\n end", "def index\n @campaign_results = CampaignResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaign_results }\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n @search = Problem.search(params[:q])\n @problems = @search.result.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @problems }\n end\n end", "def index\n @contacts = Contact.all\n @calltypes = CallType.all\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @results }\n end\n end", "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def fetch(url)\n response = RestClient.get(url)\n data = JSON.parse(response)\n @google_results = data[\"results\"].first(15).map do |result|\n {\n name: result[\"name\"],\n address: result[\"formatted_address\"],\n coordinates: {\n latitude: result[\"geometry\"][\"location\"][\"lat\"],\n longitude: result[\"geometry\"][\"location\"][\"lng\"]\n },\n opening_hours: result[\"opening_hours\"],\n type: result[\"types\"].first,\n rating: result[\"rating\"]\n }\n end\n @google_results\n end", "def search\n render json: User.first(10)\n end", "def get_results\n\n # An internal counter to get the next\n # set of results from the API\n @result_count = 0\n\n # An array into which the API results can\n # be collected\n @results = []\n\n # Get the first set of results from the API\n json_response = self.query\n\n while true\n\n # Exit the loop if the API doesn't return\n # any results and set the \"skip\" attribute\n # to nil\n if json_response['result_count'] == 0\n self.skip= nil\n break\n end\n\n # Add the count of the returned results to the\n # internal result counter's current value\n @result_count += json_response['result_count']\n\n # Append the current results to the results\n # array\n @results << json_response['results']\n\n # Set the \"skip\" attribute to the value\n # on the internal result counter\n self.skip= @result_count\n\n # Get the next set of results from the API\n json_response = self.query\n\n # A simple progress bar\n print \"#\"\n\n end\n\n # Print the total result count to the console\n puts \"\\nFound #{@result_count} results.\"\n\n return @results\n\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def json_to_results(json)\n json.map do |jr|\n uri = URI(jr['url'])\n # ignore the query string, since it may have some randomness\n uri.query = nil\n Result.new(project.name, jr['confidence'], jr['risk'], uri.to_s, jr['param'], jr['alert'])\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 index\n @response = search_service.search_results\n\n respond_to do |format|\n format.html { store_preferred_view }\n format.rss { render layout: false }\n format.atom { render layout: false }\n format.json do\n @presenter = Blacklight::JsonPresenter.new(@response,\n blacklight_config)\n end\n additional_response_formats(format)\n document_export_formats(format)\n end\n end", "def results\n fetch unless @results\n @results\n end", "def results\n # lat, lng, and term from user.js AJAX get request\n p params\n @lat = params[:lat]\n @long = params[:lng]\n term = params[:term]\n yelp_params = { term: term, limit: 5, sort: 1}\n coordinates = { latitude: @lat, longitude: @long }\n new_search = Yelp.client.search_by_coordinates(coordinates, yelp_params)\n # TODO - refactor into a separate function\n p new_search\n new_search.businesses.each do |business|\n \t result_name = business.name\n result_distance = business.distance\n \t result_address = business.location.address\n \t result_lat = business.location.coordinate.latitude\n \t result_long = business.location.coordinate.longitude\n \t # result_review = business.review_count\n \t # result_rating = business.rating\n end \n render json: new_search\n end", "def index\n @experiments = Experiment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @experiments }\n end\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def search_result\n @search = params[:search]\n query = params[:search] #Query variable is the string a user enters in the search bar.\n url = Addressable::URI.parse('https://api.themoviedb.org/3/search/tv?api_key=fb6a1d3f38c3d97f67df6d141f936f29&language=en-US')\n url.query_values = url.query_values.merge(query: query)\n response = HTTParty.get(url)\n @results = JSON.parse(response.body, symbolize_names: true) \n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def search\n @tweets = TwitterClient.search(params[:query], result_type: 'recent').take(20)\n render json: @tweets\n end", "def index\n @q = params[:q]\n @q ||= \"\"\n @shops = Shop.search(@q).records\n\n\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render json: @shops, each_serializer: ShopListSerializer }\n end\n end", "def pokemon_api_caller\nresponse = RestClient.get \"https://pokeapi.co/api/v2/pokemon/?offset=0&limit=807\"\nresponse_JSON = JSON.parse(response)\nresponse_JSON[\"results\"]\nend", "def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end", "def show\n @survey_result = SurveyResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_result }\n end\n end", "def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end", "def search\n render json: PersonEvent.first(10)\n end", "def result_params\n params[:results]\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 @result_infos = ResultInfo.all\n end", "def index\n @researches = Research.paginate(:page => params[:page], :per_page => 10)\n\t\t@research = Research.new\n\t\t@notifications = Notification.find(:all, :order => :next_notification).first(9)\n\t\t@topics= Topic.find(:all, :order => :progress, :conditions => [\"version = ?\",'latest'], :limit => '8')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @researches }\n end\n end", "def index\n @results = FourSquare.new(foursquare_params).search\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def search\n render json: Consultation.first(10)\n end", "def index\n @user = current_user\n @search = @user.loops.search(params[:q]) \n @loops = @search.result \n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loops }\n end\n end", "def search\n render json: PersonScantronAppointment.first(10)\n end", "def index\n index! do |format|\n format.html\n format.json do\n object = if params[:id]\n resource.increment_hits!\n resource\n else\n collection\n end\n\n render :json => object \n end\n end\n end", "def index\n # (@response, @document_list) = search_results(params)\n set_cached_latest\n\n respond_to do |format|\n format.html { store_preferred_view }\n format.rss { render layout: false }\n format.atom { render layout: false }\n format.js\n format.json do\n render json: render_search_results_as_json\n # @presenter = Blacklight::JsonPresenter.new(@response,\n # @document_list,\n # facets_from_request,\n # blacklight_config)\n end\n # additional_response_formats(format)\n # document_export_formats(format)\n end\n end", "def index\n @stock_results = StockResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stock_results }\n end\n end", "def index\n @survey_results = HTTParty.get('https://shielded-wave-66393.herokuapp.com',\n :headers =>{'Content-Type' => 'application/json'} )\n @survey_results = SurveyResults.all_(current_customer)\n end", "def index\n @two_results = TwoResult.all\n end", "def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end", "def show\n \t@survey = Survey.find(params[:survey_id])\n \t@result = @survey.results.find(params[:id])\n end", "def show\n @test_result = TestResult.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_result }\n end\n end", "def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n\n @properties = Property.search( params[:query] || \"\" )\n\n respond_to do |format|\n\n format.html\n format.json { render json: @properties }\n\n end\n\n end", "def index\r\n @stats = Stat.all\r\n @statsu = Stat.where(calculation_id: params[:id])\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @stats }\r\n end\r\n end", "def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end", "def search_result\n query = search_params.presence && search_params\n results = query.present? ? helpers.search_query(query) :helpers.create_query(current_user)\n render json: {:data => results, :total => results.results.total}\n end", "def filtered_results\n results = PropertyResults.paginated_results(params[:facets], params[:page], params[:per_page], params[:offset], params[:query])\n respond_to do |format|\n format.json { render json: results.to_json }\n end\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def show\n render pretty_json: Search.of(params[:id])\n end", "def results; end", "def results; end", "def results; end", "def fetch\n fetch_response.results\n end", "def raw_results\n results\n end", "def index\n @players = Player.search(params[:team_id], params[:player_forename], params[:player_surename])\n\n respond_to do |format|\n format.html # index.html.erb\n hash = {:players => @players}\n format.json { render :json => hash }\n end\n end", "def index\n @results = Admin::Result.index.paginate(page: params[:page], per_page: 20)\n end", "def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end", "def index\n @distros = getmydata(\"Distro\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @distros }\n end\n end", "def index \n artists = Artist.all \n render json: artists \n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end" ]
[ "0.73266965", "0.6979273", "0.69192237", "0.6817701", "0.67208", "0.6713047", "0.6713047", "0.66786873", "0.66508305", "0.6609092", "0.66036445", "0.65753514", "0.6566137", "0.64380974", "0.6395807", "0.63874984", "0.63825446", "0.63717514", "0.6371065", "0.6341115", "0.63237095", "0.62753654", "0.62717694", "0.6256941", "0.62498903", "0.6247879", "0.6216595", "0.620873", "0.62041825", "0.6186597", "0.6176413", "0.6176214", "0.6163217", "0.6159709", "0.61340797", "0.61243033", "0.6117008", "0.6090334", "0.6089826", "0.6085473", "0.6075838", "0.6074107", "0.60688883", "0.60662204", "0.60641646", "0.6061201", "0.6059082", "0.6049778", "0.6044316", "0.60382646", "0.6032666", "0.60309035", "0.60309035", "0.6026996", "0.60250396", "0.60229206", "0.6018585", "0.6015424", "0.60083675", "0.60081095", "0.60047644", "0.6000067", "0.599206", "0.5991236", "0.598898", "0.5982412", "0.5972443", "0.596858", "0.5965061", "0.59642553", "0.5961545", "0.59587765", "0.59576726", "0.5953421", "0.59462935", "0.5943059", "0.59389454", "0.59341717", "0.5933839", "0.5931881", "0.5930914", "0.5929737", "0.5917087", "0.5914272", "0.59106505", "0.5910614", "0.59060556", "0.59060556", "0.59060556", "0.5905401", "0.59046495", "0.5904423", "0.59028816", "0.5899051", "0.5895901", "0.58928686", "0.5886123" ]
0.66351783
12
GET /results/new GET /results/new.json
def new @result = Result.new @available_states = State.all @root = EventType.find(2) @add_event_types = @result.event_types respond_to do |format| format.html # new.html.erb format.json { render json: @result } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @result = Result.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result_item = ResultItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result_item }\n end\n end", "def new\n @result1 = Result1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result1 }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @search = Search.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @saved_search = SavedSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @saved_search }\n end\n end", "def new\n @test_result = TestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_result }\n end\n end", "def new\n @query_history = QueryHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @query_history }\n end\n end", "def new\n @collect_query = CollectQuery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collect_query }\n end\n end", "def new\n @stuff = Stuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stuff }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @survey_result = SurveyResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @result }\n end\n end", "def new\n @ptest_result = PtestResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @ptest_result }\n end\n end", "def new\n @searchstatus = Searchstatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @searchstatus }\n end\n end", "def new\n @finder = Finder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finder }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @person_search = PersonSearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person_search }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end", "def new\n @am_result = AmResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @am_result }\n end\n end", "def new\n @entry = Entry.new\n\n render json: @entry\n end", "def new\n @routing = Routing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @routing }\n end\n end", "def new\n @url = Url.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url }\n end\n end", "def new\n @research = Research.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @research }\n end\n end", "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "def new\n @hit = Hit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hit }\n end\n end", "def new\n @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @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", "def new\n @foo = Foo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foo }\n end\n end", "def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "def new\n @namesearch = Namesearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @namesearch }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @entry = Entry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end", "def new\n @version = Version.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @version }\n end\n end", "def new\n @search_list = SearchList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search_list }\n end\n end", "def new\n @search_item = SearchItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search_item }\n end\n end", "def new\n @objective_result = ObjectiveResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @objective_result }\n end\n end", "def new\n #@search = Search.new\n #\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @search }\n #end\n end", "def new\n @inventory_check_result = InventoryCheckResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_check_result }\n end\n end", "def new\n @something = Something.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @something }\n end\n end", "def new\n @match_stat = MatchStat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match_stat }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @resource = Resource.new\n respond_to do |format|\n format.html {render action: :new} # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @jobsearch = Jobsearch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jobsearch }\n end\n end", "def new\n @published = Published.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @published }\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @flsa_result = FlsaResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flsa_result }\n end\n end", "def new\n @criterion = Criterion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @criterion }\n end\n end", "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection }\n end\n end", "def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\n end\n end", "def new\n @update = Update.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @update }\n end\n end", "def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patch }\n end\n end", "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @collection }\n end\n end", "def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end", "def new\n @ridol = Ridol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ridol }\n end\n end", "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "def new\n @pycontextnlp_result = PycontextnlpResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pycontextnlp_result }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n #format.json { render json: @summary }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @match }\n end\n end", "def new\n @update = Update.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @update }\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end", "def new\n @match = Match.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @match }\n end\n end", "def new\n @search_page = SearchPage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search_page }\n end\n end", "def new\n @query = current_user.queries.new\n\n @new_filters = []\n (1..5).each do |num|\n @new_filters << @query.filters.new\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @query }\n end\n end", "def new\n @gist = Gist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gist }\n end\n end", "def new\n @criterion = Criterion.new\n render json: @criterion\n end", "def new\n @status = Status.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @status }\n end\n end", "def new\n\t\t@query = current_user.queries.find(params[:query_id])\n\t\t@filter = @query.filters.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filter }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\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 @recipe_all = RecipeAll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe_all }\n end\n end", "def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end", "def new\n @node_index = NodeIndex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_index }\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 new\n @foobar = Foobar.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foobar }\n end\n end" ]
[ "0.74078584", "0.7372339", "0.7372339", "0.7372339", "0.7372339", "0.6973376", "0.6833356", "0.68223387", "0.68223387", "0.68223387", "0.68223387", "0.68223387", "0.68056065", "0.67874837", "0.6748261", "0.6664652", "0.6639047", "0.6626612", "0.66118544", "0.6591056", "0.65880936", "0.65880936", "0.6585954", "0.65682775", "0.6564171", "0.65607655", "0.6558007", "0.65493095", "0.653724", "0.653541", "0.6534768", "0.6512035", "0.651041", "0.65050226", "0.64798194", "0.64748985", "0.6466624", "0.64631784", "0.64590365", "0.64590365", "0.64590365", "0.6453509", "0.6451499", "0.6447803", "0.6446888", "0.6446888", "0.6446888", "0.6446888", "0.6446888", "0.6446888", "0.6446888", "0.6446888", "0.6446622", "0.6445157", "0.6444889", "0.6443273", "0.6442337", "0.64393914", "0.6438156", "0.6435193", "0.6418483", "0.64145464", "0.6408409", "0.64011735", "0.64003265", "0.63857305", "0.6383145", "0.6379119", "0.63759047", "0.6356005", "0.63385606", "0.63366866", "0.632592", "0.6324349", "0.63229734", "0.6321642", "0.63154703", "0.6314028", "0.6314028", "0.6314028", "0.6314028", "0.6313858", "0.63037735", "0.62991625", "0.629539", "0.62944144", "0.62915504", "0.628889", "0.62860686", "0.6285725", "0.6285197", "0.6282814", "0.6275226", "0.6275226", "0.6275226", "0.6273617", "0.6273491", "0.6272766", "0.6271396", "0.626881" ]
0.67580503
14
POST /results POST /results.json
def create @result = Result.new @result.name = params[:name] if params[:type] == "Statuswechsel" @result.type = "ResultStateChange" if params[:selected_state] != nil && params[:selected_state] != "" @state = State.find(params[:selected_state]) @result.state = @state end end if params[:type] == "Ereignistypen Menge aendern" @result.type = "ResultChangeEventTypeAmount" if params[:event_type_operator] != nil && params[:event_type_operator] != "" @result.event_type_operator = params[:event_type_operator] if (params[:event_type_operator]) == "Zur Menge Hinzufuegen" || (params[:event_type_operator]) == "Aus Menge entfernen" if params[:add_event_types] != nil params[:add_event_types].each do |f| @event_type = EventType.find(f) @result.event_types << @event_type end end end end end if params[:info] != nil && (params[:type]) == "Info" @result.type = "ResultInfo" @result.info = params[:info] end if params[:type] == "Client Sperren" @result.type = "ResultLock" end respond_to do |format| if @result.save format.html { redirect_to @result, notice: 'Ergebnis wurde erfolgreich erzeugt' } format.json { render json: @result, status: :created, location: @result } else self.reload_edit_params format.html { render "new" } #redirect_to new_result_path format.json { render json: @result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n #TODO we need to look into the need for transactions in mongodb\n #Api::V1::Result.with_session do |session|\n #session.start_transaction\n @results = []\n result_params = params.fetch(:result, {})\n\n result_params.each do |rp|\n permitted_rp = rp.permit(*Api::V1::Result::STRONG_PARAMETERS)\n result = Api::V1::Result.new(permitted_rp)\n result.save!\n\n @results << result\n end\n\n #session.commit_transaction\n #end\n\n render json: @results\n end", "def result_params\n params[:results]\n end", "def create\n search_term = params[\"query\"][\"search_term\"]\n results = api_request_results(search_term)\n\n #movie = OwnedMovie.create(title: response[\"title\"], poster: response[\"poster_path\"], description: response[\"overview\"])\n\n #movie.save!\n\n results.each do |result|\n print result['title'] + \"\\n\"\n end \n\n @results = results\n\n\n redirect_to \"/\"\n end", "def create\n \tredirect_to results_path\n end", "def index\n @results = Result.all\n @results = Result.paginate(:per_page => 15, :page => params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @results }\n end\n end", "def index\n @results = Result.all\n end", "def index\n @results = Result.all\n end", "def index\n @results = Result.all\n\n end", "def create\n #p params\n if params[:results].present? && params[:results][:answers].present?\n answers = params[:results][:answers] \n params[:results].delete :answers\n #params[:aspects]=params[:aspects]+1\n end\n\n #p \"Array?: \" + params[:results][:aspects].is_a?(Array).to_s\n #p \"String?: \" + params[:results][:aspects].is_a?(String).to_s\n \n @results = Result.create(params[:results])\n if answers\n answers.each do |answer|\n @results.answers.build(answer)\n end\n end\n\n if @results.save\n\n # @results.send_email\n @results.delay.send_email\n end\n\n respond_with(@results)\n end", "def search_result\n query = search_params.presence && search_params\n results = query.present? ? helpers.search_query(query) :helpers.create_query(current_user)\n render json: {:data => results, :total => results.results.total}\n end", "def index\n @ptest_results = PtestResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ptest_results }\n end\n end", "def index\n @results = Result.all\n end", "def results \n if (params['location'].blank?)\n redirect_to :action => 'index'\n return\n end\n \n @venues = FoursquareVenueQuery.query(params['location']['latitude'], params['location']['longitude'])\n @reviews = {}\n \n @venues.each do |venue|\n review = Review.find_by_venue_id(venue['id'])\n \n unless (review == nil)\n @reviews[venue['id']] = review\n else\n @reviews[venue['id']] = Review.new # I don't like dealing with nils in the view\n end\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => '' }\n end\n end", "def create\n @result = Result.new(result_params)\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Result was successfully created.' }\n format.json { render :show, status: :created, location: @result }\n else\n format.html { render :new }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @result = Result.new(result_params)\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Result was successfully created.' }\n format.json { render :show, status: :created, location: @result }\n else\n format.html { render :new }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @result = Result.new(result_params)\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Result was successfully created.' }\n format.json { render :show, status: :created, location: @result }\n else\n format.html { render :new }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @result = Result.new(result_params)\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to welcome_index_path, notice: 'Result was successfully created.' }\n format.json { render :show, status: :created, location: @result }\n else\n format.html { render :new }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def results\n # lat, lng, and term from user.js AJAX get request\n p params\n @lat = params[:lat]\n @long = params[:lng]\n term = params[:term]\n yelp_params = { term: term, limit: 5, sort: 1}\n coordinates = { latitude: @lat, longitude: @long }\n new_search = Yelp.client.search_by_coordinates(coordinates, yelp_params)\n # TODO - refactor into a separate function\n p new_search\n new_search.businesses.each do |business|\n \t result_name = business.name\n result_distance = business.distance\n \t result_address = business.location.address\n \t result_lat = business.location.coordinate.latitude\n \t result_long = business.location.coordinate.longitude\n \t # result_review = business.review_count\n \t # result_rating = business.rating\n end \n render json: new_search\n end", "def index\n @survey = Survey.find(params[:survey_id])\n @results = @survey.results.all\n end", "def create\n @result = Result.new(result_params)\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Result was successfully created.' }\n format.json { render action: 'show', status: :created, location: @result }\n else\n format.html { render action: 'new' }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @result = Result.new(result_params)\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Result was successfully created.' }\n format.json { render action: 'show', status: :created, location: @result }\n else\n format.html { render action: 'new' }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @result = Result.new(params[:result])\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Result was successfully created.' }\n format.json { render json: @result, status: :created, location: @result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @result = Result.new(params[:result])\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Result was successfully created.' }\n format.json { render json: @result, status: :created, location: @result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def search\n results = @test.search(test_params)\n return render json: {results: results, total: results.total_entries}\n end", "def results\n response['data']\n end", "def upload_results(yaml, results_url='http://localhost:3000/test_results')\n begin\n url = URI.parse(results_url)\n response = Net::HTTP.post_form url, {:results => yaml}\n rescue Errno::ECONNREFUSED => e\n say 'Unable to post test results. Can\\'t connect to the results server.'\n rescue => e\n say e.message\n else\n case response\n when Net::HTTPSuccess\n body = YAML::load(response.body)\n url = body[:data][0] if body[:data]\n say \"Test results posted successfully! \\n\\t#{url}\"\n when Net::HTTPRedirection\n upload_results yaml, response.fetch('Location')\n when Net::HTTPNotFound\n say %q[Unable to find where to put the test results. Try: `gem update rubygems-test`]\n when Net::HTTPClientError\n say %q[Results server didn't like the results submission. Try: `gem update rubygems-test`]\n when Net::HTTPServerError\n say %q[Oof. Something went wrong on the results server processing these results. Sorry!]\n else\n say %q[Something weird happened. Probably a bug.]\n end\n end\n end", "def results\n respond_to do |format|\n format.html do\n content = get_content('opportunities/results.yml')\n results = Search.new(params, limit: 500).run\n @subscription = SubscriptionForm.new(results).data\n @page = PagePresenter.new(content)\n @results = OpportunitySearchResultsPresenter.new(content, results)\n render layout: 'results'\n end\n format.any(:atom, :xml) do\n results = Search.new(params, limit: 500,\n results_only: true,\n sort: 'updated_at').run\n @query = AtomOpportunityQueryDecorator.new(results, view_context)\n render :index, formats: :atom\n end\n end\n end", "def redirect_to_results\n redirect_to results_path(params[:query])\n end", "def index\n get_results\n end", "def results\n send_query\n end", "def create\n @simple_search = SimpleSearch.new(simple_search_params)\n get_response(params)\n respond_to do |format|\n format.html { render :index}\n format.json { render :index, status: 200 }\n end\n end", "def publish_results\n @contestproblem.corrected!\n \n compute_new_contest_rankings(@contest)\n \n automatic_results_published_post(@contestproblem)\n \n redirect_to @contestproblem\n end", "def index\n @evaluation_results = EvaluationResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @evaluation_results }\n end\n end", "def results\n with_monitoring do\n response = perform(:get, results_url, query_params)\n Search::ResultsResponse.from(response)\n end\n rescue => e\n handle_error(e)\n end", "def create\n @result = nil\n if (params.has_key?(:result) && params[:result][:type] == \"ResultDoubles\")\n @result = ResultDoubles.new(params[:result])\n else\n @result = Result.new(params[:result])\n end\n\n respond_to do |format|\n if @result.save\n calculate_ratings(@result)\n format.html { redirect_to :controller => \"home\", :action => \"index\", notice: 'Result was successfully created.' }\n format.json { render json: @result, status: :created, location: @result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_results\n\t\trace_id = params[:id]\n\t\t\n\t\trace = Race.find_by_id(race_id)\n\t\tresults = Result.get_race_results(race_id)\n\t\t\n\t\trender :json=>{:results=>results}\n\tend", "def index\n party_results = Event.party(params[:event], params[:location],\n params[:time], params[:category])\n @results = JSON.parse(party_results)\n\n # twitter_results = Event.twitter_search(params[:event])\n # @twitter_results = Event.twitter_search(response)\n # Event.create\n end", "def filtered_results\n results = PropertyResults.paginated_results(params[:facets], params[:page], params[:per_page], params[:offset], params[:query])\n respond_to do |format|\n format.json { render json: results.to_json }\n end\n end", "def results\n send_query\n end", "def create\n @survey_result = SurveyResult.new(params[:survey_result])\n\n respond_to do |format|\n if @survey_result.save\n format.html { redirect_to @survey_result, notice: 'Survey result was successfully created.' }\n format.json { render json: @survey_result, status: :created, location: @survey_result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @results = Result.where(:student_id => @student.id)\n .order('result_date desc')\n .paginate(:page => params[:page], :per_page => 20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @results }\n end\n end", "def create\n @survey_result = SurveyResult.new(survey_result_params)\n\n respond_to do |format|\n if @survey_result.save\n format.html { redirect_to @survey_result, notice: 'Survey result was successfully created.' }\n format.json { render :show, status: :created, location: @survey_result }\n else\n format.html { render :new }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def results_info\n render json: {results: @experiment.results, error_reason: @experiment.error_reason}\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def judge_results\n result = params[\"result\"]\n channel = params[\"channel\"]\n\n Danthes.publish_to channel, :result => result\n render :nothing => true, :status => 200, :content_type => 'text/html'\n end", "def results\n index.results\n end", "def print_results(response)\n puts response.to_json\nend", "def index\n @am_results = AmResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @am_results }\n end\n end", "def index\n @submission_results = SubmissionResult.all\n end", "def report_results(result, score)\n api_token = ENV[\"API_TOKEN\"]\n test_url = ENV[\"API_URL\"]\n track_id = ENV[\"TRACK_ID\"]\n\n test_number = result.name[5..6]\n if test_number == \"58\" #final test code\n puts \"Congratulations on passing the tests!\"\n passed_tests = true\n end\n\n if api_token && test_url && (result.result_code != '.' || passed_tests)\n puts \"Reporting results...\"\n require \"net/http\"\n params = {'test_number'=> score,\n 'api_token' => api_token,\n 'track_id' => track_id\n }\n begin\n res = Net::HTTP.post_form(URI.parse(test_url), params)\n if res.code == \"200\"\n puts \"Results successfully submitted to #{test_url}\"\n end\n rescue\n puts \"Failed to submit results.\"\n end\n end\n end", "def index\n @results = Result.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @results }\n end\n end", "def search\n @q = params[:q]\n @results = Series.external_search(@q)\n\n respond_to do |format|\n format.html # search.html.haml\n format.json { render json: @results.to_json }\n end\n end", "def index\n @searches = Sunspot.search(Drug, Review, Condition) do\n fulltext params[:search]\n end\n @results=@searches.results\n @drugresults=Array.new\n @conditionresults=Array.new\n @reviewresults=Array.new\n @results.each do |result|\n if result.instance_of?Drug\n @drugresults.push(result)\n elsif result.instance_of?Condition\n @conditionresults.push(result)\n else\n @reviewresults.push(result)\n end\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def create\n @test_result = TestResult.new(test_result_params)\n\n respond_to do |format|\n if @test_result.save\n format.html { redirect_to @test_result, notice: 'Test result was successfully created.' }\n format.json { render :show, status: :created, location: @test_result }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def response(env)\n env.trace :response_beg\n\n result_set = fetch_twitter_search(env.params['q'])\n\n fetch_trstrank(result_set)\n \n body = JSON.pretty_generate(result_set)\n\n env.trace :response_end\n [200, {}, body]\n end", "def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n external_user_id: params[:external_user_id],\n identifier: params['identifier'],\n rendered_datestamp: rendered_time,\n referer: referer,\n ip_address: request.ip,\n session_status: 'initial')\n\n assessment_result.keyword_list.add(params[:keywords], parse: true) if params[:keywords]\n assessment_result.objective_list.add(params[:objectives], parse: true) if params[:objectives]\n assessment_result.save! if params[:objectives] || params[:keywords]\n respond_with(:api, assessment_result)\n end", "def json_to_results(json)\n json.map do |jr|\n uri = URI(jr['url'])\n # ignore the query string, since it may have some randomness\n uri.query = nil\n Result.new(project.name, jr['confidence'], jr['risk'], uri.to_s, jr['param'], jr['alert'])\n end\n end", "def results\n get_results(true)\n render :partial => (params[:result_partial] || 'results')\n end", "def create\n @result = Result.new(result_params)\n\n respond_to do |format|\n if @result.save\n format.html do\n flash[:notice] = 'Result was successfully created.'\n\n redirect_to(@result)\n end\n format.xml { render :xml => @result, :status => :created, :location => @result }\n format.json { render :json => @result.to_json }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @result.errors, :status => :unprocessable_entity }\n format.json { render :json => @result.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @results = FourSquare.new(foursquare_params).search\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "def results\n raw_input = params[:search].to_s\n formatted_input = raw_input.gsub(\" \", \"+\")\n\n @client = HTTParty.get(\"http://api.shopstyle.com/api/v2/products?pid=uid5001-30368749-95&fts='#{formatted_input}'&offset=0&limit=20\")\n\n render json: @client\n end", "def populate_results(json)\n # page = json[\"page\"]\n # results = json[\"results\"].map{|r| SearchResult.new(r)}\n # start = (page - 1) * 10\n # @results[start, results.length] = results\n @results = json[\"results\"].map{|r| SearchResult.new(r)}\n end", "def create\n @result = Result.new(result_params)\n @result.status = Status.find_by_default(true)\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Result was successfully created.' }\n format.json { render json: @result, status: :created, location: @result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @hits = Hit.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @hits }\n end\n end", "def create\n @query = Query.new(params[:query])\n\n respond_to do |format|\n if @query.save\n run_query\n @results = @query.results\n \n flash[:notice] = 'Query was successfully created.'\n format.html { redirect_to(@query) }\n format.xml { render :xml => @query, :status => :created, :location => @query }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @query.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addRecipe\n\n params['results'].each do |result|\n recipe = Recipe.new\n recipe.title = result[1]['name']\n if result[1]['images'] &&\n result[1]['images'].values.first[\"large_image_path\"] != '/photos/large/missing.png'\n # deal with ridiculous image nesting\n recipe.image_url = result[1]['images'].values.first[\"large_image_path\"]\n else\n recipe.image_url = nil # for recipes with no images\n end\n recipe.description = result[1]['description']\n recipe.method = result[1]['instructions']\n recipe.ingredients = result[1]['ingredients']\n recipe.cook_time = 15 + rand(26)\n recipe.nbr_times_cooked = 5 + rand(146)\n recipe.user_rating = 1 + rand(5)\n if recipe.image_url\n recipe.save\n else\n next\n end\n end\n\n redirect_to root_path # lol this don't work no good\n\n end", "def create\n @test_result = TestResult.new(params[:test_result])\n\n respond_to do |format|\n if @test_result.save\n format.html { redirect_to @test_result, notice: 'Test result was successfully created.' }\n format.json { render json: @test_result, status: :created, location: @test_result }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def results\n respond_to do |format|\n if params[:search].present?\n @search = CompatibilitySearchForm.new(search_params)\n @search.user = current_user\n if @search.save\n @compatibility_search = @search.compatibility_search\n format.html\n format.js\n else\n format.html\n format.js\n end\n else\n format.html { redirect_to find_index_path }\n end\n end\n end", "def index\n @search = Sunspot.search Generator do\n fulltext params[:query_generator]\n end\n @generators = @search.results\n respond_to do |format|\n format.html\n format.json {render :json => @generators.map(&:attributes) }\n end\nend", "def search_results\n @term = sname = request.query_parameters[\"search\"].to_s.downcase\n data = search_term(sname)\n @top = []\n @rest = []\n data[:results].each do |type|\n type[:matches].each do |hit|\n if hit[:score] >= 1.0\n @top << hit\n else\n @rest << hit\n end\n end\n end\n @top.sort! { |a, b| b[:score] <=> a[:score] }\n @rest.sort! { |a, b| b[:score] <=> a[:score] }\n render \"site/results\"\n end", "def index\n @test_results = TestResult.all\n end", "def create\n @submission_result = SubmissionResult.new(submission_result_params)\n\n respond_to do |format|\n if @submission_result.save\n format.html { redirect_to @submission_result, notice: 'Submission result was successfully created.' }\n format.json { render action: 'show', status: :created, location: @submission_result }\n else\n format.html { render action: 'new' }\n format.json { render json: @submission_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_saved_search(query)\n post(\"/saved_searches/create.json\", :query => query)\n end", "def index\n @saved_searches = SavedSearch.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @saved_searches }\n end\n end", "def results\n respond_to do |format|\n if params[:search].present?\n @search = CheckSearchForm.new(search_params)\n @search.user = current_user\n if @search.save\n @check_search = @search.check_search\n format.html\n format.js\n else\n format.html\n format.js\n end\n else\n format.html { redirect_to check_index_path }\n end\n end\n end", "def results(test_id, day, month, year, options={})\n args = {testId: test_id, day: day, month: month, year: year}\n .merge(options)\n get('testresult', args)\n end", "def new\n @result = Result.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def new\n @result = Result.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @result }\n end\n end", "def index\n @campaign_results = CampaignResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaign_results }\n end\n end", "def set_post\n \t\t@surveyresults = Surveyresult.find(params[:ResultId])\n \tend", "def create\n @result = Result.new(params[:result])\n\n respond_to do |format|\n if @result.save\n flash[:notice] = 'Result was successfully created.'\n format.html { redirect_to(@result) }\n format.xml { render :xml => @result, :status => :created, :location => @result }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @result.errors, :status => :unprocessable_entity }\n end\n end\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 results; end", "def results; end", "def results; end", "def create\n\n reviews = []\n params[:scores].keys.each{ |name|\n score = params[:scores][name]\n peer_review = PeerReview.new(name:name, score:score, miniproject_id:params[:project][:id])\n peer_review.save\n reviews << peer_review\n }\n\n render json: reviews\n\n end", "def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end", "def index\n @search = Problem.search(params[:q])\n @problems = @search.result.paginate(:page => params[:page], :per_page => 10).order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @problems }\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n @search = Search.new(search_params)\n\n respond_to do |format|\n if @search.save\n format.html { redirect_to action: 'new', query: @search.query }\n format.json { render :show, status: :created, location: @search }\n else\n format.html { redirect_to action: 'new' }\n format.json { render json: @search.errors, status: :unprocessable_entity }\n end\n end\n end", "def results_data\n # Load the service from the database\n load_service(false)\n\n if (!params[:resume].blank?)\n resume = params[:resume].to_sym\n resume = nil if (!Service::AVAILABLE_RESUMES.include?(resume))\n end\n \n if (!@service.blank?)\n # If a last param was received, try to locate the result with that id.\n if ((!params[:last].blank?) && (Result.where(:service => @service.id, :_id => params[:last]).count > 0))\n # Get the results obtained AFTER the one which id was received\n @results = Result.where(:service => @service.id, :_id.gt => params[:last]).desc(:created_at)\n else\n # Get all the reuslts available\n @results = Result.where(:service => @service.id).desc(:created_at)\n end\n\n if ((!params[:limit].blank?) && (params[:limit].to_i.to_s == params[:limit]))\n @results = @results.limit(params[:limit].to_i)\n end\n end\n\n @data = {}\n\n if (@service.blank?)\n # If not found, return an error\n @results = {:error => t(\"services.error.not_found\")}\n else\n # Poblate the results array\n @results = @results.to_a.map do |result|\n result = {\n \"id\" => result.id.to_s, \n \"date\" => result.created_at.to_i+result.created_at.utc_offset,\n \"result\" => result.global_value(resume)\n }\n end\n end\n\n respond_to do |format|\n format.json {\n # Render the results\n if (@service.blank?)\n render :json => @results, :status => 404\n else\n render :json => @results\n end\n }\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n @insure_results_sub = InsureResultsSub.new(params[:insure_results_sub])\n\n respond_to do |format|\n if @insure_results_sub.save\n format.html { redirect_to @insure_results_sub, :notice => 'Insure results sub was successfully created.' }\n format.json { render :json => @insure_results_sub, :status => :created, :location => @insure_results_sub }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @insure_results_sub.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @results = @search.result.paginate(page: params[:page], per_page: 9).order(created_at: :desc)\n end", "def index\n @survey_results = HTTParty.get('https://shielded-wave-66393.herokuapp.com',\n :headers =>{'Content-Type' => 'application/json'} )\n @survey_results = SurveyResults.all_(current_customer)\n end", "def new\n @survey_result = SurveyResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey_result }\n end\n end" ]
[ "0.79618156", "0.70347315", "0.6430695", "0.6363882", "0.62522346", "0.6239741", "0.60929143", "0.60929143", "0.60773784", "0.6060322", "0.6051018", "0.60151786", "0.59909177", "0.5975458", "0.59725726", "0.59725726", "0.59725726", "0.59665865", "0.5965483", "0.5954307", "0.59362555", "0.59362555", "0.59213305", "0.59213305", "0.59175646", "0.59122497", "0.5908236", "0.58835727", "0.5858928", "0.58562005", "0.58500904", "0.5830769", "0.58285314", "0.5827049", "0.58188385", "0.5803584", "0.5778099", "0.5771965", "0.57493067", "0.57489365", "0.5748706", "0.57482016", "0.5739754", "0.573949", "0.573303", "0.57210207", "0.5716754", "0.5716464", "0.5699342", "0.56846976", "0.5681304", "0.5679812", "0.56776005", "0.5671153", "0.5642016", "0.56392735", "0.5638983", "0.56363493", "0.56346995", "0.5628446", "0.56269413", "0.56246597", "0.5617454", "0.56117237", "0.56092036", "0.55768067", "0.5574161", "0.5566923", "0.5559389", "0.5549191", "0.5546289", "0.5534799", "0.5520669", "0.54987633", "0.5486115", "0.548255", "0.54806525", "0.54800993", "0.54784083", "0.5469517", "0.5469517", "0.5469517", "0.5469517", "0.54515934", "0.54468733", "0.5445849", "0.5441756", "0.5440573", "0.5440573", "0.5440573", "0.54347974", "0.5429184", "0.542878", "0.54248184", "0.5418047", "0.54156744", "0.5410842", "0.54088193", "0.5401525", "0.5397798", "0.5395967" ]
0.0
-1
PUT /results/1 PUT /results/1.json
def update @result = Result.find(params[:id]) @result.name = params[:name] if params[:type] == "Statuswechsel" @result.type = "ResultStateChange" clear_entity if params[:selected_state] != nil && params[:selected_state] != "" @state = State.find(params[:selected_state]) @result.state = @state end end if params[:type] == "Ereignistypen Menge aendern" @result.type = "ResultChangeEventTypeAmount" clear_entity if params[:event_type_operator] != nil && params[:event_type_operator] != "" @result.event_type_operator = params[:event_type_operator] if (params[:event_type_operator]) == "Zur Menge Hinzufuegen" || (params[:event_type_operator]) == "Aus Menge entfernen" if params[:add_event_types] != nil params[:add_event_types].each do |f| @event_type = EventType.find(f) @result.event_types << @event_type end end end end end if params[:info] != nil && (params[:type]) == "Info" @result.type = "ResultInfo" clear_entity @result.info = params[:info] end if params[:type] == "Client Sperren" @result.type = "ResultLock" clear_entity end respond_to do |format| if @result.save format.html { redirect_to @result, notice: 'Ergebnis wurde erfolgreich aktualisiert' } format.json { head :no_content } else self.reload_edit_params format.html { render "edit" } format.json { render json: @result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @results = args[:results] if args.key?(:results)\n end", "def update!(**args)\n @results = args[:results] if args.key?(:results)\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result1 = Result1.find(params[:id])\n\n respond_to do |format|\n if @result1.update_attributes(params[:result1])\n format.html { redirect_to @result1, notice: 'Result1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @results = args[:results] if args.key?(:results)\n end", "def update!(**args)\n @metadata = args[:metadata] if args.key?(:metadata)\n @results = args[:results] if args.key?(:results)\n end", "def update\n\n respond_to do |format|\n if @result.update_attributes(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { render :show, status: :ok, location: @result }\n else\n format.html { render :edit }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { render :show, status: :ok, location: @result }\n else\n format.html { render :edit }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { render :show, status: :ok, location: @result }\n else\n format.html { render :edit }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\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 update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @results = args[:results] if args.key?(:results)\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n flash[:notice] = 'Result was successfully updated.'\n format.html { redirect_to(@result) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @result.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'result was successfully updated.' }\n format.json { render :show, status: :ok, location: @result }\n else\n format.html { render :edit }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @objective_result = ObjectiveResult.find(params[:id])\n\n respond_to do |format|\n if @objective_result.update_attributes(params[:objective_result])\n format.html { redirect_to :back}\n format.json { head :no_content }\n else\n format.html { redirect_to :back }\n format.json { render json: @objective_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", {\"passed\" => success}.to_json, :content_type => :json\nend", "def update\n result_set = @current_items\n\n {:ResultSet =>\n {\n :Result => result_set\n },\n }.to_json\n end", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update_job_success(job_id, success)\n RestClient.put \"#{rest_jobs_url}/#{job_id}\", { 'passed' => success }.to_json, :content_type => :json\nend", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(result_params)\n format.js { render :partial => @result }\n format.json { render :json => @result.to_json(:methods => [:name, :bib_number, :category_name]) }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @result.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @results = args[:results] if args.key?(:results)\n @total_results_count = args[:total_results_count] if args.key?(:total_results_count)\n end", "def update\n @test_result = TestResult.find(params[:id])\n\n respond_to do |format|\n if @test_result.update_attributes(params[:test_result])\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n results = result_params\n unless results.nil?\n stay = true\n if results.is_a?(String) #Update comes from online testing\n parts = results.split(\"#\")\n labels = parts[0].split(\",\")\n unless @result.nil?\n @result.parse_csv(parts[1])\n @result.parse_data(labels[1, labels.length-1], parts[2, parts.length-1]) if parts.length > 2\n head 200\n end\n else\n if results.has_key?(\"students\") #Update comes from editing form\n @measurement.update_students(results[\"students\"])\n else\n results.each do |id, val|\n r = @measurement.results.find_by_student_id(id)\n unless r.nil?\n if val.is_a?(String)\n r.parse_csv(val)\n stay = false\n else\n r.parse_Hash(val)\n end\n end\n end\n end\n respond_to do |format|\n format.js {\n unless stay\n render 'assessments/show'\n else\n render :edit\n end\n }\n end\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @results = args[:results] if args.key?(:results)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @results = args[:results] if args.key?(:results)\n end", "def update\n @survey_result = SurveyResult.find(params[:id])\n\n respond_to do |format|\n if @survey_result.update_attributes(params[:survey_result])\n format.html { redirect_to @survey_result, notice: 'Survey result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n @result_item = ResultItem.find(params[:id])\n\n respond_to do |format|\n if @result_item.update_attributes(params[:result_item])\n format.html { redirect_to @result_item, notice: 'Result item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update!(**args)\n @job_results = args[:job_results] if args.key?(:job_results)\n end", "def update!(**args)\n @job_results = args[:job_results] if args.key?(:job_results)\n end", "def update!(**args)\n @job_results = args[:job_results] if args.key?(:job_results)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update!(**args)\n @result = args[:result] if args.key?(:result)\n end", "def update!(**args)\n @result = args[:result] if args.key?(:result)\n end", "def update!(**args)\n @result = args[:result] if args.key?(:result)\n end", "def update\n results = fact_params.to_h\n results[\"tags\"] = Tag.where(id: [results[\"tags\"].split(\",\")])\n\n respond_to do |format|\n if @fact.update(results)\n format.html { redirect_to [:admin, :facts], notice: \"Fact was successfully updated.\" }\n format.json { render :show, status: :ok, location: @fact }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @three_result.update(three_result_params)\n format.html { redirect_to @three_result, notice: 'Three result was successfully updated.' }\n format.json { render :show, status: :ok, location: @three_result }\n else\n format.html { render :edit }\n format.json { render json: @three_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_progress_key_result\n key_result_id = params[:id]\n progress = params[:progress]\n initial_progress = params[:initial]\n contribution = params[:contribution]\n progress_decimal = BigDecimal.new(progress)\n initial_progress_decimal = BigDecimal.new(initial_progress)\n personal_key_result = PersonalKeyResult.find(key_result_id) \n\n status = PersonalKeyResult.update_progress_personal_key_result(\n key_result_id,\n progress_decimal,\n initial_progress_decimal,\n contribution,\n current_user.id\n )\n\n respond_to do |format|\n if status == 200\n format.json { render json: 'Progress of the key result is updated successfully!', status: :ok }\n else\n format.json { render json: 'Fail to update progress!', status: :unprocessable_entity }\n end\n end\n end", "def create\n #TODO we need to look into the need for transactions in mongodb\n #Api::V1::Result.with_session do |session|\n #session.start_transaction\n @results = []\n result_params = params.fetch(:result, {})\n\n result_params.each do |rp|\n permitted_rp = rp.permit(*Api::V1::Result::STRONG_PARAMETERS)\n result = Api::V1::Result.new(permitted_rp)\n result.save!\n\n @results << result\n end\n\n #session.commit_transaction\n #end\n\n render json: @results\n end", "def update\n respond_to do |format|\n if @test_result.update(test_result_params)\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_result }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @result_per_page = args[:result_per_page] if args.key?(:result_per_page)\n @start_index = args[:start_index] if args.key?(:start_index)\n @total_results = args[:total_results] if args.key?(:total_results)\n end", "def update!(**args)\n @result_per_page = args[:result_per_page] if args.key?(:result_per_page)\n @start_index = args[:start_index] if args.key?(:start_index)\n @total_results = args[:total_results] if args.key?(:total_results)\n end", "def update!(**args)\n @debug_info = args[:debug_info] if args.key?(:debug_info)\n @error_info = args[:error_info] if args.key?(:error_info)\n @facet_results = args[:facet_results] if args.key?(:facet_results)\n @has_more_results = args[:has_more_results] if args.key?(:has_more_results)\n @query_interpretation = args[:query_interpretation] if args.key?(:query_interpretation)\n @result_count_estimate = args[:result_count_estimate] if args.key?(:result_count_estimate)\n @result_count_exact = args[:result_count_exact] if args.key?(:result_count_exact)\n @result_counts = args[:result_counts] if args.key?(:result_counts)\n @results = args[:results] if args.key?(:results)\n @spell_results = args[:spell_results] if args.key?(:spell_results)\n @structured_results = args[:structured_results] if args.key?(:structured_results)\n end", "def update!(**args)\n @debug_info = args[:debug_info] if args.key?(:debug_info)\n @error_info = args[:error_info] if args.key?(:error_info)\n @facet_results = args[:facet_results] if args.key?(:facet_results)\n @has_more_results = args[:has_more_results] if args.key?(:has_more_results)\n @query_interpretation = args[:query_interpretation] if args.key?(:query_interpretation)\n @result_count_estimate = args[:result_count_estimate] if args.key?(:result_count_estimate)\n @result_count_exact = args[:result_count_exact] if args.key?(:result_count_exact)\n @result_counts = args[:result_counts] if args.key?(:result_counts)\n @results = args[:results] if args.key?(:results)\n @spell_results = args[:spell_results] if args.key?(:spell_results)\n @structured_results = args[:structured_results] if args.key?(:structured_results)\n end", "def update\n @am_result = AmResult.find(params[:id])\n\n respond_to do |format|\n if @am_result.update_attributes(params[:am_result])\n format.html { redirect_to @am_result, notice: 'Am result was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @am_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n @partial_results = args[:partial_results] if args.key?(:partial_results)\n end", "def update\n respond_to do |format|\n if @test_result.update(test_result_params)\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_result }\n else\n format.html { render :edit }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_result\n @result = Api::V1::Result.find(params[:id])\n end", "def update\n respond_to do |format|\n if @external_result.update_attributes(external_result_params)\n format.html { redirect_to competition_external_results_path(@external_result.competition), notice: 'External result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @external_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @clustered_results = args[:clustered_results] if args.key?(:clustered_results)\n @debug_info = args[:debug_info] if args.key?(:debug_info)\n @metadata = args[:metadata] if args.key?(:metadata)\n @snippet = args[:snippet] if args.key?(:snippet)\n @title = args[:title] if args.key?(:title)\n @url = args[:url] if args.key?(:url)\n end", "def update!(**args)\n @clustered_results = args[:clustered_results] if args.key?(:clustered_results)\n @debug_info = args[:debug_info] if args.key?(:debug_info)\n @metadata = args[:metadata] if args.key?(:metadata)\n @snippet = args[:snippet] if args.key?(:snippet)\n @title = args[:title] if args.key?(:title)\n @url = args[:url] if args.key?(:url)\n end", "def update!(**args)\n @results_per_page = args[:results_per_page] if args.key?(:results_per_page)\n @start_index = args[:start_index] if args.key?(:start_index)\n @total_results = args[:total_results] if args.key?(:total_results)\n end", "def update_value\n # I don't know why it isn't working with HTTPI\n # Putting these exact fields into HTTPI fails and this works correctly so...\n url = \"#{@credential.sentinelone_url}#{ANALYST_VERDICT_URL}#{@action}\"\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Authorization\"] = \"ApiToken #{@credential.access_token}\"\n body = { \"filter\" => { \"ids\" => [@app_result.details.id] } }\n request.body = JSON.dump(body)\n req_options = { use_ssl: uri.scheme == \"https\" }\n\n resp = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n resp\n end", "def update\n respond_to do |format|\n if @result_info.update(result_info_params)\n format.html { redirect_to @result_info, notice: 'Result info was successfully updated.' }\n format.json { render :show, status: :ok, location: @result_info }\n else\n format.html { render :edit }\n format.json { render json: @result_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @results = args[:results] if args.key?(:results)\n @total_size = args[:total_size] if args.key?(:total_size)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @progress = Progress.find(params[:id])\n\n respond_to do |format|\n if @progress.update_attributes(params[:progress])\n format.json { head :no_content }\n else\n format.json { render json: @progress.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @completion_results = args[:completion_results] if args.key?(:completion_results)\n @metadata = args[:metadata] if args.key?(:metadata)\n end", "def update!(**args)\n @completion_results = args[:completion_results] if args.key?(:completion_results)\n @metadata = args[:metadata] if args.key?(:metadata)\n end", "def update\n respond_to do |format|\n if @survey_result.update(survey_result_params)\n format.html { redirect_to @survey_result, notice: 'Survey result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @survey_result.update(survey_result_params)\n format.html { redirect_to @survey_result, notice: 'Survey result was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_result }\n else\n format.html { render :edit }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update!(**args)\n @results_table = args[:results_table] if args.key?(:results_table)\n end", "def update!(**args)\n @results_table = args[:results_table] if args.key?(:results_table)\n end", "def update\n respond_to do |format|\n if @test_example_result.update(test_example_result_params)\n format.html { redirect_to @test_example_result, notice: 'Test example result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_example_result }\n else\n format.html { render :edit }\n format.json { render json: @test_example_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update!(**args)\n @result_per_page = args[:result_per_page] unless args[:result_per_page].nil?\n @start_index = args[:start_index] unless args[:start_index].nil?\n @total_results = args[:total_results] unless args[:total_results].nil?\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def index\n index! do |format|\n format.html\n format.json do\n object = if params[:id]\n resource.increment_hits!\n resource\n else\n collection\n end\n\n render :json => object \n end\n end\n end", "def update\n @insure_result = InsureResult.find(params[:id])\n\n respond_to do |format|\n if @insure_result.update_attributes(params[:insure_result])\n format.html { redirect_to @insure_result, :notice => 'Insure result was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @insure_result.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n document = Document.find(params[:id])\n document.update!(update_params)\n render json: {}\n end", "def update\n @result = Result.find(@given_answer.result_id)\n correctness = @given_answer.correct_answer\n respond_to do |format|\n if @given_answer.update(given_answer_params)\n if correctness.nil?\n if @given_answer.correct_answer\n @result.total_number_of_correct_answers += 1\n end\n else\n if correctness != @given_answer.correct_answer\n if correctness && !@given_answer.correct_answer\n @result.total_number_of_correct_answers -= 1\n else\n @result.total_number_of_correct_answers += 1\n end\n end\n end\n @result.save\n \n format.html { redirect_to @given_answer, notice: 'Given answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @given_answer }\n else\n format.html { render :edit }\n format.json { render json: @given_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ptest_result = PtestResult.find(params[:id])\n\n respond_to do |format|\n if @ptest_result.update_attributes(params[:ptest_result])\n format.html { redirect_to @ptest_result, :notice => 'Ptest result was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ptest_result.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @flsa_result = FlsaResult.find(params[:id])\n\n respond_to do |format|\n if @flsa_result.update_attributes(params[:flsa_result])\n format.html { redirect_to @flsa_result, notice: 'Flsa result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flsa_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end", "def update\n @insure_results_sub = InsureResultsSub.find(params[:id])\n\n respond_to do |format|\n if @insure_results_sub.update_attributes(params[:insure_results_sub])\n format.html { redirect_to @insure_results_sub, :notice => 'Insure results sub was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @insure_results_sub.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_success\n put \"/blah\", @test_obj do |response|\n assert response.ok?, \"Update test object failed\"\n end\n end", "def update!(**args)\n @has_more_results = args[:has_more_results] if args.key?(:has_more_results)\n @result_count_estimate = args[:result_count_estimate] if args.key?(:result_count_estimate)\n @result_count_exact = args[:result_count_exact] if args.key?(:result_count_exact)\n @source = args[:source] if args.key?(:source)\n end", "def update!(**args)\n @has_more_results = args[:has_more_results] if args.key?(:has_more_results)\n @result_count_estimate = args[:result_count_estimate] if args.key?(:result_count_estimate)\n @result_count_exact = args[:result_count_exact] if args.key?(:result_count_exact)\n @source = args[:source] if args.key?(:source)\n end", "def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end", "def update(index_name, payload)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = \"application/json\"\n req.body = payload.to_json\n @client.send_http(req, true, ['200'])\n end", "def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n respond_to do |format|\n if @test_case_result.update(test_case_result_params)\n format.html { redirect_to @test_case_result, notice: 'Test case result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @location = args[:location] if args.key?(:location)\n @query = args[:query] if args.key?(:query)\n @result_count = args[:result_count] if args.key?(:result_count)\n end", "def update\n @criterion = Criterion.find(params[:id])\n\n if @criterion.update_attributes(params[:criterion])\n head :no_content\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end", "def put(data)\n client.index(**params, body: data)\n end", "def update!(**args)\n @num_results = args[:num_results] if args.key?(:num_results)\n @num_suggestions = args[:num_suggestions] if args.key?(:num_suggestions)\n end", "def update!(**args)\n @num_results = args[:num_results] if args.key?(:num_results)\n @num_suggestions = args[:num_suggestions] if args.key?(:num_suggestions)\n end", "def update\n respond_to do |format|\n if @exam_result.update(exam_result_params)\n format.html { redirect_to @exam_result, notice: 'Exam result was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_result }\n else\n format.html { render :edit }\n format.json { render json: @exam_result.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6671565", "0.6671565", "0.6349844", "0.6349844", "0.6349844", "0.6349844", "0.6249474", "0.61575747", "0.61567533", "0.6106437", "0.6044483", "0.6044483", "0.6044483", "0.6042009", "0.6038036", "0.60364544", "0.60364544", "0.5991131", "0.5977438", "0.5950011", "0.59433126", "0.590635", "0.5884354", "0.5884354", "0.5884354", "0.58786106", "0.5864605", "0.5843419", "0.58023757", "0.5783877", "0.5783877", "0.5761432", "0.57591534", "0.57528037", "0.5748509", "0.57437575", "0.5742113", "0.57282025", "0.57282025", "0.5727484", "0.5722712", "0.57188976", "0.57188976", "0.57188976", "0.56901526", "0.56733364", "0.5650858", "0.5645758", "0.56369835", "0.5620427", "0.5620427", "0.561682", "0.561682", "0.56023884", "0.559817", "0.558995", "0.5584851", "0.55751675", "0.55721754", "0.55721754", "0.5567928", "0.556713", "0.5566411", "0.5564527", "0.5562478", "0.55622363", "0.55622333", "0.55622333", "0.55362", "0.55318224", "0.55236214", "0.5514287", "0.5514287", "0.54862523", "0.54839665", "0.54715437", "0.5463566", "0.546128", "0.5459372", "0.54590565", "0.5444353", "0.54347086", "0.54251105", "0.54154325", "0.54153115", "0.54082066", "0.54072046", "0.540009", "0.5396502", "0.53939945", "0.53939945", "0.5390201", "0.5386207", "0.538433", "0.53809273", "0.5376539", "0.5374639", "0.5371067", "0.536799", "0.536799", "0.5367229" ]
0.0
-1
DELETE /results/1 DELETE /results/1.json
def destroy @result = Result.find(params[:id]) @result.destroy respond_to do |format| format.html { redirect_to results_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @result.destroy\n\n respond_to do |format|\n format.html { redirect_to results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @result1 = Result1.find(params[:id])\n @result1.destroy\n\n respond_to do |format|\n format.html { redirect_to result1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @result.destroy\n respond_to do |format|\n format.html { redirect_to results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @result.destroy\n respond_to do |format|\n format.html { redirect_to results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @result = Result.find(params[:id])\n @result.destroy\n\n respond_to do |format|\n format.html { redirect_to(results_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @result = Result.find(params[:id])\n @result.destroy\n\n respond_to do |format|\n format.html { redirect_to(results_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @result = Result.find(params[:id])\n @result.destroy\n\n respond_to do |format|\n format.html { redirect_to(results_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_result = TestResult.find(params[:id])\n @test_result.destroy\n\n respond_to do |format|\n format.html { redirect_to test_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @result.destroy\n respond_to do |format|\n format.html { redirect_to results_url, notice: 'result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @result.destroy\n respond_to do |format|\n format.html { redirect_to results_url, notice: 'Result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @result.destroy\n respond_to do |format|\n format.html { redirect_to results_url, notice: 'Result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @result.destroy\n respond_to do |format|\n format.html { redirect_to results_url, notice: 'Result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_result = SurveyResult.find(params[:id])\n @survey_result.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_case_result.destroy\n respond_to do |format|\n format.html { redirect_to test_case_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @three_result.destroy\n respond_to do |format|\n format.html { redirect_to three_results_url, notice: 'Three result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @result = Result.find(params[:id])\n @result.destroy\n\n respond_to do |format|\n format.html { redirect_to student_results_path(@student) }\n format.json { head :no_content }\n end\n end", "def destroy\n @am_result = AmResult.find(params[:id])\n @am_result.destroy\n\n respond_to do |format|\n format.html { redirect_to am_results_url }\n format.json { head :ok }\n end\n end", "def destroy\n @survey_result.destroy\n respond_to do |format|\n format.html { redirect_to survey_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @result_item = ResultItem.find(params[:id])\n @result_item.destroy\n\n respond_to do |format|\n format.html { redirect_to result_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @objective_result = ObjectiveResult.find(params[:id])\n @objective_result.destroy\n\n respond_to do |format|\n format.html { redirect_to objective_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_result.destroy\n respond_to do |format|\n format.html { redirect_to test_results_url, notice: 'Test result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_result.destroy\n respond_to do |format|\n format.html { redirect_to test_results_url, notice: 'Test result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @flsa_result = FlsaResult.find(params[:id])\n @flsa_result.destroy\n\n respond_to do |format|\n format.html { redirect_to flsa_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_example_result.destroy\n respond_to do |format|\n format.html { redirect_to test_example_results_url, notice: 'Test example result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n@result.destroy\nrespond_to do |format|\nformat.html { redirect_to results_url, notice: 'Wynik został usunięty.' }\nformat.json { head :no_content }\nend\nend", "def destroy\n @test_results_from_file.destroy\n respond_to do |format|\n format.html { redirect_to uploaded_test_results_url, notice: 'Document destroyed successfully.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @ptest_result = PtestResult.find(params[:id])\n @ptest_result.destroy\n\n respond_to do |format|\n format.html { redirect_to ptest_results_url }\n format.json { head :ok }\n end\n end", "def destroy\n @submission_result.destroy\n respond_to do |format|\n format.html { redirect_to submission_results_url }\n format.json { head :no_content }\n end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @two_result.destroy\n respond_to do |format|\n format.html { redirect_to two_results_url, notice: 'Two result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @survey_result.destroy\n # respond_to do |format|\n # format.html { redirect_to user_survey_results_url(survey_user,@survey_results) }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @insure_result = InsureResult.find(params[:id])\n @insure_result.destroy\n\n respond_to do |format|\n format.html { redirect_to insure_results_url }\n format.json { head :ok }\n end\n end", "def destroy\n @external_result.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_external_results_path(@competition) }\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 delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @evaluation_result = EvaluationResult.find(params[:id])\n @evaluation_result.destroy\n\n respond_to do |format|\n format.html { redirect_to evaluation_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render_json_auto @survey.delete_filter(params[:id].to_i) and return\n end", "def destroy\n @user_result.destroy\n respond_to do |format|\n format.html { redirect_to user_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @omikuji_result.destroy\n respond_to do |format|\n format.html { redirect_to omikuji_results_url, notice: 'Omikuji result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @survey_result.destroy\n respond_to do |format|\n format.html { redirect_to survey_results_url, notice: 'Survey result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @suite_result = SuiteResult.find(params[:id])\n @suite_result.destroy\n\n respond_to do |format|\n format.html { redirect_to suite_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crawl_result = Crawl.find(params[:id])\n @crawl_result.destroy\n\n respond_to do |format|\n format.html { redirect_to(crawl_results_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @exam_result.destroy\n respond_to do |format|\n format.html { redirect_to exam_results_url, notice: 'Exam result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_progress.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_progresses_url, notice: 'Progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fixturestat = Fixturestat.find(params[:id])\n @fixturestat.destroy\n\n respond_to do |format|\n format.html { redirect_to fixturestats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @campaign_result = CampaignResult.find(params[:id])\n @campaign_result.destroy\n\n respond_to do |format|\n format.html { redirect_to campaign_results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_query.destroy\n respond_to do |format|\n format.html { redirect_to saved_queries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @four_result.destroy\n respond_to do |format|\n format.html { redirect_to four_results_url, notice: 'Four result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @result.destroy\n respond_to do |format|\n format.html { redirect_to results_url, notice: '販売活動を削除しました。' }\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 @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @checkresult = Checkresult.find(params[:id])\n @checkresult.destroy\n\n respond_to do |format|\n format.html { redirect_to checkresults_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @insure_results_sub = InsureResultsSub.find(params[:id])\n @insure_results_sub.destroy\n\n respond_to do |format|\n format.html { redirect_to insure_results_subs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @result_info.destroy\n respond_to do |format|\n format.html { redirect_to result_infos_url, notice: 'Result info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @heat_lane_result.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def delete_by_query index, query, conflicts_proceed\n conflicts = conflicts_proceed ? 'conflicts=proceed' : ''\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/_delete_by_query?#{conflicts}\")\n\n req = Net::HTTP::Post.new(uri)\n req.body = query.to_json\n run(uri, req)\n end", "def destroy\r\n @wai = WaisResult.find(params[:id])\r\n @wai.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to wais_results_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_run_results/#{id}\", :delete) do |req|\n req.body = {\n token: project_token,\n auth_token: user.auth_token\n }\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 delete\n api_client.delete(url)\n end", "def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @result_second.destroy\n respond_to do |format|\n format.html { redirect_to result_seconds_url, notice: 'Result second was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_url }\n format.json { head :ok }\n end\n end", "def destroy\n @collect_query = CollectQuery.find(params[:id])\n @collect_query.destroy\n\n respond_to do |format|\n format.html { redirect_to collect_queries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @progress = Progress.find(params[:id])\n @progress.destroy\n\n respond_to do |format|\n format.html { redirect_to progresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @indexed_file = IndexedFile.find(params[:id])\n @indexed_file.destroy\n\n respond_to do |format|\n format.html { redirect_to indexed_files_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_result.destroy\n respond_to do |format|\n format.html { redirect_to task_results_url, notice: 'Результат успешно удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comparison_result.destroy\n respond_to do |format|\n format.html { redirect_to comparison_results_url, notice: 'Comparison result was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stat = Stat.find(params[:id])\n @stat.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to criteria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @query = Query.find(params[:id])\n @query.destroy\n\n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @foo = Foo.find(params[:id])\n @foo.destroy\n\n respond_to do |format|\n format.html { redirect_to foos_url }\n format.json { head :ok }\n end\n end", "def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @pycontextnlp_result = PycontextnlpResult.find(params[:id])\n @pycontextnlp_result.destroy\n\n respond_to do |format|\n format.html { redirect_to pycontextnlp_results_url }\n format.json { head :no_content }\n end\n end", "def delete\n @res = DialResult.find(params[:id])\n\t@res.destroy\n respond_to do |format|\n format.html { redirect_to :action => 'index' }\n format.xml { head :ok }\n end\n end", "def destroy\n @query = Query.find(params[:id])\n @query.destroy\n \n respond_to do |format|\n format.html { redirect_to(queries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stuff = Stuff.find(params[:id])\n @stuff.destroy\n\n respond_to do |format|\n format.html { redirect_to stuff_index_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end" ]
[ "0.742324", "0.73952013", "0.7390635", "0.7390635", "0.71886176", "0.71886176", "0.71886176", "0.71168256", "0.70458597", "0.7039028", "0.7039028", "0.7039028", "0.6968855", "0.6961157", "0.69093835", "0.69002604", "0.6883082", "0.6869606", "0.68522197", "0.68450713", "0.6830089", "0.6830089", "0.6817498", "0.680116", "0.68008554", "0.6785956", "0.6750255", "0.6731113", "0.6714243", "0.67123044", "0.67071307", "0.67054284", "0.6694872", "0.6686994", "0.66718054", "0.6651569", "0.66472757", "0.66442484", "0.6643069", "0.6640282", "0.66397995", "0.66359204", "0.6629996", "0.66291475", "0.65970767", "0.6596025", "0.65949005", "0.6593319", "0.65780085", "0.65761155", "0.6573252", "0.65611064", "0.65611064", "0.65455717", "0.65455717", "0.6532443", "0.6524622", "0.65227336", "0.65169847", "0.6512268", "0.6511257", "0.650984", "0.6508298", "0.6501438", "0.64943194", "0.6492806", "0.64856434", "0.64717656", "0.6471687", "0.6471086", "0.64570534", "0.6455543", "0.64504373", "0.6448429", "0.6447931", "0.64475715", "0.64441234", "0.6443031", "0.64421046", "0.6441528", "0.6439052", "0.6434173", "0.6433812", "0.64282244", "0.6426405", "0.6422589", "0.6421623", "0.6420992", "0.6420992", "0.64191234", "0.64148957", "0.6414777", "0.6414317", "0.6410517", "0.64081687", "0.64061284" ]
0.7415624
5
Method descriptions cells Returns a nested array of Brewfish::Internal::Cell instances configured to the dimensions of the Console instance tileset Returns a Brewfish::Tileset instance configured with the settings specified during initialization of the Console instance width Returns the pixel width of the Console instance height Returns the pixel height of the Console instance rows Returns the number of cell rows addressable by the Console instance cols Returns the number of cell columns addressable by the Console instance button_down? Return boolean indicating whether a given button id is being held down; only valid within the context of game_loop keyboard_map Returns a hash mapping keyboard button codes to their button ids for use in button_down?; numerical codes may differ based on keyboard layouts, implementations, etc Instance Methods
def initialize( options = {} ) # Default to Gosu rendered console options[:type] ||= :gosu case options[:type] when :gosu options[:callback_target] = self @console_delegate = Internal::GosuConsole.new( options ) else # TODO: Custome Brewfish error type here -- Thu Jan 26 21:35:41 2012 raise "Unsupported Console type: #{options[:type]}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_down(id)\n if id == Gosu::KbEscape || id == Gosu::KbQ\n save\n close\n elsif id == Gosu::KbA\n @current_type = :terrain\n elsif id == Gosu::KbS\n @current_type = :enemies\n elsif id == Gosu::KbD\n @current_type = :candies\n elsif id == Gosu::KbLeft || id == Gosu::GpLeft\n @x_offset -= 1 if @x_offset > 0\n elsif id == Gosu::KbUp || id == Gosu::GpUp\n @y_offset -= 1 if @y_offset > 0\n elsif id == Gosu::KbRight || id == Gosu::GpRight\n @x_offset += 1 if @x_offset < LEVEL_WIDTH - 10\n elsif id == Gosu::KbDown || id == Gosu::GpDown\n @y_offset += 1 if @y_offset < LEVEL_HEIGHT - 10\n elsif id == Gosu::Kb1\n if @current_type == :terrain\n @current_selection = :background\n elsif @current_type == :enemies\n @current_selection = :slug\n elsif @current_type == :candies\n @current_selection = :soda\n end\n elsif id == Gosu::Kb2\n if @current_type == :terrain\n @current_selection = :platform\n elsif @current_type == :enemies\n @current_selection = :spikes\n elsif @current_type == :candies\n @current_selection = :gum\n end\n elsif id == Gosu::Kb3\n if @current_type == :terrain\n @current_selection = :player\n elsif @current_type == :enemies\n @current_selection = :mushroom\n elsif @current_type == :candies\n @current_selection = :chocolate\n end\n elsif id == Gosu::Kb4\n if @current_type == :terrain\n @current_selection = :door\n end\n elsif id == Gosu::Kb5\n if @current_type == :terrain\n @current_selection = :background2\n end\n elsif id == Gosu::MsLeft\n if @current_selection == :slug\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n x += 32 * @x_offset\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n y -= 12\n y += 25 * @y_offset\n @enemies.push(Slug.new(self, x, y))\n elsif @current_selection == :spikes\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n x += 3\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n y -= 12\n x += 32 * @x_offset\n y += 25 * @y_offset\n @enemies.push(Spikes.new(self, x, y))\n elsif @current_selection == :mushroom\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n y += 6\n x += 32 * @x_offset\n y += 25 * @y_offset\n @enemies.push(Mushroom.new(self, x, y))\n elsif @current_selection == :player\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n x += 32 * @x_offset\n y += 25 * @y_offset\n x += 2\n @player = [x, y]\n elsif @current_selection == :door\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n x += 32 * @x_offset\n y += 25 * @y_offset\n y += 2 \n @door = [x, y]\n elsif @current_type == :candies\n x = (mouse_x / SCALE).to_i\n y = (mouse_y / SCALE).to_i\n x += 32 * @x_offset\n y += 25 * @y_offset\n @candies.push(Object.const_get(@current_selection.to_s.capitalize).new(self, x, y))\n end\n end\n end", "def button_down(id)\n if id == Gosu::KbQ\n close\n elsif id == Gosu::KbEscape\n if @state == :menu\n close\n elsif @state == :instructions\n @state = :menu\n else\n @state = :menu\n @paused = true\n end\n elsif id == Gosu::KbLeftAlt\n if @state == :game\n @player.toggle_pogo\n end\n elsif id == Gosu::KbLeftShift\n if @state == :game\n @player.sprint\n end\n elsif id == Gosu::KbSpace\n if @state == :game && !button_down?(Gosu::KbDown)\n @player.shoot(:sideways)\n elsif @state == :game && button_down?(Gosu::KbDown)\n @player.shoot(:down)\n end\n elsif id == Gosu::KbDown || id == Gosu::GpDown\n if @state == :menu\n @menu_selection += 1\n @menu_selection %= @menu_options.size\n end\n elsif id == Gosu::KbUp || id == Gosu::GpUp\n if @state == :menu\n @menu_selection += @menu_options.size - 1\n @menu_selection %= @menu_options.size\n elsif @state == :game\n @player.leave\n end\n elsif id == Gosu::KbReturn\n if @state == :menu\n if @menu_options[@menu_selection] == :Play || @menu_options[@menu_selection] == :Resume\n @menu_options[@menu_selection] = :Resume\n @state = :game\n @paused = true\n elsif @menu_options[@menu_selection] == :Instructions\n @state = :instructions\n elsif @menu_options[@menu_selection] == :Quit\n close\n end\n end\n end\n end", "def button_down(id)\n\t\t\n\t\t# Exit on escape\n\t\tif id == Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\t\t\n\t\t# Cursor Movement\n\t\t# NSEW = 0123\n\t\tif id == Gosu::KbUp\n\t\t\t@player.move(0)\n\t\tend\n\t\tif id == Gosu::KbDown\n\t\t\t@player.move(1)\n\t\tend\n\t\tif id == Gosu::KbRight\n\t\t\t@player.move(2)\n\t\tend\n\t\tif id == Gosu::KbLeft\n\t\t\t@player.move(3)\n\t\tend\n\t\t\n\t\t# Camera Movement\n\t\t# These should probably be farther from the load/save keys heh\n\t\tif id == Gosu::KbI\n\t\t\tif @zoom\n\t\t\t\t@camera_y -= 16 * 4\n\t\t\telse\n\t\t\t\t@camera_y -= 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbK\n\t\t\tif @zoom\n\t\t\t\t@camera_y += 16 * 4\n\t\t\telse\n\t\t\t\t@camera_y += 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbJ\n\t\t\tif @zoom\n\t\t\t\t@camera_x -= 16 * 4\n\t\t\telse\n\t\t\t\t@camera_x -= 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbL\n\t\t\tif @zoom\n\t\t\t\t@camera_x += 16 * 4\n\t\t\telse\n\t\t\t\t@camera_x += 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbM # Toggle lame, janky zoom\n\t\t\t@zoom = !@zoom\n\n\t\t\t# If we're turning zoom on, set the camera so it zooms\n\t\t\t# to the area the cursor is at, if we're turning zoom off\n\t\t\t# then just reset the camera to show the full editor field.\n\t\t\tif @zoom\n\t\t\t\t@camera_x = @player.x\n\t\t\t\t@camera_y = @player.y\n\t\t\telse\n\t\t\t\t@camera_x = 0\n\t\t\t\t@camera_y = 0\n\t\t\tend\n\t\tend\n\t\t\n\t\t\n\t\t# Editor Functions\n\t\tif id == Gosu::KbQ # Scroll left through sprites\n\t\t\t@player.change(1)\n\t\tend\n\t\tif id == Gosu::KbW # Scroll right through sprites\n\t\t\t@player.change(2)\n\t\tend\n\t\tif id == Gosu::KbA # Place a tile as a world tile\n\t\t\t@player.place(1)\n\t\tend\n\t\tif id == Gosu::KbS # Place a tile as a prop, draw above world tiles\n\t\t\t@player.place(2)\n\t\tend\n\t\tif id == Gosu::KbD # Clear a tiles world/prop/collision info, setting it to nil\n\t\t\t@player.place(3)\n\t\tend\n\t\tif id == Gosu::KbZ # Mark a tile for collision, only drawn in the editor\n\t\t\t@player.place(4)\n\t\tend\n\t\tif id == Gosu::KbX # Turn on/off drawing of the red cross-circle that shows where colliders are\n\t\t\t@map.draw_colliders?\n\t\tend\n\t\t\n\t\t# Save / Load Functions (Still Experimental, but working)\n\t\t# Make sure that the file you're trying to load was made\n\t\t# by the same version of Tyle you're using now, else oddness.\n\t\tif id == Gosu::KbO and DEBUG\n\t\t\t@map.save(FILENAME)\n\t\tend\n\t\tif id == Gosu::KbP and DEBUG\n\t\t\t@map.load(FILENAME)\n\t\tend\n\t\t\n\tend", "def board_state()\r\n\t\treturn @cellMap\r\n\tend", "def button_down(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n\r\n # Check if the player sprite can jump\r\n if [1,3,4,5,6].include?(get_tile_info(@player.get_x,\r\n @player.get_y,:down)) then\r\n\r\n # Call the jump function\r\n @player.jump\r\n\r\n # Player still might have a chance to \"double\" jump\r\n elsif @player.get_fall < 5 then\r\n @player.jump\r\n end\r\n end\r\n end", "def generateButtons\n @moves = @battler.moves\n @nummoves = 0\n @oldindex = -1\n @x = []; @y = []\n for i in 0...4\n @button[\"#{i}\"].dispose if @button[\"#{i}\"]\n @nummoves += 1 if @moves[i] && @moves[i].id\n @x.push(@viewport.width/2 + (i%2==0 ? -1 : 1)*(@viewport.width/2 + 99))\n @y.push(@viewport.height - 90 + (i/2)*44)\n end\n for i in 0...4\n @y[i] += 22 if @nummoves < 3\n end\n @button = {}\n for i in 0...@nummoves\n # get numeric values of required variables\n movedata = GameData::Move.get(@moves[i].id)\n category = movedata.physical? ? 0 : (movedata.special? ? 1 : 2)\n type = GameData::Type.get(movedata.type).id_number\n # create sprite\n @button[\"#{i}\"] = Sprite.new(@viewport)\n @button[\"#{i}\"].param = category\n @button[\"#{i}\"].z = 102\n @button[\"#{i}\"].bitmap = Bitmap.new(198*2, 74)\n @button[\"#{i}\"].bitmap.blt(0, 0, @buttonBitmap, Rect.new(0, type*74, 198, 74))\n @button[\"#{i}\"].bitmap.blt(198, 0, @buttonBitmap, Rect.new(198, type*74, 198, 74))\n @button[\"#{i}\"].bitmap.blt(65, 46, @catBitmap, Rect.new(0, category*22, 38, 22))\n @button[\"#{i}\"].bitmap.blt(3, 46, @typeBitmap, Rect.new(0, type*22, 72, 22))\n baseColor = @buttonBitmap.get_pixel(5, 32 + (type*74)).darken(0.4)\n pbSetSmallFont(@button[\"#{i}\"].bitmap)\n pbDrawOutlineText(@button[\"#{i}\"].bitmap, 198, 10, 196, 42,\"#{movedata.real_name}\", Color.white, baseColor, 1)\n pp = \"#{@moves[i].pp}/#{movedata.total_pp}\"\n pbDrawOutlineText(@button[\"#{i}\"].bitmap, 0, 48, 191, 26, pp, Color.white, baseColor, 2)\n pbSetSystemFont(@button[\"#{i}\"].bitmap)\n text = [[movedata.real_name, 99, 4, 2, baseColor, Color.new(0, 0, 0, 24)]]\n pbDrawTextPositions(@button[\"#{i}\"].bitmap, text)\n @button[\"#{i}\"].src_rect.set(198, 0, 198, 74)\n @button[\"#{i}\"].ox = @button[\"#{i}\"].src_rect.width/2\n @button[\"#{i}\"].x = @x[i]\n @button[\"#{i}\"].y = @y[i]\n end\n end", "def vertical_victory(b)\n win = false\n\n (1..BOARD_WIDTH).each do |i|\n column_values = board_column_values(b, i)\n win = i if victory_column?(column_values)\n end\n\n win\nend", "def victory?\n x = $last_btn.x\n y = $last_btn.y\n vic = false\n if x == 0\n vic = check_2_btns($glob.btns.by_c(x + 1,y),$glob.btns.by_c(x + 2,y))\n elsif x == 1\n vic = check_2_btns($glob.btns.by_c(x + 1,y),$glob.btns.by_c(x - 1,y))\n else\n vic = check_2_btns($glob.btns.by_c(x - 1,y),$glob.btns.by_c(x - 2,y))\n end\n if vic == false\n if y == 0 \n vic = check_2_btns($glob.btns.by_c(x,y + 1),$glob.btns.by_c(x,y + 2))\n elsif y == 1\n vic = check_2_btns($glob.btns.by_c(x,y + 1),$glob.btns.by_c(x,y - 1))\n else\n vic = check_2_btns($glob.btns.by_c(x,y - 1),$glob.btns.by_c(x,y - 2))\n end \n else\n return vic\n end \n if vic == false\n if x == 0 and y == 0\n vic = check_2_btns($glob.btns.by_c(1,1),$glob.btns.by_c(2,2))\n elsif x == 2 and y == 2\n vic = check_2_btns($glob.btns.by_c(0,0),$glob.btns.by_c(1,1))\n elsif x == 2 and y == 0\n vic = check_2_btns($glob.btns.by_c(1,1),$glob.btns.by_c(0,2))\n elsif x == 0 and y == 2\n vic = check_2_btns($glob.btns.by_c(1,1),$glob.btns.by_c(2,0))\n elsif x == 1 and y == 1\n vic = check_2_btns($glob.btns.by_c(0,0),$glob.btns.by_c(2,2))\n return vic if vic != false\n vic = check_2_btns($glob.btns.by_c(2,0),$glob.btns.by_c(0,2))\n end \n end \n return vic\n end", "def button_down(id)\n\t\tcase id\n\t\t#escape to close game\n\t\twhen Gosu::KbEscape\n\t\t\tself.close\n\t\twhen Gosu::KbSpace#, Gosu::KbUp\n\t\t\t#space is used to start the game\n\t\t\tif @startup\n\t\t\t\t@pause = !@pause\n\t\t\t\tpause_game(@pause)\n\t\t\t\t@startup = false\n\t\t\t\t@level_time = Time.now + $TimeLimit \n\t\t\t#once the game is started its used to fire\n\t\t\telsif !@game_done and !@pause\n\t\t\t\tx = @ship.x\n\t\t\t\ty = @ship.y\n\t\t\t\t#fancy lasers for when you have the powerup\n\t\t\t\tif @ship.lasers == \"b\"\n\t\t\t\t\t@lasers.push Laser.new(self, x-12, y+2, 0)\t\n\t\t\t\t\t#@lasers.push Laser.new(self, x, y)\t\n\t\t\t\t\t@lasers.push Laser.new(self, x+12, y+2, 0)\n\t\t\t\t#even fancy lasers you can't get till level 3\n\t\t\t\telsif @ship.lasers == \"g\"\n\t\t\t\t\t@lasers.push Laser.new(self, x-12, y+2, 1, 1)\t\n\t\t\t\t\t@lasers.push Laser.new(self, x, y, 1, 0)\t\n\t\t\t\t\t@lasers.push Laser.new(self, x+12, y+2, 1, -1)\n\t\t\t\t#regular lasers\n\t\t\t\telse\n\t\t\t\t\t@lasers.push Laser.new(self, x, y)\t\n\t\t\t\tend\n\t\t\t\t@shots_fired += 1\n\t\t\tend\n\t\twhen Gosu::KbUp\n\t\t\tif !@game_done and !@pause\n\t\t\t\tif @ship.missle_fired?\n\t\t\t\t\t@missles.push Missle.new(self, @ship.x, @ship.y)\n\t\t\t\t\t@missles_fired += 1\n\t\t\t\tend\n\t\t\tend\n\t\twhen Gosu::KbM\n\t\t\tif $Cheat\n\t\t\t\t3.times do\n\t\t\t\t\t@ship.powerup(\"m\", false)\n\t\t\t\tend\n\t\t\tend\n\t\t#\"p\" to pause\n\t\twhen Gosu::KbP\n\t\t\tif !@game_done\n\t\t\t\t@pause = !@pause\n\t\t\t\tpause_game(@pause)\n\t\t\tend\n\t\t#\"r\" to restart\n\t\twhen Gosu::KbR\n\t\t\trestart_game\n\t\tend\n\tend", "def render\n @pressed.map do |idx, state|\n next unless state\n if on_grid?\n xx, yy = coords_for(idx: idx)\n change_grid(x: xx, y: yy, color: @colors.down)\n else\n change_command(position: @position, color: @colors.down)\n end\n end\n end", "def key_pressed?(key)\n key_const = Gosu.const_get(:\"Kb#{key.to_s.gsub(/\\b\\w/){$&.upcase}}\")\n button_down?(key_const)\n end", "def size \n\n\t\t# Set the basic metrics\n\t\tcase @board_size\n\t\twhen :small \t\t\t\t# A 20x20 grid\n\t\t\t@width = 30\n\t\t\t@height = 20\n\t\t\t@dragon_count = 50 * @board_level\n\t\t\t@cell_size = 30\n\t\t\t@cover_png = 'sprites/cover_30.png'\n\t\t\t@dragon_png = 'sprites/dragon_30.png'\n\t\t\t@gold_png = 'sprites/gold_30.png'\n\t\t\t@cell_png = [ 'sprites/cell0_30.png', 'sprites/cell1_30.png', 'sprites/cell2_30.png', \n\t\t\t\t\t\t 'sprites/cell3_30.png', 'sprites/cell4_30.png', 'sprites/cell5_30.png',\n\t\t\t\t\t\t 'sprites/cell6_30.png', 'sprites/cell7_30.png', 'sprites/cell8_30.png' ]\n\t\tend\n\n\t\t# Clear and resize the board array\n\t\t@spawned = false\n\t\t@victorious = false\n\t\t@burniation = -1\n\t\t@burn_size = 1\n\t\t@dragons = Array.new( @width * @height, 0 )\n\t\t@cell_status = Array.new( @width * @height, :status_covered )\n\n\t\t# Decide how big the stuff on the right hand side should be\n\t\t@label_size = -2.5\n\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size )\n\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size )\n\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size )\n\n\t\twhile [ @size_restart.x, @size_dragon.x, @size_time.x ].max < ( $gtk.args.grid.w - ( ( @width + 6 ) * @cell_size ) )\n\n\t\t\t# Try some slightly bigger sizes then\n\t\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size+0.1 )\n\t\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size+0.1 )\n\t\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size+0.1 )\n\n\t\t\t# And nudge up the label size\n\t\t\t@label_size += 0.1\n\t\tend \n\n\t\t@label_size -= 0.1\n\t\t@size_restart = $gtk.calcstringbox( \"Restart\", @label_size )\n\t\t@size_dragon = $gtk.calcstringbox( \"888 Dragons To Find\", @label_size )\n\t\t@size_time = $gtk.calcstringbox( \"88:88:88\", @label_size )\n\t\t\n\t\t# Lastly, work out some sensible offsets\n\t\t@board_w = @width * @cell_size\n\t\t@board_h = @height * @cell_size\n\t\t@board_x = 2 * @cell_size \n\t\t@board_y = $gtk.args.grid.center_y - ( @board_h / 2 )\n\n\t\t@label_x = @board_x + @board_w + ( 2 * @cell_size )\n\t\t@label_time_y = $gtk.args.grid.center_y + ( @size_time.y + 20 ) * 1.5\n\t\t@label_dragon_y = @label_time_y - 20 - @size_dragon.y - 20\n\t\t@label_restart_y = @label_dragon_y - 20 - @size_restart.y - 20\n\n\t\t@label_width = [ @size_restart.x, @size_dragon.x, @size_time.x ].max + 20\n\n\tend", "def button_down?(btn)\n @down[btn]\n end", "def keyboards_tech_demo\n outputs.labels << [460, row_to_px(0), \"Current game time: #{state.tick_count}\", small_font]\n outputs.labels << [460, row_to_px(2), \"Keyboard input: inputs.keyboard.key_up.h\", small_font]\n outputs.labels << [460, row_to_px(3), \"Press \\\"h\\\" on the keyboard.\", small_font]\n\n if inputs.keyboard.key_up.h # if \"h\" key_up event occurs\n state.h_pressed_at = state.tick_count # frame it occurred is stored\n end\n\n # h_pressed_at is initially set to false, and changes once the user presses the \"h\" key.\n state.h_pressed_at ||= false\n\n if state.h_pressed_at # if h is pressed (pressed_at has a frame number and is no longer false)\n outputs.labels << [460, row_to_px(4), \"\\\"h\\\" was pressed at time: #{state.h_pressed_at}\", small_font]\n else # otherwise, label says \"h\" was never pressed\n outputs.labels << [460, row_to_px(4), \"\\\"h\\\" has never been pressed.\", small_font]\n end\n\n # border around keyboard input demo section\n outputs.borders << [455, row_to_px(5), 360, row_to_px(2).shift_up(5) - row_to_px(5)]\n end", "def button_down?(id)\n return @key_event_list_down.include? id\n end", "def actuMap()\n 0.upto(@map.rows-1) do |x|\n 0.upto(@map.cols-1) do |y|\n\n if (@map.accessAt(x,y).value == 1)\n\n if @map.accessAt(x,y).color != nil\n if (@map.accessAt(x,y).color == @nbHypo + 1)\n @timePress[x][y] = 1\n @map.accessAt(x,y).color = @nbHypo\n end\n changeImage(@buttonTab[x][y],@tabCase[@map.accessAt(x,y).color])\n else\n changeImage(@buttonTab[x][y],\"../images/cases/blanc.png\" )\n @timePress[x][y] = 0\n end\n elsif @map.accessAt(x,y).value == 2\n changeImage(@buttonTab[x][y],\"../images/cases/croix.png\" )\n @timePress[x][y] = 0\n\n else\n ajoutLimitation(x,y)\n\n end\n\n end\n\n end\n end", "def button_down(id)\n case id\n when Gosu::MsLeft\n @locs = [mouse_x, mouse_y]\n if mouse_over_button(mouse_x, mouse_y)\n @background = Gosu::Color::YELLOW\n elsif mouse_over_button(mouse_x, mouse_y) == false\n @background = Gosu::Color::WHITE\n end\n end\n end", "def button_down(id)\n super(id)\n unless @buttons_down.include?(id)\n @input_lag = INPUT_LAG\n @buttons_down << id\n end\n return unless PRINT_INPUT_KEY\n #print(\"Buttons currently held down: #{@buttons_down} T:#{@triggered}\\n\")\n print(\"Window button pressed: (#{id}) which is (#{self.get_input_symbol(id).to_s})\\n\")\n end", "def button_down?(id)\n return @input.button_down? id\n end", "def update args\n\n\t\t# Normalise the mouse position to the board origin\n\t\tmouse_x = ( ( args.inputs.mouse.x - @board_x ) / @cell_size ).floor\n\t\tmouse_y = ( ( args.inputs.mouse.y - @board_y ) / @cell_size ).floor\n\n\t\t# Handle if there's been a click, if we're still playing\n\t\tif !@victorious && ( @burniation == -1 ) && args.inputs.mouse.click\n\n\t\t\t# Save me some typing later on... ;-)\n\t\t\tcell_idx = (mouse_y*@width) + mouse_x\n\n\t\t\t# The user can do one of three things; click left, click right,\n\t\t\t# or click both. Somwhow we have to handle all of this!\n\t\t\tif mouse_x.between?( 0, @width-1 ) && mouse_y.between?( 0, @height-1 ) && args.inputs.mouse.button_left && args.inputs.mouse.button_right\n\n\t\t\t\t# Clear around an already-cleared cell\n\t\t\t\tif @cell_status[cell_idx] == :status_revealed\n\t\t\t\t\tuncover mouse_y, mouse_x, true\n\t\t\t\tend\n\n\t\t\t# If the user wants to add a gold pile to a covered cell, that's easy\n\t\t\telsif args.inputs.mouse.button_right\n\n\t\t\t\t# Needs to be on the board, and over a covered cell\n\t\t\t\tif mouse_x.between?( 0, @width-1 ) && mouse_y.between?( 0, @height-1 ) && @cell_status[cell_idx] != :status_revealed\n\n\t\t\t\t\t# We maintain a list of gold pile co-ordinates, and just toggle\n\t\t\t\t\t@cell_status[cell_idx] = ( @cell_status[cell_idx] == :status_gold ) ? :status_covered : :status_gold\n\n\t\t\t\tend\n\n\t\t\t# If the user clicks on the board, work out where.\n\t\t\telsif args.inputs.mouse.button_left\n\n\t\t\t\t# Obviously can only act if they're over the board\n\t\t\t\tif mouse_x.between?( 0, @width-1 ) && mouse_y.between?( 0, @height-1 )\n\n\t\t\t\t\t# If this is the first cell, spawn dragons!\n\t\t\t\t\tif !@spawned\n\t\t\t\t\t\tspawn_dragons mouse_y, mouse_x\n\t\t\t\t\tend\n\n\t\t\t\t\t# And then simply uncover the cell here\n\t\t\t\t\tuncover mouse_y, mouse_x\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t# Redraw the board\n\t\t\trender_board\n\n\t\tend\n\n\n\t\t# Check to see if they clicked on the restart button instead\n\t\tif args.inputs.mouse.x.between?( @label_x, @label_x + @label_width ) &&\n\t\t args.inputs.mouse.y.between?( @label_restart_y, @label_restart_y + @size_restart.y )\n\n\t\t\t# If the mouse is clicked down, we've clicked the button\n\t\t \tif args.inputs.mouse.down\n\t\t \t\t@restart_clicked = true\n\t\t \tend\n\n\t\t \tif @restart_clicked && args.inputs.mouse.up\n\t\t \t\t@restart_clicked = false\n\t\t \t\tsize\n\t\t \t\trender_board\n\t\t \tend\n\n\t\tend\n\n\t\t# Now check for end conditions; have we flagged all the dragons we seek?\n\t\tif ( @spawned ) && ( !@victorious) && ( @burniation == -1 ) &&\n\t\t ( @cell_status.count( :status_gold ) == @dragon_count )\n\n\t\t\t# Then automagically reveal all non-flagged cells\n\t\t\t@end_tick = args.tick_count\n\t\t\t@victorious = true\n\t\t\t@cell_status.map! { |cell|\n\t\t\t\tcell == :status_covered ? :status_revealed : cell\n\t\t\t}\n\n\t\t\t# Redraw the board\n\t\t\trender_board\n\n\t\tend\n\n\t\t# Have we revealed a dragon?!\n\t\tif @burniation == -1\n\t\t\t@dragons.each_with_index { |dragon, index|\n\t\t\t\tif ( dragon == DRAGON ) && ( @cell_status[index] == :status_revealed )\n\t\t\t\t\t@burniation = index\n\t\t\t\t\t@victorious = false\n\t\t\t\t\t@end_tick = args.tick_count\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\n\tend", "def button_down(id)\n case id\n when Gosu::KbEscape\n exit\n end\n end", "def pressed?(key)\n @input[key].detect { |k| @game.button_down?(k) }\n end", "def button_down?(button)\n end", "def key_pressed?\n Java.java_to_primitive(java_class.field(\"keyPressed\").value(java_object))\n end", "def key_pressed?\n Java.java_to_primitive(java_class.field(\"keyPressed\").value(java_object))\n end", "def button_down(id)\n key = self.get_key(id)\n if key != nil\n @game.state.command(key)\n \n # allow repeated movement...checked by update below\n if key.direction != nil\n @last_move = key\n @last_move_time = Gosu::milliseconds\n end\n end\n end", "def button_down(id)\n\t\t if button_down? Gosu::KbEscape\n\t\t close\n\t\t end\n\t\t if button_down? Gosu::KbR\n\t\t @tree.random_tree\n\t\t end\n\t\t if button_down? Gosu::KbC\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t #F1/F2 are split range\n\t\t if button_down? Gosu::KbF2\n\t\t\t$split_range = $split_range + 1\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t if button_down? Gosu::KbF1\n\t\t\t$split_range = $split_range - 1\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t #F3/F4 are shrink range\n\t\t if button_down? Gosu::KbF3\n\t\t\t$shrink_range[0] = $shrink_range[0] - 1\n\t\t\t$shrink_range[1] = $shrink_range[0]\n\t\t\t$shrink_range[2] = $shrink_range[0]\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t if button_down? Gosu::KbF4\n\t\t\t$shrink_range[0] = $shrink_range[0] + 1\n\t\t\t$shrink_range[1] = $shrink_range[0]\n\t\t\t$shrink_range[2] = $shrink_range[0]\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t #F5/F6 are trunk size\n\t\t if button_down? Gosu::KbF5\n\t\t\ttrunk_start = $trunk[0] - 10\n\t\t\t$trunk.clear\n\t\t\t$trunk[0] = trunk_start\n\t\t\t$trunk[1] = trunk_start\n\t\t\t@tree.custom_tree\n\t\t end\n\t\t if button_down? Gosu::KbF6\n\t\t\ttrunk_start = $trunk[0] + 10\n\t\t\t$trunk.clear\n\t\t\t$trunk[0] = trunk_start\n\t\t\t$trunk[1] = trunk_start\n\t\t\t@tree.custom_tree\n\t\t end\n\t end", "def draw?\n !victory? && @board.flatten.compact.size == 9\n end", "def button_down(id)\r\n case id\r\n when Gosu::KbEscape\r\n close\r\n end\r\n end", "def button_down(id)\n if id == Gosu::KbEscape\n close\n end\n if id == Gosu::KbO && (not @twoplayer)\n @twoplayer = true\n @player.second_player_mode\n end\n if id == Gosu::KbR && @game_over\n @ball.reset\n @score.reset\n @game_over = false\n end\n end", "def verify_tile(button)\n case (button)\n when TABLE_BUTTON\n wait_for { displayed?(CASE_TABLE_TILE) }\n when GRAPH_TILE\n wait_for { displayed?(GRAPH_TILE) }\n when MAP_BUTTON\n wait_for { displayed?(MAP_TILE) }\n when SLIDER_BUTTON\n wait_for { displayed?(SLIDER_TILE) }\n when CALC_BUTTON\n wait_for { displayed?(CALC_TILE) }\n when TEXT_BUTTON\n wait_for { displayed?(TEXT_TILE) }\n click_on(TEXT_TILE)\n when HELP_BUTTON\n # help_page_title = driver.find_element(:id, \"block-menu-menu-help-categories\")\n # wait_for {displayed?(help_page_title)}\n # expect(help_page_title.text).to include \"CODAP Help\"\n puts \"Help button clicked.\"\n when TILE_LIST_BUTTON\n puts \"Tile list button clicked\"\n #driver.find_element(:xpath=> '//span[contains(@class, \"ellipsis\") and text()=\"No Data\"]').click\n when OPTION_BUTTON\n wait_for {displayed? (VIEW_WEBPAGE_MENU_ITEM)}\n click_on(VIEW_WEBPAGE_MENU_ITEM)\n textfield = wait_for{find(SINGLE_TEXT_DIALOG_TEXTFIELD)}\n driver.action.click(textfield).perform\n find(SINGLE_TEXT_DIALOG_CANCEL_BUTTON).click\n # puts \"Option button clicked\"\n when GUIDE_BUTTON\n puts \"Guide button clicked\"\n end\n end", "def game_screen_inputs(player)\n\n movement_index = 0 # used to track switch cases\n if @game_settings.p1_init\n player.player_controls.each do |control|\n unless button_up? control\n movement_index += 1\n else\n break\n end\n end\n\n # Determines movement\n case movement_index\n when 0\n player.move_left @playing_cards\n when 1\n player.move_right @playing_cards\n when 2\n player.move_up @playing_cards\n when 3\n player.move_down @playing_cards\n when 4\n player.selection @playing_cards\n else\n nil\n end\n\n # Checks the validity of a set.\n if player.chosen_cards_indexes.length == 3\n player.chosen_set_validity! @playing_cards\n if player.set_found\n @hint.clear\n player.set_timer.update_time\n player.set_times.push player.set_timer.current\n player.score += 1\n player.set_times.sort!\n\t player.time_sum += player.set_timer.current\n player.set_timer.reset\n else\n player.clean_slate\n\t player.score -= 1\n end\n end\n end\n\n # Check if table valid\n if @deck.deck_count < 9 and valid_table(@playing_cards).length == 0\n\n @game_settings.current_screen = \"gameover\"\n @settings_hovered = Options::GAMEOVER_SCREEN[0]\n return\n end\n\n if @game_settings.are_hints_enabled and button_up? Gosu::KB_H\n @hint = player.get_hint @playing_cards\n end\n end", "def cell_sizes?\n cell_w && cell_h\n end", "def get_key(id)\n if id == Gosu::KbUp then Key.new(:up, nil, :north)\n elsif id == Gosu::KbLeft then Key.new(:left, nil, :west)\n elsif id == Gosu::KbDown then Key.new(:down, nil, :south)\n elsif id == Gosu::KbRight then Key.new(:right, nil, :east)\n elsif id == Gosu::KbA && shift_down then Key.new(:A, 0)\n elsif id == Gosu::KbB && shift_down then Key.new(:B, 1)\n elsif id == Gosu::KbC && shift_down then Key.new(:C, 2)\n elsif id == Gosu::KbD && shift_down then Key.new(:D, 3)\n elsif id == Gosu::KbE && shift_down then Key.new(:E, 4)\n elsif id == Gosu::KbF && shift_down then Key.new(:F, 5)\n elsif id == Gosu::KbG && shift_down then Key.new(:G, 6)\n elsif id == Gosu::KbH && shift_down then Key.new(:H, 7)\n elsif id == Gosu::KbI && shift_down then Key.new(:I, 8)\n elsif id == Gosu::KbJ && shift_down then Key.new(:J, 9)\n elsif id == Gosu::KbK && shift_down then Key.new(:K, 10)\n elsif id == Gosu::KbL && shift_down then Key.new(:L, 11)\n elsif id == Gosu::KbM && shift_down then Key.new(:M, 12)\n elsif id == Gosu::KbN && shift_down then Key.new(:N, 13)\n elsif id == Gosu::KbO && shift_down then Key.new(:O, 14)\n elsif id == Gosu::KbP && shift_down then Key.new(:P, 15)\n elsif id == Gosu::KbQ && shift_down then Key.new(:Q, 16)\n elsif id == Gosu::KbR && shift_down then Key.new(:R, 17)\n elsif id == Gosu::KbS && shift_down then Key.new(:S, 18)\n elsif id == Gosu::KbT && shift_down then Key.new(:T, 19)\n elsif id == Gosu::KbU && shift_down then Key.new(:U, 20)\n elsif id == Gosu::KbV && shift_down then Key.new(:V, 21)\n elsif id == Gosu::KbW && shift_down then Key.new(:W, 22)\n elsif id == Gosu::KbX && shift_down then Key.new(:X, 23)\n elsif id == Gosu::KbY && shift_down then Key.new(:Y, 24)\n elsif id == Gosu::KbZ && shift_down then Key.new(:Z, 25)\n #elsif id == 43 && shift_down then Key.new(:portal_up)\n #elsif id == 47 && shift_down then Key.new(:portal_down)\n elsif id == Gosu::KbA then Key.new(:a, 0)\n elsif id == Gosu::KbB then Key.new(:b, 1)\n elsif id == Gosu::KbC then Key.new(:c, 2)\n elsif id == Gosu::KbD then Key.new(:d, 3)\n elsif id == Gosu::KbE then Key.new(:e, 4)\n elsif id == Gosu::KbF then Key.new(:f, 5)\n elsif id == Gosu::KbG then Key.new(:g, 6)\n elsif id == Gosu::KbH then Key.new(:h, 7)\n elsif id == Gosu::KbI then Key.new(:i, 8)\n elsif id == Gosu::KbJ then Key.new(:j, 9)\n elsif id == Gosu::KbK then Key.new(:k, 10)\n elsif id == Gosu::KbL then Key.new(:l, 11)\n elsif id == Gosu::KbM then Key.new(:m, 12)\n elsif id == Gosu::KbN then Key.new(:n, 13)\n elsif id == Gosu::KbO then Key.new(:o, 14)\n elsif id == Gosu::KbP then Key.new(:p, 15)\n elsif id == Gosu::KbQ then Key.new(:q, 16)\n elsif id == Gosu::KbR then Key.new(:r, 17)\n elsif id == Gosu::KbS then Key.new(:s, 18)\n elsif id == Gosu::KbT then Key.new(:t, 19)\n elsif id == Gosu::KbU then Key.new(:u, 20)\n elsif id == Gosu::KbV then Key.new(:v, 21)\n elsif id == Gosu::KbW then Key.new(:w, 22)\n elsif id == Gosu::KbX then Key.new(:x, 23)\n elsif id == Gosu::KbY then Key.new(:y, 24)\n elsif id == Gosu::KbZ then Key.new(:z, 25)\n elsif id == Gosu::KbEscape then Key.new(:escape)\n elsif id == Gosu::KbSpace then Key.new(:space)\n elsif id == Gosu::KbReturn then Key.new(:return)\n end\n end", "def victory?\n # Loop over all Nx1 lines in the board\n [*@board, *columns, *diagonals].each do |line|\n return :x if line.all?(:x)\n return :o if line.all?(:o)\n end\n\n false\n end", "def horizontal_victory(b)\n win = false\n\n (1..BOARD_HEIGHT).each do |i|\n row_values = board_row_values(b, i)\n win = i if victory_row?(row_values)\n end\n\n win\nend", "def button_pressed?(btn)\n @down[btn] and not @prev_down[btn]\n end", "def cell_alive?(column, row)\n @cell_state[(row % ROWS) * ROWS + (column % COLUMNS)] > 0\n end", "def input_button\r\n n = 0\r\n LiteRGSS2RGSS_Input.each do |key, i|\r\n n = i if Input.trigger?(key)\r\n end\r\n if n > 0\r\n $game_variables[@button_input_variable_id] = n\r\n $game_map.need_refresh = true\r\n @button_input_variable_id = 0\r\n end\r\n end", "def button_down_game_replay_presenter(id, window, state)\n if id == Gosu::KbSpace\n navigate_back(window) if id == Gosu::KbSpace\n end\n level_up(state) if id == Gosu::KbRight\n level_down(state) if id == Gosu::KbLeft\nend", "def update_command\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Switch to map screen\n $scene = Scene_Map.new\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Branch by command sprite cursor position\n case @command_window.index\n when 0 # buy\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Change windows to buy mode\n @command_window.active = false\n @dummy_window.visible = false\n @buy_window.active = true\n @buy_window.visible = true\n @buy_window.refresh\n @status_window.visible = true\n when 1 # sell\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Change windows to sell mode\n @command_window.active = false\n @dummy_window.visible = false\n @sell_window.active = true\n @sell_window.visible = true\n @sell_window.refresh\n when 2 # quit\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to map screen\n $scene = Scene_Map.new\n end\n return\n end\n end", "def button_up(id)\n Game.begin_game(@score) if id == Gosu::KbEscape or id == Gosu::KbReturn or Gosu::KbSpace\n end", "def button_down(id)\n Log.start { \"GW#button_down...\" }\n Log.puts { \"button id: #{id.inspect}\" }\n # puts \"gosu enter (#{Gosu::KbEnter}) == #{ENTER_KEY}\"\n if Gosu::MsLeft == id\n Log.puts { \"got left mouse, now what...\" }\n if @answer_field.clicked?\n Log.puts { \"answer clicked\" }\n # Mouse click: Select text field based on mouse position.\n # Advanced: Move caret to clicked position\n self.text_input.move_caret(mouse_x) unless self.text_input.nil?\n @answer_field.text = \"\" # a bit abrupt\n self.text_input = @answer_field\n @answer_field.text = \"\" # a bit abrupt\n elsif @submit_button.clicked?\n Log.puts { \"submit\" }\n game.raw_response = @answer_field.text\n @answer_field.text = \"\" # a bit abrupt\n elsif @continue_button.clicked?\n Log.puts { \"continue\" }\n @game.sleep_end = Gosu::milliseconds - 1\n else\n Log.puts { \"no-op\" }\n end\n elsif ENTER_KEY == id #Gosu::KbEnter == id\n game.raw_response = @answer_field.text\n end\n Log.stop { \"GW#button_down...\" }\n end", "def button_down(id)\n\t\tcase id\n\t\twhen Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\tend", "def dev_commands args\n if args.inputs.keyboard.key_down.m || args.inputs.controller_one.key_down.a\n new_ball args\n end\n\n # commented out because breaks game (type = \"h\")\n # if args.inputs.keyboard.key_down.h || args.inputs.controller_one.key_down.b\n # heavy_ball args\n # end\n\n if args.inputs.keyboard.key_down.one || args.inputs.controller_one.key_down.x\n new_ball1 args\n end\n\n if args.inputs.keyboard.key_down.two || args.inputs.controller_one.key_down.y\n new_ball2 args\n end\n\n if args.inputs.keyboard.key_down.r || args.inputs.controller_one.key_down.start\n reset args\n end\nend", "def button_down(id)\n if id == Gosu::KbEscape\n close\n elsif id == Gosu::KbA\n if @bgm_si == nil or !@bgm_si.playing?\n @bgm_si = @bgm.play(1, 1, true) # play (loop enabled)\n end\n elsif id == Gosu::KbZ\n if @bgm_si\n @bgm_si.stop # stop\n end\n elsif id == Gosu::KbP\n if @bgm_si\n if @bgm_si.paused?\n @bgm_si.resume # resume\n elsif @bgm_si.playing?\n @bgm_si.pause # pause\n end\n end\n end\n end", "def brew_button_status; end", "def updateKeys\n\t\tif !@keysPressed.empty?\n\t\t\tkey = @keysPressed.pop\n\t\t\tinitX = @initPosX + @hero.sprite.posx / SQUARE_SIZE \n\t\t\tinitY = @initPosY + @hero.sprite.posy / SQUARE_SIZE \n\t\t\tdirection = 0\n\t\t\tcase key.to_s\n\t\t\twhen \"u\"\n\t\t\t\tdirection = \"right\"\n\t\t\t\tcheckX = initX + SCREEN_CENTER_X / SQUARE_SIZE + 1 \n\t\t\t\tcheckY = initY + SCREEN_CENTER_Y / SQUARE_SIZE \n\t\t\twhen \"o\"\n\t\t\t\tdirection = \"left\"\n\t\t\t\tcheckX = initX + SCREEN_CENTER_X / SQUARE_SIZE - 1 \n\t\t\t\tcheckY = initY + SCREEN_CENTER_Y / SQUARE_SIZE \n\t\t\twhen \"e\" \n\t\t\t\tdirection = \"down\"\n\t\t\t\tcheckX = initX + SCREEN_CENTER_X / SQUARE_SIZE \n\t\t\t\tcheckY = initY + SCREEN_CENTER_Y / SQUARE_SIZE + 1 \n\t\t\twhen \"period\"\n\t\t\t\tdirection = \"up\"\n\t\t\t\tcheckX = initX + SCREEN_CENTER_X / SQUARE_SIZE \n\t\t\t\tcheckY = initY + SCREEN_CENTER_Y / SQUARE_SIZE - 1 \n\t\t\twhen \"t\"\n\t\t\t\tif @keyIdle\n\t\t\t\t\t@nextGameState = Menu.new(@screen, self) \n\t\t\t\tend\n\t\t\tend\n\t\t\tif direction != 0\n\t\t\t\tmove = true\n\t\t\t\ttile = @background[checkY][checkX]\n\t\t\t\t@noMove.each { |noMove|\n\t\t\t\t\tif tile == noMove\n\t\t\t\t\t\tmove = false\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tmovement(direction, key, move)\n\t\t\tend\n\t\tend\n\tend", "def button_down(id)\n # ENTER: launch A* algorithm\n if id == Gosu::KbReturn && ready?\n @grid.update_neighbors\n a_star\n @needs_reset = true\n end\n\n # SUPPR: clear window\n reset! if id == Gosu::KbDelete\n end", "def hotkeys\n loop do\n c = @screen.getch\n\n case c\n when Ncurses::KEY_DOWN, 14, 'j'.ord\n scroll_down\n\n when Ncurses::KEY_UP, 16, 'k'.ord\n scroll_up\n\n when Ncurses::KEY_NPAGE\n (maxy - 2).times do\n break if !scroll_down\n end\n\n when Ncurses::KEY_PPAGE\n (maxy - 2).times do\n break if !scroll_up\n end\n\n when Ncurses::KEY_LEFT\n while scroll_up; end\n\n when Ncurses::KEY_RIGHT\n while scroll_down; end\n\n when 'q'.ord\n break\n\n when @callbacks[c]\n true\n\n end\n\n @screen.move(0, 0)\n end\n end", "def newGameSetup\r\n @experienceInt = 0 #Starting experience.\r\n @experience.clear { para(\"EXP: \" + @experienceInt.to_s, @style_stats) }\r\n @tierInt = 1 #Starting tier.\r\n @tier.clear{ para(\"TIER: \" + @tierInt.to_s, @style_stats) }\r\n @durability.clear { para(\"DUR: \" + @durabilityInt.to_s, @style_stats) }\r\n\r\n @oreTotal = Array.new(@tiers, 0) #Total number of ores for each tier.\r\n @oreRemaining = Array.new(@tiers, 0) #Remaining number of ores for each tier.\r\n @tierExp = Array.new(@tiers) #Total experience available for each tier of ore.\r\n @tile = Array.new(@columns){Array.new(@rows)} #Declares the 2D array to represent the grid.\r\n @hiddenCount = @columns * @rows\r\n @endState.clear\r\n\r\n #Generates the grid of buttons\r\n @board.clear do\r\n stack(width: (@columns * @tile_size)) do\r\n background(\"#000000\") #Sets the background to black.\r\n border(\"#CE8\", strokewidth: 1)\r\n\r\n (0..@rows-1).each do |row|\r\n flow(width: 1.0) do\r\n (0..@columns-1).each do |col|\r\n @btn = button(width: @tile_size, height: @tile_size) {\r\n mineTile(col,row)\r\n }\r\n @tile[col][row] = Tile.new(@btn)\r\n end\r\n end\r\n end\r\n end\r\n end\r\n\r\n @endGame = false\r\n\r\n generateOres #Generates the ores into the grid.\r\n calculateAdjacent #Calculates all adjacent values of every tile.\r\n\r\nend", "def update_ctrl_button\n if Input.trigger?(:B) # Quit\n action_b\n elsif Input.trigger?(:A) # Action\n action_a\n elsif Input.trigger?(:X) # Info\n action_x\n elsif Input.trigger?(:Y) # Sort\n action_y\n else\n return true\n end\n return false\n end", "def update_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Branch by command window cursor position\r\n case @command_window.index\r\n when 0 # buy\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Change windows to buy mode\r\n @command_window.active = false\r\n @dummy_window.visible = false\r\n @buy_window.active = true\r\n @buy_window.visible = true\r\n @buy_window.refresh\r\n @status_window.visible = true\r\n when 1 # sell\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Change windows to sell mode\r\n @command_window.active = false\r\n @dummy_window.visible = false\r\n @sell_window.active = true\r\n @sell_window.visible = true\r\n @sell_window.refresh\r\n when 2 # quit\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n end\r\n return\r\n end\r\n end", "def button_down(id)\n puts \"#{id}=>#{button_id_to_char(id)}\"\n end", "def key_pressed?\n @declared_fields['keyPressed'].value(java_self)\n end", "def isClick(x,y)\n @pixel = y * @rowstride + x * @n_channel\n if @tabPixel[@pixel+3] == 255\n @action.call\n end\n return @tabPixel[@pixel+3] == 255\n end", "def update_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Return if Disabled Command\r\n if disabled_main_command?\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Command Input\r\n main_command_input\r\n return\r\n end\r\n end", "def button_down(id)\n @@game_state.button_down(id)\n end", "def buttons; end", "def in_column?\n @board.transpose.each do |column|\n if column == @key\n return true\n end\n end\n false\n end", "def button_down(id)\n case id\n when Gosu::KbEnter, Gosu::KbReturn\n @paused = !@paused\n end\n end", "def is_win?\n cell[0] == cell[1] && cell[1] == cell[2] ||\n cell[3] == cell[4] && cell[4] == cell[5] ||\n cell[6] == cell[7] && cell[7] == cell[8] ||\n cell[0] == cell[3] && cell[3] == cell[6] ||\n cell[1] == cell[4] && cell[4] == cell[7] ||\n cell[2] == cell[5] && cell[5] == cell[8] ||\n cell[0] == cell[4] && cell[4] == cell[8] ||\n cell[2] == cell[4] && cell[4] == cell[6]\n end", "def cell_elements(identifier)\n platform.cells_for(identifier.clone)\n end", "def update_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Return if Disabled Command\r\n if disabled_main_command?\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n main_command_input\r\n return\r\n end\r\n end", "def board\n game.board\n end", "def store_button()\n if $kx_model==2\n button_hold(14)\n elsif $kx_model==3\n button_hold(41)\n else\n return(nil)\n end\n return(true)\nend", "def grid_clicked?\n inputs.mouse.down && mouse_inside_grid?\n end", "def button_down(id)\n if id == Gosu::Button::KbEscape\n close\n end\n end", "def button_down id\n end", "def won?\n @grid.flatten.all? { |el| el.face_down == false }\n end", "def victory(player) # Recense toutes les conditions de victoire (8 au total)\n\n if @cells[0].value == @cells[1].value && @cells[1].value == @cells[2].value\n return true\n\n elsif @cells[3].value == @cells[4].value && @cells[4].value == @cells[5].value\n return true\n\n elsif @cells[6].value == @cells[7].value && @cells[7].value == @cells[8].value\n return true\n\n elsif @cells[0].value == @cells[3].value && @cells[3].value == @cells[6].value\n return true\n\n elsif @cells[1].value == @cells[4].value && @cells[4].value == @cells[7].value\n return true\n\n elsif @cells[2].value == @cells[5].value && @cells[5].value == @cells[8].value\n return true\n\n elsif @cells[2].value == @cells[4].value && @cells[4].value == @cells[6].value\n return true\n\n elsif @cells[0].value == @cells[4].value && @cells[4].value == @cells[8].value\n return true\n\n end\n end", "def print_board\n\t\tcell_index=1\n\t\tputs \"\\n\\n\\t[A]\\t[B]\\t[C]\"\n\t\t@cell_status.each_key do |cell|\n\t\t\tcase cell\n\t\t\twhen \"A1\" \n\t\t\t\tprint \" [1]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B1\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C1\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\t\tputs \"\\t--------------------\"\n\t\t\twhen \"A2\" \n\t\t\t\tprint \" [2]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B2\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C2\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\t\tputs \"\\t--------------------\"\n\t\t\twhen \"A3\" \n\t\t\t\tprint \" [3]\\t #{marker_on_cell(cell)}\"\n\t\t\twhen \"B3\" \n\t\t\t\tprint \" | #{marker_on_cell(cell)}\"\n\t\t\twhen \"C3\" \n\t\t\t\tprint \" |\\t#{marker_on_cell(cell)}\\n\"\n\t\t\tend\t\n\t\tend\n\tend", "def button_up?(id)\n button = button_down? id\n return false if @pressed != id && @pressed != nil\n if button && @pressed != id\n @pressed = id\n return true\n elsif !button\n @pressed = nil\n end\n return false\n end", "def tick_help_text args\n return unless args.state.h_pressed_at\n\n args.state.key_value_history ||= {}\n args.state.key_down_value_history ||= {}\n args.state.key_held_value_history ||= {}\n args.state.key_up_value_history ||= {}\n\n if (args.inputs.keyboard.key_down.truthy_keys.length > 0 ||\n args.inputs.keyboard.key_held.truthy_keys.length > 0 ||\n args.inputs.keyboard.key_up.truthy_keys.length > 0)\n args.state.help_available = true\n args.state.no_activity_debounce = nil\n else\n args.state.no_activity_debounce ||= 5.seconds\n args.state.no_activity_debounce -= 1\n if args.state.no_activity_debounce <= 0\n args.state.help_available = false\n args.state.key_value_history = {}\n args.state.key_down_value_history = {}\n args.state.key_held_value_history = {}\n args.state.key_up_value_history = {}\n end\n end\n\n args.outputs.labels << { x: 10, y: row_to_px(args, 6), text: \"This is the api for the keys you've pressed:\", size_enum: -1, r: 180 }\n\n if !args.state.help_available\n args.outputs.labels << [10, row_to_px(args, 7), \"Press a key and I'll show code to access the key and what value will be returned if you used the code.\"]\n return\n end\n\n args.outputs.labels << { x: 10 , y: row_to_px(args, 7), text: \"args.inputs.keyboard\", size_enum: -2 }\n args.outputs.labels << { x: 330, y: row_to_px(args, 7), text: \"args.inputs.keyboard.key_down\", size_enum: -2 }\n args.outputs.labels << { x: 650, y: row_to_px(args, 7), text: \"args.inputs.keyboard.key_held\", size_enum: -2 }\n args.outputs.labels << { x: 990, y: row_to_px(args, 7), text: \"args.inputs.keyboard.key_up\", size_enum: -2 }\n\n fill_history args, :key_value_history, :down_or_held, nil\n fill_history args, :key_down_value_history, :down, :key_down\n fill_history args, :key_held_value_history, :held, :key_held\n fill_history args, :key_up_value_history, :up, :key_up\n\n render_help_labels args, :key_value_history, :down_or_held, nil, 10\n render_help_labels args, :key_down_value_history, :down, :key_down, 330\n render_help_labels args, :key_held_value_history, :held, :key_held, 650\n render_help_labels args, :key_up_value_history, :up, :key_up, 990\nend", "def tool_1\n @@mse = Proc.new { |up_down_dbl, flags, x, y, view|\n button = ''\n key_mod = ''\n if (MK_LBUTTON & flags != 0) then button << ', Left' end\n if (MK_MBUTTON & flags != 0) then button << ', Middle' end\n if (MK_RBUTTON & flags != 0) then button << ', Right' end\n\n if (MK_SHIFT & flags != 0) then key_mod << ', Shift' end\n if (MK_CONTROL & flags != 0) then key_mod << ', Ctrl' end\n if (MK_ALT & flags != 0) then key_mod << ', Alt' end\n s1 = up_down_dbl.ljust(7)\n s2 = button.sub(/^, /, '').ljust(20)\n s3 = key_mod.sub(/^, /, '')\n puts \"Mouse Button #{s1} button = #{s2} keys = #{s3}\"\n }\n @tool = Object.new\n @tool.instance_eval {\n def onLButtonDown(*a) ; @@mse.call('Down' , *a) ; end\n def onMButtonDown(*a) ; @@mse.call('Down' , *a) ; end\n def onRButtonDown(*a) ; @@mse.call('Down' , *a) ; end\n\n def onLButtonUp(*a) ; @@mse.call('Up' , *a) ; end\n def onMButtonUp(*a) ; @@mse.call('Up' , *a) ; end\n def onRButtonUp(*a) ; @@mse.call('Up' , *a) ; end\n\n def onLButtonDoubleClick(*a) ; @@mse.call('DblClk', *a) ; end\n def onMButtonDoubleClick(*a) ; @@mse.call('DblClk', *a) ; end\n def onRButtonDoubleClick(*a) ; @@mse.call('DblClk', *a) ; end\n\n def onKeyDown(key, repeat, flags, view)\n # Some binary fun for testing\n t = flags.to_s(2).rjust(16)\n bin = \"#{ t[-16,4]} #{ t[-12,4]} \" \\\n \"#{ t[ -8,4]} #{ t[ -4,4]}\".rjust(19)\n puts \"#{key.to_s.ljust(4)}\\t#{flags.to_s.ljust(5)}\\t#{bin}\"\n\n k = key.to_s.rjust(3)\n alt = (ALT_MODIFIER_MASK & key != 0).to_s.ljust(5)\n cons = (CONSTRAIN_MODIFIER_MASK & key != 0).to_s.ljust(5)\n copy = (COPY_MODIFIER_MASK & key != 0).to_s.ljust(5)\n puts \"key = #{k} alt = #{alt} cons = #{cons} copy = #{copy}\"\n end\n }\n Sketchup.active_model.select_tool(@tool)\n end", "def repaint # button\n\n #@bgcolor ||= $def_bg_color\n #@color ||= $def_fg_color\n $log.debug(\"BUTTON repaint : #{self} r:#{@row} c:#{@col} , #{@color} , #{@bgcolor} , #{getvalue_for_paint}\" )\n r,c = @row, @col #rowcol include offset for putting cursor\n # NOTE: please override both (if using a string), or else it won't work \n # These are both colorpairs not colors ??? 2014-05-31 - 11:58 \n _highlight_color = @highlight_color || $reversecolor\n _highlight_bgcolor = @highlight_bgcolor || 0\n _bgcolor = bgcolor()\n _color = color()\n if @state == :HIGHLIGHTED\n _bgcolor = @state==:HIGHLIGHTED ? _highlight_bgcolor : _bgcolor\n _color = @state==:HIGHLIGHTED ? _highlight_color : _color\n elsif selected? # only for certain buttons lie toggle and radio\n _bgcolor = @selected_bgcolor || _bgcolor\n _color = @selected_color || _color\n end\n $log.debug \"XXX: button #{text} STATE is #{@state} color #{_color} , bg: #{_bgcolor} \"\n if _bgcolor.is_a?( Integer) && _color.is_a?( Integer)\n # i think this means they are colorpairs not colors, but what if we use colors on the 256 scale ?\n # i don;t like this at all. \n else\n _color = get_color($datacolor, _color, _bgcolor)\n end\n value = getvalue_for_paint\n $log.debug(\"button repaint :#{self} r:#{r} c:#{c} col:#{_color} bg #{_bgcolor} v: #{value} ul #{@underline} mnem #{@mnemonic} datacolor #{$datacolor} \")\n len = @width || value.length\n @graphic = @form.window if @graphic.nil? ## cell editor listbox hack \n @graphic.printstring r, c, \"%-*s\" % [len, value], _color, attr()\n# @form.window.mvchgat(y=r, x=c, max=len, Ncurses::A_NORMAL, bgcolor, nil)\n # in toggle buttons the underline can change as the text toggles\n if @underline || @mnemonic\n uline = @underline && (@underline + @text_offset) || value.index(@mnemonic) || \n value.index(@mnemonic.swapcase)\n # if the char is not found don't print it\n if uline\n y=r #-@graphic.top\n x=c+uline #-@graphic.left\n #\n # NOTE: often values go below zero since root windows are defined \n # with 0 w and h, and then i might use that value for calcaluting\n #\n $log.error \"XXX button underline location error #{x} , #{y} \" if x < 0 or c < 0\n raise \" #{r} #{c} #{uline} button underline location error x:#{x} , y:#{y}. left #{@graphic.left} top:#{@graphic.top} \" if x < 0 or c < 0\n @graphic.mvchgat(y, x, max=1, Ncurses::A_BOLD|Ncurses::A_UNDERLINE, _color, nil)\n end\n end\n end", "def display_board\n row_idx = -1\n numera = [1,2,3,4,5,6,7,8,9]\n @display = @grid.map do |row|\n \n col_idx = -1\n row_idx += 1 \n row.map do |col| \n col_idx += 1 \n if @flag_pair.include? ((row_idx.to_s) + (col_idx.to_s))\n col = 'F'.orange\n elsif col == :B\n col = 'H'.green\n elsif (@known_empty.include? ((row_idx.to_s) + (col_idx.to_s))) && (numera.include? col)\n col = col.to_s.red\n elsif @known_empty.include? ((row_idx.to_s) + (col_idx.to_s))\n col = 'O'.blue\n else\n col = 'H'.green\n end \n end \n end\n end", "def button_down; end", "def process_button_down(button_id, point)\n ui_controls.each do |control|\n if(control.area.includes?(point))\n control.button_down(button_id, point)\n end\n end\n end", "def poll\n bc = bz = dl = dr = du = dd = false\n \n while true;\n read_packet;\n read_packet\n \n next unless read_packet\n \n if c_button_pressed? and !bc\n bc = true\n \n xinput.key_down! @map[:c]\n elsif !c_button_pressed? and bc\n bc = false\n \n xinput.key_up! @map[:c]\n end\n \n if z_button_pressed? and !bz\n bz = true\n \n xinput.key_down! @map[:z] \n elsif !z_button_pressed? and bz\n bz = false\n\n xinput.key_up! @map[:z]\n end\n \n if digital_right? and !dr\n dr = true\n \n xinput.key_down! @map[:right] \n elsif !digital_right? and dr\n dr = false\n \n xinput.key_up! @map[:right] \n end\n \n if digital_left? and !dl\n dl = true\n \n xinput.key_down! @map[:left] \n elsif !digital_left? and dl\n dl = false\n \n xinput.key_up! @map[:left] \n end \n\n if digital_up? and !du\n du = true\n \n xinput.key_down! @map[:up] \n elsif !digital_up? and du\n du = false\n \n xinput.key_up! @map[:up] \n end\n \n if digital_down? and !dd\n dd = true\n \n xinput.key_down! @map[:down] \n elsif !digital_down? and dd\n dd = false\n\n xinput.key_up! @map[:down]\n end \n\n sleep POLL_RATE \n end\n\tend", "def update_status\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Make command window active\r\n @command_window.active = true\r\n @status_window.active = false\r\n @status_window.index = -1\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Return if Disabled Command\r\n if disabled_main_command?\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Command Input\r\n sub_command_input\r\n return\r\n end\r\n end", "def draw?\n !(@board_game.hash_board.value?(\" \"))\n end", "def on_board?( position )\n position[ 0 ].ord >= 97 && \n position[ 0 ].ord <= 104 && \n position[ 1 ].to_i >= 1 && \n position[ 1 ].to_i <= 8 && \n end\n\n # See if another piece of the opposing color occupies the space; bool\n def capture?( position )\n ( white? && ( get_space( position ).token ) =~ /[prnbqk]/ ) || \n ( !white? && ( get_space( position ).token ) =~ /[PRNBQK]/ )\n end\n\n # Check for B/W; bool true for white\n def white?\n @color == \"White\" ? true : false\n end\n\n # See if space is occupied by piece of same color; bool\n def empty?( *positions )\n positions.all? { | position | get_space( position ).token =~ /_/ }\n end\n\nend", "def keys_down? *key_symbols\n key_symbols.each do |key_symbol|\n return false unless key_down? key_symbol\n end\n return nil if key_symbols.empty?\n return true\n end", "def view_board\n row = [\"A\",\"B\",\"C\"]\n i = 0\n puts \" 1 2 3\"\n puts \" ___________\"\n @@tab.each do |y|\n puts \"#{row[i]}: | #{y[0].status} | #{y[1].status} | #{y[2].status} |\"\n puts \" |___________|\"\n i +=1\n end\n end", "def pressed?\n low?\n end", "def button_down(id); end", "def victory?\n self.grid.flatten.select {|space| !space.mine }.\n all? {|space| space.visible }\n end", "def key_pressed?(key)\n SDL::Key.press?(key)\n end", "def button_down_main_menu_presenter(id, window, state)\n case id\n when Gosu::MsLeft\n navigate_to(window, Presenter::HOW_TO_PRESENTER) if mouse_over_button(state[:buttons][:how_to], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::DEPTH_FIRST}) if mouse_over_button(state[:buttons][:depth_first], window.mouse_x, window.mouse_y)\n navigate_to(window, Presenter::MAZE_PRESENTER, { algorithm: MazeAlgorithm::ITERATIVE_DIVISION}) if mouse_over_button(state[:buttons][:iterative_division], window.mouse_x, window.mouse_y)\n window.close if mouse_over_button(state[:buttons][:quit], window.mouse_x, window.mouse_y)\n end\nend", "def controller_tech_demo\n x = 460\n outputs.labels << small_label(x, 6, \"Controller one input: inputs.controller_one\")\n outputs.labels << small_label(x, 7, \"Current state of the \\\"a\\\" button.\")\n outputs.labels << small_label(x, 8, \"Check console window for more info.\")\n\n if inputs.controller_one.key_down.a # if \"a\" is in \"down\" state\n outputs.labels << small_label(x, 9, \"\\\"a\\\" button down: #{inputs.controller_one.key_down.a}\")\n puts \"\\\"a\\\" button down at #{inputs.controller_one.key_down.a}\" # prints frame the event occurred\n elsif inputs.controller_one.key_held.a # if \"a\" is held down\n outputs.labels << small_label(x, 9, \"\\\"a\\\" button held: #{inputs.controller_one.key_held.a}\")\n elsif inputs.controller_one.key_up.a # if \"a\" is in up state\n outputs.labels << small_label(x, 9, \"\\\"a\\\" button up: #{inputs.controller_one.key_up.a}\")\n puts \"\\\"a\\\" key up at #{inputs.controller_one.key_up.a}\"\n else # if no event has occurred\n outputs.labels << small_label(x, 9, \"\\\"a\\\" button state is nil.\")\n end\n\n # border around controller input demo section\n outputs.borders << [455, row_to_px(10), 360, row_to_px(6).shift_up(5) - row_to_px(10)]\n end", "def update_inputs\n return false if @entering || @quiting\n if index_changed(:@index, :UP, :DOWN, @max_index)\n play_cursor_se\n update_buttons\n elsif Input.trigger?(:A)\n action\n elsif Input.trigger?(:B)\n @running = false\n else\n return true\n end\n return false\n end", "def key_pressed?(key)\n @prev_down.index(key).nil? and @down.index(key)\n end", "def levels_screen_inputs\n index = Options::LEVELS_SCREEN.find_index @settings_hovered\n if button_up? Gosu::KB_S\n if index == 2\n @settings_hovered = Options::LEVELS_SCREEN[0]\n else\n index += 1\n @settings_hovered = Options::LEVELS_SCREEN[index]\n end\n elsif button_up? Gosu::KB_W\n if index == 0\n @settings_hovered = Options::LEVELS_SCREEN[2]\n else\n index -= 1\n @settings_hovered = Options::LEVELS_SCREEN[index]\n end\n elsif button_up? Gosu::KB_SPACE\n if @settings_hovered == \"Easy\"\n @game_settings.cpu_difficulty = 1\n elsif @settings_hovered == \"Medium\"\n @game_settings.cpu_difficulty = 4\n elsif @settings_hovered == \"Hard\"\n @game_settings.cpu_difficulty = 10\n end\n @game_settings.current_screen = \"game\"\n end\n end", "def keyboard_block_shortcuts\n return @keyboard_block_shortcuts\n end", "def board\n end", "def view_board\n row = [\"A\",\"B\",\"C\"]\n i = 0\n puts \" 1 2 3\"\n puts \" -------------\"\n @@tab.each do |y|\n puts \"#{row[i]}: | #{y[0].status} | #{y[1].status} | #{y[2].status} |\"\n puts \" -------------\"\n i +=1\n end\n end", "def button_down(key)\n end", "def can_have_cells?\n definition['cells'].present?\n end", "def win_checker\n @board.flatten.max == 16_384\n end", "def draw?\n if !won?\n board.cells.each do |i|\n if i == \" \"\n return false\n end\n true\n end\n end\n \n end" ]
[ "0.5801726", "0.5780867", "0.5749513", "0.56723183", "0.549728", "0.538721", "0.5328305", "0.52946013", "0.52397746", "0.523253", "0.5178944", "0.51389897", "0.51240396", "0.51164967", "0.5088872", "0.5026192", "0.50200725", "0.5017379", "0.50160444", "0.50158507", "0.49994236", "0.4986088", "0.49593145", "0.4958661", "0.49575302", "0.49481118", "0.493102", "0.4912348", "0.48961553", "0.4887217", "0.48833752", "0.48821947", "0.4876106", "0.48738113", "0.48729444", "0.48667014", "0.48580718", "0.4856264", "0.4854155", "0.482017", "0.48200086", "0.48163062", "0.4806864", "0.4803189", "0.47911474", "0.47882822", "0.4787375", "0.47848094", "0.47835797", "0.4781003", "0.47786978", "0.47758478", "0.47719154", "0.47668493", "0.47608793", "0.47579414", "0.4752609", "0.4751628", "0.47391894", "0.47236854", "0.47230875", "0.47193596", "0.47181958", "0.47145966", "0.4707669", "0.46901497", "0.4690102", "0.46842554", "0.4671449", "0.46690407", "0.46652514", "0.4661033", "0.46534786", "0.46377063", "0.46310627", "0.46274447", "0.46241537", "0.46231383", "0.4623024", "0.4616945", "0.46112758", "0.46091405", "0.46044487", "0.4602535", "0.45999265", "0.45948163", "0.4594704", "0.45909604", "0.45865884", "0.4583839", "0.45823106", "0.45810634", "0.45796746", "0.45793903", "0.45740348", "0.45725706", "0.45679364", "0.45674336", "0.45583326", "0.45555198", "0.45467505" ]
0.0
-1
Override in the subclass to provide a place to do initialization of game logic, load files, set up state, etc
def game_setup end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize()\n @tileset = Gosu::Image.load_tiles(\"media/tileset.png\", TILE_WIDTH, TILE_HEIGHT, tileable: true)\n\n # Load images here so they will only be loaded once per game\n @enemyAnimation = *Gosu::Image.load_tiles(\"media/enemy_char.png\", Enemy::WIDTH, Enemy::HEIGHT)\n @portalAnimation = *Gosu::Image.load_tiles(\"media/portal.png\", Portal::WIDTH, Portal::HEIGHT)\n @diamondImg = Gosu::Image.new(\"media/diamond.png\")\n\n # Load all the stages in to an array\n @stages = Dir.glob('stages/*').select { |e| File.file? e }\n @finalStage = false\n end", "def initialize(*args)\n super\n @game = Game.new\n\n @changelog = self.load_changelog\n\n @mods = config[:mods]\n @channel_name = config[:channel]\n @settings_file = config[:settings]\n @games_dir = config[:games_dir]\n\n @idle_timer_length = config[:allowed_idle]\n @invite_timer_length = config[:invite_reset]\n\n @idle_timer = self.start_idle_timer\n\n @game_timer_minutes = nil\n @game_timer = nil\n end", "def initialize\n\t \t# loading or not loading should be the key here.\n end", "def initialize()\n original_dir = Dir.pwd\n Dir.chdir(__dir__)\n\n classes_before = ObjectSpace.each_object(Class).to_a\n Dir[\"../model/game/*\"].each {|file|\n require_relative file\n }\n Dir.chdir(original_dir)\n\n classes_after = ObjectSpace.each_object(Class).to_a\n @modes_loaded = classes_after - classes_before\n\n @game_started = false\n @observer_views = []\n @players = []\n @clients_players = Hash.new\n @board = nil\n @clients_board = nil\n @player_playing = nil\n @clients_player_playing_index = nil\n @AI_players = 0\n # http://docs.ruby-lang.org/en/2.0.0/Hash.html\n @game_history = Hash.new(-1)\n @turn = 1\n @online_mode = false\n @player_name = nil\n @player_id = 1\n @save_requests_received = Hash.new(0)\n @turn_which_save_was_requested = -1\n @continuing_game = false\n end", "def initialise(loadfile)\n\n # Initialise steps\n\n phases = Phases.new\n $commands = Commands.new\n \n if $testing == 1\n require_relative 'Testing.rb'\n require_relative '../Extra/Parser.rb'\n end\n \n if $debugplay == 1\n $debug.debugplay\n end\n \n # Initialise graphics if graphics mode is on\n #if $graphics == 1\n #require 'RMagick'\n require_relative '../Graphics/GraphicsHandler.rb'\n #graphicsinit\n #end\n \n #system(\"unzip ../Resources/Images.zip\")\n \n \n # Load game\n if $loadgame == true\n loadgame(loadfile)\n end\n \n # Set command authentication levels\n IO.foreach(\"cards.txt\") { |line| puts line }\n \nend", "def initialize_game\n setup_boards\n end", "def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end", "def initialize \n # Keep track of hooks and what object owns what\n @hooks = {}\n @cmds = {}\n @modules = {}\n\n # Prevent access to hooks when other things are\n # editing or using them.\n @hooks_mutex = Mutex.new\n end", "def initialize \n super(ScreenWidth, ScreenHeight, false)\n self.caption = \"Mad Pokemon\"\n $window = self\n\n @@images = Hash.new\n @@fonts = Hash.new \n load_images\n load_fonts\n\n @@fading_off = false\n @@fading_on = false\n @@end_fade = 0\n @@start_fade = 0\n\n @@change_game_state = nil\n\n @@game_state = MenuState.new\n end", "def on_init; end", "def on_init; end", "def initialize\n Game.engine.draw(Game.engine.markdown.parse('# Bandit Mayhem'))\n selection = Game.engine.prompt.select('Select an option', 'New game', 'Load game', 'Quit')\n\n case selection\n when 'New game'\n save_name = Game.engine.prompt.ask('Enter save name:', default: 'bandit-mayhem')\n\n Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n\n # intro\n Cinematic.new('intro').play\n\n @quit = false\n when 'Load game'\n Game.load_save if File.exist?(DEFAULT_SAVE)\n # TODO fix\n # Game.player = Player.new(name: 'Nigel', health: 30, x: 1, y: 5, map: BanditMayhem::Map::Map.new('lynwood/strick_household'))\n @quit = false\n when 'Quit'\n @quit = true\n end\n end", "def post_init\n end", "def load_game\n require './game/setup.rb'\n end", "def initialize(parent_wnd)\r\n super(parent_wnd)\r\n \r\n @core_game = nil\r\n @splash_name = File.join(@resource_path, \"icons/mariazza_title_trasp.png\")\r\n @algorithm_name = \"AlgCpuMariazza\" \r\n #core game name (created on base class)\r\n @core_name_class = 'CoreGameMariazza'\r\n \r\n # game commands\r\n @game_cmd_bt_list = []\r\n\r\n ## NOTE: don't forget to initialize variables also in ntfy_base_gui_start_new_game\r\n end", "def initialize\n @imgs = {}\n @global_imgs = {}\n @tilesets = {}\n @global_tilesets = {}\n @sounds = {}\n @global_sounds = {}\n @songs = {}\n @global_songs = {}\n @fonts = {}\n @global_fonts = {}\n\n @prefix = File.expand_path(File.dirname($0)) + '/data/'\n @img_dir = 'img/'\n @tileset_dir = 'tileset/'\n @sound_dir = 'sound/'\n @song_dir = 'song/'\n @font_dir = 'font/'\n @separator = '_'\n @retro_images = false\n end", "def initialize fps, title\n # The sprite and sound managers.\n @spriteManager = SpriteManager.new\n @soundManager = SoundManager.new 3\n\n # Number of frames per second.\n @framesPerSecond = fps\n\n # Title in the application window.\n @windowTitle = title\n\n # create and set timeline for the game loop\n buildAndSetGameLoop\n end", "def initialize!\n $sfxengine = SoundEngine.new\n\n GameMode.enter_name_input =\n Text.new(\n Settings.winX/2,\n Settings.winY/2,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"\")\n GameMode.enter_name_headline =\n Text.new(\n Settings.winX/2,\n Settings.winY*0.35,\n Settings.fontsize,\n Color.new(0, 255, 0, 0.8),\n Settings.fontfile,\n \"enter name\")\n\n GameMode.fader = Rect.new(0, 0, Settings.winX, Settings.winY)\n GameMode.fader.colors = ColorList.new(4) { |i| Color.new(0, 0, 0, 0.8) }\n\n @ingame_timer = Timer.new\n @external_timer = Timer.new\n @engine_running = true\n @score_object = Score.new\n\n $gfxengine.prepare # TODO put to end, remove things mouse depends on!\n @mouse = Mouse.new(100, 100, Settings.mousedef)\n @score_object.cur_level = 0\n start_level @score_object.cur_level\n @textbuffer = \"\"\n GameMode.set_mode(GameMode::NORMAL)\n end", "def run_init_script; end", "def init; end", "def init; end", "def init; end", "def init; end", "def loadGame()\n\nend", "def Init()\n end", "def post_init\n\tend", "def post_init\n end", "def at_init\n\n\t\tend", "def init\n\t\t## Pathfind\n\t\t#@pathfind = Pathfind.new\n\n\t\t## Add player\n\t\t@player = Player.new #spawn: @room.get_spawn\n\n\t\t## Song controller\n\t\t@song = SongController.new\n\n\t\t## Only load one level\n\t\t@level = load_level @level_name\n\n\t\t#@room = @levels[@level_name].rooms.first unless (@levels[:first].nil?)\n\t\t@room = @level.get_room @room_name\n\t\t@player.move_to_spawn @room.get_spawn\n\n\t\tputs \"Level: #{@level.name}\"\n\t\tputs \" Room: #{@room.name}\"\n\t\tputs \"INSTANCE_COUNT:\\n\\tsolid:\\t\\t#{@room.instances[:solid].size}\"\n\t\tputs \"\\tpassable:\\t#{@room.instances[:passable].size}\"\n\n\t\t## Init Pathfinder\n\t\t#@pathfind.pathfind_init\n\t\t## Add Solid blocks to pathfind grid (bootstrap it)\n\t\t#@pathfind.add_solids @room.get_instances(:solid)\n\n\t\ttracker0 = Tracker.new pos: @player.pos, track: @player\n\t\ttracker1 = Tracker.new pos: @player.pos, track: tracker0\n\t\ttracker2 = Tracker.new pos: @player.pos, track: tracker1\n\t\ttracker3 = Tracker.new pos: @player.pos, track: tracker2\n\t\ttracker4 = Tracker.new pos: @player.pos, track: tracker3\n\t\ttracker5 = Tracker.new pos: @player.pos, track: tracker4\n\n\t\t@entities = [\n\t\t\t@player,\n\t\t\tEnemy.new,\n\t\t\ttracker0, tracker1, tracker2, tracker3, tracker3, tracker4, tracker5\n\t\t]\n\n\t\t## Move camera to player\n\t\t$camera.center_on x: @player.pos(:x), y: @player.pos(:y)\n\n\t\t## Font for FPS display\n\t\t@font_fps = Gosu::Font.new 32\n\n\t\t## For consequtive updating of entities, instead of all at once\n\t\t#@update_entity_index = 0\n\tend", "def initialize\n @game_settings = GameSettings.new\n super 920, 480\n self.caption = GAME_TITLE\n @settings_hovered = Options::START_SCREEN[0]\n @title_font, @subtitle_font = Gosu::Font.new(50), Gosu::Font.new(20)\n @background_image = Gosu::Image.new(\"media/background1.jpg\", :tileable => true)\n @blank_card = Gosu::Image.new(\"media/card.png\", :tileable => true)\n @button_option = Gosu::Image.new(\"media/button.png\", :tileable => true)\n @deck = Deck.new\n @playing_cards = Array.new\n @computer_signal = ComputerTimer.new\n @players_created, @mes, @false_mes, @true_mes, @trying_mes = false, false, false, false, false\n @hint = []\n #players\n @pressed, @p1, @p2 = nil, nil, nil\n @game_timer = Timers.new\n end", "def initialize\n\n @prompt = TTY::Prompt.new\n escape_to_welcome\n LoadAssets.load_logo\n\n end", "def initialize(window)\n @terrain = Gosu::Image::load_tiles(window, \"media/Terrain.png\", TILE_WIDTH, TILE_HEIGHT * 2, true)\n @window = window\n\n @level = 0\n\n @start_x = 0\n @start_y = 0\n\n load_level(\"levels/level0.lvl\")\n end", "def init\n\nend", "def viewDidLoad \n super\n self.new_game \n self.init_views\n\n end", "def init\n end", "def init\n end", "def init\n end", "def init\n\n end", "def InitializeHooks\n end", "def setup (game)\n\t\t# #@height = hgt\n\t\t# #@width = wdth\n\t\t# flash[:notice] = \"hello world\"\n\t\t#super.initialize(game)\n\t\trequire 'Time'\n\t\tt = Time.utc(nil,nil,days,hours,minutes,nil)\n\t\t@turn_speed = t\n\tend", "def initialize(options = {})\n options = default_options.merge(options)\n require_keys!(options, [:engine_path, :movetime])\n @movetime = options[:movetime]\n\n set_debug(options)\n reset_board!\n set_startpos!\n\n check_engine(options)\n set_engine_name(options)\n open_engine_connection(options[:engine_path])\n set_engine_options(options[:options]) if !options[:options].nil?\n new_game!\n end", "def init\n Runner.in_shell = true\n Command.all_option_commands = true if @options[:option_commands]\n super\n Index.update(:verbose=>true, :libraries=>@options[:index]) if @options.key?(:index)\n if @options[:load]\n Manager.load @options[:load], load_options\n elsif @options[:execute]\n define_autoloader\n else\n load_command_by_index\n end\n end", "def initialize\n super\n init_conditions\n init_indexes\n @index = $game_temp.last_menu_index\n @index = 0 if @index >= @image_indexes.size\n @max_index = @image_indexes.size - 1\n @quiting = false # Flag allowing to really quit\n @entering = true # Flag telling we're entering\n @counter = 0 # Animation counter\n @in_save = false\n @mbf_type = @mef_type = :noen if $scene.is_a?(Scene_Map)\n end", "def init\r\n @tasks = {\r\n on_update: {},\r\n on_scene_switch: {},\r\n on_dispose: {},\r\n on_init: {},\r\n on_warp_start: {},\r\n on_warp_process: {},\r\n on_warp_end: {},\r\n on_hour_update: {},\r\n on_getting_tileset_name: {},\r\n on_transition: {}\r\n }\r\n @storage = {}\r\n end", "def initialize(file_name)\n super()\n # prep some working variables\n @jump = [0, 15, false] # [hight, time, grounded?]\n @swimming = false\n @climbing = false\n # set screen camera\n @camera_pending_move_x = 0\n @camera_pending_move_y = 0\n @camera_should_x = 0\n @camera_should_y = 0\n @camera_is_x = 0\n @camera_is_y = 0\n @map_name = file_name\n # map properties\n @@tilemap = nil\n end", "def init\n\t\t@state = NewGame.new(self)\n\t\t# Deck.create({:game => self})\n\tend", "def initialize\n super(640, 400, false)\n self.caption = 'Tennis Game'\n\n @player = Player.new(self)\n @player2 = Player2.new(self)\n @help = TextBox.new(self, \"Press O to activate 2P\", 193, 500)\n @bot = Bot.new(self)\n @ball = Ball.new(self)\n @wall = Wall.new(self)\n @score = Score.new(self)\n @twoplayer = false\n @game_over = false\n\n @music = Gosu::Song.new('media/rick.ogg')\n # @music.play(true)\n end", "def initialize\n super(WIDTH, HEIGHT)\n self.caption = 'Sector Five'\n @background_image = Gosu::Image.new('images/start_screen.png')\n @scene = :start\n\n @game = GameService.new(self)\n end", "def init_for_battle\n super\n self.song_count = 0\n initialize_anger\n end", "def init_file; end", "def setup\n super\n @background = Image['Bg level1.png']\n viewport.lag = 0\n viewport.game_area = [0, 0, 3000, 1000]\n @gilbert = Gilbert.create(x: 50, y: 900, limited: viewport.game_area.width)\n @level = File.join(ROOT, 'levels', self.filename + '.yml')\n load_game_objects(file: @level)\n\n @plataformas = Plataforma2.all\n @music = Song.new('media/Songs/Music Level1.mp3')\n @loser_song = Song.new('media/Songs/gameover.ogg')\n\n @moneda = Moneda.all.first\n\n @meta_on = false\n\n @marco_name = Image['MarcoName.png']\n @marco_score = Image['MarcoPoint.png']\n\n @score = 0\n @msj_name = Chingu::Text.new(@player_name, x: 85, y: 25, size: 30, color: Gosu::Color::WHITE)\n @msj_score = Chingu::Text.new(@score.to_s, x: $window.width - 130, y: 30, size: 35)\n @mensaje = Chingu::Text.new('Has encontrado todas las monedas', x: 320, y: 20, size: 25, color: Gosu::Color::GREEN)\n @mensaje2 = Chingu::Text.new('Encuentra la Meta', x: @msj_name.x, y: 45, size: 30, color: Gosu::Color::YELLOW)\n\n @music.play(true) if @sonido\n end", "def init; end", "def initialize\n @screen = Game_Screen.new\n @interpreter = Game_Interpreter.new(0, true)\n @map_id = 0\n @display_x = 0\n @display_y = 0\n create_vehicles\n end", "def init(filepath)\n\t\tsuper # This loads the parent's init method (which stores self.root)\n\tend", "def initialize\n super(WIDTH * SCALE, HEIGHT * SCALE, false)\n self.caption = \"Commander Keen in Revenge of the Shikadi!\"\n\n @level = Level.new(self)\n @player = Player.new(self, @level.start_x, @level.start_y)\n\n @menu_options = [\n :Play,\n :Instructions,\n :\"Save/Load\",\n :Quit\n ]\n\n @menu_selection = 0\n\n @state = :menu\n @paused = false\n end", "def initialize(objects = nil)\n Aethyr::Extend::HandlerRegistry.handle(self)\n\n @soft_restart = false\n @storage = StorageMachine.new\n @uptime = Time.new.to_i\n @future_actions = PriorityQueue.new\n @pending_actions = PriorityQueue.new\n\n unless objects\n @cancelled_events = Set.new\n\n log \"Loading objects from storage...\"\n @game_objects = @storage.load_all(false, CacheGary.new(@storage, self))\n log \"#{@game_objects.length} objects have been loaded.\"\n\n @calendar = Calendar.new\n\n @event_handler = EventHandler.new(@game_objects)\n\n @running = true\n else\n @game_objects = objects\n end\n end", "def initialize(install_path, game_path)\n @install_path = install_path\n @game_path = game_path\n # Set of scripts that have been run\n @runs = {}\n end", "def init_state_handler\n set_state_handler(:start)\n set_state_handler(:change)\n set_state_handler(:player)\n set_state_handler(:enemy)\n set_state_handler(:friend)\n set_state_handler(:over)\n end", "def initialize\n puts 'Welcome to the Casino'.colorize(:blue)\n @player = Player.new #seeing new here so it means its going to the class listed and runs the initi method\n puts \"what game do you want to play #{player.name}?\"\n #show a casino game menu\n #let the player choose a game\n # initialize the new game, passing the player as a parameter\n end", "def initialize\n\tinit\n\tsuper\nend", "def on_load\n\t\t#\n\t\t# Setup constants\n\t\t#\n\t\tself[:volume_min] = 0\n\t\tself[:volume_max] = 31\n\t\tself[:brightness_min] = 0\n\t\tself[:brightness_max] = 31\n\t\tself[:contrast_min] = 0\n\t\tself[:contrast_max] = 60\t# multiply by two when VGA selected\n\t\t#self[:error] = []\t\tTODO!!\n\t\t\n\t\tbase.default_send_options = {\n\t\t\t:delay_on_recieve => DelayTime,\t\t# Delay time required between commands\n\t\t\t:retry_on_disconnect => false,\t\t# Don't retry last command sent as we need to login\n\t\t\t:timeout => 6\n\t\t}\n\t\t#base.config = {\n\t\t#\t:clear_queue_on_disconnect => true\t# Clear the queue as we need to send login\n\t\t#}\n\t\t@poll_lock = Mutex.new\n\tend", "def setup\n\t\tsuper\n\t\t@x = 400\n\t\t@y = 300\n\t\t#@image = Gosu::Image[\"Ship.png\"]\n\t\t self.input = {\n\t\t \tholding_left: :left,\n\t\t \tholding_right: :right,\n\t\t \tholding_up: :up,\n\t\t \tholding_down: :down,\n\t\t \tspace: :fire\n\t\t }\n\t\t@speed = 10\n\t\t@angle = 0\n\t\t@animation = Chingu::Animation.new(:file => \"flame_48x48.bmp\")\n\t\t@animation.frame_names = { :still =>0..1, :up =>2..5, :fire =>6..7}\n# :still =>0..1, :fire =>6..7, :up =>2..5\n\t\t@frame_name = :still\n\t\t@last_x, @last_y = @x, @y\n\tend", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n create_command_window()\n @status_window = Window_Party_Status.new(0, 0, 480,424, $game_party.members)\n @menu_info_window = Window_Menu_Info.new(0,424,640,56)\n end", "def user_init; end", "def pre_initialize( *args, & block )\n # call to super in case we extend Class or Module, so we can stack calls to pre_initialize\n super if defined?( super )\n # nothing here - subclasses define\n end", "def initialize\n @next_scene = nil\n @map_bgm = nil\n @map_bgs = nil\n @common_event_id = 0\n @in_battle = false\n @battle_proc = nil\n @shop_goods = nil\n @shop_purchase_only = false\n @name_actor_id = 0\n @name_max_char = 0\n @menu_beep = false\n @last_file_index = 0\n @debug_top_row = 0\n @debug_index = 0\n @background_bitmap = Bitmap.new(1, 1)\n end", "def start\n\t\tinit\n\t end", "def initialize(scene)\n super(800,600, false)\n self.caption = \"Ruby Ren'ai Game Engine\"\n @hidden = false\n @script = Script.new(self)\n @graphics = Graphics.new(self)\n @clickables = Array.new\n @music = Music.new(self)\n @scriptreader = ScriptReader.new(self, scene || \"mainmenu\")\n @time = Gosu::milliseconds\n advance\n end", "def init\n fname = path(\"init.rb\")\n load fname unless fname.nil?\n end", "def initialize\n init\n end", "def initialize_players\n\n end", "def initialize\n greeting\n init_players\n end", "def onStart()\n\t\t\tputs 'onStart method has not been overridden!'\n\t\tend", "def post_initialize\n # raise NotImplementedError\n end", "def initialize window, x, y\n images = Gosu::Image::load_tiles(window, \"media/SlugSlime.png\", WIDTH, HEIGHT, true)\n\n super(window, x, y, WIDTH, HEIGHT, images)\n\n @creation_milliseconds = Gosu.milliseconds\n end", "def initialize(...)\n super\n mon_initialize\n end", "def initialize()\n begin\n puts \"Eis::Runner::init called\" if $DEBUG\n @loaded_modules = []\n generate_module_list()\n handle = InputHandler.new()\n set_environment()\n rescue ArgumentError =>e\n puts \"\\e[31mERROR\\e[0m: No config file given...\" + e\n puts \"--------------------------------------------\"\n raise\n end\n end", "def loaded()\n end", "def initialize\n super\n \n run_hook :before_configuration\n \n # Search the root of the project for required files\n $LOAD_PATH.unshift(root)\n \n # Check for and evaluate local configuration\n local_config = File.join(root, \"config.rb\")\n if File.exists? local_config\n puts \"== Reading: Local config\" if logging?\n instance_eval File.read(local_config)\n end\n \n run_hook :build_config if build?\n run_hook :development_config if development?\n \n run_hook :after_configuration\n \n # Add in defaults\n default_extensions.each do |ext|\n activate ext\n end\n \n if logging?\n self.class.extensions.each do |ext|\n puts \"== Extension: #{ext}\"\n end\n end\n end", "def pre_initialize; end", "def initialize\n super(RESOLUTION[0], RESOLUTION[1], {:update_interval => UP_MS_DRAW, :fullscreen => ISFULLSCREEN})\n $program = self # global pointer to window creation object\n controls_init # prep the input controls scheme manager\n gl_version = glGetString(GL_VERSION).to_s\n gl_version = gl_version.split(' ')\n @openGL_version = Gem::Version.new(gl_version[0])\n puts(\"Using OpenGL version: #{@openGL_version} On a #{gl_version[1]} Driver Version: #{gl_version[2]}\")\n puts(\"*\" * 70)\n @@active_state = Map.new( { :level => \"\" } )\n end", "def initialize\n @width = 800\n @width_tiles = @width / 32\n @height = 640\n @height_tiles = @height / 32\n @keys = []\n super(@width, @height, fullscreen = false)\n self.caption = \"Aetheris\"\n\n @spell = Gosu::Image.new(Utils.image_path_for(\"explosion\"), rect: [0, 0, 32 * 3, 32 * 3])\n @spell_cooldown = 0\n @game_name = Gosu::Image.from_text(\"Aetheris\", 100)\n @player = Player.new(self)\n @npc = NPC.new\n @player.warp(300, 200)\n @visibility = { fog: 3 }\n @map = Gosu::Image.new(\"images/map.jpg\")\n @low_grass = @map.subimage(32, 32 * 2, 22, 22)\n @camera = Camera.new(x: 0, y: 0, width: WIDTH, height: HEIGHT)\n @interacting = false\n @spell_avalanche_of_fire = nil\n end", "def initialize\n super()\n init_data()\n end", "def initialize\n\t\t\n\tend", "def initialize\n @name_boy = default_male_name\n @name_girl = default_female_name\n $game_switches[Yuki::Sw::Gender] = @playing_girl = false\n $game_variables[Yuki::Var::Player_ID] = @id_boy = rand(0x3FFFFFFF)\n @id_girl = (@id_boy ^ 0x28F4AB4C)\n @start_time = Time.new.to_i\n @play_time = 0\n @badges = Array.new(6 * 8, false)\n @region = 0\n @game_version = PSDK_CONFIG.game_version\n @current_version = PSDK_Version rescue 0\n @time_counter = 0\n load_time\n end", "def initialize()\r\n\r\n end", "def init_core_game(options)\r\n if options[:netowk_core_game]\r\n # we are on network game, use NAL class for core game\r\n @core_game = options[:netowk_core_game]\r\n @core_game.set_custom_core( create_instance_core() )\r\n @core_game.custom_core.create_deck\r\n @log.debug \"using network core game\"\r\n elsif options[:custom_deck]\r\n @core_game = create_instance_core()\r\n @log.debug \"using local cpu core CUSTOM deck\"\r\n @core_game.rnd_mgr = options[:custom_deck][:deck]\r\n # say to the core we need to use a custom deck\r\n @core_game.game_opt[:replay_game] = true \r\n else\r\n # local game\r\n @core_game = create_instance_core()\r\n @core_game.set_specific_options(options)\r\n @log.debug \"using local cpu core\"\r\n @mnu_salva_part.enable if @mnu_salva_part\r\n end\r\n end", "def initialize(battle_info)\n # Call the initialize of GamePlay::Base (show message box at z index 10001)\n super(false, 10_001)\n @battle_info = battle_info\n $game_temp.vs_type = battle_info.vs_type\n $game_temp.trainer_battle = battle_info.trainer_battle?\n $game_temp.in_battle = true\n @logic = create_logic\n @logic.load_rng\n @logic.load_battlers\n @visual = create_visual\n @AIs = Array.new(count_ai_battler) { create_ai }\n # Next method called in update\n @next_update = :pre_transition\n # List of the player actions\n @player_actions = []\n # Battle result\n @battle_result = :draw\n # All the event procs\n @battle_events = {}\n # Skip the next frame to go faster in the next update\n @skip_frame = false\n # Create the message proc\n create_message_proc\n # Init & call first event\n load_events(logic.battle_info.battle_id)\n call_event(:logic_init)\n end", "def initialize\n # kosong\n end", "def onStart\r\n end", "def initialize(*args)\n super\n mon_initialize\n end", "def post_initialize\n end", "def initialize level\n\t\t@tile_size = 32\n\t\t@level = level + 1\n\t\t@num_enemies = 0\n\t\tloadlevel\n\t\tloadgraphics\n\t\tinterpret\n\t\tcreate_tiles\n\t\tfind_player_index\n\t\t@travel = 0\n\tend", "def initialize\n\n\n\n end", "def initialize()\n\t\tend", "def pre_initialize\n end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def init_game\n @io.welcome_msg\n @num_decks = @io.get_num_decks \n @player_cnt = @io.get_player_cnt(@max_players)\n players_names = @io.get_players_names\n\n # Initialize player objects\n 0.upto(players_names.length - 1) do |x|\n @players[x] = Player.new(players_names[x], @bankroll)\n end\n\n # Create the dealer and add as a player\n @dealer = Dealer.new\n @dealer.hit_soft_17 = @hit_soft_17\n @players[@players.length] = @dealer\n end", "def initialize session_id\n @session_id = session_id\n\n # The command will be passed to the game instance first\n # and the game instance should notify the decision manager.\n @decision_manager = DecisionManager.new\n\n # After the decision manager filter the commands,\n # other managers should continue to process the command respectively.\n @player_manager = PlayerManager.new\n @score_board_manager = ScoreBoardManager.new\n @word_manager = WordManager.new\n\n @state_manager = StateManager.new @player_manager, @score_board_manager, @word_manager\n\n end" ]
[ "0.7197501", "0.6927094", "0.68548703", "0.68363637", "0.67903966", "0.6709493", "0.6681035", "0.66754824", "0.6657464", "0.6593433", "0.6593433", "0.6568565", "0.6536359", "0.6532853", "0.65298796", "0.6522084", "0.6518121", "0.6491702", "0.64911246", "0.64601445", "0.64601445", "0.64601445", "0.64601445", "0.6441526", "0.6423529", "0.6421361", "0.64070183", "0.63972855", "0.63967264", "0.6387362", "0.63830525", "0.63802713", "0.63788354", "0.63711864", "0.6350821", "0.6350821", "0.6350821", "0.63365936", "0.63184696", "0.6315001", "0.6314586", "0.63091755", "0.6309089", "0.6302083", "0.6294025", "0.62577367", "0.62366724", "0.62366295", "0.62350416", "0.62322897", "0.62278587", "0.62099814", "0.6196028", "0.6178153", "0.6164957", "0.6154115", "0.61509115", "0.61453575", "0.6140602", "0.6138123", "0.61372846", "0.61147135", "0.6110593", "0.610351", "0.6099157", "0.60965735", "0.60797024", "0.6074938", "0.607425", "0.6070928", "0.6065724", "0.6061212", "0.6055342", "0.60525924", "0.6050362", "0.6033013", "0.60296595", "0.602829", "0.60249317", "0.60164356", "0.6014976", "0.60122025", "0.6008919", "0.6008526", "0.6008382", "0.6001065", "0.59971756", "0.59912276", "0.59865016", "0.59844595", "0.5980293", "0.5979327", "0.59774005", "0.597397", "0.5959319", "0.5956764", "0.59536266", "0.59536266", "0.5948146", "0.5947582" ]
0.7465463
0
Called every update interval while the console is being shown
def game_loop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_screen(output)\n if output != $last_update\n clear_screen\n puts(output)\n end\nend", "def update\n return if @destoryed\n super\n #---------------------------------------------------------\n # debug information:\n unless DEBUG_PRINT_WAIT.nil?\n if @time_between_debug_prints <= 0\n @time_between_debug_prints = DEBUG_PRINT_WAIT\n #puts(get_debug_string)\n else\n @time_between_debug_prints -= 1\n end\n end\n end", "def init_display_updater(fps = 20)\n\n Raise ArgumentError, \"Argument must be numeric\" if not fps.is_a? Numeric\n\n Thread.new do\n while true\n\n # Update current calculation display\n @screen.text = @calculator_api.calculation_string\n @screen.text = \"0\" if @screen.text == \"\"\n\n #update historical display\n @history_buffer.set_text @calculator_api.ticker_value\n @history.show if @history_buffer.get_text != \"\"\n @history.hide if @history_buffer.get_text == \"\"\n\n # pause 1/20th of a second\n sleep Rational(1) / Rational(fps) # 20 FPS\n\n end\n end\n end", "def listen\n # if the user resizes the screen we redraw it to fit the new dimensions\n Console.set_console_resized_hook! do\n draw\n end\n\n # create an interaction object to handle user input\n interaction = Interaction.new\n\n # call draw here because interaction blocks until it gets input\n draw\n\n # loop over user input (individual keypresses)\n interaction.loop do |key|\n @last_key = key\n if key == \"q\" then\n interaction.quit!\n end\n draw\n end\n end", "def init_text\n puts 'Iniciando programa'\n print '.'\n sleep(0.3)\n print '.'\n sleep(0.3)\n print '.'\n print \"\\n\"\nend", "def update\n super\n # blinking period of 1 second\n @frame = (@frame + 1) % 20\n update_input\n update_cursor\n end", "def update\r\n # タイマー作動中なら可視に設定\r\n self.visible = $game_system.timer_working\r\n # タイマーを再描画する必要がある場合\r\n if $game_system.timer / 60 != @total_sec # Graphics.frame_rate\r\n # トータル秒数を計算\r\n @total_sec = $game_system.timer / 60#Graphics.frame_rate\r\n # タイマー表示用の文字列を作成\r\n min = @total_sec / 60\r\n sec = @total_sec % 60\r\n # タイマーを描画\r\n self.text = sprintf(\"%02d:%02d\", min, sec)\r\n end\r\n end", "def update(elapsed)\n \n end", "def refresh()\n\t\t@pipe.puts \"refresh\"\n\tend", "def clear_screen\n 40.times { puts }\n end", "def start\r\n loop do\r\n t1 = Time.now\r\n update\r\n t2 = Time.now\r\n update_duration = t2 - t1\r\n \r\n milliseconds = (@update_interval/1000 - update_duration)\r\n sleep(milliseconds) if milliseconds > 0\r\n end\r\n end", "def main_process\n while @running\n Graphics.update\n update\n end\n end", "def draw s, delay = nil\n puts s # note if s is array, it is joined with \"\\n\"\n if delay\n puts \"wait #{delay}\"\n end\n puts \"update\"\n $stdout.flush\nend", "def display_word\n system \"clear\"\n wave_display\n puts \"Watch carefully and remember...\"\n puts \" \" + fetch_current_word + \" \\r\"\n # time_limit\n sleep($hide_speed)\n player_input_word\nend", "def rl_forced_update_display()\r\n if (@visible_line)\r\n @visible_line.gsub!(/[^\\x00]/,0.chr)\r\n end\r\n rl_on_new_line()\r\n @forced_display=true if !@forced_display\r\n send(@rl_redisplay_function)\r\n 0\r\n end", "def slow_scroll()\r\n 10.times do\r\n sleep 0.05\r\n puts \"\"\r\n end\r\nend", "def half_refresh\n contents.clear_rect(24, 0, contents_width - 24, line_height)\n draw_text(24, 0, contents_width - 24, line_height, $game_system.playtime_s, 2)\n end", "def dot_and_sleep(interval)\n print('.')\n sleep(interval)\n end", "def redisplay_delay\r\n 20\r\n end", "def update\n\t\t\t\tprotect_runtime_errors do\n\t\t\t\t\tif @clear_history\n\t\t\t\t\t\t@history_cache = nil \n\t\t\t\t\t\tGC.start\n\t\t\t\t\tend\n\t\t\t\t\t@window.show_text(CP::Vec2.new(352,100), \"ERROR: See terminal for details. Step back to start time traveling.\")\n\t\t\t\t\t\n\t\t\t\t\t# -- update files as necessary\n\t\t\t\t\t# need to try and load a new file,\n\t\t\t\t\t# as loading is the only way to escape this state\n\t\t\t\t\tdynamic_load @files[:body]\n\t\t\t\t\t\n\t\t\t\t\t@ui.update @window, self, @wrapped_object, turn_number()\n\t\t\t\tend\n\t\t\tend", "def console; end", "def console; end", "def updated(message)\n @count += 1\n @out.print \".\"\n @out.flush\n end", "def process\n @viewport.visible = true\n while Core::LOCK.locked?\n Graphics.update\n @text.text = @texts[Graphics.frame_count % 60 / 20] if Graphics.frame_count % 20 == 0\n end\n @viewport.visible = false\n end", "def watch_interval; end", "def intro\n clr\n puts\"\n████████╗██╗ ██████╗████████╗ █████╗ ██████╗████████╗ ██████╗ ███████╗\n╚══██╔══╝██║██╔════╝╚══██╔══╝██╔══██╗██╔════╝╚══██╔══╝██╔═══██╗██╔════╝\n ██║ ██║██║ ██║ ███████║██║ ██║ ██║ ██║█████╗ \n ██║ ██║██║ ██║ ██╔══██║██║ ██║ ██║ ██║██╔══╝ \n ██║ ██║╚██████╗ ██║ ██║ ██║╚██████╗ ██║ ╚██████╔╝███████╗\n ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝\n \"\n sleep 2\n end", "def console\nend", "def run_blinky\n\t\twhile @i<10**3\n\t\t\t@i += 1\n\t\t\t# sleep(0.3)\n\t\t\tsystem(\"clear\")\n\t\t\tpretty_print\n\t\t\tgo_team\n\t\tend\n\tend", "def sync_real\n sw = Knj::Gtk2::StatusWindow.new\n self.timelog_stop_tracking if @timelog_active\n \n Knj::Thread.new do\n begin\n sw.label = _(\"Pushing time-updates.\")\n self.push_time_updates\n sw.percent = 0.3\n \n sw.label = _(\"Update task-cache.\")\n self.update_task_cache\n sw.percent = 0.66\n \n sw.label = _(\"Updating worktime-cache.\")\n self.update_worktime_cache\n sw.percent = 1\n \n sw.label = _(\"Done\")\n \n sleep 1\n rescue => e\n Knj::Gtk2.msgbox(\"msg\" => Knj::Errors.error_str(e), \"type\" => \"warning\", \"title\" => _(\"Error\"), \"run\" => false)\n ensure\n sw.destroy if sw\n end\n end\n end", "def reload\n reload_msg = '# Reloading the console...'\n puts CodeRay.scan(reload_msg, :ruby).term\n Pry.save_history\n exec('rake console')\n end", "def show!\n Spi.begin do |s|\n s.clock(@spi_hz)\n s.write(START_FRAME + @led_frames + @end_frame)\n end\n end", "def process_console\r\n process(console)\r\n ensure\r\n console.flush\r\n end", "def start\n restart\n update\n Tk.mainloop\n end", "def start_update \n @updating = $app.animate(UPDATE_SPEED) do\n update\n end\n end", "def event_loop\n loop do\n Curses.doupdate\n @message.clear\n\n case key = @message.getch\n when 9 then @display.next_link\n when 'Z', 353, Curses::Key::BTAB then @display.previous_link # shift-tab\n\n when 10, Curses::Key::ENTER then display_name @display.current_link\n\n when Curses::Key::LEFT then go_to @history.back\n when Curses::Key::RIGHT then go_to @history.forward\n\n when Curses::Key::END then @display.scroll_bottom\n when Curses::Key::HOME then @display.scroll_top\n when 'j', Curses::Key::DOWN then @display.scroll_down\n when 'k', Curses::Key::UP then @display.scroll_up\n when ' ', Curses::Key::NPAGE then @display.page_down\n when Curses::Key::PPAGE then @display.page_up\n\n when 'h' then\n display @history.list, nil\n when 'i' then\n @message.show \"pos: #{@history.position} items: #{@history.pages.length}\"\n\n when 'Q', 3, 4 then\n break # ^C, ^D\n when 26, Curses::Key::SUSPEND then\n Curses.close_screen\n Process.kill 'STOP', $$\n when nil, Curses::Key::RESIZE then\n @display.update_size\n @message.update_size\n\n when 'g' then display_name @message.prompt\n\n else\n @message.error \"unknown key #{key.inspect}\"\n end\n end\n end", "def display_current(game_hash)\n\treset_screen\n\tputs pretty_board(hash_to_array(game_hash))\n\tsleep(0.001)\nend", "def slow_command\n EventMachine::Timer.new(3) { send_output \"This is the output.\" }\n end", "def foreground\n connect\n loop do\n run(@config[:interval], @config[:concurrency])\n end\nend", "def eol_preview # :nologin: :norobots:\n @timer_start = Time.now\n eol_data(['unvetted', 'vetted'])\n @timer_end = Time.now\n end", "def update_loop_count\r\n @loop_count += 1\r\n if @loop_count > 100\r\n log_debug(\"Event #{@event_id} executed 100 commands without giving the control back\")\r\n Graphics.update\r\n @loop_count = 0\r\n end\r\n end", "def update\r\n #\r\n # Register a tick with our rather standard tick/framerate counter. \r\n # Returns the amount of milliseconds since last tick. This number is used in all update()-calls.\r\n # Without this self.fps would return an incorrect value.\r\n # If you override this in your Chingu::Window class, make sure to call super.\r\n #\r\n @milliseconds_since_last_tick = @fps_counter.register_tick\r\n \r\n intermediate_update\r\n end", "def run\n Thread.new(interval, server) do |i, s|\n loop do\n s.refresh!\n sleep(i)\n end\n end\n end", "def display_message!(*lines)\n display_message(*lines)\n sleep 0.01 until message_drawn?\n end", "def run\n while 1\n sleep(0.2)\n #puts \"bezim \"+@pid.to_s\n end\n end", "def run_cycle\n\t\t\t\tsuper()\n\t\t\t\t\n\t\t\t\t#puts 'CursesApp->run_cycle'\n\t\t\t\t\n\t\t\t\thandle_user_input\n\t\t\tend", "def start\n\t\t\t@thread = Thread.new do\n\t\t\t\twhile true\n\t\t\t\t\tupdate\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def ui_refresh\n\t\t\t\tCurses.refresh\n\t\t\tend", "def fps_update\n dt = @current_time - @last_second_time\n if dt >= 1\n @last_second_time = @current_time\n @ingame_fps_text.text = \"FPS: #{((Graphics.frame_count - @last_frame_count) / dt).ceil}\" if dt * 10 >= 1\n @last_frame_count = Graphics.frame_count\n @gpu_fps_text.text = \"GPU FPS: #{(@gc_count / @gc_accu).round}\" unless @gc_count == 0 || @gc_accu == 0\n @ruby_fps_text.text = \"Ruby FPS: #{(@ruby_count / @ruby_accu).round}\" unless @ruby_count == 0 || @ruby_accu == 0\n reset_gc_time\n reset_ruby_time\n end\n end", "def preInit\n # Pre-Startup things go here. THIS RUNS BEFORE ANY SCREEN DRAWING OR ANYTHING!!!\n # Determines Debug mode\n # Change CONST_VERBOSE in globalVars.rb to switch from verbose to nonverbose.\n DEBUG.new(CONST_VERBOSE)\n\n #Syntax for console out function is <message> <message severity from 0-4> <should it be displayed only in verbose mode?>\n DEBUG.cout(\"Debugging has been loaded, initial cout here.\", 0, false)\n\n\n #Signal end of Preinitialization code\n DEBUG.cout(\"PreInit Finished!\", 0, false)\nend", "def timer; end", "def timer; end", "def timer; end", "def timer; end", "def status_line(switch_on = true)\n if switch_on\n set_vars :_display_busy => 1, :_display_status => 1\n else # switch off\n set_vars :_display_busy => 0, :_display_status => 0\n end\n sleep 1\n exec 'redisplay;'\n end", "def about\n puts \"Created by: Frank Rycak Jr.\" + \" \" + \"\\u00A9\" + \" \" + \"2016\" + \" \" + \"Wyncode Cohort 8\"\n sleep(3)\nend", "def play\n while(true)\n system('clear')\n render_board\n board_update\n sleep(5)\n end\n end", "def game_start\n game_setup\n @console_delegate.show\n end", "def update\n loop do\n if (Time.now.to_f - @_ntime.to_f) >= @time.to_f\n Graphics.update \n terminate\n break \n return\n end\n Input.update\n if Input.trigger?(Input::C) && $game_temp.mskip\n terminate\n break \n return\n end\n if @refreshTime >= rtime\n Graphics.update \n @refreshTime = 0\n end\n @refreshTime += 1\n end\n end", "def running; end", "def running; end", "def tick args\n # sets console command when sample app initially opens\n if Kernel.global_tick_count == 0\n puts \"\"\n puts \"\"\n puts \"=========================================================\"\n puts \"* INFO: Static Sprites, Classes, Draw Override\"\n puts \"* INFO: Please specify the number of sprites to render.\"\n args.gtk.console.set_command \"reset_with count: 100\"\n end\n\n # init\n if args.state.tick_count == 0\n args.state.stars = args.state.star_count.map { |i| Star.new args.grid }\n args.outputs.static_sprites << args.state.stars\n end\n\n # render framerate\n args.outputs.background_color = [0, 0, 0]\n args.outputs.primitives << args.gtk.current_framerate_primitives\nend", "def tick\n unless @queue.empty?\n @queue.shift.call\n else\n unless (c = FFI::NCurses.getch) == FFI::NCurses::ERR\n @controller.handle_char(c)\n else\n sleep(0.1)\n end\n end\n h, w = FFI::NCurses.getmaxyx(FFI::NCurses.stdscr)\n @controller.size(w,h)\n @controller.draw\n end", "def curses_print_and_refresh(x, y, string) # rubocop:disable Naming/MethodParameterName\n Curses.setpos(x, y)\n Curses.addstr(string)\n Curses.refresh\nend", "def update\n set_moon_clocks\n Tk.after(1000) {update}\nend", "def loop(timer: 0.1)\n loop do\n puts \"\\e[H\\e[2J\"\n puts step()\n sleep(timer)\n end\n end", "def update\r\n until @done\r\n var, val = self.next\r\n self.write(var, val)\r\n\r\n sleep(EMULATOR_CONFIG::REFRESH_RATE / 1000)\r\n end\r\n\r\n end", "def verbose!\n @actor << 'VERBOSE'\n @actor.wait\n end", "def run_loop\n end", "def welcome \n\n system \"clear\"\n puts \"\n ██████╗░██████╗░░█████╗░██╗░░░██╗░██████╗░██╗░░██╗████████╗░██████╗\n ██╔══██╗██╔══██╗██╔══██╗██║░░░██║██╔════╝░██║░░██║╚══██╔══╝██╔════╝\n ██║░░██║██████╔╝███████║██║░░░██║██║░░██╗░███████║░░░██║░░░╚█████╗░\n ██║░░██║██╔══██╗██╔══██║██║░░░██║██║░░╚██╗██╔══██║░░░██║░░░░╚═══██╗\n ██████╔╝██║░░██║██║░░██║╚██████╔╝╚██████╔╝██║░░██║░░░██║░░░██████╔╝\n ╚═════╝░╚═╝░░╚═╝╚═╝░░╚═╝░╚═════╝░░╚═════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═════╝░\\n\\n\\n\"\n\n # Progress bar\n bar = TTY::ProgressBar.new(\"[:bar]\", total: 74)\n 100.times do\n sleep(0.01)\n bar.advance(1)\n end\n\n main_menu\nend", "def main_loop\r\n Graphics.update # Update game screen\r\n Input.update # Update input information\r\n main_update # Update scene objects\r\n update # Update Processing\r\n end", "def stdout(event) ; $stdout.puts event ; $stdout.flush ; end", "def println(text)\n Platform.runLater(-> { @output.append_text(\"#{text.to_s}\\n\") })\n end", "def put_hold_notice\n @io.puts\n @io.puts 'Pausing here -- run Ruby again to ' \\\n 'measure the next benchmark...'\n end", "def update_gui\n unless app.disposed?\n app.flush\n app.real.redraw\n end\n end", "def iterate\n self.update\n @time += 1\n end", "def update\n puts \"Updating...\"\n end", "def intro\n clear_screen\n print \"Today is \"\n puts Time.now\n sleep(2)\n puts\"\\nYou are travelling by motorcycle on a dirt road in Thailand, when all of a sudden you swerve and hit a ditch. Knocking yourself unconcious...\\n\\n\"\n sleep (5)\nend", "def run\n first_run = true\n\n poll_content do |content|\n sleep @options[:update_interval].to_f unless first_run\n if content != @content\n changed\n @content = content\n\n notify_observers(id, content)\n end\n first_run = false\n end\n end", "def on_load\n clear_output\n end", "def sleep_if_set\n config[:sleep].to_i.times do\n print '.'\n sleep 1\n end\n end", "def initialize\n $stdout.sync = true\n super\n end", "def update\n if @step_count == 20 # 3 times / s\n @board.step!\n @step_count = 0\n else\n @step_count += 1\n end\n end", "def display(arr=[])\n arr.each do |quad|\n @device.reset\n sleep 0.25\n light_up(quad)\n delay\n end\n @device.reset\n end", "def watch!\n start_watch true\n end", "def loading_bar\n loading_array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]\n 1.upto(loading_array.length.to_i) do |i|\n printf(\"\\rCycles Complete: %d\", i)\n sleep(0.1)\n end\n end", "def update\n super\n refresh if @cw_data.include?(:playtime) && Graphics.frame_count / Graphics.frame_rate != @total_sec\n end", "def run()\n while(true)\n cycle() ;\n sleep(2) ;\n end\n end", "def read_from_console\n puts 'Enter new tweet (not more than 140 signs)'\n @text = STDIN.gets.chomp[0..140]\n puts \"Sending your new tweet: #{@text.encode('UTF-8')}\"\n @@CLIENT.update(@text.encode('UTF-8'))\n puts 'Your tween has been sent'\n end", "def shownext\n if @session.current_screen and @session.current_screen.stdin\n display @session.current_screen\n @session.next\n else\n print Paint[\"... \", :cyan]\n @playprompt = false\n @lastelapsed = 0\n end\nend", "def loop\n end", "def loop\n end", "def heartbeat_command\n logger.debug(\"heartbeat_command: enter \")\n logger.debug(client.observers_overview.join(\", \"))\n begin\n client.refresh_observers_if_needed\n client.update_cluster if client.status == :down\n client.get(\"foo\")\n rescue Exception => e\n client.status = :down\n logger.debug \"heartbeat - #{e.message} #{e.backtrace}\"\n end\n sleep freq\n end", "def start_driver\n every(interval) do\n update(connection.analog_read(pin))\n end\n\n super\n end", "def loop\n end", "def console(&blk); end", "def console(&blk); end", "def run\n loop do\n tick\n sleep settings.service.polling_interval\n end\n end", "def run\n loop do\n tick\n sleep settings.service.polling_interval\n end\n end", "def run\n Signal.trap('EXIT') do\n reset_terminal\n exit\n end\n Signal.trap('WINCH') do\n screen_settings\n redraw\n place_cursor\n end\n\n setup_terminal\n config_read\n parse_ls_colors\n set_bookmark '0'\n\n redraw true\n place_cursor\n\n # do we need this, have they changed after redraw XXX\n @patt = nil\n @sta = 0\n\n # forever loop that prints dir and takes a key\n loop do\n key = get_char\n\n unless resolve_key key # key did not map to file name, so don't redraw\n place_cursor\n next\n end\n\n break if @quitting\n\n next if only_cursor_moved?\n\n next unless @redraw_required # no change, or ignored key\n\n redraw rescan?\n place_cursor\n\n end\n write_curdir\n puts 'bye'\n config_write if @writing\n @log&.close\nend", "def start\n while not @stopped\n puts \"Waiting for something to happen\"\n sleep 1\n end\n end", "def run\n send Rainbow('Running cpgui...').aqua\n @run = true\n input while @run\n end" ]
[ "0.6738439", "0.6426053", "0.6280463", "0.6244588", "0.61609226", "0.6086194", "0.6071217", "0.6012852", "0.599135", "0.59864616", "0.597321", "0.5950648", "0.5945575", "0.5940598", "0.5927845", "0.584486", "0.58150864", "0.577988", "0.5778276", "0.5767212", "0.5765037", "0.5765037", "0.57639915", "0.57609665", "0.57574505", "0.5754118", "0.5733593", "0.5721828", "0.57092595", "0.5693455", "0.56900144", "0.5687372", "0.56792825", "0.56727725", "0.56628865", "0.56616443", "0.56601363", "0.564891", "0.5639009", "0.5637014", "0.56292313", "0.562524", "0.56216586", "0.5618287", "0.5611501", "0.56036764", "0.5602838", "0.5589556", "0.5582595", "0.5582437", "0.5582437", "0.5582437", "0.5582437", "0.5555578", "0.5552417", "0.555196", "0.5544936", "0.55447125", "0.55430686", "0.55430686", "0.5537275", "0.5533343", "0.5532787", "0.55294096", "0.5515702", "0.5514033", "0.55070317", "0.550279", "0.5492281", "0.5488224", "0.54880786", "0.54863983", "0.548279", "0.548", "0.5479732", "0.5478271", "0.5476633", "0.5472902", "0.5470094", "0.5467799", "0.54597235", "0.5450933", "0.5449846", "0.54497576", "0.54463017", "0.5443928", "0.5439337", "0.5438597", "0.5436047", "0.5435065", "0.5435065", "0.5430767", "0.5428995", "0.54284996", "0.54242575", "0.54242575", "0.5417224", "0.5417224", "0.54151314", "0.54131776", "0.54106134" ]
0.0
-1
Called on an instance of the subclass, this will run the game_setup method and then begin the show loop on the delegate
def game_start game_setup @console_delegate.show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_setup\n end", "def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_name = $game_player.character_name\n @character_index = $game_player.character_index\n $game_player.set_graphic('', 0)\n\n $game_system.menu_disabled = true\n Graphics.frame_count = 0\n\n super\n create_foreground\n create_background\n create_command_window\n play_title_music\n end", "def viewDidLoad \n super\n self.new_game \n self.init_views\n\n end", "def run\n game = Game.new\n game.game_start\nend", "def run\r\n @log.debug \"Run the tester...\"\r\n @dlg_box = CupSingleGameWin.new(@options)\r\n @dlg_box.create\r\n end", "def Main\n #Begin preinitialization\n preInit()\n\n #Render Game Window and begin drawing onto the screen.\n\n DEBUG.cout(\"Initializing Game Window...\", 0, false)\n window = GameWindow.new\n window.show\n\n #End game and return to desktop\n return nil\nend", "def setup (game)\n\t\t# #@height = hgt\n\t\t# #@width = wdth\n\t\t# flash[:notice] = \"hello world\"\n\t\t#super.initialize(game)\n\t\trequire 'Time'\n\t\tt = Time.utc(nil,nil,days,hours,minutes,nil)\n\t\t@turn_speed = t\n\tend", "def beginGameLoop\n @gameLoop.play\n end", "def run\n start_game\n game_loop\n end_game\n end", "def start_game\n begin\n @game_text.intro\n\n # Run the tutorial\n ActionDirector.new(@world, @player).call({command: :talk, target: :jerry})\n\n # The main game\n while @player.alive? && @world.has_hostiles?\n @player.in_battle? ? battle_loop : game_loop\n end\n\n @player.alive? ? @player.win : @player.defeat\n rescue SystemExit, Interrupt # Catpure ctrl+c exit, end gracefully\n @game_text.exit\n end\n end", "def initialize fps, title\n # The sprite and sound managers.\n @spriteManager = SpriteManager.new\n @soundManager = SoundManager.new 3\n\n # Number of frames per second.\n @framesPerSecond = fps\n\n # Title in the application window.\n @windowTitle = title\n\n # create and set timeline for the game loop\n buildAndSetGameLoop\n end", "def game_loop\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n create_command_window()\n @status_window = Window_Party_Status.new(0, 0, 480,424, $game_party.members)\n @menu_info_window = Window_Menu_Info.new(0,424,640,56)\n end", "def play\n board_setup\n gameplay_setup\n end", "def start\n main_loop\n end", "def start\n # start a new game using @config\n end", "def main\n raise 'You forgot to call super in initialize of your scene' unless @object_to_dispose\n # Store the last scene and store self in $scene\n @__last_scene = $scene if $scene != self\n $scene = self\n yield if block_given? # Ensure we call the on_scene_switch in call_scene\n # Tell the interface is running\n @running = true\n # Main processing\n main_begin\n main_process\n main_end\n # Reset $scene unless it was already done\n $scene = @__last_scene if $scene == self\n Scheduler.start(:on_scene_switch, self.class)\n end", "def run\n @music.play(:repeats => -1)\n\thook_run()\n\thook_quit()\n\t# Handling input\n\tloop do\n\t @queue.each do |event|\n\t\thandle(event)\n end\n\t# Draw the image to screen\n\t@intro_screen.blit(@screen,[0,0])\n\t@screen.flip()\n end\n end", "def play\n\t\tgame_loop\n\tend", "def setup_display\n gameboard.build_display\n build_white_side\n build_black_side\n end", "def game_loop\n end", "def main\n\t\tstart\n\t\twhile self == SceneManager.scene\n\t\t\tGraphics.update\n\t\t\tController.keyboard.update\n\t\t\tupdate\n\t\t\tController.wait_next_frame\n\t\tend\n\t\tterminate\n\tend", "def play\n \n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @title_window = Window_Outline_Title.new(0, 0, 640, 56)\n @content_window = Window_Outline.new(0, 56, 640, 424)\n \n # Create Window \n @list_window = Window_Outline_List.new(0, 0, 400, 400, Vocab::tutorials_strings)\n width_remain = (640 - @list_window.width)/2\n @list_window.x = width_remain.floor\n height_remain = (480 - @list_window.height)/2\n @list_window.y = height_remain.floor\n end", "def main\n create_graphics\n curr_scene = $scene\n check_up\n while @running && curr_scene == $scene\n Graphics.update\n update\n end\n dispose\n # Unload title related pictures\n RPG::Cache.load_title(true)\n RPG::Cache.load_interface(true)\n ::Scheduler.start(:on_scene_switch, ::Scene_Title) if !@running && $scene.is_a?(Scene_Map)\n end", "def start!\n @window = Window.new width, height, fullscreen?\n window.caption = name\n window.scene = Scenes.generate(first_scene)\n window.show\n end", "def play\n #calls to all the methods that produce game!\n end", "def run \n Engine::play(Beginning)\nend", "def start_run\n # Abstract\n end", "def start_run\n # Abstract\n end", "def start\n set_player_name\n deal_cards\n show_flop\n player_turn\n dealer_turn\n end", "def setup\n super\n @background = Image['Bg level1.png']\n viewport.lag = 0\n viewport.game_area = [0, 0, 3000, 1000]\n @gilbert = Gilbert.create(x: 50, y: 900, limited: viewport.game_area.width)\n @level = File.join(ROOT, 'levels', self.filename + '.yml')\n load_game_objects(file: @level)\n\n @plataformas = Plataforma2.all\n @music = Song.new('media/Songs/Music Level1.mp3')\n @loser_song = Song.new('media/Songs/gameover.ogg')\n\n @moneda = Moneda.all.first\n\n @meta_on = false\n\n @marco_name = Image['MarcoName.png']\n @marco_score = Image['MarcoPoint.png']\n\n @score = 0\n @msj_name = Chingu::Text.new(@player_name, x: 85, y: 25, size: 30, color: Gosu::Color::WHITE)\n @msj_score = Chingu::Text.new(@score.to_s, x: $window.width - 130, y: 30, size: 35)\n @mensaje = Chingu::Text.new('Has encontrado todas las monedas', x: 320, y: 20, size: 25, color: Gosu::Color::GREEN)\n @mensaje2 = Chingu::Text.new('Encuentra la Meta', x: @msj_name.x, y: 45, size: 30, color: Gosu::Color::YELLOW)\n\n @music.play(true) if @sonido\n end", "def start_scene; end", "def start_game(user = nil)\n super\n # ...\n end", "def initialize_game\n setup_boards\n end", "def initialize # calls the class Show with a new board\n\t\tShow.new\n\t\tcreate_player1\n\t\tcreate_player2\n\t\t@partie = Game.new(@player1, @player2) #class Game\n\t\t@partie.each_turn\n\tend", "def initialize(scene)\n super(800,600, false)\n self.caption = \"Ruby Ren'ai Game Engine\"\n @hidden = false\n @script = Script.new(self)\n @graphics = Graphics.new(self)\n @clickables = Array.new\n @music = Music.new(self)\n @scriptreader = ScriptReader.new(self, scene || \"mainmenu\")\n @time = Gosu::milliseconds\n advance\n end", "def setup\n @turn_order_delegate = self\n @end_game_delegate = self\n #a = self.players.length if self.players\n #puts \"first player id: #{@players.first.id}\"\n #broadcast_event Game::GAME_INITIALIZED, {}\nend", "def start\n\t\tinit\n\t end", "def setup(&b)\r\n\t$game.setup(&b)\r\nend", "def start\r\n initialize_game\r\n until @game.over?\r\n take_turn\r\n end\r\n print_outcome\r\n end", "def play\n end", "def initialize_screen\n try_set_screen\n\t Klass.initialize(@handle)\n\t true\n end", "def start\n @window = Window.new(slide_deck)\n @window.show\n end", "def start!(scene)\n raise \"The game has already started.\" if showing?\n\n Gamework::ENV ||= 'development'\n make_logger(@log_file)\n @logger.info 'Starting the game'\n\n make_window\n add_scene(scene)\n show\n end", "def start\n # start a timer on scene load\n @timer.reset_timer\n case @scene\n when 'intro'\n start_intro\n when 'level'\n start_level\n when 'transition'\n start_transition\n when 'credits'\n start_credits\n end\n end", "def run_cycle\n\t\t\t\tsuper()\n\t\t\t\t\n\t\t\t\t#puts 'CursesApp->run_cycle'\n\t\t\t\t\n\t\t\t\thandle_user_input\n\t\t\tend", "def start\n SocketController.init_game(self.users, self.id)\n end", "def startGame\n\tif !$running\n\t\t$gui.hide_info()\n\t\t$gui.hide_scored()\n\t\t$p1.reset_position()\n\t\t$p2.reset_position()\n\t\t$ball.reset_position()\n\t\t$ball.start()\n\t\t$running = true\n\tend\nend", "def perform\n\tgame_menu\n\tgameplay\nend", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @item_back_window = Window_Base.new(0, 56, 640, 328)\n @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view)\n @item_window.opacity = 0\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n update_detail_window(@item_window.selected_item)\n \n @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def start\n super\n create_menu_background\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @item_back_window = Window_Base.new(0, 56, 640, 328)\n @dataviews_window = Window_Dataviews.new(0, 56, 640, 56, MENU_CONFIG::ITEM_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @item_window = Window_Item.new(0, 96, 640, 272, $game_party.items, @dataviews_window.selected_view)\n @item_window.opacity = 0\n @item_window.help_window = @help_window\n \n @equip_details_window = Window_EquipDetails.new(0,384,640,96,nil)\n @equip_details_window.visible = false\n @item_details_window = Window_ItemDetails.new(0,384,640,96,nil)\n @item_details_window.visible = false\n update_detail_window(@item_window.selected_item)\n \n @target_window = Window_Party_Status.new(0, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def run\n Interface::header\n Interface::newline\n\n count = get_number_of_players\n get_player_names( count )\n\n @b.play_game\n end", "def start\n @win_state = CHECK # clear out win_state for new games\n get_player_name\n deck.deal_hand(players)\n show_flops\n player_turn\n dealer_turn\n check_winner\n play_again?\n end", "def start_game\n\t\tself.game_is_started = true\n send_update\n end", "def initialize( * )\n\t\tsuper\n\t\t@presenter = self.setup_presentation_layer\n\tend", "def start\n \t\tself.board.display_instruction\n \t\tcurrent_player = select_first_player\n \t\t(self.board.size).times do \n \t\t\tplay(current_player)\n \t\t\tcurrent_player = next_of current_player \n end\n display_winner(nil, true)\n \tend", "def run\n room = robot.config.adapters.shell.private_chat ? nil : \"shell\"\n @source = Source.new(user: user, room: room)\n puts t(\"startup_message\")\n robot.trigger(:connected)\n\n run_loop\n end", "def run_loop\n end", "def setup\n\t\tsize(displayWidth, displayHeight)\n\t\tcolorMode(HSB,360,100,100,60)\n\t\t@w, @h = [width/2.0, 0]\n\t\t@i = 0 ; @t = 0\n frame_rate 20\n\t\tbackground(0)\n\n\t\t@monster = Monster.new 7, width, height\n\t\tstroke_width(160)\n\tend", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "def run (game)\n @state.run(self, game)\n end", "def game_setup\n\t\t\tputs \"Would you like to play? [yes|no] \"\n\n\t\t\tinput = gets.chomp.downcase\n\n\t\t\tif input == \"yes\"\n\t\t\t\tname = @ui.get_name()\n\t\t\t\tmark = @ui.get_mark(name)\n\n\t\t\t\t@player = Player.new(name, mark)\n\n\t\t\t\tmark == 'X' ? @ai = AI.new('O', @player, @board) : @ai = AI.new('X',\n\t\t\t\t@player, @board)\n\t\n\t\t\t\tputs \"\\nTo play, you will need to input a number between 1 and 9\"\n\t\t\t\tputs \"representing to locations on the grid with 1 being the\"\n\t\t\t\tputs \"top-left corner and 9 being the bottom right corner,\"\n\t\t\t\tputs \"decreasing from left to right\\n\"\n\t\n\t\t\t\tself.run()\n\n\t\t\telse\n\t\t\t\tputs \"Have a nice day and come play next time.\"\n\t\t\t\texit\n\t\t\tend\n\t\tend", "def game_setup\n cls\n print \"----------------\\n\"\n print \"Cinnabar - A Game Of Rocks and Minerals\\n\"\n print \"----------------\\n\\n\"\n\n print \"DISCLAIMER\\n\"\n print \" Cinnabar (c) 1966, 1972, 1980 is a trademark of Naturegraph Publishers, Inc.\\n\"\n print \" No copyright or trademark infringement is intended in using Cinnabar.\\n\\n\"\n\n print \"Welcome to Cinnabar, a digital version of the 1966 card game by Vinson Brown.\\n\"\n print \"Rules can be found in RULES.md, and info can be found in README.md.\\n\"\n print \"Source code can be found at https://www.github.com/Pokeconomist/cinnabar.\\n\\n\"\n end", "def start\n super\n end", "def play; end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @skill_back_window = Window_Base.new(200, 56, 440, 328)\n @dataviews_window = Window_Dataviews.new(200, 56, 440, 56, MENU_CONFIG::SKILL_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @status_window = Window_Skill_Status.new(0, 0, 200, 128, @actor)\n \n @skill_window = Window_Skill.new(200, 96, 440, 272, @actor, @dataviews_window.selected_view)\n @skill_window.opacity = 0\n @skill_window.help_window = @help_window\n \n @skill_details_window = Window_SkillDetails.new(0,384,640,96,nil)\n @skill_details_window.visible = false\n @skill_window.detail_window = @skill_details_window\n \n @target_window = Window_Party_Status.new(140, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n \n @actor = $game_party.members[@actor_index]\n \n @char_image_window = Window_Char_Image.new(-16, 56+16, 640, 424, @actor)\n @char_image_window.opacity = 0\n \n @help_window = Window_Info_Help.new(0, 384, 640, 96, nil)\n \n @skill_back_window = Window_Base.new(200, 56, 440, 328)\n @dataviews_window = Window_Dataviews.new(200, 56, 440, 56, MENU_CONFIG::SKILL_DATAVIEWS)\n @dataviews_window.active = false\n @dataviews_window.opacity = 0\n \n @status_window = Window_Skill_Status.new(0, 0, 200, 128, @actor)\n \n @skill_window = Window_Skill.new(200, 96, 440, 272, @actor, @dataviews_window.selected_view)\n @skill_window.opacity = 0\n @skill_window.help_window = @help_window\n \n @skill_details_window = Window_SkillDetails.new(0,384,640,96,nil)\n @skill_details_window.visible = false\n @skill_window.detail_window = @skill_details_window\n \n @target_window = Window_Party_Status.new(140, 0, 480, 424, $game_party.members)\n hide_target_window\n end", "def initialize\n puts 'Welcome to the Casino'.colorize(:blue)\n @player = Player.new #seeing new here so it means its going to the class listed and runs the initi method\n puts \"what game do you want to play #{player.name}?\"\n #show a casino game menu\n #let the player choose a game\n # initialize the new game, passing the player as a parameter\n end", "def start_game(game_config)\n # start a new game\nend", "def initialize \n super(ScreenWidth, ScreenHeight, false)\n self.caption = \"Mad Pokemon\"\n $window = self\n\n @@images = Hash.new\n @@fonts = Hash.new \n load_images\n load_fonts\n\n @@fading_off = false\n @@fading_on = false\n @@end_fade = 0\n @@start_fade = 0\n\n @@change_game_state = nil\n\n @@game_state = MenuState.new\n end", "def play \n end", "def run\n start_key = self.display_instructions\n exit if start_key.downcase == \"q\"\n self.play_round until @board.won? || @board.lost?\n @board.lost? ? self.display_loss : self.display_win\n end", "def setupgamemode(&b)\r\n\t\t\t@setup = b\r\n\t\tend", "def start\r\n\t\t\t@output.puts \"Welcome to Deal or No Deal!\"\r\n\t\t\t@output.puts \"Designed by: #{created_by}\"\r\n\t\t\t@output.puts \"StudentID: #{student_id}\"\r\n\t\t\t@output.puts \"Starting game...\"\r\n\t\tend", "def show\n @started = true\n @viewport.color = Color.white\n @sprites[\"trainer\"].color.alpha = 0\n for key in @sprites.keys\n @sprites[key].visible = true\n end\n end", "def play_game\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n \r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n \r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n \r\n #Call on the \r\n gameCount = game_count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n \r\n end", "def setup(args)\n position = Engine3D::Vector.new 0.0, 0.0, 0.0, 1.0\n direction = Engine3D::Vector.new 0.0, 0.0,-1.0, 1.0\n args.state.camera = Engine3D::Camera.new position, direction\n args.state.renderer = Engine3D::Render.new 1280, 720, args.state.camera, 1.0, 300.0\n\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/debug.rb'\n #args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/scene1.rb'\n args.state.scene = Engine3D::Scene.load 'sprite3dengine/data/scenes/demo.rb'\n\n #args.state.angle = 0.01\n #args.state.camera_angle = 0.001\n\n # DEBUG :\n #args.state.frame_counter = 0\n\n args.state.setup_done = true\n\n puts \"setup finished!!!\"\nend", "def on_start(_klass, _method); end", "def game_start\n opening\n first_menu\n end", "def start\n super\n end", "def start\n super\n end", "def start\n super\n end", "def start\n super\n end", "def start\n super\n end", "def initialize\n\n #Graphics.freeze\n\n @closing = false\n @savequit = false\n\n $mouse.change_cursor('Default')\n sys('open')\n\n # Vp\n @vp = Viewport.new(0,0,$game.width,$game.height)\n @vp.z = 3500\n\n @snap = Sprite.new(@vp)\n @snap.z = -101\n @snap.bitmap = $game.snapshot\n\n # Background\n @bg = Sprite.new(@vp)\n @bg.z = -100\n #@bg.bitmap = Bitmap.new(640,480)\n #@bg.bitmap.fill(Color.new(0,0,0,180))\n @bg.bitmap = $cache.menu_background(\"sample\")\n #@bg.bitmap = $cache.menu_background(\"witch\")\n @bg.opacity = 0\n \n #@bg.y = 30\n #@bg.do(seq(go(\"y\",-50,150,:qio),go(\"y\",20,150,:qio)))\n\n #self.do(delay(300))\n\n @next_menu = $menu.menu_page\n $menu.menu_page = nil\n\n @menu = nil\n\n #Graphics.transition(20,'Graphics/Transitions/trans') \n\n end", "def initialize\n @game_settings = GameSettings.new\n super 920, 480\n self.caption = GAME_TITLE\n @settings_hovered = Options::START_SCREEN[0]\n @title_font, @subtitle_font = Gosu::Font.new(50), Gosu::Font.new(20)\n @background_image = Gosu::Image.new(\"media/background1.jpg\", :tileable => true)\n @blank_card = Gosu::Image.new(\"media/card.png\", :tileable => true)\n @button_option = Gosu::Image.new(\"media/button.png\", :tileable => true)\n @deck = Deck.new\n @playing_cards = Array.new\n @computer_signal = ComputerTimer.new\n @players_created, @mes, @false_mes, @true_mes, @trying_mes = false, false, false, false, false\n @hint = []\n #players\n @pressed, @p1, @p2 = nil, nil, nil\n @game_timer = Timers.new\n end", "def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Call on the method responsible for collecting the player's move\r\n playerMove = get_player_move\r\n\r\n #Call on the method responsible for generating the computer's move\r\n computerMove = get_computer_move\r\n\r\n #Call on the method responsible for determining the results of the game\r\n result = analyze_results(playerMove, computerMove)\r\n\r\n #CAll on the method responsible for ingrementing the game count\r\n game_Count\r\n\r\n #Call on the method responsible for displaying the results of the game\r\n display_results(playerMove, computerMove, result)\r\n\r\n end", "def main_begin\n create_spriteset\n # When comming back from battle we ensure that we don't have a weird transition by warping immediately\n if $game_temp.player_transferring\n transfer_player\n else\n $wild_battle.reset\n $wild_battle.load_groups\n end\n fade_in(@mbf_type || DEFAULT_TRANSITION, @mbf_param || DEFAULT_TRANSITION_PARAMETER)\n $quests.check_up_signal\n end", "def play\n init_player()\n init_board()\n puts \"Test game play\"\n end", "def initialize(*args)\n return if args.length < 4\n # sets up main viewports\n @started = false\n @viewport = args[0]\n @viewport.color = Color.new(255,255,255,EliteBattle.get(:colorAlpha))\n EliteBattle.set(:colorAlpha,0)\n @msgview = args[1]\n # sets up variables\n @disposed = false\n @sentout = false\n @scene = args[2]\n @trainer = args[3]\n @trainertype = GameData::TrainerType.get(@trainer.trainer_type)\n @speed = 1\n @frames = 1\n @curFrame = 1\n @sprites = {}\n @evilteam = EliteBattle.can_transition?(\"evilTeam\", @trainertype.id, :Trainer, @trainer.name, @trainer.partyID)\n @teamskull = EliteBattle.can_transition?(\"teamSkull\", @trainertype.id, :Trainer, @trainer.name, @trainer.partyID)\n # retreives additional parameters\n self.getParameters(@trainer)\n # initializes the backdrop\n args = \"@viewport,@trainertype,@evilteam,@teamskull\"\n var = @variant == \"trainer\" ? \"default\" : @variant\n # check if can continue\n unless var.is_a?(String) && !var.empty?\n EliteBattle.log.error(\"Cannot get VS sequence variant for Sun/Moon battle transition for trainer: #{@trainertype.id}!\")\n var = \"default\"\n end\n # loag background effect\n @sprites[\"background\"] = eval(\"SunMoon#{var.capitalize}Background.new(#{args})\")\n @sprites[\"background\"].speed = 24\n # trainer shadow\n @sprites[\"shade\"] = Sprite.new(@viewport)\n @sprites[\"shade\"].z = 250\n # trainer glow (left)\n @sprites[\"glow\"] = Sprite.new(@viewport)\n @sprites[\"glow\"].z = 250\n # trainer glow (right)\n @sprites[\"glow2\"] = Sprite.new(@viewport)\n @sprites[\"glow2\"].z = 250\n # trainer graphic\n @sprites[\"trainer_\"] = Sprite.new(@viewport)\n @sprites[\"trainer_\"].z = 350\n file = sprintf(\"Graphics/EBDX/Transitions/%s\", @trainertype.id)\n file = sprintf(\"Graphics/EBDX/Transitions/trainer%03d\", @trainertype.id_number) if !pbResolveBitmap(file)\n @sprites[\"trainer_\"].bitmap = pbBitmap(file)\n # splice bitmap\n if @sprites[\"trainer_\"].bitmap.height > @viewport.height\n @frames = (@sprites[\"trainer_\"].bitmap.height.to_f/@viewport.height).ceil\n @sprites[\"trainer_\"].src_rect.height = @viewport.height\n end\n @sprites[\"trainer_\"].ox = @sprites[\"trainer_\"].src_rect.width/2\n @sprites[\"trainer_\"].oy = @sprites[\"trainer_\"].src_rect.height/2\n @sprites[\"trainer_\"].x = @viewport.width/2 if @variant != \"plasma\"\n @sprites[\"trainer_\"].y = @viewport.height/2\n @sprites[\"trainer_\"].tone = Tone.new(255,255,255)\n @sprites[\"trainer_\"].zoom_x = 1.32 if @variant != \"plasma\"\n @sprites[\"trainer_\"].zoom_y = 1.32 if @variant != \"plasma\"\n @sprites[\"trainer_\"].opacity = 0\n # sets a bitmap for the trainer\n bmp = Bitmap.new(@sprites[\"trainer_\"].src_rect.width, @sprites[\"trainer_\"].src_rect.height)\n bmp.blt(0, 0, @sprites[\"trainer_\"].bitmap, Rect.new(0, @sprites[\"trainer_\"].src_rect.height*(@frames-1), @sprites[\"trainer_\"].src_rect.width, @sprites[\"trainer_\"].src_rect.height))\n # colours the shadow\n @sprites[\"shade\"].bitmap = bmp\n @sprites[\"shade\"].center!(true)\n @sprites[\"shade\"].color = Color.new(10,169,245,204)\n @sprites[\"shade\"].color = Color.new(150,115,255,204) if @variant == \"elite\"\n @sprites[\"shade\"].color = Color.new(115,216,145,204) if @variant == \"digital\"\n @sprites[\"shade\"].opacity = 0\n @sprites[\"shade\"].visible = false if @variant == \"crazy\" || @variant == \"plasma\"\n # creates and colours an outer glow for the trainer\n c = Color.black\n c = Color.white if @variant == \"crazy\" || @variant == \"digital\" || @variant == \"plasma\"\n @sprites[\"glow\"].bitmap = bmp\n @sprites[\"glow\"].center!\n @sprites[\"glow\"].glow(c, 35, false)\n @sprites[\"glow\"].color = c\n @sprites[\"glow\"].y = @viewport.height/2 + @viewport.height\n @sprites[\"glow\"].src_rect.set(0,@viewport.height,@viewport.width/2,0)\n @sprites[\"glow\"].ox = @sprites[\"glow\"].src_rect.width\n @sprites[\"glow2\"].bitmap = @sprites[\"glow\"].bitmap\n @sprites[\"glow2\"].center!\n @sprites[\"glow2\"].ox = 0\n @sprites[\"glow2\"].src_rect.set(@viewport.width/2,0,@viewport.width/2,0)\n @sprites[\"glow2\"].color = c\n @sprites[\"glow2\"].y = @viewport.height/2\n # creates the fade-out ball graphic overlay\n @sprites[\"overlay\"] = Sprite.new(@viewport)\n @sprites[\"overlay\"].z = 999999\n @sprites[\"overlay\"].bitmap = Bitmap.new(@viewport.width,@viewport.height)\n @sprites[\"overlay\"].opacity = 0\n end", "def setGameLoop gameLoop\n @gameLoop = gameLoop\n end", "def play\n take_turn until @master.game_over?\n @master.show_board\n @robot.speak\n end", "def show\n call Screen.setColor(true)\n call draw\n end", "def start\n # always load so no restarting of server is needed'\n maze_config = YAML.load_file(maze.file_name)\n # set starting points\n update_attributes(starting_point_player1: maze_config[\"starting_points_for_player1\"].values.sample, starting_point_player2: maze_config[\"starting_points_for_player2\"].values.sample)\n # set countdown via pusher, game is starting\n Pusher.trigger(\"player_#{player_one_id}_channel\", 'game_started', {message: 'game started'})\n Pusher.trigger(\"player_#{player_two_id}_channel\", 'game_started', {message: 'game started'})\n end", "def start\n end", "def onStart\r\n end" ]
[ "0.68360984", "0.6639908", "0.6451325", "0.62993324", "0.61970586", "0.6163759", "0.6157443", "0.6131971", "0.6095512", "0.6061154", "0.6006015", "0.60039425", "0.5999125", "0.5988099", "0.5987031", "0.59720844", "0.59613466", "0.59466904", "0.5942263", "0.59374255", "0.5935373", "0.5887371", "0.58749026", "0.5868839", "0.585444", "0.5838807", "0.58384335", "0.5825603", "0.5811942", "0.5811942", "0.5805168", "0.5803052", "0.5787563", "0.5786687", "0.57793945", "0.5777591", "0.5766037", "0.57611525", "0.57556784", "0.5750769", "0.5750494", "0.57066596", "0.5704419", "0.57008094", "0.5700685", "0.569832", "0.5693409", "0.56882036", "0.56861746", "0.5678705", "0.56760234", "0.56760234", "0.5669022", "0.56658447", "0.5663133", "0.56607425", "0.56567556", "0.56561834", "0.5655624", "0.56462544", "0.56448364", "0.56448364", "0.56448364", "0.56448364", "0.5632145", "0.56312186", "0.562918", "0.56206554", "0.56201607", "0.56195354", "0.56195354", "0.5608228", "0.55859023", "0.5573366", "0.5568133", "0.55664724", "0.5566086", "0.55539757", "0.55456036", "0.55434006", "0.55372727", "0.5531872", "0.5531869", "0.55259204", "0.55259204", "0.55259204", "0.55259204", "0.55259204", "0.5518422", "0.55177593", "0.55153877", "0.5515016", "0.551049", "0.55031353", "0.55002165", "0.5497827", "0.5497425", "0.5490971", "0.5488993", "0.54687876" ]
0.77794194
0
Calling this method cause the game window to stop rendering and close
def game_close @console_delegate.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_game\r\n $window.close\r\n end", "def close\n @window.destroy if @window\n VER::stop_ncurses\n end", "def quit_command()\n @subSceneScan.hide_windows()\n @target_enemy_window.active = true\n end", "def exit\n @window.pause = true\n @window.close\n end", "def new_game\n @display = false\n @window.pause = false\n end", "def close\n @window.destroy if @window\n @window = nil\n end", "def exit\n stop\n $window.deleteAllWidgets\n $window.createWidgets\n $window.deleteAllImages\n $window.cursor.unforceVisible\n terminate\n end", "def destroy; @win.destroy if @win; @win = nil; end", "def main_end\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end", "def dispose\n @frame.set_visible false\n @frame.dispose\n end", "def CloseWindow\n @window.hide\n Gtk.main_quit\n end", "def close_window\n end", "def main_end\r\n # Refresh map\r\n $game_map.refresh\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n # If switching from battle test to any screen other than game over screen\r\n if $BTEST and not $scene.is_a?(Scene_Gameover)\r\n $scene = nil\r\n end\r\n end", "def end_rune_selection\n @rune_stack_window.hide\n @rune_window.hide\n #@rune_stack_window = nil\n #@rune_window.help_window = nil\n #@rune_window.dispose\n #@rune_window = nil\n @help_window.hide\n end", "def close\n return if closed?\n\n nocbreak\n close_screen\n end", "def close\n @window.close\n end", "def close_graphics\n @p.close_graphics(self)\n end", "def terminate\n super\n @forge_animator.dispose\n end", "def destroy\n # typically the ensure block should have this\n # @panel = @window.panel if @window\n #Ncurses::Panel.del_panel(@panel) if !@panel.nil? \n #@window.delwin if !@window.nil?\n $log.debug \"win destroy start\"\n\n #@panel = @window.panel if @window\n Ncurses::Panel.del_panel(@panel) if !@panel.nil? \n @window.delwin if !@window.nil?\n $log.debug \"win destroy end\"\n end", "def exit_func(state)\n # clear screen\n RaspiGL::GLES.glClear(RaspiGL::GLES::GL_COLOR_BUFFER_BIT)\n RaspiGL::EGL.eglSwapBuffers(state.display, state.surface)\n\n # Release OpenGL resources\n RaspiGL::EGL.eglMakeCurrent(state.display,\n RaspiGL::EGL::EGL_NO_SURFACE,\n RaspiGL::EGL::EGL_NO_SURFACE,\n RaspiGL::EGL::EGL_NO_CONTEXT)\n RaspiGL::EGL.eglDestroySurface(state.display, state.surface)\n RaspiGL::EGL.eglDestroyContext(state.display, state.context)\n RaspiGL::EGL.eglTerminate(state.display)\n\n # release texture buffers\n #free(state.tex_buf1)\n #free(state.tex_buf2)\n #free(state.tex_buf3)\n\n puts(\"\\ncube closed\")\nend", "def exit_session\n @window.dispose\n @viewport.dispose\n ShellOptions.save\n end", "def close_game\n show\n Ncurses.mvaddstr(MAXY - 1, 0, 'Press any key to exit')\n Ncurses.getch\n Ncurses.curs_set(1)\n Ncurses.endwin\n end", "def window_message_close(smooth)\n if smooth\n while $game_temp.message_window_showing\n Graphics.update\n @message_window.update\n end\n else\n $game_temp.message_window_showing = false\n @message_window.visible = false\n @message_window.opacity = 255\n end\n end", "def destructionFen \n @v1.getWindow.destroy\n Gtk.main_quit\n end", "def stop\n dispose_fps_text\n @mouse.dispose unless !@mouse || @mouse.disposed?\n @cmd_thread&.kill\n @stop.call\n rescue LiteRGSS::Graphics::StoppedError\n puts 'Graphics already stopped.'\n end", "def end\r\n onEnd\r\n $window.deleteAllWidgets\r\n $window.createWidgets\r\n $window.deleteAllImages\r\n $window.cursor.unforceVisible\r\n onTerminate\r\n end", "def main_end\r\n super\r\n # If switching to title screen\r\n if $scene.is_a?(Scene_Title)\r\n # Fade out screen\r\n Graphics.transition\r\n Graphics.freeze\r\n end\r\n end", "def close\r\n pop_game_state\r\n end", "def terminate\n super\n dispose_spriteset\n end", "def close_message_window\n return unless @message_window\n while $game_temp.message_window_showing\n Graphics.update\n yield if block_given?\n @message_window.update\n end\n end", "def destroy\n # typically the ensure block should have this\n\n #$log.debug \"win destroy start\"\n\n $global_windows.delete self\n Ncurses::Panel.del_panel(@panel.pointer) if @panel\n delwin() if @window \n Ncurses::Panel.update_panels # added so below window does not need to do this 2011-10-1 \n\n # destroy any pads that were created by widgets using get_pad\n @pads.each { |pad| \n FFI::NCurses.delwin(pad) if pad \n pad = nil\n } if @pads\n # added here to hopefully take care of this issue once and for all. \n # Whenever any window is destroyed, the root window is repainted.\n #\n # 2014-08-18 - 20:35 trying out without refresh all since lower dialog gets erased\n Window.refresh_all\n #$log.debug \"win destroy end\"\n end", "def hide_window\n end", "def dispose_gameover_graphic\n @sprite.bitmap.dispose\n @sprite.dispose\n end", "def stop; self.app.stop end", "def hide\n call Screen.setColor(false)\n call draw\n end", "def destroy\n self.cleanTitle\n @label = []\n \n # Clean up the windows.\n CDK.deleteCursesWindow(@field_win)\n CDK.deleteCursesWindow(@label_win)\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n # Clean the key bindings.\n self.cleanBindings(self.object_type)\n\n # Unregister this object\n CDK::SCREEN.unregister(self.object_type, self)\n end", "def on_click\n @status_window_tb.hide\n $game_map.clear_next_highlights\n reset_aoe_follows\n #@spriteset.remove_group(DISPLAY_TB) # @spriteset.dispose_highlights_tb\n remove_show_hls\n end", "def close\n SLogger.debug(\"[client] interrupting window (#{@window_pid})...\")\n\n Process.kill(:INT, @window_pid)\n end", "def close \n #Self trigger window lost focus, since we are going to home\n focus_changed false, @screen_width, @screen_height\n @showing = false\n @activity.moveTaskToBack(true)\n end", "def quit\n Gamework::App.quit\n end", "def test_close_Speed\n w = Window_Base.new(300, 200, 100, 50)\n @windows.push(w)\n w.animationSpeed = 2000\n w.close()\n return true\n end", "def stop\n Shader.active_shader = nil if Shader.active_shader == self\n glUseProgram(0)\n end", "def game_exit\n Message.game_quit\n false\n end", "def quit\n ::HawkLoginController.load_into @stage, :width => 517,\n :height => 374\n\n @stage.min_width = 500\n @stage.min_height = 300\n\n @stage.size_to_scene\n end", "def command_shutdown\n Sound.play_decision\n RPG::BGM.fade(800)\n RPG::BGS.fade(800)\n RPG::ME.fade(800)\n $scene = nil\n end", "def endgame_render\n self.grid.flatten.each {|space| space.visible = true }\n render\n end", "def stoppen\n destroy_fox_components\n end", "def shutdown\n @gameLoop.stop\n @soundManager.shutdown\n end", "def close!\n @controller.close! if @controller\n FFI::NCurses.endwin\n Process.exit!\n end", "def dispose_splashscreen\r\n @sprite.bitmap.dispose\r\n @sprite.dispose\r\n end", "def exit\n @interface.hide\n # sth to destroy all dat shit??\n # Shut down propeller\n end", "def destroy\n FFI::NCurses.del_panel(@panel) if @panel\n FFI::NCurses.delwin(@pointer) if @pointer\n @panel = @pointer = nil # prevent call twice\n end", "def on_window1_destroy\n\t\tdestroy_window\n\tend", "def cancel\n @stage.close\n end", "def dispose_battlefloor\n @battlefloor_sprite.dispose\n end", "def close\n @contexts[0..maxy-1].each_with_index do |line, idx|\n @screen.move(idx, 0)\n @screen.addstr(line.to_s)\n end\n\n @screen.move(0, 0)\n @screen.refresh\n hotkeys\n Ncurses.endwin\n end", "def keyPressed(key, x, y)\n\n # If escape is pressed, kill everything. \n if (key == 27) \n # shut down our window \n glutDestroyWindow(@window)\n # exit the program...normal termination.\n exit(0) \n end\nend", "def command_shutdown\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Fade out BGM, BGS, and ME\r\n Audio.bgm_fade(800)\r\n Audio.bgs_fade(800)\r\n Audio.me_fade(800)\r\n # Shutdown\r\n $scene = nil\r\n end", "def quit\n scene = current_scene\n scene.end_scene\n @@scenes = [scene]\n end", "def quit_command()\n @command_window.active = false\n $scene = Scene_Menu.new(3)\n end", "def end_game\r\n @game_over = true\r\n end", "def reset_window\n end", "def dispose_battleback\n @battleback_sprite.dispose\n end", "def end_game\n\n end", "def dispose\n @info_window.dispose\n @desc_window.dispose\n super\n end", "def dispose\n dispose_backgrounds\n dispose_sprites\n dispose_weather\n dispose_timer\n dispose_viewports\n end", "def wait_for_dispose\n self.opacity = (@point.continue ? 255 : 0)\n @afterimage = false if out_of_screen?\n return unless @afterimages.empty?\n return if @anim_end.animation?\n return if @point.continue && !out_of_screen?\n dispose\n end", "def dispose\n super\n @visual.dispose\n end", "def quit\n Rubygame.quit()\n exit\n end", "def erase\n if self.validCDKObject\n CDK.eraseCursesWindow(@label_win)\n CDK.eraseCursesWindow(@field_win)\n CDK.eraseCursesWindow(@win)\n CDK.eraseCursesWindow(@shadow_win)\n end\n end", "def erase\n if self.validCDKObject\n CDK.eraseCursesWindow(@label_win)\n CDK.eraseCursesWindow(@field_win)\n CDK.eraseCursesWindow(@win)\n CDK.eraseCursesWindow(@shadow_win)\n end\n end", "def exit\n @main_loop = false\n end", "def terminate\n $game_system.quest_categories = QuestData::CATEGORIES\n $game_system.quest_scene_label = QuestData::VOCAB[:scene_label]\n $game_system.last_quest_id = @quest_list_window.item ? @quest_list_window.item.id : 0\n $game_system.last_quest_cat = @quest_category_window ? \n @quest_category_window.item : $game_system.quest_categories[0]\n super\n dispose_maqj_picture\n end", "def end_game\n end", "def stop\n session[:request_game] = nil\n flash[:notice] = 'Thank you for helping us keep the site tidy!'\n redirect_to frontpage_url\n end", "def exit_still_pp\n TactBattleManager.placing_party = true # party placement highlights\n return_scene\n end", "def dispose_active_window\n @active_window.dispose\n @active_window = nil\n end", "def dispose_active_window\n @active_window.dispose\n @active_window = nil\n end", "def terminate_message\n self.active = false\n self.pause = false\n @contents_showing = false\n $game_temp.message_proc&.call\n reset_game_temp_message_info\n dispose_sub_elements\n reset_overwrites\n @auto_skip = false\n end", "def close\n Processing::App.current = nil\n control_panel.remove if respond_to?(:control_panel) && !online?\n container = (@frame || JRUBY_APPLET)\n container.remove(self)\n self.destroy\n container.dispose\n end", "def Main\n #Begin preinitialization\n preInit()\n\n #Render Game Window and begin drawing onto the screen.\n\n DEBUG.cout(\"Initializing Game Window...\", 0, false)\n window = GameWindow.new\n window.show\n\n #End game and return to desktop\n return nil\nend", "def destroy\n FFI::NCurses.delwin(@pad) if @pad # when do i do this ? FIXME\n @pad = nil\n end", "def destroy\n FFI::NCurses.delwin(@pad) if @pad # when do i do this ? FIXME\n @pad = nil\n end", "def Animate_Stop(hwnd)\r\n send_animation_message(hwnd, :STOP)\r\n end", "def main_end\r\n super\r\n # Execute transition\r\n Graphics.transition(40)\r\n # Prepare for transition\r\n Graphics.freeze\r\n # If battle test\r\n if $BTEST\r\n $scene = nil\r\n end\r\n end", "def destroy\n CDK.deleteCursesWindow(@shadow_win)\n CDK.deleteCursesWindow(@win)\n\n self.cleanBindings(:BUTTON)\n\n CDK::SCREEN.unregister(:BUTTON, self)\n end", "def quit_command()\n return_scene\n end", "def quit_command()\n return_scene\n end", "def stop\n send Rainbow('Stopping cpgui...').aqua\n @run = false\n end", "def dispose\n for key in @sprites.keys\n @sprites[key].dispose\n end\n @viewport.dispose\n end", "def dispose_background\n @background.dispose;\n end", "def end_frame\n @frame = false\n end", "def dispose\r\n super\r\n dispose_shadow\r\n @bush_depth_sprite.dispose\r\n end", "def cancel_frame\n end", "def stop_loop_animation\n loop_animation(nil)\n end", "def pop_scene\n\t\t\tset_state(:stopped)\n\t\tend", "def main_loop\n# Set up the objects the main loop will\n# need.\n\n# The screen is the window displayed on the\n# screen.\nscreen = Screen.new [640, 480]\n\n# The event queue handles events from the\n# operating system\nqueue = EventQueue.new\n\n# The clock limits the framerate to 30fps\nclock = Clock.new\nclock.target_framerate = 30\n\n# This is the infinite main loop\nloop do\n# Pause the program for a short amount of\n# time so it doesn't exceed 30fps\nclock.tick\n\n# Process all events, return if the window\n# was closed\nqueue.each do|e|\nreturn if e.is_a? QuitEvent\nend\n\n# Fill the screen with a grey color and\n# display it on the monitor\nscreen.fill [200, 200, 200]\nscreen.update\nend\n\nensure\nRubygame.quit\nend", "def ui_close\n\t\t\t\t#puts \"CursesApp->ui_close\"\n\t\t\t\t\n\t\t\t\traise 'ui already closed' if @ui_closed\n\t\t\t\t@ui_closed = true\n\t\t\t\t\n\t\t\t\t# Curses.setpos(10, 0)\n\t\t\t\t# Curses.addstr('CLOSE ')\n\t\t\t\t# Curses.refresh\n\t\t\t\t# sleep(2)\n\t\t\t\t\n\t\t\t\tCurses.refresh\n\t\t\t\tCurses.stdscr.clear\n\t\t\t\tCurses.stdscr.refresh\n\t\t\t\tCurses.stdscr.close\n\t\t\t\tCurses.close_screen\n\t\t\tend", "def mouse_quit\n $game_system.se_play($data_system.cancel_se)\n if display_message(ext_text(8997, 40), 1, ext_text(8997, 33), ext_text(8997, 34)) == 0\n @return_data = false\n @running = false\n end\n end", "def stop()\n @ole.Stop()\n end" ]
[ "0.7248885", "0.7152591", "0.7067125", "0.7001458", "0.6953493", "0.6791762", "0.6774483", "0.671602", "0.6700217", "0.6667256", "0.6641483", "0.6640057", "0.6631214", "0.66063243", "0.65814114", "0.6562784", "0.65586424", "0.6557892", "0.65463716", "0.65423113", "0.6536912", "0.6523524", "0.6489975", "0.6474994", "0.64711267", "0.6465508", "0.64401525", "0.6422193", "0.641393", "0.63806725", "0.63790274", "0.63564706", "0.6344226", "0.6289395", "0.6232532", "0.62320155", "0.62205416", "0.6210038", "0.62048006", "0.6194038", "0.619315", "0.6152211", "0.61440843", "0.6142985", "0.61418897", "0.6108245", "0.60894364", "0.60865843", "0.6076852", "0.6075834", "0.60543233", "0.6050131", "0.6043051", "0.60344553", "0.6033343", "0.6031972", "0.6026026", "0.60190564", "0.6011884", "0.6010555", "0.59969723", "0.5989146", "0.5983176", "0.59778947", "0.5976017", "0.5971774", "0.5964856", "0.5963605", "0.5955213", "0.59544486", "0.59544486", "0.5951488", "0.59225374", "0.5909665", "0.5899394", "0.5897983", "0.5896859", "0.5896859", "0.58900243", "0.588692", "0.58841765", "0.5878261", "0.5878261", "0.5877482", "0.58751845", "0.5872053", "0.5858442", "0.5858442", "0.5853641", "0.5852775", "0.58402056", "0.5834071", "0.58304626", "0.5829899", "0.58228326", "0.58213913", "0.58197135", "0.58190495", "0.5818627", "0.5816383" ]
0.6174471
41
Override in the subclass in order to handle single button presses, called before game_loop; keyboard_map provides a map between keyboard_code => button_id
def on_button_down( button_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pressed?() sdl_event.press end", "def button_down(key)\n end", "def input_button\r\n n = 0\r\n LiteRGSS2RGSS_Input.each do |key, i|\r\n n = i if Input.trigger?(key)\r\n end\r\n if n > 0\r\n $game_variables[@button_input_variable_id] = n\r\n $game_map.need_refresh = true\r\n @button_input_variable_id = 0\r\n end\r\n end", "def handle_keys\n exit if SDL::Key.press? SDL::Key::ESCAPE\n exit if SDL::Key.press? SDL::Key::Q\n self.paused = !paused if SDL::Key.press? SDL::Key::P\n end", "def updateKeys\n\t\tif !@keysPressed.empty?\n\t\t\tkey = @keysPressed.pop\n\t\t\t@keysPressed.push(key)\n\t\t\tcase key.to_s\n\t\t\twhen \"t\" \n\t\t\t\t@nextGameState = Map1.new(@screen, @hero)\n\t\t\tend\n\t\tend\n\tend", "def key_pressed?(key)\n key_const = Gosu.const_get(:\"Kb#{key.to_s.gsub(/\\b\\w/){$&.upcase}}\")\n button_down?(key_const)\n end", "def key_pressed?(key)\n SDL::Key.press?(key)\n end", "def button_down(id)\n super(id)\n unless @buttons_down.include?(id)\n @input_lag = INPUT_LAG\n @buttons_down << id\n end\n return unless PRINT_INPUT_KEY\n #print(\"Buttons currently held down: #{@buttons_down} T:#{@triggered}\\n\")\n print(\"Window button pressed: (#{id}) which is (#{self.get_input_symbol(id).to_s})\\n\")\n end", "def button_down(id)\n if id == Gosu::KbQ\n close\n elsif id == Gosu::KbEscape\n if @state == :menu\n close\n elsif @state == :instructions\n @state = :menu\n else\n @state = :menu\n @paused = true\n end\n elsif id == Gosu::KbLeftAlt\n if @state == :game\n @player.toggle_pogo\n end\n elsif id == Gosu::KbLeftShift\n if @state == :game\n @player.sprint\n end\n elsif id == Gosu::KbSpace\n if @state == :game && !button_down?(Gosu::KbDown)\n @player.shoot(:sideways)\n elsif @state == :game && button_down?(Gosu::KbDown)\n @player.shoot(:down)\n end\n elsif id == Gosu::KbDown || id == Gosu::GpDown\n if @state == :menu\n @menu_selection += 1\n @menu_selection %= @menu_options.size\n end\n elsif id == Gosu::KbUp || id == Gosu::GpUp\n if @state == :menu\n @menu_selection += @menu_options.size - 1\n @menu_selection %= @menu_options.size\n elsif @state == :game\n @player.leave\n end\n elsif id == Gosu::KbReturn\n if @state == :menu\n if @menu_options[@menu_selection] == :Play || @menu_options[@menu_selection] == :Resume\n @menu_options[@menu_selection] = :Resume\n @state = :game\n @paused = true\n elsif @menu_options[@menu_selection] == :Instructions\n @state = :instructions\n elsif @menu_options[@menu_selection] == :Quit\n close\n end\n end\n end\n end", "def pressed?(key)\n @input[key].detect { |k| @game.button_down?(k) }\n end", "def keyEvent(event, pressed)\n @keyStatus ||= {}\n #oldStatus = @keyStatus[event.key]\n @keyStatus[event.key] = pressed\n if pressed\n self.sprites.each do | sprite |\n sprite.keyTyped(event) if sprite.respond_to?(:keyTyped)\n end\n end\n end", "def button_down(id)\n\t\t\n\t\t# Exit on escape\n\t\tif id == Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\t\t\n\t\t# Cursor Movement\n\t\t# NSEW = 0123\n\t\tif id == Gosu::KbUp\n\t\t\t@player.move(0)\n\t\tend\n\t\tif id == Gosu::KbDown\n\t\t\t@player.move(1)\n\t\tend\n\t\tif id == Gosu::KbRight\n\t\t\t@player.move(2)\n\t\tend\n\t\tif id == Gosu::KbLeft\n\t\t\t@player.move(3)\n\t\tend\n\t\t\n\t\t# Camera Movement\n\t\t# These should probably be farther from the load/save keys heh\n\t\tif id == Gosu::KbI\n\t\t\tif @zoom\n\t\t\t\t@camera_y -= 16 * 4\n\t\t\telse\n\t\t\t\t@camera_y -= 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbK\n\t\t\tif @zoom\n\t\t\t\t@camera_y += 16 * 4\n\t\t\telse\n\t\t\t\t@camera_y += 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbJ\n\t\t\tif @zoom\n\t\t\t\t@camera_x -= 16 * 4\n\t\t\telse\n\t\t\t\t@camera_x -= 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbL\n\t\t\tif @zoom\n\t\t\t\t@camera_x += 16 * 4\n\t\t\telse\n\t\t\t\t@camera_x += 16\n\t\t\tend\n\t\tend\n\t\tif id == Gosu::KbM # Toggle lame, janky zoom\n\t\t\t@zoom = !@zoom\n\n\t\t\t# If we're turning zoom on, set the camera so it zooms\n\t\t\t# to the area the cursor is at, if we're turning zoom off\n\t\t\t# then just reset the camera to show the full editor field.\n\t\t\tif @zoom\n\t\t\t\t@camera_x = @player.x\n\t\t\t\t@camera_y = @player.y\n\t\t\telse\n\t\t\t\t@camera_x = 0\n\t\t\t\t@camera_y = 0\n\t\t\tend\n\t\tend\n\t\t\n\t\t\n\t\t# Editor Functions\n\t\tif id == Gosu::KbQ # Scroll left through sprites\n\t\t\t@player.change(1)\n\t\tend\n\t\tif id == Gosu::KbW # Scroll right through sprites\n\t\t\t@player.change(2)\n\t\tend\n\t\tif id == Gosu::KbA # Place a tile as a world tile\n\t\t\t@player.place(1)\n\t\tend\n\t\tif id == Gosu::KbS # Place a tile as a prop, draw above world tiles\n\t\t\t@player.place(2)\n\t\tend\n\t\tif id == Gosu::KbD # Clear a tiles world/prop/collision info, setting it to nil\n\t\t\t@player.place(3)\n\t\tend\n\t\tif id == Gosu::KbZ # Mark a tile for collision, only drawn in the editor\n\t\t\t@player.place(4)\n\t\tend\n\t\tif id == Gosu::KbX # Turn on/off drawing of the red cross-circle that shows where colliders are\n\t\t\t@map.draw_colliders?\n\t\tend\n\t\t\n\t\t# Save / Load Functions (Still Experimental, but working)\n\t\t# Make sure that the file you're trying to load was made\n\t\t# by the same version of Tyle you're using now, else oddness.\n\t\tif id == Gosu::KbO and DEBUG\n\t\t\t@map.save(FILENAME)\n\t\tend\n\t\tif id == Gosu::KbP and DEBUG\n\t\t\t@map.load(FILENAME)\n\t\tend\n\t\t\n\tend", "def button_down(id)\n if id == Gosu::KbEscape || id == Gosu::KbQ\n save\n close\n elsif id == Gosu::KbA\n @current_type = :terrain\n elsif id == Gosu::KbS\n @current_type = :enemies\n elsif id == Gosu::KbD\n @current_type = :candies\n elsif id == Gosu::KbLeft || id == Gosu::GpLeft\n @x_offset -= 1 if @x_offset > 0\n elsif id == Gosu::KbUp || id == Gosu::GpUp\n @y_offset -= 1 if @y_offset > 0\n elsif id == Gosu::KbRight || id == Gosu::GpRight\n @x_offset += 1 if @x_offset < LEVEL_WIDTH - 10\n elsif id == Gosu::KbDown || id == Gosu::GpDown\n @y_offset += 1 if @y_offset < LEVEL_HEIGHT - 10\n elsif id == Gosu::Kb1\n if @current_type == :terrain\n @current_selection = :background\n elsif @current_type == :enemies\n @current_selection = :slug\n elsif @current_type == :candies\n @current_selection = :soda\n end\n elsif id == Gosu::Kb2\n if @current_type == :terrain\n @current_selection = :platform\n elsif @current_type == :enemies\n @current_selection = :spikes\n elsif @current_type == :candies\n @current_selection = :gum\n end\n elsif id == Gosu::Kb3\n if @current_type == :terrain\n @current_selection = :player\n elsif @current_type == :enemies\n @current_selection = :mushroom\n elsif @current_type == :candies\n @current_selection = :chocolate\n end\n elsif id == Gosu::Kb4\n if @current_type == :terrain\n @current_selection = :door\n end\n elsif id == Gosu::Kb5\n if @current_type == :terrain\n @current_selection = :background2\n end\n elsif id == Gosu::MsLeft\n if @current_selection == :slug\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n x += 32 * @x_offset\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n y -= 12\n y += 25 * @y_offset\n @enemies.push(Slug.new(self, x, y))\n elsif @current_selection == :spikes\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n x += 3\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n y -= 12\n x += 32 * @x_offset\n y += 25 * @y_offset\n @enemies.push(Spikes.new(self, x, y))\n elsif @current_selection == :mushroom\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n y += 6\n x += 32 * @x_offset\n y += 25 * @y_offset\n @enemies.push(Mushroom.new(self, x, y))\n elsif @current_selection == :player\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n x += 32 * @x_offset\n y += 25 * @y_offset\n x += 2\n @player = [x, y]\n elsif @current_selection == :door\n x = (mouse_x / SCALE).to_i\n x -= x % 32\n y = (mouse_y / SCALE).to_i\n y -= y % 25\n x += 32 * @x_offset\n y += 25 * @y_offset\n y += 2 \n @door = [x, y]\n elsif @current_type == :candies\n x = (mouse_x / SCALE).to_i\n y = (mouse_y / SCALE).to_i\n x += 32 * @x_offset\n y += 25 * @y_offset\n @candies.push(Object.const_get(@current_selection.to_s.capitalize).new(self, x, y))\n end\n end\n end", "def button_down(id)\n case id\n when Gosu::KbEnter, Gosu::KbReturn\n @paused = !@paused\n end\n end", "def process_keyboard\n ACCEPTED_KEYS.each {|key|\n if Input.repeat?(key[0])\n c = (key[0] != :kSPACE) ? Keyboard.add_char(Ascii::SYM[key[0]]) : \" \"\n process_add(c)\n #Sound.play_ok\n play_random_key_sound\n end\n }\n end", "def on_key(ch)\n end", "def button_down(id)\n case id\n when Gosu::KbEscape\n exit\n end\n end", "def button_up(id)\n Game.begin_game(@score) if id == Gosu::KbEscape or id == Gosu::KbReturn or Gosu::KbSpace\n end", "def button_down(id)\r\n case id\r\n when Gosu::KbEscape\r\n close\r\n end\r\n end", "def key_pressed?\n @declared_fields['keyPressed'].value(java_self)\n end", "def handle(key)\n case key\n when :left, :right, :space, :one, :two, :three, :four, :five, :six, :seven, :eight, :nine\n @player_controller.events.trigger(:key, key)\n when :down, :up, :enter, :u, :f, :s, :j, :k, :m, :h, :o\n @track_controller.events.trigger(:key, key)\n end\n end", "def move_for_keypress(window, pressed_buttons)\n # Generated once for each keypress\n until pressed_buttons.empty?\n button = pressed_buttons.shift\n case button\n when Gosu::KbUp then return :flip\n when Gosu::KbP then @conn.send_ping; return nil\n when Gosu::KbLeft, Gosu::KbRight # nothing\n else puts \"Ignoring key #{button}\"\n end\n end\n\n # Continuously-generated when key held down\n case\n when window.button_down?(Gosu::KbLeft) then :slide_left\n when window.button_down?(Gosu::KbRight) then :slide_right\n end\n end", "def button_down(id)\n if id == Gosu::KbEscape\n close\n end\n if id == Gosu::KbO && (not @twoplayer)\n @twoplayer = true\n @player.second_player_mode\n end\n if id == Gosu::KbR && @game_over\n @ball.reset\n @score.reset\n @game_over = false\n end\n end", "def input_map\n if @player_killed\n keymap = {\n ?x => :reload,\n ?q => :exit\n }\n else\n keymap =\n {\n ?w => :move_up,\n ?s => :move_down,\n ?a => :move_left,\n ?d => :move_right,\n ?A => :eat_left,\n ?D => :eat_right,\n ?q => :exit\n }\n end\n keymap\n end", "def button_down(id)\n Log.start { \"GW#button_down...\" }\n Log.puts { \"button id: #{id.inspect}\" }\n # puts \"gosu enter (#{Gosu::KbEnter}) == #{ENTER_KEY}\"\n if Gosu::MsLeft == id\n Log.puts { \"got left mouse, now what...\" }\n if @answer_field.clicked?\n Log.puts { \"answer clicked\" }\n # Mouse click: Select text field based on mouse position.\n # Advanced: Move caret to clicked position\n self.text_input.move_caret(mouse_x) unless self.text_input.nil?\n @answer_field.text = \"\" # a bit abrupt\n self.text_input = @answer_field\n @answer_field.text = \"\" # a bit abrupt\n elsif @submit_button.clicked?\n Log.puts { \"submit\" }\n game.raw_response = @answer_field.text\n @answer_field.text = \"\" # a bit abrupt\n elsif @continue_button.clicked?\n Log.puts { \"continue\" }\n @game.sleep_end = Gosu::milliseconds - 1\n else\n Log.puts { \"no-op\" }\n end\n elsif ENTER_KEY == id #Gosu::KbEnter == id\n game.raw_response = @answer_field.text\n end\n Log.stop { \"GW#button_down...\" }\n end", "def entry_point(native_event)\n # A gtk key-press event handler should return true if it handles the keystroke.\n # If not, the event is handled normally by gtk\n res = @map_engine.event @km.map_key native_event\n # if res\n # puts \"we keep the event\"\n # else\n # puts \"no it's ok we don't handle this event you can forward it\"\n # end\n res\n end", "def button_down(id)\n if id == Gosu::KbEscape\n close\n elsif id == Gosu::KbA\n if @bgm_si == nil or !@bgm_si.playing?\n @bgm_si = @bgm.play(1, 1, true) # play (loop enabled)\n end\n elsif id == Gosu::KbZ\n if @bgm_si\n @bgm_si.stop # stop\n end\n elsif id == Gosu::KbP\n if @bgm_si\n if @bgm_si.paused?\n @bgm_si.resume # resume\n elsif @bgm_si.playing?\n @bgm_si.pause # pause\n end\n end\n end\n end", "def new_key_pressed?(key)\n flag = last_keys[key] || SDL::Key.press?(key)\n last_keys[key] = SDL::Key.press?(key)\n flag\n end", "def update_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Return if Disabled Command\r\n if disabled_main_command?\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n main_command_input\r\n return\r\n end\r\n end", "def update_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Return if Disabled Command\r\n if disabled_main_command?\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Command Input\r\n main_command_input\r\n return\r\n end\r\n end", "def button_down; end", "def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end", "def updateKeys\n\t\tif !@keysPressed.empty?\n\t\t\tkey = @keysPressed.pop\n\t\t\tinitX = @initPosX + @hero.sprite.posx / SQUARE_SIZE \n\t\t\tinitY = @initPosY + @hero.sprite.posy / SQUARE_SIZE \n\t\t\tdirection = 0\n\t\t\tcase key.to_s\n\t\t\twhen \"u\"\n\t\t\t\tdirection = \"right\"\n\t\t\t\tcheckX = initX + SCREEN_CENTER_X / SQUARE_SIZE + 1 \n\t\t\t\tcheckY = initY + SCREEN_CENTER_Y / SQUARE_SIZE \n\t\t\twhen \"o\"\n\t\t\t\tdirection = \"left\"\n\t\t\t\tcheckX = initX + SCREEN_CENTER_X / SQUARE_SIZE - 1 \n\t\t\t\tcheckY = initY + SCREEN_CENTER_Y / SQUARE_SIZE \n\t\t\twhen \"e\" \n\t\t\t\tdirection = \"down\"\n\t\t\t\tcheckX = initX + SCREEN_CENTER_X / SQUARE_SIZE \n\t\t\t\tcheckY = initY + SCREEN_CENTER_Y / SQUARE_SIZE + 1 \n\t\t\twhen \"period\"\n\t\t\t\tdirection = \"up\"\n\t\t\t\tcheckX = initX + SCREEN_CENTER_X / SQUARE_SIZE \n\t\t\t\tcheckY = initY + SCREEN_CENTER_Y / SQUARE_SIZE - 1 \n\t\t\twhen \"t\"\n\t\t\t\tif @keyIdle\n\t\t\t\t\t@nextGameState = Menu.new(@screen, self) \n\t\t\t\tend\n\t\t\tend\n\t\t\tif direction != 0\n\t\t\t\tmove = true\n\t\t\t\ttile = @background[checkY][checkX]\n\t\t\t\t@noMove.each { |noMove|\n\t\t\t\t\tif tile == noMove\n\t\t\t\t\t\tmove = false\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tmovement(direction, key, move)\n\t\t\tend\n\t\tend\n\tend", "def press_any_key\n # TODO: Print footer.\n get_wch\n end", "def handle_input\n case event = SDL::Event2.poll\n when SDL::Event2::Quit then @running = false\n when SDL::Event2::KeyDown\n case event.sym\n when SDL::Key::ESCAPE then @running = false\n when SDL::Key::LEFT then direction = :left\n when SDL::Key::RIGHT then direction = :right\n when SDL::Key::UP then direction = :up\n when SDL::Key::DOWN then direction = :down \n end\n\n @log.info \"Key Event: #{event.sym} #{direction}\"\n return direction\n end\n end", "def update\n\t\t@controller.buttons_pressed_down if @controller\n\tend", "def handle_key ch\n if ch == 32\n toggle\n else\n super\n end\n end", "def press(key_sequence)\n end", "def button_down(id)\n\t\tcase id\n\t\twhen Gosu::KbEscape\n\t\t\tclose\n\t\tend\n\tend", "def process_key keycode, object\n return _process_key keycode, object, @window\n end", "def render\n @pressed.map do |idx, state|\n next unless state\n if on_grid?\n xx, yy = coords_for(idx: idx)\n change_grid(x: xx, y: yy, color: @colors.down)\n else\n change_command(position: @position, color: @colors.down)\n end\n end\n end", "def key_pressed?(key)\r\n\t\tif (GetKeyState.call(VALUES[key]).abs & 0x8000 == 0x8000)\r\n\t\t\tKeyRepeatCounter[key] = 0\r\n\t\t\treturn true\r\n\t\tend\r\n\t\treturn false\r\n\tend", "def key_pressed( event )\n @keys += [event.key]\n end", "def charPressedInMenu\n char = pressKey\n case (char)\n when \"p\"\n #load level of choice\n loadArray\n #displayArray\n displayArray\n when \"q\"\n #stop game\n exit\n when \"c\"\n #request level\n selectLevel\n else\n menuScreen\n end\nend", "def handle(key)\n case key\n when :left, :right, :space, :s\n @player_controller.events.trigger(:key, key)\n when :down, :up, :enter, :u\n @track_controller.events.trigger(:key, key)\n end\n end", "def key_pressed(event)\n case event.key\n when :left\n update_position :left\n when :right\n update_position :right\n when :up\n update_position :up\n when :down\n update_position :down\n when :space\n build_ladder\n end\n end", "def button_down_game_replay_presenter(id, window, state)\n if id == Gosu::KbSpace\n navigate_back(window) if id == Gosu::KbSpace\n end\n level_up(state) if id == Gosu::KbRight\n level_down(state) if id == Gosu::KbLeft\nend", "def button_down(id)\r\n if id == Gosu::KB_ESCAPE\r\n close\r\n else\r\n super\r\n end\r\n end", "def handle_key ch\n super\n end", "def button_down(id)\n if id == Gosu::Button::KbEscape\n close\n end\n end", "def button_up(id)\n super\n return unless controls_enabled?\n\n @drawing = false if id == Gosu::MsLeft\n @removing = false if id == Gosu::MsRight\n\n IO::SaveManager.save_map_state(map) if id == Gosu::KB_S\n IO::SaveManager.load_map_state(map) if id == Gosu::KB_L\n end", "def button_down(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n\r\n # Check if the player sprite can jump\r\n if [1,3,4,5,6].include?(get_tile_info(@player.get_x,\r\n @player.get_y,:down)) then\r\n\r\n # Call the jump function\r\n @player.jump\r\n\r\n # Player still might have a chance to \"double\" jump\r\n elsif @player.get_fall < 5 then\r\n @player.jump\r\n end\r\n end\r\n end", "def on_button_down(button_id, point)\n end", "def updateKeys\n\t\tif !@keysPressed.empty? and @phase == \"menu\"\n\t\t\tkey = @keysPressed.pop\n\t\t\tcase key.to_s\n\t\t\twhen \"u\"\n\t\t\t\tmenu = @menuStack.pop\n\t\t\t\tmenu.changeOption(1, 0)\n\t\t\t\t@menuStack.push(menu)\n\t\t\twhen \"o\"\n\t\t\t\tmenu = @menuStack.pop\n\t\t\t\tmenu.changeOption(-1, 0)\n\t\t\t\t@menuStack.push(menu)\n\t\t\twhen \"period\"\n\t\t\t\tmenu = @menuStack.pop\n\t\t\t\tif !menu.changeOption(0, -1)\n\t\t\t\t\t@subMenuIndex -= 1\n\t\t\t\t\tmenu = cycleMenu(menu)\n\t\t\t\tend\n\t\t\t\t@menuStack.push(menu)\n\t\t\twhen \"e\"\n\t\t\t\tmenu = @menuStack.pop\n\t\t\t\tif !menu.changeOption(0, 1)\n\t\t\t\t\t@subMenuIndex += 1\n\t\t\t\t\tmenu = cycleMenu(menu)\n\t\t\t\tend\n\t\t\t\t@menuStack.push(menu)\n\t\t\twhen \"t\"\n\t\t\t\tmenuAOption\n\t\t\twhen \"h\"\n\t\t\t\tif (@menuStack.length > 1) \n\t\t\t\t\t@menuStack.pop\n\t\t\t\t\t@hero.nextCommand.pop\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def key_press *args\n\t\t\tevent(:key_press, *args)\n\t\tend", "def on_char(evt)\n ch = evt.get_key_code\n mflag = evt.modifiers\n\n case ch\n when Wx::K_RIGHT : move_cursor_right(evt.shift_down)\n when Wx::K_LEFT : move_cursor_left(evt.shift_down)\n when Wx::K_DOWN : move_cursor_down(evt.shift_down)\n when Wx::K_UP : move_cursor_up(evt.shift_down)\n when Wx::K_BACK : on_key_back(evt)\n when Wx::K_DELETE : on_key_delete(evt)\n when Wx::K_TAB : on_key_tab(evt)\n when (mflag == Wx::MOD_CMD and ?a) # select all\n do_select_all\n when (mflag == Wx::MOD_CMD and ?c) # copy\n do_clipboard_copy\n when (mflag == Wx::MOD_CMD and ?x) # cut\n do_clipboard_cut\n when (mflag == Wx::MOD_CMD and ?v) # paste\n do_clipboard_paste\n when ((mflag == Wx::MOD_NONE or mflag == Wx::MOD_SHIFT) and 0x20..0x7e)\n if @cursor.area\n # redirect regular typing to on_char_AREANAME\n return self.send(\"on_char_#{AREAS[@cursor.area]}\", evt)\n end\n else # everything else is for dynamically handling key combo handlers\n m = []\n m << 'alt' if (mflag & Wx::MOD_ALT) != 0\n m << 'cmd' if (mflag & Wx::MOD_CMD) != 0\n m << 'shift' if (mflag & Wx::MOD_SHIFT) != 0\n mods = (m.empty?)? \"\" : \"_\" + m.join('_')\n\n ch = evt.get_key_code\n hex = ch.to_s(16).rjust(2,'0')\n meth=nil\n\n if (n=resolve_key_code(ch)) and respond_to?(\"on_key#{mods}_#{n}\")\n meth=\"on_key#{mods}_#{n}\"\n elsif respond_to?(\"on_key#{mods}_0x#{hex}\")\n meth=\"on_key#{mods}_#{hex}\"\n end\n\n if meth and ret=self.send(meth, evt)\n return ret\n else\n evt.skip()\n end\n end\n end", "def move_for_keypress\n # Generated once for each keypress\n until @pressed_buttons.empty?\n move = player.move_for_keypress(@pressed_buttons.shift)\n return move if move\n end\n\n # Continuously-generated when key held down\n player.moves_for_key_held.each do |key, move|\n return move if button_down?(key)\n end\n\n nil\n end", "def keypress\n key = input\n\n @keypress ||= Vedeu::Input::Translator.translate(key)\n end", "def key(k, x, y)\n case k\n when 27 # Escape\n exit\n end\n GLUT.PostRedisplay()\n end", "def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end", "def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end", "def change_keyboard_control! (**hash)\n super(*value_param(KB, hash))\n end", "def button_down(id); end", "def button_up(id)\n # 'P' for pause\n if id == Gosu::Button::KbP\n @state = (@state == :paused)? :in_game : :paused\n end\n end", "def check_selected_key\n key = @input_window.selected_key\n if key == 0\n return_scene\n else\n $game_system.xinput_key_set[@keys_window.item] = key\n @keys_window.refresh\n @keys_window.activate\n end\n end", "def map_keys\n return if @keys_mapped\n bind_key(KEY_F1, 'help') { hm = help_manager(); hm.display_help }\n bind_keys([?\\M-?,?\\?], 'show field help') { \n #if get_current_field.help_text \n #textdialog(get_current_field.help_text, 'title' => 'Help Text', :bgcolor => 'green', :color => :white) \n #else\n print_key_bindings\n #end\n }\n bind_key(FFI::NCurses::KEY_F9, \"Print keys\", :print_key_bindings) # show bindings, tentative on F9\n bind_key(?\\M-:, 'show menu') {\n fld = get_current_field\n am = fld.action_manager()\n #fld.init_menu\n am.show_actions\n }\n @keys_mapped = true\n end", "def keypress\n Vedeu::Input::Translator.translate(input)\n end", "def button_up(id)\r\n\r\n # Up-Arrow key\r\n if id == Gosu::KbUp then\r\n @player.reset_jump if @player.is_jumping?\r\n end\r\n end", "def process_key keycode, object\n return _process_key keycode, object, @graphic\n end", "def update_ctrl_button\n if Input.trigger?(:B) # Quit\n action_b\n elsif Input.trigger?(:A) # Action\n action_a\n elsif Input.trigger?(:X) # Info\n action_x\n elsif Input.trigger?(:Y) # Sort\n action_y\n else\n return true\n end\n return false\n end", "def onKeyDown( *args )\r\n capture = relay_event( :onKeyDown, args )\r\n relay_event( :onSetCursor, [] )\r\n capture\r\n end", "def button_up(key)\n self.close if key == Gosu::KbEscape\n end", "def update_command\n # If B button was pressed\n if Input.trigger?(Input::B)\n # Play cancel SE\n $game_system.se_play($data_system.cancel_se)\n # Switch to map screen\n $scene = Scene_Map.new\n return\n end\n # If C button was pressed\n if Input.trigger?(Input::C)\n # Branch by command sprite cursor position\n case @command_window.index\n when 0 # buy\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Change windows to buy mode\n @command_window.active = false\n @dummy_window.visible = false\n @buy_window.active = true\n @buy_window.visible = true\n @buy_window.refresh\n @status_window.visible = true\n when 1 # sell\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Change windows to sell mode\n @command_window.active = false\n @dummy_window.visible = false\n @sell_window.active = true\n @sell_window.visible = true\n @sell_window.refresh\n when 2 # quit\n # Play decision SE\n $game_system.se_play($data_system.decision_se)\n # Switch to map screen\n $scene = Scene_Map.new\n end\n return\n end\n end", "def button_up(key)\n close if key == Gosu::KbEscape\n\n # reset the game\n if @state == :end && key == Gosu::MsLeft\n @board = Board.new(self, 22, @root_dir)\n @state = :game\n return\n end\n\n @player_b.ai_inc if key == Gosu::KbS\n @player_b.ai_dec if key == Gosu::KbD\n\n if @player_on_turn.class == HotseatPlayer && key == Gosu::MsLeft\n if @board.cell_clicked(mouse_x, mouse_y, @player_on_turn.sym)\n\n return if @state == :end\n\n switch_players\n\n if @player_on_turn.class == AIPlayer\n @player_on_turn.make_move(@board)\n switch_players\n end\n end\n end\n end", "def key_down key\n @keys.push key\n end", "def bind_hotkey\n if @mnemonic\n ch = @mnemonic.downcase()[0].ord ## 1.9 DONE \n # meta key \n mch = ?\\M-a.getbyte(0) + (ch - ?a.getbyte(0)) ## 1.9\n if (@label_for.is_a? Canis::Button ) && (@label_for.respond_to? :fire)\n @form.bind_key(mch, \"hotkey for button #{@label_for.text} \") { |_form, _butt| @label_for.fire }\n else\n $log.debug \" bind_hotkey label for: #{@label_for}\"\n @form.bind_key(mch, \"hotkey for label #{text} \") { |_form, _field| @label_for.focus }\n end\n end\n end", "def button_down(id)\r\n dispatch_button_down(id, self)\r\n @input_clients.each { |object| dispatch_button_down(id, object) unless object.paused? } if @input_clients\r\n end", "def player_button_clicked(player_button, player_button_modifier_keys)\n @ole.PlayerButtonClicked(player_button, player_button_modifier_keys)\n end", "def _handle_key ch\n begin\n ret = process_key ch, self\n $multiplier = 0\n bounds_check\n rescue => err\n $log.error \" TEXTPAD ERROR _handle_key #{err} \"\n $log.debug(err.backtrace.join(\"\\n\"))\n alert \"#{err}\"\n #textdialog [\"Error in TextPad: #{err} \", *err.backtrace], :title => \"Exception\"\n ensure\n padrefresh\n Ncurses::Panel.update_panels\n end\n return 0\n end", "def button_down(id)\n case id\n when Gosu::MsLeft\n button_handler\n end\n end", "def show_single_key\n system(\"clear\")\n board.render\n\n c = read_char\n\n case c\n when \"\\e[A\"\n # puts \"UP ARROW\"\n board.selected_pos[0] -= 1 unless board.selected_pos[0] < 1\n when \"\\e[B\"\n board.selected_pos[0] += 1 unless board.selected_pos[0] > 7\n # puts \"DOWN ARROW\"\n when \"\\e[C\"\n board.selected_pos[1] += 1 unless board.selected_pos[1] > 7\n # puts \"RIGHT ARROW\"\n when \"\\e[D\"\n board.selected_pos[1] -= 1 unless board.selected_pos[1] < 1\n # puts \"LEFT ARROW\"\n when \"r\"\n make_move(board.selected_pos,\"r\")\n when \"f\"\n make_move(board.selected_pos,\"f\")\n when \"s\"\n save?\n end\n end", "def press_keycode(key, metastate: [], flags: [])\n @bridge.press_keycode(key, metastate: metastate, flags: flags)\n end", "def press_keycode(key, metastate: [], flags: [])\n @bridge.press_keycode(key, metastate: metastate, flags: flags)\n end", "def get_key(id)\n if id == Gosu::KbUp then Key.new(:up, nil, :north)\n elsif id == Gosu::KbLeft then Key.new(:left, nil, :west)\n elsif id == Gosu::KbDown then Key.new(:down, nil, :south)\n elsif id == Gosu::KbRight then Key.new(:right, nil, :east)\n elsif id == Gosu::KbA && shift_down then Key.new(:A, 0)\n elsif id == Gosu::KbB && shift_down then Key.new(:B, 1)\n elsif id == Gosu::KbC && shift_down then Key.new(:C, 2)\n elsif id == Gosu::KbD && shift_down then Key.new(:D, 3)\n elsif id == Gosu::KbE && shift_down then Key.new(:E, 4)\n elsif id == Gosu::KbF && shift_down then Key.new(:F, 5)\n elsif id == Gosu::KbG && shift_down then Key.new(:G, 6)\n elsif id == Gosu::KbH && shift_down then Key.new(:H, 7)\n elsif id == Gosu::KbI && shift_down then Key.new(:I, 8)\n elsif id == Gosu::KbJ && shift_down then Key.new(:J, 9)\n elsif id == Gosu::KbK && shift_down then Key.new(:K, 10)\n elsif id == Gosu::KbL && shift_down then Key.new(:L, 11)\n elsif id == Gosu::KbM && shift_down then Key.new(:M, 12)\n elsif id == Gosu::KbN && shift_down then Key.new(:N, 13)\n elsif id == Gosu::KbO && shift_down then Key.new(:O, 14)\n elsif id == Gosu::KbP && shift_down then Key.new(:P, 15)\n elsif id == Gosu::KbQ && shift_down then Key.new(:Q, 16)\n elsif id == Gosu::KbR && shift_down then Key.new(:R, 17)\n elsif id == Gosu::KbS && shift_down then Key.new(:S, 18)\n elsif id == Gosu::KbT && shift_down then Key.new(:T, 19)\n elsif id == Gosu::KbU && shift_down then Key.new(:U, 20)\n elsif id == Gosu::KbV && shift_down then Key.new(:V, 21)\n elsif id == Gosu::KbW && shift_down then Key.new(:W, 22)\n elsif id == Gosu::KbX && shift_down then Key.new(:X, 23)\n elsif id == Gosu::KbY && shift_down then Key.new(:Y, 24)\n elsif id == Gosu::KbZ && shift_down then Key.new(:Z, 25)\n #elsif id == 43 && shift_down then Key.new(:portal_up)\n #elsif id == 47 && shift_down then Key.new(:portal_down)\n elsif id == Gosu::KbA then Key.new(:a, 0)\n elsif id == Gosu::KbB then Key.new(:b, 1)\n elsif id == Gosu::KbC then Key.new(:c, 2)\n elsif id == Gosu::KbD then Key.new(:d, 3)\n elsif id == Gosu::KbE then Key.new(:e, 4)\n elsif id == Gosu::KbF then Key.new(:f, 5)\n elsif id == Gosu::KbG then Key.new(:g, 6)\n elsif id == Gosu::KbH then Key.new(:h, 7)\n elsif id == Gosu::KbI then Key.new(:i, 8)\n elsif id == Gosu::KbJ then Key.new(:j, 9)\n elsif id == Gosu::KbK then Key.new(:k, 10)\n elsif id == Gosu::KbL then Key.new(:l, 11)\n elsif id == Gosu::KbM then Key.new(:m, 12)\n elsif id == Gosu::KbN then Key.new(:n, 13)\n elsif id == Gosu::KbO then Key.new(:o, 14)\n elsif id == Gosu::KbP then Key.new(:p, 15)\n elsif id == Gosu::KbQ then Key.new(:q, 16)\n elsif id == Gosu::KbR then Key.new(:r, 17)\n elsif id == Gosu::KbS then Key.new(:s, 18)\n elsif id == Gosu::KbT then Key.new(:t, 19)\n elsif id == Gosu::KbU then Key.new(:u, 20)\n elsif id == Gosu::KbV then Key.new(:v, 21)\n elsif id == Gosu::KbW then Key.new(:w, 22)\n elsif id == Gosu::KbX then Key.new(:x, 23)\n elsif id == Gosu::KbY then Key.new(:y, 24)\n elsif id == Gosu::KbZ then Key.new(:z, 25)\n elsif id == Gosu::KbEscape then Key.new(:escape)\n elsif id == Gosu::KbSpace then Key.new(:space)\n elsif id == Gosu::KbReturn then Key.new(:return)\n end\n end", "def update_command\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Branch by command window cursor position\r\n case @command_window.index\r\n when 0 # buy\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Change windows to buy mode\r\n @command_window.active = false\r\n @dummy_window.visible = false\r\n @buy_window.active = true\r\n @buy_window.visible = true\r\n @buy_window.refresh\r\n @status_window.visible = true\r\n when 1 # sell\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Change windows to sell mode\r\n @command_window.active = false\r\n @dummy_window.visible = false\r\n @sell_window.active = true\r\n @sell_window.visible = true\r\n @sell_window.refresh\r\n when 2 # quit\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to map screen\r\n $scene = Scene_Map.new\r\n end\r\n return\r\n end\r\n end", "def key_pressed?\n Java.java_to_primitive(java_class.field(\"keyPressed\").value(java_object))\n end", "def key_pressed?\n Java.java_to_primitive(java_class.field(\"keyPressed\").value(java_object))\n end", "def button_down(id)\n key = self.get_key(id)\n if key != nil\n @game.state.command(key)\n \n # allow repeated movement...checked by update below\n if key.direction != nil\n @last_move = key\n @last_move_time = Gosu::milliseconds\n end\n end\n end", "def button_up(id)\n @bgm.play(true) if id == Gosu::KbA # play (loop enabled)\n @bgm.stop if id == Gosu::KbZ # stop\n @bgm.pause if id == Gosu::KbX # pause\n end", "def handle_key_press(key)\n case @scene\n when 'intro'\n handle_intro_key_press(key)\n when 'level'\n handle_level_key_press(key)\n when 'transition'\n when 'credits'\n end\n end", "def store_button()\n if $kx_model==2\n button_hold(14)\n elsif $kx_model==3\n button_hold(41)\n else\n return(nil)\n end\n return(true)\nend", "def button_up(id)\r\n dispatch_button_up(id, self)\r\n @input_clients.each { |object| dispatch_button_up(id, object) unless object.paused? } if @input_clients\r\n end", "def control_key_up\r\n command 'controlKeyUp'\r\n end", "def ORIG_process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n blk = @_key_map[keycode]\n $log.debug \"XXX: _process key keycode #{keycode} #{blk.class}, #{self.class} \"\n return :UNHANDLED if blk.nil?\n if blk.is_a? OrderedHash \n #Ncurses::nodelay(window.get_window, bf = false)\n # if you set nodelay in ncurses.rb then this will not\n # wait for second key press, so you then must either make it blocking\n # here, or set a wtimeout here.\n #\n # This is since i have removed timeout globally since resize was happeing\n # after a keypress. maybe we can revert to timeout and not worry about resize so much\n Ncurses::wtimeout(window.get_window, 500) # will wait a second on wgetch so we can get gg and qq\n ch = window.getch\n # we should not reset here, resetting should happen in getch itself so it is consistent\n #Ncurses::nowtimeout(window.get_window, true)\n\n $log.debug \" process_key: got #{keycode} , #{ch} \"\n # next line ignores function keys etc. C-x F1, thus commented 255 2012-01-11 \n if ch < 0 #|| ch > 255\n return nil\n end\n #yn = ch.chr\n blk1 = blk[ch]\n # FIXME we are only returning the second key, what if form\n # has mapped first and second combo. We should unget keycode and ch. 2011-12-23 \n # check this out first.\n window.ungetch(ch) if blk1.nil? # trying 2011-09-27 \n return :UNHANDLED if blk1.nil? # changed nil to unhandled 2011-09-27 \n $log.debug \" process_key: found block for #{keycode} , #{ch} \"\n blk = blk1\n end\n if blk.is_a? Symbol\n if respond_to? blk\n return send(blk, *@_key_args[keycode])\n else\n ## 2013-03-05 - 19:50 why the hell is there an alert here, nowhere else\n alert \"This ( #{self.class} ) does not respond to #{blk.to_s} [PROCESS-KEY]\"\n # added 2013-03-05 - 19:50 so called can know\n return :UNHANDLED \n end\n else\n $log.debug \"rwidget BLOCK called _process_key \" if $log.debug? \n return blk.call object, *@_key_args[keycode]\n end\n #0\n end", "def rp5_key_press?(key)\n if $sketch.key_pressed?\n if $sketch.key == $sketch.class::CODED\n return $sketch.key_code == key\n else\n return $sketch.key == key.chr\n end\n end\n return false\n end", "def control_key_down\r\n command 'controlKeyDown'\r\n end", "def button_down(id)\n # ENTER: launch A* algorithm\n if id == Gosu::KbReturn && ready?\n @grid.update_neighbors\n a_star\n @needs_reset = true\n end\n\n # SUPPR: clear window\n reset! if id == Gosu::KbDelete\n end", "def button_down(key)\n MenuControllerContracts.invariant(self)\n @current_view.button_down(key)\n MenuControllerContracts.invariant(self)\n end", "def keypress_handler(scancode)\n i = scancode & 0x7f\n x = SCREEN_W() - 100 * 3 + (i % 3) * 100\n y = SCREEN_H() / 2 + (i / 3 - 21) * 10\n color = scancode & 0x80 != 0 ? makecol(255, 255, 0) : makecol(128, 0, 0)\n rectfill(screen, x, y, x + 95, y + 8, color)\n str = ustrzncpy(scancode_to_name(i), 12)\n textprintf_ex(screen, font, x + 1, y + 1, makecol(0, 0, 0), -1, str)\nend", "def pressed?(key)\n p = button_down?(key)\n if p\n if @unpress.include?(key)\n p = false\n else\n @unpress.push(key)\n end\n end\n return p\n end" ]
[ "0.6638239", "0.6602832", "0.6585344", "0.6490322", "0.6445961", "0.63370883", "0.6271538", "0.6268035", "0.62628454", "0.6252203", "0.6236943", "0.6228796", "0.6176521", "0.6141354", "0.6132879", "0.6113606", "0.6103785", "0.61017424", "0.6076202", "0.6075147", "0.6069541", "0.605203", "0.60472775", "0.60363024", "0.5982222", "0.5966383", "0.59361637", "0.5933822", "0.59312344", "0.59067565", "0.5899837", "0.5898256", "0.58894265", "0.58849216", "0.58809644", "0.58734196", "0.58582664", "0.5842872", "0.58365357", "0.58352005", "0.5833918", "0.5822112", "0.5815302", "0.5807514", "0.58002394", "0.5794939", "0.5794534", "0.57841176", "0.5779553", "0.5777029", "0.57699865", "0.5769537", "0.5758369", "0.57469124", "0.5746899", "0.5741941", "0.5726316", "0.5716636", "0.5705451", "0.56873214", "0.56873214", "0.5681933", "0.56764984", "0.56756115", "0.56579167", "0.56505615", "0.5650406", "0.56456715", "0.5645467", "0.56413037", "0.56356597", "0.5634018", "0.56284523", "0.56271255", "0.5626591", "0.5625053", "0.56228024", "0.56178814", "0.56164443", "0.5609349", "0.559095", "0.5590627", "0.5590627", "0.5581603", "0.55789715", "0.5577941", "0.5577577", "0.5566161", "0.5555759", "0.5554768", "0.55520076", "0.55518866", "0.55509216", "0.554304", "0.5542312", "0.55401635", "0.55396533", "0.5533267", "0.5532301", "0.55206066" ]
0.5949351
26
Never trust parameters from the scary internet, only allow the white list through.
def additional_packet_params params.require(:additional_packet).permit(:content, :price) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def 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 user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def 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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def 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.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.62905645", "0.6289235", "0.6283876", "0.62425834", "0.62410337", "0.6218672", "0.62151134", "0.62096137", "0.6192354", "0.6178057", "0.6177618", "0.61727077", "0.6162073", "0.6152049", "0.61515594", "0.61458135", "0.6122875", "0.61165285", "0.6107696", "0.6104097", "0.6091097", "0.6080201", "0.60699946", "0.6063739", "0.60206395", "0.60169303", "0.60134894", "0.601003", "0.6007347", "0.6007347", "0.6001054", "0.59997267", "0.5997844", "0.5991826", "0.5991213", "0.59911627", "0.5980111", "0.5967009", "0.59597385", "0.5958542", "0.595787", "0.5957425", "0.59522784", "0.5951228", "0.59423685", "0.5939385", "0.5939122", "0.5939122", "0.59325653", "0.5930178", "0.59248054", "0.59243476", "0.59164625", "0.59106", "0.59101933", "0.59084356", "0.5905666", "0.58975077", "0.58974737", "0.5895128", "0.58946574", "0.589308", "0.58916", "0.5885987", "0.58838505", "0.58792", "0.58723736", "0.58684355", "0.58677715", "0.5865701", "0.5865538", "0.5865288", "0.586385", "0.5862139", "0.58614355", "0.58593005", "0.5857459", "0.58541363", "0.58536613", "0.58520085", "0.585011" ]
0.0
-1
I worked on this challenge [by myself, with: ]. count_between is a method with three arguments: 1. An array of integers 2. An integer lower bound 3. An integer upper bound It returns the number of integers in the array between the lower and upper bounds, including (potentially) those bounds. If +array+ is empty the method should return 0 Your Solution Below Pesudocode define a method that has three arguments 1. An array of integers 2. An integer lower bound 3. An integer upper bound This will return the numbers that are between the lower and upper bound and if the array is empty it will return 0 =begin def count_between(list_of_integers, lower_bound, upper_bound) x = 2 if x >= lower_bound && x <= upper_bound p x else p 0 end end =end REFACTOR USING RUBY METHOD
def count_between(list_of_integers, lower_bound, upper_bound) list_of_integers.count {|x| x>= lower_bound && x <= upper_bound} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_between(list_of_integers, lower_bound, upper_bound)\n if list_of_integers == []\n return 0\nelsif upper_bound < lower_bound\n return 0\nend\n# sum = 0\n# sum = list_of_integers[lower_bound..upper_bound].each\n# for integer in lower_bound..upper_bound\n# p integer\n# if list_of_integers.each >= lower_bound && list_of_integers.each <= upper_bound\nnew_array = []\nlist_of_integers.each do |number| if number >= lower_bound && number <= upper_bound\nnew_array.push(number)\nend\nend\nsum = new_array.length\nsum\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n if list_of_integers == []\n return 0\n end\n new_array = list_of_integers.select { |x| x >= lower_bound && x <= upper_bound }\n new_array.length\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n if list_of_integers == []\n return 0\n end\n\n counter = 0\n list_of_integers.each { |x|\n if (x >= lower_bound) && (x <= upper_bound)\n counter += 1\n elsif\n counter += 0\n end\n }\n p counter\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n if (list_of_integers.size != 0) && (upper_bound >= lower_bound)\n #puts \"Array size greater than 0 and upper_bound is greater than lower_bound!\"\n i = 0\n nums_between = 0\n #puts \"size of array: \" + list_of_integers.size.to_s\n for i in 0...list_of_integers.size\n num = list_of_integers[i]\n #puts \"array at index #{i} is #{num}\"\n if (lower_bound <= num) && (num <= upper_bound)\n nums_between += 1\n #puts nums_between\n end\n i += 1\n end\n return nums_between\n else\n #puts \"Array empty\"\n return 0\n end\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n #find numbers less than or equal to upper bound\n #find numbers greater than or equal to lower bound\n # how many there are\n counter = []\n list_of_integers.each do |num|\n if num >= lower_bound && num <= upper_bound\n counter.push(num)\n else\n end\n end\n return counter.length\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n # Your code goes here!\n return 0 if list_of_integers.length == 0 || upper_bound < lower_bound\n\n numbers_between = 0\n\n list_of_integers.each { |this_integer| \n if this_integer >= lower_bound && this_integer <= upper_bound\n numbers_between += 1\n end\n }\n\n return numbers_between\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\nnew_array=Array.new\nlist_of_integers.each {|x|\n if x >= lower_bound.to_i && x <= upper_bound.to_i\n new_array << x\n end}\n return new_array.length\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n\treturn 0 if list_of_integers.length == 0 || upper_bound<lower_bound\n\trange = (lower_bound..upper_bound).to_a\n\tlist_of_integers.count {|v| (lower_bound..upper_bound).include? (v)}\n\n # Your code goes here!\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n if list_of_integers.nil?\n return 0\n end\n list_of_integers.count do |integer|\n (lower_bound..upper_bound).include?(integer)\n end\nend", "def count_between(list_of_integers,lower_bound,upper_bound)\nr = Range.new(lower_bound,upper_bound)\nnew_array=[]\nlist_of_integers.each do |x|\n if r.include?(x)\n new_array.push(x)\n end\n\nend\n\nreturn new_array.length\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n\n list_of_integers.each do |n|\n answer = 0\n if n >= lower_bound && n <= upper_bound\n answer = answer + 1\n else\n end\n\n end\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n new_array = []\n \n list_of_integers.each do |num|\n if num >= lower_bound && num <= upper_bound\n new_array.push(num)\n end\n end\n new_array.length\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\ncount = 0\nrange_array = *(lower_bound..upper_bound)\nlist_of_integers.each do |i|\nif range_array.include?(i) == true\ncount += 1\nend\nend\nreturn count\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n\tarray_length = list_of_integers.sort!.length\n\tcounter = 0\n\tlist_of_integers.each {|element| counter += 1 if element >= lower_bound && element <= upper_bound}\n\tcounter\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n\nend", "def count_between(array, lower_bound, upper_bound)\n\tcounter = 0\n\tnumbers = 0\n\twhile counter < array.length\n\t\tif ((array[counter] <= upper_bound) && (array[counter] >= lower_bound))\n\t\tnumbers += 1\n\t\tcounter += 1\n\t\telse\n\t\t\tcounter += 1\n\t\tend\n\tend\n\treturn numbers\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\nin_bounds = []\n\n list_of_integers.each do |num|\n if num >= lower_bound && num <= upper_bound\n in_bounds << num\n else\n \"out of bounds\"\n end\n end\n\n p in_bounds.length\n\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n\treturn list_of_integers.count {|x| x >= lower_bound && x <= upper_bound}\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n return 0 if list_of_integers.empty?\n return 0 if upper_bound < lower_bound\n\n test_num = list_of_integers.pop\n out_of_bounds = []\n solution = []\n\n if test_num > upper_bound || test_num < lower_bound\n out_of_bounds << test_num\n else\n solution << test_num\n end\n\n list_of_integers.each do |num|\n if num > upper_bound || num < lower_bound\n out_of_bounds << num\n else\n solution << num\n end\n end\n\n return solution.length\n\n # OR USE delete_if METHOD:\n # new_list = list_of_integers.delete_if {|num| num > upper_bound || num < lower_bound}\n # return new_list.length\n\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n count = 0\n list_of_integers.each do |int|\n if (lower_bound..upper_bound).include? int\n count = count + 1\n end\n end\n return count\nend", "def count_between(list_of_integers, lower_bound, upper_bound)\n # Your code goes here!\n return 0 if list_of_integers.length == 0\n\n flag = false\n con\n # iter array\n list_of_integers.each do |x|\n\n if x >= lower_bound || x <= upper_bound\n #flag = !flag\n new_array.push(x)\n end\n if flag == false\n list_of_integers.delete(x)\n end\n end\n return list_of_integers\nend", "def find_range(arr,low,high)\n arr.find_all{|item| item >=low && item <= high}.length\nend", "def sum_of_range(array)\n value = 0\n if array[0] < array[1] == true\n value = array[0] \n elsif array[0] > array[1] == true\n value = array[1] \n end\n\n new_array = []\n 50.times do \n if value.between?(array[0], array[1]) == true\n new_array << value\n value = value + 1\n elsif value.between?(array[1], array[0]) == true\n new_array << value\n value = value + 1\n end\n end\n sum = 0\n new_array.each { |n| sum += n } \n p sum\nend", "def count_in_array(number)\n first = first_in_array(number)\n return 0 if first == -1\n\n last = last_in_array(number)\n (last - first + 1)\n end", "def counting_sort(arr, value_upper_bound)\n if !value_upper_bound.integer? || value_upper_bound < 0\n raise ArgumentError.new(\"counting_sort must be invoked with integer value_upper_bound >= 0\")\n end\n if !arr.all? { |elem| elem.integer? && elem.between?(0, value_upper_bound) }\n raise ArgumentError.new(\"counting_sort must be invoked with integer array elements in (0..value_upper_bound)\")\n end\n sorted_arr = Array.new(arr.length) { 0 }\n tmp_arr = Array.new(value_upper_bound+1) { 0 }\n for elem in arr\n tmp_arr[elem] += 1\n end\n for i in 1..value_upper_bound\n tmp_arr[i] += tmp_arr[i-1]\n end\n arr.reverse_each do |elem|\n sorted_arr[tmp_arr[elem]-1] = elem\n tmp_arr[elem] -= 1\n end\n sorted_arr\nend", "def sum_of_range(arr)\n arr[0] < arr[1] ? (arr[0]..arr[1]).reduce(:+) : arr[0].downto(arr[1]).reduce(:+)\nend", "def count_numbers_v2(from, to)\n total_numbers = (to - from).abs\n\n # handles X5\n possible_fives = total_numbers / 10\n\n # handles 5X\n possible_fifthy = total_numbers / 100\n\n # we already counted 55\n possible_fives += possible_fifthy * 8\n\n total_numbers - possible_fives\nend", "def sum_of_range(array)\n first = array.first\n last = array.last\n if first < last\n numbers = (first..last).to_a\n else\n numbers = (last..first).to_a\n end\n index = 0\n numbers.each do |number|\n index += number\n end\n result = index\nend", "def count(arr)\n count = 0\n arr_length_half = arr.length / 2\n\n arr_length_half.times do |i|\n if arr [i] > arr[- i - 1]\n count += arr[i]\n else\n count += arr[-i - 1]\n end\n end\n count\nend", "def zero_count(numbers)\n result = 0\n index = 0\n while index < numbers.length\n if numbers[index] == 0\n result += 1\n end\n index += 1\n end\n result\nend", "def count(array)\n if array == []\n 0\n else\n 1 + count(array[1..-1])\n end\nend", "def sum_of_range(array)\n\n if array[0] > array[1]\n rev_array = array.reverse\n range_array = (rev_array[0]..rev_array[1]).to_a\n sum = 0\n range_array.each {|e| sum += e}\n p sum\n else\n range_array = (array[0]..array[1]).to_a\n sum = 0\n range_array.each {|e| sum += e }\n p sum\n end\n\nend", "def Consecutive(arr)\nlowest_num = arr.min\nhighest_num = arr.max\nconsec_numbers = (lowest_num..highest_num).to_a.size - arr.size\nconsec_numbers\nend", "def count_sum(array)\n ans = []\n count = 0\n sum = 0\n return [] if array.empty?\n array.each do |n|\n if n > 0\n count += 1\n elsif n < 0\n sum += n\n end\n end\n ans << count\n ans << sum \n return ans\nend", "def how_many_missing(arr)\n arr.count > 0 ? (arr.first..arr.last).count - arr.count : 0\nend", "def length_of_lis(nums)\n len = []\n (0...nums.size).map { |i|\n len[i] = (0...i)\n .select { |j| nums[j] < nums[i] }\n .map { |j| len[j] + 1 }.max || 1\n }.max || 0\nend", "def lcount(arr)\n (1...arr.length).reduce(1) { |c, i| arr[i] > arr[0...i].max ? c + 1 : c }\nend", "def generatePossibleCombinationsCount(low, high)\n count = 0\n for number in (low..high)\n count += 1 if testNumber(number)\n end\n count\nend", "def sum_of_range(range)\n range.sort! # easiest way to max sure it's in min max order\n # range = [range[1], range[0]] if range[1] < range[0] # longer way to check min/max order\n (range[0]..range[1]).reduce(:+)\nend", "def dont_give_me_five(start_,end_)\n array = (start_..end_).to_a\n\n array.delete_if {|x| x.to_s.include?(\"5\")}\n n = array.count\n return n\nend", "def counting(limit) # this method receives an integer argument and returns an array\n numbers = []\n if limit.is_a?(Integer)\n count = 0\n while count < limit\n numbers << count\n count += 1\n end\n end \n numbers\nend", "def find_number_of_lis(nums)\n return 0 if nums.empty?\n lengths = Array.new(nums.size, 1)\n counts = Array.new(nums.size, 1)\n\n for i in 1...nums.size\n for j in 0...i\n if nums[i] > nums[j]\n if lengths[j] + 1 == lengths[i]\n counts[i] += counts[j]\n elsif lengths[j] + 1 > lengths[i]\n counts[i] = counts[j]\n lengths[i] = lengths[j] + 1\n end\n end\n end\n end\n\n max_length = lengths.max\n result = 0\n \n counts.each_with_index do |count, i|\n result += count if lengths[i] == max_length\n end\n \n result\nend", "def count input, first, last\n# puts first.to_s() + \" \" + last.to_s()\n \n return if first == last\n \n mid = (first+last)/2\n \n count(input, first, mid)\n count(input, mid+1, last)\n mergeAndCountSplit(input, first, last)\n \nend", "def count_to(num)\n\tnum > 0 ? (0..num).to_a : 0.downto(num).to_a\nend", "def count_to(num)\n num = num.to_i\n if num >= 0\n (0..num).to_a\n else\n 0.downto(num).to_a\n end\nend", "def search_upper_boundary(array, range=nil, &block)\n range = 0 ... array.length if range == nil\n \n lower = range.first() -1\n upper = if range.exclude_end? then range.last else range.last + 1 end\n while lower + 1 != upper\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\n if yield(array[mid]) <= 0\n lower = mid\n else \n upper = mid\n end\n end\n return lower + 1 # outside of the matching range.\n end", "def total_negative_integers(array)\n if array.length > 0\n\n total_negative_integers(array.shift)\n # if array.shift < 0\n # counter += 1\n else\n counter\n end\n # total_negative_integers(array[1..-1])\n end", "def simber_count(n)\n lower_range = 10**(n - 1)\n upper_range = (10**n) - 1\n count = 0\n (lower_range..upper_range).each do |i|\n count += 1 if simber_check(i)\n end\n count\nend", "def count_to(num)\n arr = []\n num = num.to_int\n num > 0 ? 0.upto(num){|i| arr.push(i)} : 0.upto(-num){|i| arr.push(-i)}\n return arr\n end", "def how_many(value)\n lo = 0\n hi = @array.length - 1\n mid = lo + (hi - lo) / 2\n\n # ordinary binary search\n # while both bounds hasn't reach each other\n while (lo <= hi) and @array[mid] != value\n # divide the range where the value could be\n mid = lo + (hi - lo) / 2\n if value < @array[mid] then\n hi = mid - 1\n elsif value > @array[mid] then\n lo = mid + 1\n end\n end\n\n # if didn't find the value with the binary search\n if @array[mid] != value\n return 0\n end\n\n hi_index = find_bounds @array, hi, lo, mid, value, :HI\n lo_index = find_bounds @array, hi, lo, mid, value, :LO\n\n hi_index - lo_index + 1\n end", "def count_up(number)\n if number < 0\n (number..1).to_a\n else\n (1..number).to_a\n end\nend", "def span_count ary\n ([0] + ary).lazy\n .each_cons(2)\n .count{|c,n| c == 0 && n != 0 }\nend", "def total_negative_numbers\n numbers = [0, 3, -1, -45.4, 5, 68, -8]\n\n # numbers.count { |number| number < 0 }\n numbers.count(&:negative?)\nend", "def count_to(num)\n # takes in a number\n # returns an array containing every integer from 0 to n\n # counts up or down\n # rounds off decimals\n arr=[]\n if num ==0\n return [0]\n end\n n = num\n n = num.÷floor\n if !num.integer? && num < 0\n n = num.floor + 1\n end\n\n if n < 0\n 0.downto(n) { |i| arr.push(i) }\n else\n 0.upto(n) { |i| arr.push(i) }\n end\n arr\nend", "def number_of_55(numbers)\n count = 0\n\n numbers.each do |number|\n if number == 55\n count += 1\n end\n end\n\n return count\nend", "def counting_sort(arr, min, max)\n output = Array.new(arr.length) { 0 }\n\n count = Array.new(max - min + 1) { 0 }\n\n arr.each { |element| count[element] += 1 }\n\n count.each_with_index { |_element, i| count[i] += count[i - 1] }\n\n arr.each do |element|\n output[count[element] - 1] = element\n count[element] -= 1\n end\n\n output\n end", "def count(array)\n count = 0\n array.each do |x|\n count += 1\n end\n\n return count\nend", "def countApplesAndOranges(start_point, ending_point, apple_tree,\n orange_tree, apples, oranges)\n fallen_a = Array.new(0)\n fallen_o = Array.new(0)\n v = start_point..ending_point\n apples.each do |a|\n fallen_a << a if v.include?(apple_tree + a)\n end\n oranges.each do |o|\n fallen_o << o if v.include?(orange_tree + o)\n end\n p fallen_a.size\n p fallen_o.size\nend", "def count_list(array)\n counter = 0\n array.each do |num|\n counter +=1\n end\ncounter\nend", "def checkCount(arrival,duration)\n return arrival.length if arrival.length<2\n\n event_count=1\n\n (1...arrival.length).each do |idx|\n prev_arrival = arrival[idx-1]\n curr_arrival = arrival[idx]\n time_req = duration[idx]\n\n event_count+=1 if time_req <= curr_arrival-prev_arrival\n end\n\n event_count\n\nend", "def run(lower, upper, validator)\n count = 0\n current_value = lower - 1\n\n # Each iteration, we skip to the next valid number in range and check whether\n # it satisfies the validator.\n while (current_value = step(current_value)) <= upper\n count += 1 if validator.call(current_value)\n end\n\n count\nend", "def find_between(min, max)\n #place solution here\n end", "def count_stops_in_array(stops_array)\n result = stops_array.length()\n return result\nend", "def count_elements(arr)\n count = 0\n\n arr.each do |x|\n if arr.include?(x+1)\n count += 1\n end\n end\n \n count\nend", "def count_positive_subarrays(arr) \n return arr.count{|ele| ele.sum > 0}\nend", "def count_elements(array)\n\nend", "def sum(upper_limit)\n acc = 0\n (1..upper_limit).each { |num| acc+=num }\n acc\nend", "def sum_positive_count_negative(arr)\n positives, negatives = arr.partition(&:positive?)\n [positives.inject(0,&:+), negatives.length]\nend", "def missing_ranges(array, lower = 0, upper = 99)\n ranges = []\n\n i = 0\n prev = lower - 1\n\n while i <= array.size\n curr = (i == array.size) ? upper + 1 : array[i]\n\n if curr - prev > 1\n ranges << get_range(prev + 1, curr - 1)\n end\n\n prev = curr\n i += 1\n end\n\n ranges\nend", "def dont_give_me_five(start_,end_)\n number = 0\n (start_..end_).each do |n|\n n = n.to_s.split('')\n if n.include?(\"5\")\n else\n number += 1\n end\n end\n return number\nend", "def count_menor_5(arr)\n con = arr.count{|cont| cont < 5} \n puts \"Los elementos del array menores que 5 son #{con}\" \nend", "def find_a_starting_index_within_range(j, lower_range, upper_range)\n step = ((upper_range - lower_range) / 2).round\n\n index = lower_range + step\n sum = $sorted_numbers[j] + $sorted_numbers[index]\n\n # if we found an index that satisifies the conditions, we return it\n if sum.between?(LOWER_BOUND, UPPER_BOUND)\n return index\n end\n\n # otherwise, we recurse until we find it or we've exhausted the search space\n\n # return nil if we've exhausted all possiblities\n return nil if step == 0\n\n if sum < LOWER_BOUND\n # in this case, we are below the lower bound, so we constrain our binary search upwards\n return find_a_starting_index_within_range(j, lower_range + step, upper_range)\n elsif sum > UPPER_BOUND\n # in this case, we are above the upper bound, so we constrain our binary search downwards\n return find_a_starting_index_within_range(j, lower_range, upper_range - step)\n else\n # this should never happen\n raise 'logic error'\n end\nend", "def element_count(array)\n\nend", "def number_of_values\n Integer((@upper - @lower) / @step) + 1\n end", "def search_lower_boundary(array, range=nil, &block)\n range = 0 ... array.length if range == nil\n \n lower = range.first() -1\n upper = if range.exclude_end? then range.last else range.last + 1 end\n while lower + 1 != upper\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\n if yield(array[mid]) < 0\n lower = mid\n else \n upper = mid\n end\n end\n return upper\n end", "def count_positive_sum_negative(arr)\n positives, negatives = arr.partition(&:positive?)\n [positives.length, negatives.inject(0,&:+)]\nend", "def getTotalX(a, b)\n is_factor = -> (n1, n2){n1 % n2 == 0}\n\n max = [a.max, b.max].max\n\n ns_between = (1..max).each.select{ |i|\n a.all?{|_a| is_factor.(i, _a)} && b.all?{|_b| is_factor.(_b, i)}\n }\n\n return ns_between.length\nend", "def letters_to_count(min, max)\n count = 0\n (min..max).each do |number|\n count += to_words(number).downcase.count(\"a-z\")\n end\n count\nend", "def count_clumps(array)\n count = []\n current_num = 0\n array.each do |num|\n if ((num === current_num) && (count.include?(num) == false))\n count << num\n end\n current_num = num\n end\n return count.length\nend", "def solution(a)\n # write your code in Ruby 2.2\n return 0 if a.length == 3\n range = a[1...-1]\n min = Float::INFINITY\n max_ending = 0\n range.inject(0) do |max, y|\n if max_ending + y > 0\n max_ending += y\n if min == Float::INFINITY\n max = [max, max_ending].max\n min = y\n else\n min = y if y < min\n max = [max, max_ending - min].max\n end\n else\n max_ending = 0\n min = Float::INFINITY\n end\n max\n end\nend", "def count(list, number)\n c = 0\n list.each do |n|\n if n == number\n c += 1\n end\n end\n return c\nend", "def num_occur(array, target)\n count = 0\n first_ele = array[0]\n count += 1 if first_ele == target\n\n return count if array.empty?\n\n count += num_occur(array[1..-1],target)\n count\nend", "def length(array)\n count = 0\n\n until array[count].nil?\n count +=1\n end\n return count\nend", "def count_positive_subarrays(two_arr)\n # two_arr.count { |sub_arr| sub_arr.sum > 0 } \n two_arr.count { |sub_arr| sub_arr.sum.positive? }\nend", "def custom_count(array)\n counter = 0\n array.each do |elem|\n if elem != nil\n counter += 1\n end\n end\n counter\nend", "def total_numbers_except(number, max)\n ('0'..max.to_s).reject{ |i| i.include?(number.to_s) }.size\nend", "def get_sum(a, b)\n a < b ? (a..b).sum : (b..a).sum\nend", "def range(arr)\n # your code goes here\n arr.max - arr.min\nend", "def range(arr)\n # your code goes here\n arr.max - arr.min\nend", "def array_nums(arr)\n\n result = []\n count = 0\n\n arr.each { |num| num!=0 ? result << num : count += 1 }\n count.times { result.push(0) }\n result\n\nend", "def _num_bits_in_range(bits, max, min)\n upper = bits.position + bits.size - 1\n lower = bits.position\n [upper, max].min - [lower, min].max + 1\n end", "def num_occur(array, target)\n return 0 if array.length <= 0\n count = 0\n if array[0] == target\n count += 1\n count += num_occur(array[1..-1], target)\n else \n count += num_occur(array[1..-1], target)\n end \n count\nend", "def opposite_count(nums)\n\tcount = 0\n nums.each do |i|\n nums.each do |j|\n if (j > i && i + j == 0)\n count += 1\n end\n end\n end\n return count\nend", "def max_span(list)\n ans = 0\n # Counts the amount in between the first and last item in the list.\n if list.count >= 2\n ans = list.count - 2\n else\n ans = list.count\n end\n print ans\nend", "def dont_give_me_five(start, end )\n (start..end).count{|i| not i.to_s.include? '5'}\nend", "def count(arr, val)\n if arr.length == 0\n return 0\n end\n\n if val == arr[0] \n cnt = 1\n else \n cnt = 0\n end\n \n cnt + count(arr[1..-1], val)\nend", "def subarray_count(subarray)\n\t\t\t\t\teach_cons(subarray.length).count(subarray)\n\t\t\t end", "def count_up(number)\n (1..number).to_a\nend", "def num_occur(array, target)\n @base ||= 0\n @base += 1 if array[0] == target\n num_occur(array.drop(1),target) unless array.empty?\n @base\nend", "def range(arr)\r\n # your code goes here\r\n\r\n arr.max - arr.min\r\nend" ]
[ "0.8824842", "0.8799786", "0.8719823", "0.8707406", "0.86933243", "0.8603774", "0.8582064", "0.8554849", "0.85482943", "0.85303205", "0.8529982", "0.85137075", "0.84885913", "0.84025383", "0.83743644", "0.83329076", "0.83190405", "0.8318204", "0.8317177", "0.8241471", "0.7934499", "0.71082896", "0.6904963", "0.674031", "0.6694831", "0.65230185", "0.6504533", "0.6499626", "0.6494762", "0.6311637", "0.6265638", "0.6254493", "0.6238715", "0.62092686", "0.6147561", "0.6143614", "0.6136485", "0.6129062", "0.61117387", "0.61075974", "0.60967565", "0.6077453", "0.60511893", "0.60338676", "0.6024513", "0.60120845", "0.6007883", "0.5975997", "0.5971273", "0.5967087", "0.5954531", "0.595428", "0.5947577", "0.59457785", "0.5929441", "0.5911871", "0.58958226", "0.58892584", "0.58642155", "0.58559704", "0.58445", "0.583618", "0.5826526", "0.58220404", "0.5822024", "0.58205587", "0.5814444", "0.58096623", "0.5790962", "0.57710063", "0.576904", "0.57526654", "0.57500654", "0.57424873", "0.57263994", "0.5723432", "0.5718666", "0.5717378", "0.57089025", "0.56987053", "0.56917185", "0.5687784", "0.5681784", "0.56685966", "0.56660056", "0.5657242", "0.5655247", "0.5653562", "0.5653562", "0.565051", "0.5648601", "0.56437206", "0.56417394", "0.5638456", "0.5636592", "0.56249076", "0.5611233", "0.5590771", "0.5590136", "0.5583131" ]
0.82633716
19
Gets the chat property value. The chat between the user and Teams app.
def chat return @chat end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chat_info\n return @chat_info\n end", "def chat\n @_chat || payload && payload['chat']\n end", "def chat=(value)\n @chat = value\n end", "def chat\n @_chat ||=\n if payload\n if payload.is_a?(Hash)\n payload['chat'] || payload['message'] && payload['message']['chat']\n else\n payload.try(:chat) || payload.try(:message).try!(:chat)\n end\n end\n end", "def chat_id\n return @chat_id\n end", "def chat_id\n return @chat_id\n end", "def chat_type\n return @chat_type\n end", "def chat_display_name\n return @chat_display_name\n end", "def chat_info=(value)\n @chat_info = value\n end", "def chat_id=(value)\n @chat_id = value\n end", "def chat_id=(value)\n @chat_id = value\n end", "def set_chat\n @chat = Chat.get_one(params[:app_token], params[:number])\n end", "def chat_type=(value)\n @chat_type = value\n end", "def conversation_member_user\n return @conversation_member_user\n end", "def conversation_person\n\t\treturn nil unless (mode? :conversation)\n\t\treturn @talking_to\n\tend", "def set_chat\n @chat = @application.chats.find_by!(number: params[:id])\n end", "def chat_params\n params[:chat]\n end", "def property_conversation property, account\n # super\n unless valid_conversation_target? account\n raise ArgumentError, \"Account must be a tenant or system account, was: #{account}\"\n end\n conversations_about(property).find_for(account).first\n end", "def conversation_id\n return @conversation_id\n end", "def conversation_id\n return @conversation_id\n end", "def teamchat?\n return @teamchat\n end", "def has_chatter=(value)\n @has_chatter = value\n end", "def property_conversations\n @property_conversations ||= sender.conversations_about(property)\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def chat_display_name=(value)\n @chat_display_name = value\n end", "def set_chat_message\n @chat_message = ChatMessage.find(params[:id])\n end", "def chat\n @title = \"Conversacion\"\n @chats = GetChatsForPreviaGroup.call(@previa_group)\n @messages = GetMessagesForChat.call(Chat.find(params[:chat]))\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def chat\n\t\t#TODO: this user\n\t\t@thisuser = session[:user_id]\n\n\t\t#TODO: get other users this user chats with\n\t\t@chat = Chat.where('user1 = ? OR user2 = ?', @thisuser, @thisuser)\n\n\t\t# @chat.each do |eachChat|\n\t\t@chatData = []\n\t\tfor eachChat in @chat\n\t\t\tuser1 = User.find(eachChat.user1)\n\t\t\tuser2 = User.find(eachChat.user2)\n\n\t\t\tchat_with = user1.username\n\t\t\tchat_user_id = user1.id\n\t\t\trole = user1.role == 1 ? \"trainer\" : \"user\"\n\t\t\tif eachChat.user1 == @thisuser\n\t\t\t\tchat_with = user2.username\n\t\t\t\tchat_user_id = user2.id\n\t\t\t\trole = user1.role == 1 ? \"trainer\" : \"user\"\n\t\t\tend\n\t\t\tthisChat = { \"chat_with\": chat_with, \"chat_user_id\": chat_user_id, \"role\": role }\n\t\t\t\n\t\t\t@chatData << thisChat\n\t\t\t\n\t\tend\n\tend", "def conversation_thread_id\n return @conversation_thread_id\n end", "def message\n\t\tself.object[\"message\"]\n\tend", "def message\n\t\tself.object[:message]\n\tend", "def communicate value\n c = Chat.new\n c.created_at = Time.now\n c.message = value\n self.chats << c\n Player.connected.each { |p| \n p.packet(\"say\", [self.id, \"#{value.make_safe_for_web_client()}\"]) \n }\n c.save\n self.save\n end", "def name\n :chat\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def users_messaged_by\r\n self.users_who_messaged_me\r\n end", "def message_user\n return self.username\n end", "def chat?\n self.state == :chat\n end", "def chat_data(arg)\n chat = arg.respond_to?(:chat) ? arg.chat : arg\n barrymore_chats_data[chat] ||= {}.freeze\n end", "def user_ref\n @messaging['optin']['user_ref']\n end", "def has_chatter\n return @has_chatter\n end", "def message\n @attributes[:message]\n end", "def property_conversation property, account\n unless owner_of? property\n raise ArgumentError, \"Property must be owned by you, was: #{property} belonging to #{property.landlord}\"\n end\n\n # super\n unless valid_conversation_target? account\n raise ArgumentError, \"Account must be a tenant or system account, was: #{account}\"\n end\n conversations_about(property).find_for(account).first\n end", "def number\n @number || (conversation.try(:number))\n end", "def sender_message\n return @sender_message\n end", "def message\n @values['message']\n end", "def set_chat_room\n @chat_room = current_user.chat_rooms.find(params[:id])\n \n end", "def last_contacted\n object.channels.where(is_private: true).first.last_message_time\n end", "def set_chat\n @chat_room = ChatRoom.find(params[:id])\n end", "def sent_to_me\n return @sent_to_me\n end", "def get_email_recipient\n user == chat.sender ? chat.recipient : chat.sender\n end", "def message\n @data['message']\n end", "def my_participant_id\n return @my_participant_id\n end", "def message\n attributes.fetch(:message)\n end", "def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end", "def conversation\n @conversation ||= mailbox.conversations.find(params[:id])\n end", "def conversation_member_user=(value)\n @conversation_member_user = value\n end", "def get(key)\n messages[key]\n end", "def get(key)\n messages[key]\n end", "def set_chat_room\n @chat_room_user = ChatRoomUser.find(chat_room_user_params)\n end", "def conversation_id=(value)\n @conversation_id = value\n end", "def conversation_id=(value)\n @conversation_id = value\n end", "def get_chat_by_phone(phone, opts = {})\n data, _status_code, _headers = get_chat_by_phone_with_http_info(phone, opts)\n data\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Chat.V3.ChannelInstance #{values}>\"\n end", "def property_conversations\n validate_property!\n sender.conversations_about(property)\n end", "def getMessage()\n return @message\n end", "def user_id; @message_impl.getUserId; end", "def react_chat_room\n @message = current_user.messages.build\n messages = Message.all.includes(:user)\n @messages_props = messages.map{ |m| [m.id, m.as_json.merge({user: {email: m.user.email}})] }.to_h\n end", "def id\n messaging['id']\n end", "def get_message\n get_status[:message]\n end", "def message\n @messages.first\n end", "def conversation_thread_id=(value)\n @conversation_thread_id = value\n end", "def conversation\n Conversation\n .where(\"creator_id = ? or member_id = ?\", user_id, user_id)\n .order(\"latest_message_id DESC\").first\n end", "def sent_to_or_cc_me\n return @sent_to_or_cc_me\n end", "def message_id\n self['message-id']\n end", "def set_coffee_chat\n @coffee_chat = CoffeeChat.find(params[:id])\n end", "def chat_message(message)\n r = Skype.send_command \"CHATMESSAGE #{id} #{message}\"\n ChatMessage.parse_from(r)\n end", "def get_message\n @reply['message']\n end", "def get_chat_using_get(chat_id, opts = {})\n data, _status_code, _headers = get_chat_using_get_with_http_info(chat_id, opts)\n data\n end", "def challenger\n Competitor.find_by(id: self.game.challenger_id).username\n end", "def conversation\n message.conversation if message.is_a? Mailboxer::Message\n end", "def conversation\n message.conversation if message.is_a? Mailboxer::Message\n end", "def show\n @chat_thread = ChatThread.find(params[:id])\n # 既読つける\n readChat(@chat_thread.id, @chat_thread.chats.last.id) if @chat_thread.chats.size > 0\n render json: @chat_thread.chats, each_serializer: Rest::ChatSerializer\n end", "def chat_params\n params.fetch(:chat, {})\n end", "def telegram\n self.matched_line(\"TELEGRAM\")&.strip\n end", "def set_direct_chat\n @direct_chat = DirectChat.find(params[:id]) rescue nil\n return res_with_error(\"Chat not found\", :not_found) unless @direct_chat\n end", "def chatting_with\n ChatMessage.participant(self).map do |chat|\n if chat.parent.id != self.id\n chat.parent\n else\n Parent.find(chat.recipient_fk)\n end\n end.uniq\n end", "def chat_history\n \t@chat_history = EmailConversation.where(receiver_id: params[:lead_id], is_sent: true)\n end", "def set_customerchat\r\n @customerchat = Customerchat.find(params[:id])\r\n end", "def set_chat_messages\n @chat_messages = ChatMessage.find(params[:id])\n end" ]
[ "0.71748775", "0.7054701", "0.7045065", "0.7031462", "0.7023305", "0.7023305", "0.67733926", "0.6639497", "0.6575313", "0.6302959", "0.6302959", "0.6287643", "0.5960013", "0.5855995", "0.5847797", "0.58272797", "0.57949525", "0.57499456", "0.57348585", "0.57348585", "0.5711575", "0.5625744", "0.55913454", "0.5562799", "0.5562799", "0.5562799", "0.5562799", "0.5562799", "0.5562799", "0.5562799", "0.5562799", "0.5562799", "0.5562799", "0.5562799", "0.5507449", "0.54958254", "0.5468286", "0.54671204", "0.5452024", "0.544331", "0.54390806", "0.54253787", "0.5413163", "0.5398089", "0.539522", "0.539522", "0.5377442", "0.53583515", "0.5340704", "0.5336759", "0.5335592", "0.53069425", "0.5304363", "0.5292066", "0.5291965", "0.52554446", "0.52479714", "0.52459896", "0.5238168", "0.5226915", "0.522641", "0.5216407", "0.52105117", "0.516623", "0.5163727", "0.5163727", "0.5159245", "0.5151787", "0.5151787", "0.5143695", "0.51300853", "0.51300853", "0.51243234", "0.5122954", "0.51139987", "0.511237", "0.5105596", "0.5093636", "0.5089971", "0.5088018", "0.50852156", "0.50840837", "0.5081223", "0.507547", "0.5071507", "0.5070681", "0.50623035", "0.50607044", "0.5059526", "0.5052037", "0.5046497", "0.5046497", "0.503849", "0.5035469", "0.50270385", "0.5025287", "0.50188166", "0.5015789", "0.50018203", "0.49971676" ]
0.7338721
0
Sets the chat property value. The chat between the user and Teams app.
def chat=(value) @chat = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_chat\n @chat = Chat.get_one(params[:app_token], params[:number])\n end", "def set_chat\n @chat = @application.chats.find_by!(number: params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def chat_info=(value)\n @chat_info = value\n end", "def chat_id=(value)\n @chat_id = value\n end", "def chat_id=(value)\n @chat_id = value\n end", "def set_chat\n @chat = Chat.find(params[:id])\n end", "def chat_type=(value)\n @chat_type = value\n end", "def set_chat_message\n @chat_message = ChatMessage.find(params[:id])\n end", "def set_chat_room\n @chat_room = current_user.chat_rooms.find(params[:id])\n \n end", "def set_chat_room\n @chat_room_user = ChatRoomUser.find(chat_room_user_params)\n end", "def set_smpl_chat\n @smpl_chat = SmplChat.find(params[:id])\n end", "def set_chat\n @chat_room = ChatRoom.find(params[:id])\n end", "def has_chatter=(value)\n @has_chatter = value\n end", "def chat\n @_chat || payload && payload['chat']\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:chatroom_id])\n end", "def set_coffee_chat\n @coffee_chat = CoffeeChat.find(params[:id])\n end", "def set_direct_chat\n @direct_chat = DirectChat.find(params[:id]) rescue nil\n return res_with_error(\"Chat not found\", :not_found) unless @direct_chat\n end", "def set_chat_room\n @chat_room = ChatRoom.find(params[:id])\n end", "def set_chat_room\n @chat_room = ChatRoom.find(params[:id])\n end", "def set_chat_messages\n @chat_messages = ChatMessage.find(params[:id])\n end", "def set_customerchat\r\n @customerchat = Customerchat.find(params[:id])\r\n end", "def chat\n @_chat ||=\n if payload\n if payload.is_a?(Hash)\n payload['chat'] || payload['message'] && payload['message']['chat']\n else\n payload.try(:chat) || payload.try(:message).try!(:chat)\n end\n end\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def set_chatroom\n\t\t@chatroom = Chatroom.find(params[:id])\n\tend", "def set_chatroom\n @chatroom = Chatroom.find_by( name: params[:id] )\n end", "def set_chatroom_user\n @chatroom_user = ChatroomUser.find(params[:id])\n end", "def set_chat_data(arg, data)\n chat = arg.respond_to?(:chat) ? arg.chat : arg\n barrymore_chats_data[chat] = chat_data(arg).merge(data).freeze\n end", "def sent_to_me=(value)\n @sent_to_me = value\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def set_chatroom\n @chatroom = Chatroom.find(params[:id])\n end", "def hipchat=(arg)\n raise ArgumentError, \"hipchat expected a string, not a #{arg.class}\" unless arg.is_a?(String)\n @hipchat = arg\n end", "def set_chatwork\n @chatwork = Chatwork.find(params[:id])\n end", "def chat_display_name=(value)\n @chat_display_name = value\n end", "def send_team_chat\n data = {display_name: params[:display_name],\n avatar: params[:avatar],\n chat_text: params[:chat]}\n Pusher.trigger(params[:channel], 'chat_message', data)\n end", "def set_guest_chat_token\n @guest_chat_token = GuestChatToken.find(params[:id])\n end", "def set_modchat(level)\n send \"/modchat #{level}\"\n end", "def set_admin_chatting\n @admin_chatting = AdminChatting.find(params[:id])\n end", "def chat\n return @chat\n end", "def set_chatroompost\n @chatroompost = Chatroompost.find(params[:chatroompost_id])\n end", "def sent_to_or_cc_me=(value)\n @sent_to_or_cc_me = value\n end", "def chat_id\n return @chat_id\n end", "def chat_id\n return @chat_id\n end", "def set_activity_participant\n @activity_participant = current_user\n end", "def communicate value\n c = Chat.new\n c.created_at = Time.now\n c.message = value\n self.chats << c\n Player.connected.each { |p| \n p.packet(\"say\", [self.id, \"#{value.make_safe_for_web_client()}\"]) \n }\n c.save\n self.save\n end", "def chat\n @title = \"Conversacion\"\n @chats = GetChatsForPreviaGroup.call(@previa_group)\n @messages = GetMessagesForChat.call(Chat.find(params[:chat]))\n end", "def set_message\n @message = @chat.messages.find_by!(number: params[:number])\n end", "def conversation_thread_id=(value)\n @conversation_thread_id = value\n end", "def conversation_member_user=(value)\n @conversation_member_user = value\n end", "def set_telebot\n @telebot = Telebot.find(params[:id])\n end", "def initialize(chat)\n @chat = chat\n @users = []\n end", "def chat_type\n return @chat_type\n end", "def conversation_id=(value)\n @conversation_id = value\n end", "def conversation_id=(value)\n @conversation_id = value\n end", "def set_live_chat_answer\n @live_chat_answer = LiveChatAnswer.find(params[:id])\n end", "def set_api_v1_chat\n @api_v1_chat = Api::V1::Chat.find(params[:id])\n end", "def set_chat_status(set_chat_status_input_object, opts = {})\n data, _status_code, _headers = set_chat_status_with_http_info(set_chat_status_input_object, opts)\n data\n end", "def set_teacher_chatting\n @teacher_chatting = TeacherChatting.find(params[:id])\n end", "def set_number\n self.number = self.application.chat_count + 1\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"chat\", @chat)\n end", "def set_messenger\n @messenger = Messenger.find(params[:id])\n end", "def set_messenger\n @messenger = Messenger.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def set_conversation\n @conversation = Conversation.find(params[:id])\n end", "def chat_params\n params.require(:chat).permit(:message)\n end", "def chat_params\n params.require(:chat).permit(:room_id, :user_id, :message)\n end", "def set_conversation\n\t\t@conversation = Conversation.find(params[:id])\n\tend", "def chat?\n self.state == :chat\n end", "def set_user_conversation\n @user_conversation = UserConversation.find(params[:id])\n end", "def set_message\n @message = Message\n .joins(:chat)\n .where(\n number: params[:number],\n chats: {\n number: params[:chat_number],\n application: Application.find_by(token: params[:application_token]),\n },\n )\n end", "def talker=(value)\n\t\t\tclient_is_talker = value\n\t\tend", "def set_conversation_message\n @conversation_message = ConversationMessage.find(params[:id])\n end", "def set_Message(value)\n set_input(\"Message\", value)\n end", "def set_Message(value)\n set_input(\"Message\", value)\n end", "def set_Message(value)\n set_input(\"Message\", value)\n end", "def set_Message(value)\n set_input(\"Message\", value)\n end", "def chat_params\n params.require(:chat).permit(:user_id, :reciever_id, :message, :status, :last_msg_id)\n end" ]
[ "0.75856173", "0.7266743", "0.7255754", "0.7255754", "0.7255754", "0.7255754", "0.7255754", "0.7255754", "0.7255754", "0.7255754", "0.7255754", "0.7255754", "0.7255754", "0.71931034", "0.7139131", "0.7139131", "0.7018493", "0.6961826", "0.67970365", "0.6774398", "0.66801286", "0.6664401", "0.66429245", "0.6637469", "0.65708447", "0.65598893", "0.6543329", "0.65381527", "0.64922804", "0.64922804", "0.64740527", "0.63722426", "0.63635224", "0.6357335", "0.6357335", "0.62976485", "0.6242909", "0.62137485", "0.62005794", "0.61039835", "0.60585415", "0.60585415", "0.6050049", "0.6016374", "0.5899631", "0.5894935", "0.58397305", "0.5836676", "0.58341044", "0.5812077", "0.57608134", "0.5732378", "0.57303053", "0.57303053", "0.5708807", "0.56899", "0.56884575", "0.5681255", "0.56303227", "0.5615924", "0.5607098", "0.559005", "0.5578961", "0.55675626", "0.55675626", "0.55616057", "0.55456275", "0.5538567", "0.5536746", "0.5518023", "0.55101275", "0.5487642", "0.54704183", "0.54704183", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54627955", "0.54532653", "0.5443283", "0.54174614", "0.54004526", "0.538589", "0.53796566", "0.53772086", "0.53585136", "0.53461957", "0.53461957", "0.53461957", "0.53461957", "0.532704" ]
0.8534229
0
Instantiates a new userScopeTeamsAppInstallation and sets the default values.
def initialize() super @odata_type = "#microsoft.graph.userScopeTeamsAppInstallation" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def installed_apps()\n return MicrosoftGraph::Me::JoinedTeams::Item::InstalledApps::InstalledAppsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def initialize\n @initted = false\n @h_steam_user = @@dll_SteamAPI_GetHSteamUser.call\n return if (@steam_user_stats = @@dll_SteamInternal_FindOrCreateUserInterface.call(@h_steam_user, STEAMUSERSTATS_INTERFACE_VERSION)) == 0\n return if (@steam_apps = @@dll_SteamInternal_FindOrCreateUserInterface.call(@h_steam_user, STEAMAPPS_INTERFACE_VERSION)) == 0\n\n @initted = true\n end", "def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end", "def initialize_user_settings_defaults\n self.disabled_sports = []\n self.locale = 'en'\n self.device_ids = []\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsAppXAppAssignmentSettings\"\n end", "def initialize(*args)\n super\n\n @apps = {}\n fields = %w[AppID name StateFlags Universe installdir LastUpdated\n UpdateResult SizeOnDisk buildid LastOwner BytesToDownload BytesDownloaded\n AutoUpdateBehavior AllowOtherDownloadsWhileRunning UserConfig\n MountedDepots\n ]\n \n options[:steam_home].gsub!('~', ENV['HOME'])\n Dir.glob(\"#{options[:steam_home]}/steam/SteamApps/*.acf\") do |file|\n acf = SteamCodec::ACF::loadFromFile(File.open(file))\n @apps[acf.get('AppID')] = fields.map do |field|\n [field.downcase, acf.get(field)]\n end.to_h\n end\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.iosVppAppAssignmentSettings\"\n end", "def teams_app_settings=(value)\n @teams_app_settings = value\n end", "def user_set_to_default_app_type\n return if @current_user.app_type_valid?\n\n current_user.app_type_id = all_user_app_type_ids.first\n current_user.save\n end", "def init_teams\n init_org if @org.blank?\n @team = Team.where('name is NOT NULL').first_or_create(name: 'development', org_id: @org.id)\n end", "def initialize(bot:, user:)\n super\n @settings = user.student_settings\n end", "def initial_onboarding_user_api_token\n ENV[\"FASTLANE_CI_INITIAL_ONBOARDING_USER_API_TOKEN\"]\n end", "def add_default_team_memberships\n if transaction_include_action?(:create)\n team_memberships.create!(employee_id: company.employees.solo_employee.id)\n team_memberships.create!(employee_id: company.employees.out_of_office_employee.id)\n end\n end", "def init\n init_oauth_access_token\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.aadUserConversationMember\"\n end", "def initialize(user = nil, scope)\n @user = user\n @scope = scope\n end", "def default_options\n { \"token_credential_uri\" => self.class::TOKEN_CREDENTIAL_URI,\n \"audience\" => self.class::AUDIENCE,\n \"scope\" => self.class::SCOPE }\n end", "def initialize(app_id, app_secret, api_key, email, password)\n\n merge!(\n {\n applicationCredentials: {\n applicationId: app_id,\n applicationSecret: app_secret\n },\n userCredentials: {\n apiKey: api_key,\n email: email,\n password: password \n }\n }\n )\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsUniversalAppXContainedApp\"\n end", "def init_settings\n merge_in_user_settings(copy_hash(DEFAULT_SETTINGS))\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.macOsLobAppAssignmentSettings\"\n end", "def initialize(company, product_family, product, teams, team, user, time_period)\n self.company = company\n self.teams = teams\n self.team = team\n self.user = user\n self.product_family = product_family\n self.product = product\n self.time_period = time_period\n end", "def add_user_to_org(org_id, app_id, user_id)\n app_user = Application\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.windowsUniversalAppX\"\n end", "def initialize(options = {})\n requires!(options, :global_user_name, :global_password, :term_type)\n super\n end", "def new\n @app_user = @app.app_users.build\n end", "def initialize(api_user, api_secret, workflow=nil)\n\n @api_user = api_user\n @api_secret = api_secret\n @workflow = nil \n @min = 0.9 \n\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.application\"\n end", "def init\n\t\tuser_credentials = {\n\t\t\t:access_token => access_token,\n\t\t\t:refresh_token => refresh_token,\n\t\t\t:expires_at => Time.now + expires_in\n\t\t}\n\n client_id = '694fc2f618facf30b3b41726ee6d0ac04c650669ca3d114cb0bae4223cecade3'\n client_secret = '3e7cfd07d829211ac50dd6486fe677ca76e965f25ad7d68e67e845e0d4a213e7'\n\t\tCoinbase::OAuthClient.new(client_id, client_secret, user_credentials)\n\tend", "def init_usersettings\n UserSetting.create(:user => self)\n end", "def initialize(username, token, test_env = false)\n @username = username\n @token = token\n @test_environment = test_env\n @root_uri = get_root_uri(test_env)\n @endpoints = [:valid_token, :generate_token, :valid_user,\n :new_search, :search_status, :search_result,\n :packages, :search_inputs]\n end", "def process_application_default_auth(options)\n ::Google::Auth.get_application_default(options[:google_api_scope_url])\n end", "def make_user(params = {})\n self.user= account.users.build_with_fields params.reverse_merge(:email => email, :invitation => self)\n end", "def initialize_advertiser_user\n self.user_type = TYPE_ADVERTISER\n self.update_user_code\n self.status = STATUS_ACTIVE\n end", "def initialize(user_id, scope = nil)\n @user_id = user_id\n @config = config\n @scope = scope\n end", "def create(org_username, body = {})\n @client.team.create(org_username, body)\n end", "def create_users_and_sign_in\n OmniAuth.config.mock_auth[:github] = OmniAuth::AuthHash.new({\n \"provider\" => \"github\",\n \"uid\" => \"666\",\n \"credentials\" => {\n \"token\" => \"123123\"},\n \"info\" => {\n \"nickname\" => \"The Bease\",\n \"name\" => \"WilliamShatner\",\n \"email\" => \"LOLCATZ@io.com\",\n },\n \"extra\" => {\n \"raw_info\" => {\n \"avatar_url\" => \"123\",\n \"html_url\" => \"12312\",\n \"hireable\" => \"false\",\n \"followers\" => \"1\",\n \"following\" => \"1\",\n }\n },\n })\n\n user = User.create(name: \"sexykitten123\", description: \"description\")\n user.languages.create(name: \"Ruby\")\n user = User.create(name: \"uglyplatypus321\", description: \"description2\")\n Match.create(user_id: 1, matchee_id: 2)\n Match.create(user_id: 1, matchee_id: 3)\n end", "def initialize(tokens_and_secrets = {})\n @oauth = KynetxAmApi::Oauth.new(tokens_and_secrets)\n end", "def steam_apps\n @steam_apps if initted?\n end", "def init!\n @defaults = {\n :@refresh_token => ENV[\"STC_REFRESH_TOKEN\"],\n :@client_id => ENV[\"STC_CLIENT_ID\"],\n :@client_secret => ENV[\"STC_CLIENT_SECRET\"],\n :@language_code => \"nl-NL\",\n :@environment => 'test',\n :@version => 1,\n :@verbose => false,\n }\n end", "def fill_default_params\n fill_organization\n fill_app\n end", "def allowed_to_create_apps=(value)\n @allowed_to_create_apps = value\n end", "def build_default_interested_users_list\n self.create_interested_users_list\n true\n end", "def initialize(username = nil, token = nil)\n if username && token\n @base_params = {:username => username, :token => token}\n else\n @base_params = {}\n end\n end", "def initialize(options = nil)\n @options = options || @@default_options\n @api_key = @options[:api_key] || @options[:oauth_consumer_key]\n @shared_secret = @options[:shared_secret]\n @rest_endpoint = @options[:rest_endpoint] || REST_ENDPOINT\n @auth_endpoint = @options[:auth_endpoint] || AUTH_ENDPOINT\n \n if @options[:oauth_access_token] && @options[:oauth_access_token_secret]\n @access_token = OAuth::AccessToken.new(oauth_customer, @options[:oauth_access_token], @options[:oauth_access_token_secret])\n end\n end", "def initialize(ctoken, csecret, options={})\n @ctoken, @csecret, @consumer_options = ctoken, csecret, {}\n @api_endpoint = options[:api_endpoint] || 'http://api.teambox.com'\n @signing_endpoint = options[:signing_endpoint] || 'http://api.teambox.com'\n if options[:sign_in]\n @consumer_options[:authorize_path] = '/oauth/authenticate'\n end\n end", "def initialize\n get_enterprise_token\n initialize_client\n end", "def blank_user_for_create_action_form\n @blank_user ||= User.new(\n provider_credentials: [GitHubProviderCredential.new]\n )\n end", "def initialize(options = {})\n @options = default_options.merge(options)\n @app = @options.delete(:app)\n end", "def initialize_website_user\n self.user_type = TYPE_WEBSITE\n self.update_user_code\n self.update_activation_code\n self.status = STATUS_UNACTIVE\n end", "def give_options\n clean_user_options\n @user_options.merge(default_options)\n end", "def initialize(options = {})\n client_id = options[:client_id]\n\n @oauth2_client = TwitchOAuth2::Client.new(\n client_id: client_id, **options.slice(:client_secret, :redirect_uri, :scopes)\n )\n\n @token_type = options.fetch(:token_type, :application)\n\n @tokens = @oauth2_client.check_tokens(\n **options.slice(:access_token, :refresh_token), token_type: @token_type\n )\n\n CONNECTION.headers['Client-ID'] = client_id\n\n renew_authorization_header if access_token\n end", "def create(config, name, user_guid)\n\n token = @client.token\n\n user_setup_obj = UsersSetup.new(config)\n admin_token = user_setup_obj.get_admin_token\n\n # elevate user just to create organization\n @client.token = admin_token\n\n new_org = @client.organization\n new_org.name = name\n if new_org.create!\n org_guid = new_org.guid\n users_obj = Users.new(admin_token, @client.target)\n users_obj.add_user_to_org_with_role(org_guid, user_guid, ['owner', 'billing'])\n\n # then put token back to the initial one\n @client.token = token\n org_guid\n end\n\n end", "def invite_user(param)\n email_addresses.set param[:email]\n is_owner.set(true) if param[:owner] == 'true'\n unless nil_or_empty?(param[:apps])\n param[:apps].each_with_index do |item, index|\n app_drop_down.select item\n role_drop_down.select param[:roles][index] if param[:roles]\n site_drop_down.select param[:sites][index] if param[:sites]\n add_new_app.click\n end\n end\n invite_button.click\n end", "def set_app_user_satisfaction_level\n @app_user_satisfaction_level = AppUserSatisfactionLevel.find(params[:id])\n end", "def initialize(session_id = nil, call_id = 1, user_id = nil)\n @session_id = session_id\n @call_id = call_id\n @user_id = user_id\n end", "def initialize(context:)\n @user = JSONAPI::Authorization.configuration.user_context(context)\n end", "def create_user(type: :collection_manager, token: true)\n user = FactoryBot.create(type)\n user.create_token if token\n user.save\n user\nend", "def initialize(params = {})\n @user_collection = ::Spree::User.all\n @options = params\n end", "def initialize(total_number_of_games, game_count: 0)\n @total_number_of_games = total_number_of_games\n end", "def initialize(credentials)\n self.client ||= FbGraph::Application.new(credentials[:id], secret: credentials[:secret])\n self.test_users = []\n end", "def set_app_user\n @app_user = AppUser.find(params[:id])\n end", "def new_user options = {}\n User.where(@default_user_credentials.merge(options)).delete_all\n user = User.new @default_user_credentials.merge(options)\n user.login = options['login'] || 'cool_user'\n user\n end", "def initialize(apps=nil, env=nil)\n @logger = Log4r::Logger.new(\"acceptance::isolated_environment\")\n\n @apps = apps || {}\n @env = env || {}\n\n # Create a temporary directory for our work\n @tempdir = Tempdir.new(\"vagrant\")\n @logger.info(\"Initialize isolated environment: #{@tempdir.path}\")\n\n # Setup the home and working directories\n @homedir = Pathname.new(File.join(@tempdir.path, \"home\"))\n @workdir = Pathname.new(File.join(@tempdir.path, \"work\"))\n\n @homedir.mkdir\n @workdir.mkdir\n\n # Set the home directory and virtualbox home directory environmental\n # variables so that Vagrant and VirtualBox see the proper paths here.\n @env[\"HOME\"] = @homedir.to_s\n @env[\"VBOX_USER_HOME\"] = @homedir.to_s\n end", "def init\n\t\tif @@should_init\n\t\t\tbot.logger.debug \"initializing\"\n\t\t\t@@should_init \t= false\n\t\t\t@users \t\t\t= Users.reload\n\t\tend\n\tend", "def set_user_setting\n @current_user.create_default_user_setting unless @current_user.user_setting\n @user_setting = @current_user.user_setting\n end", "def add_user(user)\n super.tap do |org_user|\n class_name = (users.count == 1) ? JudgeTeamLead : DecisionDraftingAttorney\n class_name.create!(organizations_user: org_user)\n end\n end", "def set_create_user(opts)\n opts = check_params(opts,[:user_info])\n super(opts)\n end", "def preset_default_values( params_hash = {} )\n unless self.le_user || params_hash[:user_id].blank? # Set current user only if not set\n begin\n if params_hash[:user_id]\n self.user_id = params_hash[:user_id].to_i\n end\n rescue\n self.user_id = nil\n end\n end\n self\n end", "def set_users\n if is_event_creator\n @user_1 = event_creator\n @user_2 = participant\n else\n @user_1 = participant\n @user_2 = event_creator\n end\n end", "def get_office365_activations_user_counts()\n return MicrosoftGraph::Reports::GetOffice365ActivationsUserCounts::GetOffice365ActivationsUserCountsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def initialize(user_ids)\n @user_ids = user_ids\n end", "def create\n @user = current_user\n @membership_application = @user.build_membership_application(membership_application_params)\n @user.update_attribute(:guest, false)\n @user.update_attribute(:member, true)\n\n if @membership_application.membership == \"Gold\"\n @user.update_attribute(:shareholder, true)\n end\n\n respond_to do |format|\n if @membership_application.save\n format.html { redirect_to @membership_application, notice: 'Membership application was successfully created.' }\n format.json { render :show, status: :created, location: @membership_application }\n else\n format.html { render :new }\n format.json { render json: @membership_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_user_preferences\n @user_preferences = UserPreferences.find_or_create_by!(:user => current_user)\n end", "def teams\n @teams ||= ApiFactory.new 'Orgs::Teams'\n end", "def initialize(options = {})\n @app_name = options[:app_name].to_s if options[:app_name]\n @platform = options[:platform]\n\n @purpose = check_purpose!(options[:purpose])\n\n @compressors = options[:compressors] || []\n @wrapping_libraries = options[:wrapping_libraries]\n @server_api = options[:server_api]\n\n return unless options[:user] && !options[:auth_mech]\n\n auth_db = options[:auth_source] || 'admin'\n @request_auth_mech = \"#{auth_db}.#{options[:user]}\"\n end", "def initialize(user, application_id)\n @api = user.api\n @application_id = application_id\n @user = user\n load_base\n end", "def initialize( user )\n @meetings_ids = []\n @seasons_ids = []\n @pending_reservations = []\n\n @seasons_found = false\n @meetings_found = false\n\n @user = user\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.androidWorkProfileCompliancePolicy\"\n end", "def initialize(user_ids)\n @user_ids = user_ids\n end", "def initialize\n @users = Hash.new { |hash, name| hash[name] = User.new(name) }\n end", "def initialize(options = {}, &blk)\n options ||= {}\n options[:type] = :application\n init(options, &blk)\n end", "def initialize(options = {})\n @logger = options[:logger] || Logger.new(STDERR)\n Koala::Utils.logger = @logger\n \n token = options[:token] || get_token(options[:app_id],options[:app_secret])\n @graph = Koala::Facebook::API.new(token)\n @page_size = options[:page_size] || DEFAULT_PAGE_SIZE\n end", "def auto_assign_users(team_size)\n all_registrations = course.registrations.where(for_credit: true).\n includes(:user).all\n\n team_sets = []\n overflow = []\n all_registrations.group_by(&:for_credit?).each do |credit, registrations|\n students = registrations.map(&:user).shuffle!\n (0...students.length).step(team_size) do |i|\n team_set = students[i, team_size]\n if team_set.length == team_size\n team_sets << team_set\n else\n overflow += team_set\n if overflow.length >= team_size\n team_sets << overflow.shift(team_size)\n end\n end\n end\n end\n team_sets << overflow\n\n teams = team_sets.map.with_index do |members, i|\n team = Team.create! partition: self, name: \"Team #{i + 1}\"\n members.each do |member|\n TeamMembership.create! user: member, team: team, course: course\n end\n team\n end\n\n teams\n end", "def initialize(appid=nil, secret=nil, securityalgorithm=nil)\n self.appid = appid if appid\n self.secret = secret if secret\n self.securityalgorithm = securityalgorithm if securityalgorithm\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.androidManagedAppProtection\"\n end", "def user_init; end", "def merge_oauth_defaults!\n @defaults.merge!(:@oauth_providers => [])\n end", "def default_user\n u = User.find_or_create_by_oauth2(default_oauth2_hash)\n create_user_shop(u)\n u\n end", "def initialize options = {}\n @authorization_uri = nil\n @token_credential_uri = nil\n @client_id = nil\n @client_secret = nil\n @code = nil\n @expires_at = nil\n @issued_at = nil\n @issuer = nil\n @password = nil\n @principal = nil\n @redirect_uri = nil\n @scope = nil\n @target_audience = nil\n @state = nil\n @username = nil\n @access_type = nil\n update! options\n end", "def set_appointment_types\n @user = current_user\n end", "def set_users\n\n end", "def setup\n @admin = users(:admin)\n @user = users(:user)\n @user2 = users(:user2)\n @user3 = users(:user3)\n @user4 = users(:user4)\n @instance = instances(:instance_teaming)\n @invitation = invitations(:invitation1)\n end", "def initialize(scope, user, params, &block)\n @scope = scope\n @params = params.dup\n @user = user\n\n instance_eval(block) if block_given?\n\n build\n end", "def initialize(user:, permission:, klass:, applies_to:, auth_configs:, participations_only:)\n @user = user\n @permission = permission\n @klass = klass\n @applies_to = applies_to\n @auth_configs = auth_configs\n @participations_only = participations_only\n end", "def installation_params\n if current_user.present?\n params.require(:installation).permit(:device_type, :token).merge(:user_id => current_user.id)\n else\n params.require(:installation).permit(:device_type, :token)\n end\n end", "def default_scopes(*scopes)\n @config.instance_variable_set(:@default_scopes, OAuth::Scopes.from_array(scopes))\n end", "def setup!(requesting_actor_id, options=Hash.new)\n create_database!\n\n policy = OrgAuthPolicy.new(self, requesting_actor_id, options)\n policy.apply!\n\n # Environments are in erchef / SQL. Make an HTTP request to create the default environment\n headers = {:headers => {'x-ops-request-source' => 'web'}}\n rest = Chef::REST.new(Chef::Config[:chef_server_host_uri],\n Chef::Config[:web_ui_proxy_user],\n Chef::Config[:web_ui_private_key], headers)\n rest.post_rest(\"organizations/#{name}/environments\",\n {\n 'name' => '_default',\n 'description' => 'The default Chef environment'\n })\n end", "def initialize(app_context: nil, factory_config:)\n @app_context = app_context\n @factory_config = factory_config\n end", "def create_default_settings\n setting = Setting.new\n setting.user_id = self.id\n setting.save!\n end" ]
[ "0.54527813", "0.52849585", "0.5226986", "0.51630723", "0.51314735", "0.5057966", "0.50249255", "0.5002965", "0.50024647", "0.49959233", "0.4945063", "0.4878081", "0.48780555", "0.48567334", "0.48553476", "0.48341924", "0.48106268", "0.48098832", "0.47992164", "0.479649", "0.47846857", "0.47554588", "0.47512", "0.47380596", "0.47124124", "0.46949703", "0.46791098", "0.46760303", "0.46587422", "0.46470279", "0.46305135", "0.46264285", "0.4624327", "0.46200866", "0.46115842", "0.46082968", "0.46015295", "0.4599408", "0.45953524", "0.4565863", "0.4537107", "0.45177713", "0.4515073", "0.4505673", "0.44950014", "0.44935447", "0.4491321", "0.4490383", "0.44822547", "0.44738612", "0.44663307", "0.44641", "0.44607753", "0.44603395", "0.4459549", "0.44588116", "0.44445354", "0.44428536", "0.4438284", "0.44344926", "0.44312954", "0.443015", "0.4428381", "0.44252357", "0.44196582", "0.44135204", "0.44127882", "0.44108456", "0.44099972", "0.44037575", "0.43998665", "0.4393989", "0.43911567", "0.43855837", "0.43843383", "0.43807378", "0.438063", "0.43740177", "0.436729", "0.43668893", "0.436605", "0.43628338", "0.43618992", "0.43602207", "0.43563196", "0.43520102", "0.4351354", "0.43498126", "0.43485206", "0.43477434", "0.43460393", "0.43454555", "0.43436015", "0.43364602", "0.43339574", "0.4332831", "0.43324566", "0.4328428", "0.43238747", "0.4323702" ]
0.74524724
0
The deserialization information for the current model
def get_field_deserializers() return super.merge({ "chat" => lambda {|n| @chat = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Chat.create_from_discriminator_value(pn) }) }, }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end", "def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"fileDetails\" => lambda {|n| @file_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n })\n end", "def serialized_attributes\n read_inheritable_attribute(\"attr_serialized\") || { }\n end", "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"file\" => lambda {|n| @file = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"fileHash\" => lambda {|n| @file_hash = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"committedContentVersion\" => lambda {|n| @committed_content_version = n.get_string_value() },\n \"contentVersions\" => lambda {|n| @content_versions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::MobileAppContent.create_from_discriminator_value(pn) }) },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"attribution\" => lambda {|n| @attribution = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ImageInfo.create_from_discriminator_value(pn) }) },\n \"backgroundColor\" => lambda {|n| @background_color = n.get_string_value() },\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayText\" => lambda {|n| @display_text = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"detectionType\" => lambda {|n| @detection_type = n.get_string_value() },\n \"method\" => lambda {|n| @method = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resourceReference\" => lambda {|n| @resource_reference = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceReference.create_from_discriminator_value(pn) }) },\n \"resourceVisualization\" => lambda {|n| @resource_visualization = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResourceVisualization.create_from_discriminator_value(pn) }) },\n \"weight\" => lambda {|n| @weight = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"maxImageSize\" => lambda {|n| @max_image_size = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"timeout\" => lambda {|n| @timeout = n.get_duration_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"contentData\" => lambda {|n| @content_data = n.get_string_value() },\n \"fileName\" => lambda {|n| @file_name = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"applicationVersion\" => lambda {|n| @application_version = n.get_string_value() },\n \"headerValue\" => lambda {|n| @header_value = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"callEndSubReason\" => lambda {|n| @call_end_sub_reason = n.get_number_value() },\n \"callType\" => lambda {|n| @call_type = n.get_string_value() },\n \"calleeNumber\" => lambda {|n| @callee_number = n.get_string_value() },\n \"callerNumber\" => lambda {|n| @caller_number = n.get_string_value() },\n \"correlationId\" => lambda {|n| @correlation_id = n.get_string_value() },\n \"duration\" => lambda {|n| @duration = n.get_number_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"failureDateTime\" => lambda {|n| @failure_date_time = n.get_date_time_value() },\n \"finalSipCode\" => lambda {|n| @final_sip_code = n.get_number_value() },\n \"finalSipCodePhrase\" => lambda {|n| @final_sip_code_phrase = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"inviteDateTime\" => lambda {|n| @invite_date_time = n.get_date_time_value() },\n \"mediaBypassEnabled\" => lambda {|n| @media_bypass_enabled = n.get_boolean_value() },\n \"mediaPathLocation\" => lambda {|n| @media_path_location = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"signalingLocation\" => lambda {|n| @signaling_location = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"successfulCall\" => lambda {|n| @successful_call = n.get_boolean_value() },\n \"trunkFullyQualifiedDomainName\" => lambda {|n| @trunk_fully_qualified_domain_name = n.get_string_value() },\n \"userDisplayName\" => lambda {|n| @user_display_name = n.get_string_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isCourseActivitySyncEnabled\" => lambda {|n| @is_course_activity_sync_enabled = n.get_boolean_value() },\n \"learningContents\" => lambda {|n| @learning_contents = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningContent.create_from_discriminator_value(pn) }) },\n \"learningCourseActivities\" => lambda {|n| @learning_course_activities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningCourseActivity.create_from_discriminator_value(pn) }) },\n \"loginWebUrl\" => lambda {|n| @login_web_url = n.get_string_value() },\n \"longLogoWebUrlForDarkTheme\" => lambda {|n| @long_logo_web_url_for_dark_theme = n.get_string_value() },\n \"longLogoWebUrlForLightTheme\" => lambda {|n| @long_logo_web_url_for_light_theme = n.get_string_value() },\n \"squareLogoWebUrlForDarkTheme\" => lambda {|n| @square_logo_web_url_for_dark_theme = n.get_string_value() },\n \"squareLogoWebUrlForLightTheme\" => lambda {|n| @square_logo_web_url_for_light_theme = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"versionId\" => lambda {|n| @version_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"buildNumber\" => lambda {|n| @build_number = n.get_string_value() },\n \"bundleId\" => lambda {|n| @bundle_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"versionNumber\" => lambda {|n| @version_number = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroups\" => lambda {|n| @section_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n \"sectionGroupsUrl\" => lambda {|n| @section_groups_url = n.get_string_value() },\n \"sections\" => lambda {|n| @sections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"sectionsUrl\" => lambda {|n| @sections_url = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"dataType\" => lambda {|n| @data_type = n.get_string_value() },\n \"isSyncedFromOnPremises\" => lambda {|n| @is_synced_from_on_premises = n.get_boolean_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"targetObjects\" => lambda {|n| @target_objects = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },\n \"imageFile\" => lambda {|n| @image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"mdeDeviceId\" => lambda {|n| @mde_device_id = n.get_string_value() },\n \"parentProcessCreationDateTime\" => lambda {|n| @parent_process_creation_date_time = n.get_date_time_value() },\n \"parentProcessId\" => lambda {|n| @parent_process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"parentProcessImageFile\" => lambda {|n| @parent_process_image_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityFileDetails.create_from_discriminator_value(pn) }) },\n \"processCommandLine\" => lambda {|n| @process_command_line = n.get_string_value() },\n \"processCreationDateTime\" => lambda {|n| @process_creation_date_time = n.get_date_time_value() },\n \"processId\" => lambda {|n| @process_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"userAccount\" => lambda {|n| @user_account = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityUserAccount.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::OperationStatus) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"completedDateTime\" => lambda {|n| @completed_date_time = n.get_date_time_value() },\n \"progress\" => lambda {|n| @progress = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::DataPolicyOperationStatus) },\n \"storageLocation\" => lambda {|n| @storage_location = n.get_string_value() },\n \"submittedDateTime\" => lambda {|n| @submitted_date_time = n.get_date_time_value() },\n \"userId\" => lambda {|n| @user_id = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"completedUnits\" => lambda {|n| @completed_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"progressObservationDateTime\" => lambda {|n| @progress_observation_date_time = n.get_date_time_value() },\n \"totalUnits\" => lambda {|n| @total_units = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"units\" => lambda {|n| @units = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"provisioningStepType\" => lambda {|n| @provisioning_step_type = n.get_enum_value(MicrosoftGraph::Models::ProvisioningStepType) },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::ProvisioningResult) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"downloadUri\" => lambda {|n| @download_uri = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fulfilledDateTime\" => lambda {|n| @fulfilled_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodEndDateTime\" => lambda {|n| @review_history_period_end_date_time = n.get_date_time_value() },\n \"reviewHistoryPeriodStartDateTime\" => lambda {|n| @review_history_period_start_date_time = n.get_date_time_value() },\n \"runDateTime\" => lambda {|n| @run_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::AccessReviewHistoryStatus) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"check32BitOn64System\" => lambda {|n| @check32_bit_on64_system = n.get_boolean_value() },\n \"comparisonValue\" => lambda {|n| @comparison_value = n.get_string_value() },\n \"fileOrFolderName\" => lambda {|n| @file_or_folder_name = n.get_string_value() },\n \"operationType\" => lambda {|n| @operation_type = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppFileSystemOperationType) },\n \"operator\" => lambda {|n| @operator = n.get_enum_value(MicrosoftGraph::Models::Win32LobAppRuleOperator) },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n })\n end", "def read_object\n if @version == 0\n return amf0_deserialize\n else\n return amf3_deserialize\n end\n end", "def get_field_deserializers()\n return {\n \"destinationFileName\" => lambda {|n| @destination_file_name = n.get_string_value() },\n \"sourceFile\" => lambda {|n| @source_file = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemReference.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return {\n \"newText\" => lambda {|n| @new_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"numBytes\" => lambda {|n| @num_bytes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"oldText\" => lambda {|n| @old_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"startNum\" => lambda {|n| @start_num = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"audioDeviceName\" => lambda {|n| @audio_device_name = n.get_string_value() },\n \"bookingType\" => lambda {|n| @booking_type = n.get_enum_value(MicrosoftGraph::Models::BookingType) },\n \"building\" => lambda {|n| @building = n.get_string_value() },\n \"capacity\" => lambda {|n| @capacity = n.get_number_value() },\n \"displayDeviceName\" => lambda {|n| @display_device_name = n.get_string_value() },\n \"emailAddress\" => lambda {|n| @email_address = n.get_string_value() },\n \"floorLabel\" => lambda {|n| @floor_label = n.get_string_value() },\n \"floorNumber\" => lambda {|n| @floor_number = n.get_number_value() },\n \"isWheelChairAccessible\" => lambda {|n| @is_wheel_chair_accessible = n.get_boolean_value() },\n \"label\" => lambda {|n| @label = n.get_string_value() },\n \"nickname\" => lambda {|n| @nickname = n.get_string_value() },\n \"tags\" => lambda {|n| @tags = n.get_collection_of_primitive_values(String) },\n \"videoDeviceName\" => lambda {|n| @video_device_name = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"targetType\" => lambda {|n| @target_type = n.get_enum_value(MicrosoftGraph::Models::FeatureTargetType) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"managedDevices\" => lambda {|n| @managed_devices = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ManagedDevice.create_from_discriminator_value(pn) }) },\n \"platform\" => lambda {|n| @platform = n.get_enum_value(MicrosoftGraph::Models::DetectedAppPlatformType) },\n \"publisher\" => lambda {|n| @publisher = n.get_string_value() },\n \"sizeInByte\" => lambda {|n| @size_in_byte = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"activationUrl\" => lambda {|n| @activation_url = n.get_string_value() },\n \"activitySourceHost\" => lambda {|n| @activity_source_host = n.get_string_value() },\n \"appActivityId\" => lambda {|n| @app_activity_id = n.get_string_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"contentInfo\" => lambda {|n| @content_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"fallbackUrl\" => lambda {|n| @fallback_url = n.get_string_value() },\n \"historyItems\" => lambda {|n| @history_items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ActivityHistoryItem.create_from_discriminator_value(pn) }) },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::Status) },\n \"userTimezone\" => lambda {|n| @user_timezone = n.get_string_value() },\n \"visualElements\" => lambda {|n| @visual_elements = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::VisualInfo.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"category\" => lambda {|n| @category = n.get_string_value() },\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"version\" => lambda {|n| @version = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"malwareIdentifier\" => lambda {|n| @malware_identifier = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"lastActionDateTime\" => lambda {|n| @last_action_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operation\" => lambda {|n| @operation = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"details\" => lambda {|n| @details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::DetailsInfo.create_from_discriminator_value(pn) }) },\n \"identityType\" => lambda {|n| @identity_type = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"dataLocationCode\" => lambda {|n| @data_location_code = n.get_string_value() },\n \"hostname\" => lambda {|n| @hostname = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"root\" => lambda {|n| @root = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Root.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return {\n \"address\" => lambda {|n| @address = n.get_string_value() },\n \"itemId\" => lambda {|n| @item_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"relevanceScore\" => lambda {|n| @relevance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"selectionLikelihood\" => lambda {|n| @selection_likelihood = n.get_enum_value(MicrosoftGraph::Models::SelectionLikelihoodInfo) },\n }\n end", "def get_field_deserializers()\n return {\n \"hashes\" => lambda {|n| @hashes = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Hashes.create_from_discriminator_value(pn) }) },\n \"mimeType\" => lambda {|n| @mime_type = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"processingMetadata\" => lambda {|n| @processing_metadata = n.get_boolean_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"configurationVersion\" => lambda {|n| @configuration_version = n.get_number_value() },\n \"errorCount\" => lambda {|n| @error_count = n.get_number_value() },\n \"failedCount\" => lambda {|n| @failed_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"notApplicableCount\" => lambda {|n| @not_applicable_count = n.get_number_value() },\n \"pendingCount\" => lambda {|n| @pending_count = n.get_number_value() },\n \"successCount\" => lambda {|n| @success_count = n.get_number_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"format\" => lambda {|n| @format = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookChartDataLabelFormat.create_from_discriminator_value(pn) }) },\n \"position\" => lambda {|n| @position = n.get_string_value() },\n \"separator\" => lambda {|n| @separator = n.get_string_value() },\n \"showBubbleSize\" => lambda {|n| @show_bubble_size = n.get_boolean_value() },\n \"showCategoryName\" => lambda {|n| @show_category_name = n.get_boolean_value() },\n \"showLegendKey\" => lambda {|n| @show_legend_key = n.get_boolean_value() },\n \"showPercentage\" => lambda {|n| @show_percentage = n.get_boolean_value() },\n \"showSeriesName\" => lambda {|n| @show_series_name = n.get_boolean_value() },\n \"showValue\" => lambda {|n| @show_value = n.get_boolean_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"errorDetails\" => lambda {|n| @error_details = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::GenericError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"sourceId\" => lambda {|n| @source_id = n.get_string_value() },\n \"targetId\" => lambda {|n| @target_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"contentSource\" => lambda {|n| @content_source = n.get_string_value() },\n \"hitId\" => lambda {|n| @hit_id = n.get_string_value() },\n \"isCollapsed\" => lambda {|n| @is_collapsed = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"rank\" => lambda {|n| @rank = n.get_number_value() },\n \"resource\" => lambda {|n| @resource = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Entity.create_from_discriminator_value(pn) }) },\n \"resultTemplateId\" => lambda {|n| @result_template_id = n.get_string_value() },\n \"summary\" => lambda {|n| @summary = n.get_string_value() },\n }\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 get_field_deserializers()\n return super.merge({\n \"audioRoutingGroups\" => lambda {|n| @audio_routing_groups = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AudioRoutingGroup.create_from_discriminator_value(pn) }) },\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_string_value() },\n \"callOptions\" => lambda {|n| @call_options = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallOptions.create_from_discriminator_value(pn) }) },\n \"callRoutes\" => lambda {|n| @call_routes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CallRoute.create_from_discriminator_value(pn) }) },\n \"callbackUri\" => lambda {|n| @callback_uri = n.get_string_value() },\n \"chatInfo\" => lambda {|n| @chat_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ChatInfo.create_from_discriminator_value(pn) }) },\n \"contentSharingSessions\" => lambda {|n| @content_sharing_sessions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ContentSharingSession.create_from_discriminator_value(pn) }) },\n \"direction\" => lambda {|n| @direction = n.get_enum_value(MicrosoftGraph::Models::CallDirection) },\n \"incomingContext\" => lambda {|n| @incoming_context = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IncomingContext.create_from_discriminator_value(pn) }) },\n \"mediaConfig\" => lambda {|n| @media_config = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MediaConfig.create_from_discriminator_value(pn) }) },\n \"mediaState\" => lambda {|n| @media_state = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallMediaState.create_from_discriminator_value(pn) }) },\n \"meetingInfo\" => lambda {|n| @meeting_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::MeetingInfo.create_from_discriminator_value(pn) }) },\n \"myParticipantId\" => lambda {|n| @my_participant_id = n.get_string_value() },\n \"operations\" => lambda {|n| @operations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::CommsOperation.create_from_discriminator_value(pn) }) },\n \"participants\" => lambda {|n| @participants = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Participant.create_from_discriminator_value(pn) }) },\n \"requestedModalities\" => lambda {|n| @requested_modalities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Modality.create_from_discriminator_value(pn) }) },\n \"resultInfo\" => lambda {|n| @result_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ResultInfo.create_from_discriminator_value(pn) }) },\n \"source\" => lambda {|n| @source = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ParticipantInfo.create_from_discriminator_value(pn) }) },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::CallState) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"targets\" => lambda {|n| @targets = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::InvitationParticipantInfo.create_from_discriminator_value(pn) }) },\n \"tenantId\" => lambda {|n| @tenant_id = n.get_string_value() },\n \"toneInfo\" => lambda {|n| @tone_info = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ToneInfo.create_from_discriminator_value(pn) }) },\n \"transcription\" => lambda {|n| @transcription = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::CallTranscriptionInfo.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"externalId\" => lambda {|n| @external_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"teacherNumber\" => lambda {|n| @teacher_number = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"key\" => lambda {|n| @key = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"thumbprint\" => lambda {|n| @thumbprint = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"usage\" => lambda {|n| @usage = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"allowMultipleLines\" => lambda {|n| @allow_multiple_lines = n.get_boolean_value() },\n \"appendChangesToExistingText\" => lambda {|n| @append_changes_to_existing_text = n.get_boolean_value() },\n \"linesForEditing\" => lambda {|n| @lines_for_editing = n.get_number_value() },\n \"maxLength\" => lambda {|n| @max_length = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"textType\" => lambda {|n| @text_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"assignCategories\" => lambda {|n| @assign_categories = n.get_collection_of_primitive_values(String) },\n \"copyToFolder\" => lambda {|n| @copy_to_folder = n.get_string_value() },\n \"delete\" => lambda {|n| @delete = n.get_boolean_value() },\n \"forwardAsAttachmentTo\" => lambda {|n| @forward_as_attachment_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"forwardTo\" => lambda {|n| @forward_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"markAsRead\" => lambda {|n| @mark_as_read = n.get_boolean_value() },\n \"markImportance\" => lambda {|n| @mark_importance = n.get_enum_value(MicrosoftGraph::Models::Importance) },\n \"moveToFolder\" => lambda {|n| @move_to_folder = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"permanentDelete\" => lambda {|n| @permanent_delete = n.get_boolean_value() },\n \"redirectTo\" => lambda {|n| @redirect_to = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Recipient.create_from_discriminator_value(pn) }) },\n \"stopProcessingRules\" => lambda {|n| @stop_processing_rules = n.get_boolean_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"acceptMappedClaims\" => lambda {|n| @accept_mapped_claims = n.get_boolean_value() },\n \"knownClientApplications\" => lambda {|n| @known_client_applications = n.get_collection_of_primitive_values(UUIDTools::UUID) },\n \"oauth2PermissionScopes\" => lambda {|n| @oauth2_permission_scopes = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PermissionScope.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preAuthorizedApplications\" => lambda {|n| @pre_authorized_applications = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::PreAuthorizedApplication.create_from_discriminator_value(pn) }) },\n \"requestedAccessTokenVersion\" => lambda {|n| @requested_access_token_version = n.get_number_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdByAppId\" => lambda {|n| @created_by_app_id = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"level\" => lambda {|n| @level = n.get_number_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PageLinks.create_from_discriminator_value(pn) }) },\n \"order\" => lambda {|n| @order = n.get_number_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSection\" => lambda {|n| @parent_section = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"userTags\" => lambda {|n| @user_tags = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return {\n \"failedRuns\" => lambda {|n| @failed_runs = n.get_number_value() },\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulRuns\" => lambda {|n| @successful_runs = n.get_number_value() },\n \"totalRuns\" => lambda {|n| @total_runs = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_guid_value() },\n \"isEnabled\" => lambda {|n| @is_enabled = n.get_boolean_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"recommendedActions\" => lambda {|n| @recommended_actions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RecommendedAction.create_from_discriminator_value(pn) }) },\n \"resolvedTargetsCount\" => lambda {|n| @resolved_targets_count = n.get_number_value() },\n \"simulationEventsContent\" => lambda {|n| @simulation_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SimulationEventsContent.create_from_discriminator_value(pn) }) },\n \"trainingEventsContent\" => lambda {|n| @training_events_content = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TrainingEventsContent.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return {\n \"customKeyIdentifier\" => lambda {|n| @custom_key_identifier = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"endDateTime\" => lambda {|n| @end_date_time = n.get_date_time_value() },\n \"hint\" => lambda {|n| @hint = n.get_string_value() },\n \"keyId\" => lambda {|n| @key_id = n.get_guid_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"secretText\" => lambda {|n| @secret_text = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"isRequired\" => lambda {|n| @is_required = n.get_boolean_value() },\n \"locations\" => lambda {|n| @locations = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LocationConstraintItem.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"suggestLocation\" => lambda {|n| @suggest_location = n.get_boolean_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"activityType\" => lambda {|n| @activity_type = n.get_string_value() },\n \"chainId\" => lambda {|n| @chain_id = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"previewText\" => lambda {|n| @preview_text = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::ItemBody.create_from_discriminator_value(pn) }) },\n \"recipient\" => lambda {|n| @recipient = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkNotificationRecipient.create_from_discriminator_value(pn) }) },\n \"templateParameters\" => lambda {|n| @template_parameters = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::KeyValuePair.create_from_discriminator_value(pn) }) },\n \"topic\" => lambda {|n| @topic = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::TeamworkActivityTopic.create_from_discriminator_value(pn) }) },\n }\n end", "def metadata\n self.class.metadata\n end", "def get_field_deserializers()\n return {\n \"activityIdentifier\" => lambda {|n| @activity_identifier = n.get_string_value() },\n \"countEntitled\" => lambda {|n| @count_entitled = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEntitledForProvisioning\" => lambda {|n| @count_entitled_for_provisioning = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowed\" => lambda {|n| @count_escrowed = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countEscrowedRaw\" => lambda {|n| @count_escrowed_raw = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExported\" => lambda {|n| @count_exported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countExports\" => lambda {|n| @count_exports = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImported\" => lambda {|n| @count_imported = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedDeltas\" => lambda {|n| @count_imported_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"countImportedReferenceDeltas\" => lambda {|n| @count_imported_reference_deltas = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"error\" => lambda {|n| @error = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SynchronizationError.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"state\" => lambda {|n| @state = n.get_enum_value(MicrosoftGraph::Models::SynchronizationTaskExecutionResult) },\n \"timeBegan\" => lambda {|n| @time_began = n.get_date_time_value() },\n \"timeEnded\" => lambda {|n| @time_ended = n.get_date_time_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"content\" => lambda {|n| @content = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"transportKey\" => lambda {|n| @transport_key = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"activeDeviceCount\" => lambda {|n| @active_device_count = n.get_number_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"modelAppHealthScore\" => lambda {|n| @model_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceAccess\" => lambda {|n| @resource_access = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ResourceAccess.create_from_discriminator_value(pn) }) },\n \"resourceAppId\" => lambda {|n| @resource_app_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"key\" => lambda {|n| @key = n.get_string_value() },\n \"volumeType\" => lambda {|n| @volume_type = n.get_enum_value(MicrosoftGraph::Models::VolumeType) },\n })\n end", "def get_field_deserializers()\n return {\n \"anchor\" => lambda {|n| @anchor = n.get_boolean_value() },\n \"apiExpressions\" => lambda {|n| @api_expressions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::StringKeyStringValuePair.create_from_discriminator_value(pn) }) },\n \"caseExact\" => lambda {|n| @case_exact = n.get_boolean_value() },\n \"defaultValue\" => lambda {|n| @default_value = n.get_string_value() },\n \"flowNullValues\" => lambda {|n| @flow_null_values = n.get_boolean_value() },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeDefinitionMetadataEntry.create_from_discriminator_value(pn) }) },\n \"multivalued\" => lambda {|n| @multivalued = n.get_boolean_value() },\n \"mutability\" => lambda {|n| @mutability = n.get_enum_value(MicrosoftGraph::Models::Mutability) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"referencedObjects\" => lambda {|n| @referenced_objects = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ReferencedObject.create_from_discriminator_value(pn) }) },\n \"required\" => lambda {|n| @required = n.get_boolean_value() },\n \"type\" => lambda {|n| @type = n.get_enum_value(MicrosoftGraph::Models::AttributeType) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"size\" => lambda {|n| @size = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"averageBlueScreens\" => lambda {|n| @average_blue_screens = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"averageRestarts\" => lambda {|n| @average_restarts = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"blueScreenCount\" => lambda {|n| @blue_screen_count = n.get_number_value() },\n \"bootScore\" => lambda {|n| @boot_score = n.get_number_value() },\n \"coreBootTimeInMs\" => lambda {|n| @core_boot_time_in_ms = n.get_number_value() },\n \"coreLoginTimeInMs\" => lambda {|n| @core_login_time_in_ms = n.get_number_value() },\n \"deviceCount\" => lambda {|n| @device_count = n.get_object_value(lambda {|pn| Int64.create_from_discriminator_value(pn) }) },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"diskType\" => lambda {|n| @disk_type = n.get_enum_value(MicrosoftGraph::Models::DiskType) },\n \"groupPolicyBootTimeInMs\" => lambda {|n| @group_policy_boot_time_in_ms = n.get_number_value() },\n \"groupPolicyLoginTimeInMs\" => lambda {|n| @group_policy_login_time_in_ms = n.get_number_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"loginScore\" => lambda {|n| @login_score = n.get_number_value() },\n \"manufacturer\" => lambda {|n| @manufacturer = n.get_string_value() },\n \"model\" => lambda {|n| @model = n.get_string_value() },\n \"modelStartupPerformanceScore\" => lambda {|n| @model_startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"operatingSystemVersion\" => lambda {|n| @operating_system_version = n.get_string_value() },\n \"responsiveDesktopTimeInMs\" => lambda {|n| @responsive_desktop_time_in_ms = n.get_number_value() },\n \"restartCount\" => lambda {|n| @restart_count = n.get_number_value() },\n \"startupPerformanceScore\" => lambda {|n| @startup_performance_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return {\n \"connectingIP\" => lambda {|n| @connecting_i_p = n.get_string_value() },\n \"deliveryAction\" => lambda {|n| @delivery_action = n.get_string_value() },\n \"deliveryLocation\" => lambda {|n| @delivery_location = n.get_string_value() },\n \"directionality\" => lambda {|n| @directionality = n.get_string_value() },\n \"internetMessageId\" => lambda {|n| @internet_message_id = n.get_string_value() },\n \"messageFingerprint\" => lambda {|n| @message_fingerprint = n.get_string_value() },\n \"messageReceivedDateTime\" => lambda {|n| @message_received_date_time = n.get_date_time_value() },\n \"messageSubject\" => lambda {|n| @message_subject = n.get_string_value() },\n \"networkMessageId\" => lambda {|n| @network_message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"application\" => lambda {|n| @application = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Identity.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"preventsDownload\" => lambda {|n| @prevents_download = n.get_boolean_value() },\n \"scope\" => lambda {|n| @scope = n.get_string_value() },\n \"type\" => lambda {|n| @type = n.get_string_value() },\n \"webHtml\" => lambda {|n| @web_html = n.get_string_value() },\n \"webUrl\" => lambda {|n| @web_url = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"nextExpectedRanges\" => lambda {|n| @next_expected_ranges = n.get_collection_of_primitive_values(String) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"uploadUrl\" => lambda {|n| @upload_url = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceCountWithCrashes\" => lambda {|n| @device_count_with_crashes = n.get_number_value() },\n \"isLatestUsedVersion\" => lambda {|n| @is_latest_used_version = n.get_boolean_value() },\n \"isMostUsedVersion\" => lambda {|n| @is_most_used_version = n.get_boolean_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"attributeMappings\" => lambda {|n| @attribute_mappings = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::AttributeMapping.create_from_discriminator_value(pn) }) },\n \"enabled\" => lambda {|n| @enabled = n.get_boolean_value() },\n \"flowTypes\" => lambda {|n| @flow_types = n.get_enum_value(MicrosoftGraph::Models::ObjectFlowTypes) },\n \"metadata\" => lambda {|n| @metadata = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ObjectMappingMetadataEntry.create_from_discriminator_value(pn) }) },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"scope\" => lambda {|n| @scope = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Filter.create_from_discriminator_value(pn) }) },\n \"sourceObjectName\" => lambda {|n| @source_object_name = n.get_string_value() },\n \"targetObjectName\" => lambda {|n| @target_object_name = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"isDefault\" => lambda {|n| @is_default = n.get_boolean_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionLinks.create_from_discriminator_value(pn) }) },\n \"pages\" => lambda {|n| @pages = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::OnenotePage.create_from_discriminator_value(pn) }) },\n \"pagesUrl\" => lambda {|n| @pages_url = n.get_string_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSectionGroup\" => lambda {|n| @parent_section_group = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SectionGroup.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appHangCount\" => lambda {|n| @app_hang_count = n.get_number_value() },\n \"crashedAppCount\" => lambda {|n| @crashed_app_count = n.get_number_value() },\n \"deviceAppHealthScore\" => lambda {|n| @device_app_health_score = n.get_object_value(lambda {|pn| Double.create_from_discriminator_value(pn) }) },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"deviceManufacturer\" => lambda {|n| @device_manufacturer = n.get_string_value() },\n \"deviceModel\" => lambda {|n| @device_model = n.get_string_value() },\n \"healthStatus\" => lambda {|n| @health_status = n.get_enum_value(MicrosoftGraph::Models::UserExperienceAnalyticsHealthState) },\n \"meanTimeToFailureInMinutes\" => lambda {|n| @mean_time_to_failure_in_minutes = n.get_number_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"messageId\" => lambda {|n| @message_id = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"replyChainMessageId\" => lambda {|n| @reply_chain_message_id = n.get_string_value() },\n \"threadId\" => lambda {|n| @thread_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"isUsable\" => lambda {|n| @is_usable = n.get_boolean_value() },\n \"isUsableOnce\" => lambda {|n| @is_usable_once = n.get_boolean_value() },\n \"lifetimeInMinutes\" => lambda {|n| @lifetime_in_minutes = n.get_number_value() },\n \"methodUsabilityReason\" => lambda {|n| @method_usability_reason = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n \"temporaryAccessPass\" => lambda {|n| @temporary_access_pass = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"owner\" => lambda {|n| @owner = n.get_string_value() },\n \"properties\" => lambda {|n| @properties = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ExtensionSchemaProperty.create_from_discriminator_value(pn) }) },\n \"status\" => lambda {|n| @status = n.get_string_value() },\n \"targetTypes\" => lambda {|n| @target_types = n.get_collection_of_primitive_values(String) },\n })\n end", "def get_field_deserializers()\n return {\n \"bargeInAllowed\" => lambda {|n| @barge_in_allowed = n.get_boolean_value() },\n \"clientContext\" => lambda {|n| @client_context = n.get_string_value() },\n \"initialSilenceTimeoutInSeconds\" => lambda {|n| @initial_silence_timeout_in_seconds = n.get_number_value() },\n \"maxRecordDurationInSeconds\" => lambda {|n| @max_record_duration_in_seconds = n.get_number_value() },\n \"maxSilenceTimeoutInSeconds\" => lambda {|n| @max_silence_timeout_in_seconds = n.get_number_value() },\n \"playBeep\" => lambda {|n| @play_beep = n.get_boolean_value() },\n \"prompts\" => lambda {|n| @prompts = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::Prompt.create_from_discriminator_value(pn) }) },\n \"stopTones\" => lambda {|n| @stop_tones = n.get_collection_of_primitive_values(String) },\n }\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"response\" => lambda {|n| @response = n.get_enum_value(MicrosoftGraph::Models::ResponseType) },\n \"time\" => lambda {|n| @time = n.get_date_time_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"driveId\" => lambda {|n| @drive_id = n.get_string_value() },\n \"driveType\" => lambda {|n| @drive_type = n.get_string_value() },\n \"id\" => lambda {|n| @id = n.get_string_value() },\n \"name\" => lambda {|n| @name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"path\" => lambda {|n| @path = n.get_string_value() },\n \"shareId\" => lambda {|n| @share_id = n.get_string_value() },\n \"sharepointIds\" => lambda {|n| @sharepoint_ids = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SharepointIds.create_from_discriminator_value(pn) }) },\n \"siteId\" => lambda {|n| @site_id = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"appCrashCount\" => lambda {|n| @app_crash_count = n.get_number_value() },\n \"appDisplayName\" => lambda {|n| @app_display_name = n.get_string_value() },\n \"appName\" => lambda {|n| @app_name = n.get_string_value() },\n \"appPublisher\" => lambda {|n| @app_publisher = n.get_string_value() },\n \"appVersion\" => lambda {|n| @app_version = n.get_string_value() },\n \"deviceDisplayName\" => lambda {|n| @device_display_name = n.get_string_value() },\n \"deviceId\" => lambda {|n| @device_id = n.get_string_value() },\n \"processedDateTime\" => lambda {|n| @processed_date_time = n.get_date_time_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"activeMalwareDetectionCount\" => lambda {|n| @active_malware_detection_count = n.get_number_value() },\n \"category\" => lambda {|n| @category = n.get_enum_value(MicrosoftGraph::Models::WindowsMalwareCategory) },\n \"deviceCount\" => lambda {|n| @device_count = n.get_number_value() },\n \"distinctActiveMalwareCount\" => lambda {|n| @distinct_active_malware_count = n.get_number_value() },\n \"lastUpdateDateTime\" => lambda {|n| @last_update_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"issuer\" => lambda {|n| @issuer = n.get_string_value() },\n \"issuerName\" => lambda {|n| @issuer_name = n.get_string_value() },\n \"status\" => lambda {|n| @status = n.get_enum_value(MicrosoftGraph::Models::CertificateStatus) },\n \"subject\" => lambda {|n| @subject = n.get_string_value() },\n \"subjectName\" => lambda {|n| @subject_name = n.get_string_value() },\n \"uploadDateTime\" => lambda {|n| @upload_date_time = n.get_date_time_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"appId\" => lambda {|n| @app_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"servicePrincipalId\" => lambda {|n| @service_principal_id = n.get_string_value() },\n \"servicePrincipalName\" => lambda {|n| @service_principal_name = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"riskDetections\" => lambda {|n| @risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskDetection.create_from_discriminator_value(pn) }) },\n \"riskyServicePrincipals\" => lambda {|n| @risky_service_principals = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyServicePrincipal.create_from_discriminator_value(pn) }) },\n \"riskyUsers\" => lambda {|n| @risky_users = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RiskyUser.create_from_discriminator_value(pn) }) },\n \"servicePrincipalRiskDetections\" => lambda {|n| @service_principal_risk_detections = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::ServicePrincipalRiskDetection.create_from_discriminator_value(pn) }) },\n }\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return super.merge({\n })\n end", "def get_field_deserializers()\n return {\n \"failedTasks\" => lambda {|n| @failed_tasks = n.get_number_value() },\n \"failedUsers\" => lambda {|n| @failed_users = n.get_number_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"successfulUsers\" => lambda {|n| @successful_users = n.get_number_value() },\n \"totalTasks\" => lambda {|n| @total_tasks = n.get_number_value() },\n \"totalUsers\" => lambda {|n| @total_users = n.get_number_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"durationInSeconds\" => lambda {|n| @duration_in_seconds = n.get_number_value() },\n \"joinDateTime\" => lambda {|n| @join_date_time = n.get_date_time_value() },\n \"leaveDateTime\" => lambda {|n| @leave_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"applicationId\" => lambda {|n| @application_id = n.get_string_value() },\n \"changeType\" => lambda {|n| @change_type = n.get_string_value() },\n \"clientState\" => lambda {|n| @client_state = n.get_string_value() },\n \"creatorId\" => lambda {|n| @creator_id = n.get_string_value() },\n \"encryptionCertificate\" => lambda {|n| @encryption_certificate = n.get_string_value() },\n \"encryptionCertificateId\" => lambda {|n| @encryption_certificate_id = n.get_string_value() },\n \"expirationDateTime\" => lambda {|n| @expiration_date_time = n.get_date_time_value() },\n \"includeResourceData\" => lambda {|n| @include_resource_data = n.get_boolean_value() },\n \"latestSupportedTlsVersion\" => lambda {|n| @latest_supported_tls_version = n.get_string_value() },\n \"lifecycleNotificationUrl\" => lambda {|n| @lifecycle_notification_url = n.get_string_value() },\n \"notificationQueryOptions\" => lambda {|n| @notification_query_options = n.get_string_value() },\n \"notificationUrl\" => lambda {|n| @notification_url = n.get_string_value() },\n \"notificationUrlAppId\" => lambda {|n| @notification_url_app_id = n.get_string_value() },\n \"resource\" => lambda {|n| @resource = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"entityType\" => lambda {|n| @entity_type = n.get_string_value() },\n \"mailNickname\" => lambda {|n| @mail_nickname = n.get_string_value() },\n \"onBehalfOfUserId\" => lambda {|n| @on_behalf_of_user_id = n.get_guid_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"actionName\" => lambda {|n| @action_name = n.get_string_value() },\n \"actionState\" => lambda {|n| @action_state = n.get_enum_value(MicrosoftGraph::Models::ActionState) },\n \"lastUpdatedDateTime\" => lambda {|n| @last_updated_date_time = n.get_date_time_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"startDateTime\" => lambda {|n| @start_date_time = n.get_date_time_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"accountName\" => lambda {|n| @account_name = n.get_string_value() },\n \"azureAdUserId\" => lambda {|n| @azure_ad_user_id = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"domainName\" => lambda {|n| @domain_name = n.get_string_value() },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"userPrincipalName\" => lambda {|n| @user_principal_name = n.get_string_value() },\n \"userSid\" => lambda {|n| @user_sid = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return super.merge({\n \"comment\" => lambda {|n| @comment = n.get_string_value() },\n \"createdBy\" => lambda {|n| @created_by = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::IdentitySet.create_from_discriminator_value(pn) }) },\n \"createdDateTime\" => lambda {|n| @created_date_time = n.get_date_time_value() },\n \"items\" => lambda {|n| @items = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::DocumentSetVersionItem.create_from_discriminator_value(pn) }) },\n \"shouldCaptureMinorVersion\" => lambda {|n| @should_capture_minor_version = n.get_boolean_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"resourceId\" => lambda {|n| @resource_id = n.get_string_value() },\n \"uri\" => lambda {|n| @uri = n.get_string_value() },\n }\n end", "def get_field_deserializers()\n return {\n \"callChainId\" => lambda {|n| @call_chain_id = n.get_guid_value() },\n \"cloudServiceDeploymentEnvironment\" => lambda {|n| @cloud_service_deployment_environment = n.get_string_value() },\n \"cloudServiceDeploymentId\" => lambda {|n| @cloud_service_deployment_id = n.get_string_value() },\n \"cloudServiceInstanceName\" => lambda {|n| @cloud_service_instance_name = n.get_string_value() },\n \"cloudServiceName\" => lambda {|n| @cloud_service_name = n.get_string_value() },\n \"deviceDescription\" => lambda {|n| @device_description = n.get_string_value() },\n \"deviceName\" => lambda {|n| @device_name = n.get_string_value() },\n \"mediaLegId\" => lambda {|n| @media_leg_id = n.get_guid_value() },\n \"mediaQualityList\" => lambda {|n| @media_quality_list = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::TeleconferenceDeviceMediaQuality.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"participantId\" => lambda {|n| @participant_id = n.get_guid_value() },\n }\n end", "def _before_validation\n serialize_deserialized_values\n super\n end", "def get_field_deserializers()\n return super.merge({\n \"description\" => lambda {|n| @description = n.get_string_value() },\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isBuiltIn\" => lambda {|n| @is_built_in = n.get_boolean_value() },\n \"roleAssignments\" => lambda {|n| @role_assignments = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RoleAssignment.create_from_discriminator_value(pn) }) },\n \"rolePermissions\" => lambda {|n| @role_permissions = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::RolePermission.create_from_discriminator_value(pn) }) },\n })\n end", "def get_field_deserializers()\n return super.merge({\n \"firstSeenDateTime\" => lambda {|n| @first_seen_date_time = n.get_date_time_value() },\n \"host\" => lambda {|n| @host = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::SecurityHost.create_from_discriminator_value(pn) }) },\n \"kind\" => lambda {|n| @kind = n.get_string_value() },\n \"lastSeenDateTime\" => lambda {|n| @last_seen_date_time = n.get_date_time_value() },\n \"value\" => lambda {|n| @value = n.get_string_value() },\n })\n end", "def get_field_deserializers()\n return {\n \"color\" => lambda {|n| @color = n.get_string_value() },\n \"criterion1\" => lambda {|n| @criterion1 = n.get_string_value() },\n \"criterion2\" => lambda {|n| @criterion2 = n.get_string_value() },\n \"dynamicCriteria\" => lambda {|n| @dynamic_criteria = n.get_string_value() },\n \"filterOn\" => lambda {|n| @filter_on = n.get_string_value() },\n \"icon\" => lambda {|n| @icon = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::WorkbookIcon.create_from_discriminator_value(pn) }) },\n \"@odata.type\" => lambda {|n| @odata_type = n.get_string_value() },\n \"operator\" => lambda {|n| @operator = n.get_string_value() },\n \"values\" => lambda {|n| @values = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Json.create_from_discriminator_value(pn) }) },\n }\n end" ]
[ "0.6510734", "0.63224316", "0.6322254", "0.63094735", "0.62954384", "0.6238735", "0.6232461", "0.62155676", "0.6200175", "0.6199403", "0.6173917", "0.61733985", "0.61705345", "0.61631054", "0.61620396", "0.6158031", "0.6156071", "0.6142402", "0.613998", "0.6138061", "0.61200523", "0.6089013", "0.60869795", "0.6079146", "0.60785794", "0.6070405", "0.6063533", "0.60625833", "0.6061235", "0.60584134", "0.6055769", "0.6051312", "0.60465735", "0.6046329", "0.6031944", "0.6029311", "0.6028314", "0.60255736", "0.6022033", "0.60210633", "0.6009887", "0.5988654", "0.59844214", "0.59793943", "0.5975247", "0.5969614", "0.596824", "0.5966432", "0.5965554", "0.596292", "0.5951651", "0.5950895", "0.59456754", "0.59448177", "0.593984", "0.59362113", "0.5935833", "0.59319806", "0.59312665", "0.59307545", "0.5930406", "0.5926444", "0.5926136", "0.59240156", "0.5922303", "0.591605", "0.591336", "0.5913327", "0.59130335", "0.5910617", "0.5906052", "0.5906045", "0.59042066", "0.5903306", "0.5902868", "0.59027255", "0.5902389", "0.5902219", "0.5901496", "0.58978146", "0.5891392", "0.5890228", "0.5885622", "0.5885429", "0.5884738", "0.5883899", "0.5883899", "0.5883899", "0.58811784", "0.5878516", "0.5877111", "0.5869185", "0.5844199", "0.58430207", "0.58408237", "0.58383596", "0.58362466", "0.5836192", "0.5835942", "0.5834559", "0.583357" ]
0.0
-1
Serializes information the current object
def serialize(writer) raise StandardError, 'writer cannot be null' if writer.nil? super writer.write_object_value("chat", @chat) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def serialize\n end", "def serialize(object) end", "def serialize; end", "def serialize; end", "def serialize\n \n end", "def serialize\n raise NotImplementedError\n end", "def serialize\n raise NotImplementedError\n end", "def dump\r\n super + to_s\r\n end", "def serialize\n self.to_hash.to_json\n end", "def serialized\n serializer_class.new(self).serializable_hash\n end", "def serialize\n @raw_data\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"identityType\", @identity_type)\n end", "def serialize\n @serializer.serialize(self.output)\n end", "def serialize(_object, data); end", "def serialize(_object, data); end", "def to_json\n\t\t\tself.instance_variable_hash\n\t\tend", "def serializer; end", "def serialize!\n end", "def serialize(object)\n object.serializable_hash\n end", "def serialize(object)\n object.to_s\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"device\", @device)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"keyStrength\", @key_strength)\n end", "def marshal\n Marshal.dump self\n end", "def marshal\n Marshal.dump self\n end", "def marshal\n Marshal.dump self\n end", "def inspect\n serialize.to_s\n end", "def serialize\n YAML::dump(self)\n end", "def inspect()\n serialize.to_s()\n end", "def inspect()\n serialize.to_s()\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_collection_of_object_values(\"answers\", @answers)\n writer.write_object_value(\"assignment\", @assignment)\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionCalloutInstances\", @custom_extension_callout_instances)\n writer.write_enum_value(\"requestType\", @request_type)\n writer.write_object_value(\"requestor\", @requestor)\n writer.write_object_value(\"schedule\", @schedule)\n writer.write_enum_value(\"state\", @state)\n writer.write_string_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"initiator\", @initiator)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_date_time_value(\"visibleHistoryStartDateTime\", @visible_history_start_date_time)\n end", "def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_primitive_values(\"aliases\", @aliases)\n writer.write_collection_of_object_values(\"countriesOrRegionsOfOrigin\", @countries_or_regions_of_origin)\n writer.write_object_value(\"description\", @description)\n writer.write_date_time_value(\"firstActiveDateTime\", @first_active_date_time)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_enum_value(\"kind\", @kind)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"targets\", @targets)\n writer.write_string_value(\"title\", @title)\n writer.write_object_value(\"tradecraft\", @tradecraft)\n end", "def serialize(object, data); end", "def serialize\n JSON.generate(to_h)\n end", "def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"life\", @life)\n writer.write_object_value(\"per\", @per)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end", "def inspect\n id_string = (respond_to?(:id) && !id.nil?) ? \" id=#{id}\" : ''\n \"#<#{self.class}:0x#{object_id.to_s(16)}#{id_string}> JSON: \" +\n Clever::JSON.dump(@values, pretty: true)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"owner\", @owner)\n writer.write_collection_of_object_values(\"properties\", @properties)\n writer.write_string_value(\"status\", @status)\n writer.write_collection_of_primitive_values(\"targetTypes\", @target_types)\n end", "def write\n hash = attributes_hash\n write_value(serializer_class.dump(hash))\n @_cache = hash # set @_cache after the write\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_string_value(\"dataType\", @data_type)\n writer.write_boolean_value(\"isSyncedFromOnPremises\", @is_synced_from_on_premises)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_primitive_values(\"targetObjects\", @target_objects)\n end", "def instance_to_json\n\t\t# byebug\n\t\t{\n\t\tid: self.id,\n\t\tname: self.name,\n\t\theight: self.height,\n\t\tlast_watered: self.last_watered,\n\t\tlast_watered_amount: self.last_watered_amount,\n\t\tgrow_zone: self.grow_zone,\n\t\tnotes: self.notes,\n\t\tplanted_date: self.planted_date,\n\t\tfarm: self.farm,\t\n\t\tsensor: self.sensor\n\t\t# farm: { \n\t\t# \tfarm: self.farm.name,\n\t\t# \tfarm: self.farm.id,\n\t\t# },\n\t\t}\n\tend", "def _dump(depth)\n scrooge_fetch_remaining\n scrooge_invalidate_updateable_result_set\n scrooge_dump_flag_this\n str = Marshal.dump(self)\n scrooge_dump_unflag_this\n str\n end", "def to_s\n \"#<#{self.class.name}:#{object_id} #{info}>\"\n end", "def to_dump\n @time = Time.now\n Base64.encode64(Marshal.dump(self))\n end", "def dump\n\t\t\t\tflatten!\n\t\t\t\t\n\t\t\t\tMessagePack.dump(@attributes)\n\t\t\tend", "def inspect\n serialize.to_s\n end", "def inspect\n serialize.to_s\n end", "def inspect\n serialize.to_s\n end", "def serialize(options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"apiConnectorConfiguration\", @api_connector_configuration)\n writer.write_collection_of_object_values(\"identityProviders\", @identity_providers)\n writer.write_collection_of_object_values(\"languages\", @languages)\n writer.write_collection_of_object_values(\"userAttributeAssignments\", @user_attribute_assignments)\n writer.write_collection_of_object_values(\"userFlowIdentityProviders\", @user_flow_identity_providers)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"clientContext\", @client_context)\n writer.write_object_value(\"resultInfo\", @result_info)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_number_value(\"memberCount\", @member_count)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_enum_value(\"tagType\", @tag_type)\n writer.write_string_value(\"teamId\", @team_id)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_object_value(\"resource\", @resource)\n writer.write_object_value(\"weight\", @weight)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"comment\", @comment)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"deletedDateTime\", @deleted_date_time)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_boolean_value(\"hostOnly\", @host_only)\n writer.write_string_value(\"hostOrDomain\", @host_or_domain)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"path\", @path)\n writer.write_enum_value(\"sourceEnvironment\", @source_environment)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"category\", @category)\n writer.write_date_time_value(\"firstSeenDateTime\", @first_seen_date_time)\n writer.write_object_value(\"host\", @host)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_string_value(\"name\", @name)\n writer.write_string_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"large\", @large)\n writer.write_object_value(\"medium\", @medium)\n writer.write_object_value(\"small\", @small)\n writer.write_object_value(\"source\", @source)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"accessPackage\", @access_package)\n writer.write_enum_value(\"allowedTargetScope\", @allowed_target_scope)\n writer.write_object_value(\"automaticRequestSettings\", @automatic_request_settings)\n writer.write_object_value(\"catalog\", @catalog)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customExtensionStageSettings\", @custom_extension_stage_settings)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"expiration\", @expiration)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"questions\", @questions)\n writer.write_object_value(\"requestApprovalSettings\", @request_approval_settings)\n writer.write_object_value(\"requestorSettings\", @requestor_settings)\n writer.write_object_value(\"reviewSettings\", @review_settings)\n writer.write_collection_of_object_values(\"specificAllowedTargets\", @specific_allowed_targets)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"deviceId\", @device_id)\n writer.write_string_value(\"key\", @key)\n writer.write_enum_value(\"volumeType\", @volume_type)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"assignedTo\", @assigned_to)\n writer.write_date_time_value(\"closedDateTime\", @closed_date_time)\n writer.write_object_value(\"createdBy\", @created_by)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_object_value(\"dataSubject\", @data_subject)\n writer.write_enum_value(\"dataSubjectType\", @data_subject_type)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"history\", @history)\n writer.write_object_value(\"insight\", @insight)\n writer.write_date_time_value(\"internalDueDateTime\", @internal_due_date_time)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"notes\", @notes)\n writer.write_collection_of_primitive_values(\"regulations\", @regulations)\n writer.write_collection_of_object_values(\"stages\", @stages)\n writer.write_enum_value(\"status\", @status)\n writer.write_object_value(\"team\", @team)\n writer.write_enum_value(\"type\", @type)\n end", "def serializable_hash\n self.attributes\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_string_value(\"joinWebUrl\", @join_web_url)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_collection_of_object_values(\"modalities\", @modalities)\n writer.write_object_value(\"organizer\", @organizer)\n writer.write_collection_of_object_values(\"participants\", @participants)\n writer.write_collection_of_object_values(\"sessions\", @sessions)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_enum_value(\"type\", @type)\n writer.write_object_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"axes\", @axes)\n writer.write_object_value(\"dataLabels\", @data_labels)\n writer.write_object_value(\"format\", @format)\n writer.write_object_value(\"height\", @height)\n writer.write_object_value(\"left\", @left)\n writer.write_object_value(\"legend\", @legend)\n writer.write_string_value(\"name\", @name)\n writer.write_collection_of_object_values(\"series\", @series)\n writer.write_object_value(\"title\", @title)\n writer.write_object_value(\"top\", @top)\n writer.write_object_value(\"width\", @width)\n writer.write_object_value(\"worksheet\", @worksheet)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_object_value(\"details\", @details)\n writer.write_string_value(\"name\", @name)\n writer.write_enum_value(\"scenarios\", @scenarios)\n end", "def serialize\n JSON.dump(@hash)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_boolean_value(\"isUsable\", @is_usable)\n writer.write_boolean_value(\"isUsableOnce\", @is_usable_once)\n writer.write_number_value(\"lifetimeInMinutes\", @lifetime_in_minutes)\n writer.write_string_value(\"methodUsabilityReason\", @method_usability_reason)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n writer.write_string_value(\"temporaryAccessPass\", @temporary_access_pass)\n end", "def to_s\r\n dump\r\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"callee\", @callee)\n writer.write_object_value(\"caller\", @caller)\n writer.write_date_time_value(\"endDateTime\", @end_date_time)\n writer.write_object_value(\"failureInfo\", @failure_info)\n writer.write_collection_of_object_values(\"media\", @media)\n writer.write_date_time_value(\"startDateTime\", @start_date_time)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_number_value(\"deviceCount\", @device_count)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"managedDevices\", @managed_devices)\n writer.write_enum_value(\"platform\", @platform)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_object_value(\"sizeInByte\", @size_in_byte)\n writer.write_string_value(\"version\", @version)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_collection_of_object_values(\"members\", @members)\n writer.write_string_value(\"roleTemplateId\", @role_template_id)\n writer.write_collection_of_object_values(\"scopedMembers\", @scoped_members)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"options\", @options)\n writer.write_boolean_value(\"protected\", @protected)\n end", "def serialize(io)\n Encoder.encode(io, self)\n io\n end", "def _dump() end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"authenticationConfiguration\", @authentication_configuration)\n writer.write_object_value(\"clientConfiguration\", @client_configuration)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_object_value(\"endpointConfiguration\", @endpoint_configuration)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"container\", @container)\n writer.write_string_value(\"containerId\", @container_id)\n writer.write_object_value(\"lastModifiedBy\", @last_modified_by)\n writer.write_object_value(\"member\", @member)\n writer.write_string_value(\"memberId\", @member_id)\n writer.write_enum_value(\"outlierContainerType\", @outlier_container_type)\n writer.write_enum_value(\"outlierMemberType\", @outlier_member_type)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"body\", @body)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"imageUrl\", @image_url)\n writer.write_collection_of_object_values(\"indicators\", @indicators)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_date_time_value(\"lastUpdatedDateTime\", @last_updated_date_time)\n writer.write_object_value(\"summary\", @summary)\n writer.write_collection_of_primitive_values(\"tags\", @tags)\n writer.write_string_value(\"title\", @title)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_date_time_value(\"completedDateTime\", @completed_date_time)\n writer.write_object_value(\"progress\", @progress)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"storageLocation\", @storage_location)\n writer.write_date_time_value(\"submittedDateTime\", @submitted_date_time)\n writer.write_string_value(\"userId\", @user_id)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"accessPackages\", @access_packages)\n writer.write_enum_value(\"catalogType\", @catalog_type)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_collection_of_object_values(\"customWorkflowExtensions\", @custom_workflow_extensions)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_boolean_value(\"isExternallyVisible\", @is_externally_visible)\n writer.write_date_time_value(\"modifiedDateTime\", @modified_date_time)\n writer.write_collection_of_object_values(\"resourceRoles\", @resource_roles)\n writer.write_collection_of_object_values(\"resourceScopes\", @resource_scopes)\n writer.write_collection_of_object_values(\"resources\", @resources)\n writer.write_enum_value(\"state\", @state)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"bundles\", @bundles)\n writer.write_string_value(\"driveType\", @drive_type)\n writer.write_collection_of_object_values(\"following\", @following)\n writer.write_collection_of_object_values(\"items\", @items)\n writer.write_object_value(\"list\", @list)\n writer.write_object_value(\"owner\", @owner)\n writer.write_object_value(\"quota\", @quota)\n writer.write_object_value(\"root\", @root)\n writer.write_object_value(\"sharePointIds\", @share_point_ids)\n writer.write_collection_of_object_values(\"special\", @special)\n writer.write_object_value(\"system\", @system)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"classification\", @classification)\n writer.write_string_value(\"feature\", @feature)\n writer.write_string_value(\"featureGroup\", @feature_group)\n writer.write_string_value(\"impactDescription\", @impact_description)\n writer.write_boolean_value(\"isResolved\", @is_resolved)\n writer.write_enum_value(\"origin\", @origin)\n writer.write_collection_of_object_values(\"posts\", @posts)\n writer.write_string_value(\"service\", @service)\n writer.write_enum_value(\"status\", @status)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"connectors\", @connectors)\n writer.write_boolean_value(\"hasPhysicalDevice\", @has_physical_device)\n writer.write_boolean_value(\"isShared\", @is_shared)\n writer.write_date_time_value(\"lastSeenDateTime\", @last_seen_date_time)\n writer.write_date_time_value(\"registeredDateTime\", @registered_date_time)\n writer.write_collection_of_object_values(\"shares\", @shares)\n writer.write_collection_of_object_values(\"taskTriggers\", @task_triggers)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_collection_of_object_values(\"deviceStates\", @device_states)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_object_value(\"installSummary\", @install_summary)\n writer.write_object_value(\"largeCover\", @large_cover)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_date_time_value(\"publishedDateTime\", @published_date_time)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_collection_of_object_values(\"userStateSummary\", @user_state_summary)\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"assignments\", @assignments)\n writer.write_collection_of_object_values(\"categories\", @categories)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_string_value(\"description\", @description)\n writer.write_string_value(\"developer\", @developer)\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"informationUrl\", @information_url)\n writer.write_boolean_value(\"isFeatured\", @is_featured)\n writer.write_object_value(\"largeIcon\", @large_icon)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_string_value(\"notes\", @notes)\n writer.write_string_value(\"owner\", @owner)\n writer.write_string_value(\"privacyInformationUrl\", @privacy_information_url)\n writer.write_string_value(\"publisher\", @publisher)\n writer.write_enum_value(\"publishingState\", @publishing_state)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_enum_value(\"platformType\", @platform_type)\n writer.write_number_value(\"settingCount\", @setting_count)\n writer.write_collection_of_object_values(\"settingStates\", @setting_states)\n writer.write_enum_value(\"state\", @state)\n writer.write_number_value(\"version\", @version)\n end", "def _dump()\n #This is a stub, used for indexing\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"displayName\", @display_name)\n writer.write_string_value(\"templateId\", @template_id)\n writer.write_collection_of_object_values(\"values\", @values)\n end", "def marshal_dump\n { \n :klass => self.class.to_s, \n :values => @attribute_values_flat, \n :joined => @joined_models\n }\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"containers\", @containers)\n writer.write_object_value(\"controller\", @controller)\n writer.write_collection_of_object_values(\"ephemeralContainers\", @ephemeral_containers)\n writer.write_collection_of_object_values(\"initContainers\", @init_containers)\n writer.write_object_value(\"labels\", @labels)\n writer.write_string_value(\"name\", @name)\n writer.write_object_value(\"namespace\", @namespace)\n writer.write_object_value(\"podIp\", @pod_ip)\n writer.write_object_value(\"serviceAccount\", @service_account)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"detectionStatus\", @detection_status)\n writer.write_object_value(\"imageFile\", @image_file)\n writer.write_string_value(\"mdeDeviceId\", @mde_device_id)\n writer.write_date_time_value(\"parentProcessCreationDateTime\", @parent_process_creation_date_time)\n writer.write_object_value(\"parentProcessId\", @parent_process_id)\n writer.write_object_value(\"parentProcessImageFile\", @parent_process_image_file)\n writer.write_string_value(\"processCommandLine\", @process_command_line)\n writer.write_date_time_value(\"processCreationDateTime\", @process_creation_date_time)\n writer.write_object_value(\"processId\", @process_id)\n writer.write_object_value(\"userAccount\", @user_account)\n end", "def inspect\n self.to_hash.inspect\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"administrativeUnits\", @administrative_units)\n writer.write_collection_of_object_values(\"attributeSets\", @attribute_sets)\n writer.write_collection_of_object_values(\"customSecurityAttributeDefinitions\", @custom_security_attribute_definitions)\n writer.write_collection_of_object_values(\"deletedItems\", @deleted_items)\n writer.write_collection_of_object_values(\"federationConfigurations\", @federation_configurations)\n writer.write_collection_of_object_values(\"onPremisesSynchronization\", @on_premises_synchronization)\n end", "def inspect\n \"#<#{self.class}:0x#{object_id.to_s(16)}> JSON: \" +\n JSON.pretty_generate(@data)\n end", "def encode\n raise Errors::SerializerNotConfigured if serializer_missing?\n\n serializer.encode(self)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_string_value(\"activationUrl\", @activation_url)\n writer.write_string_value(\"activitySourceHost\", @activity_source_host)\n writer.write_string_value(\"appActivityId\", @app_activity_id)\n writer.write_string_value(\"appDisplayName\", @app_display_name)\n writer.write_object_value(\"contentInfo\", @content_info)\n writer.write_string_value(\"contentUrl\", @content_url)\n writer.write_date_time_value(\"createdDateTime\", @created_date_time)\n writer.write_date_time_value(\"expirationDateTime\", @expiration_date_time)\n writer.write_string_value(\"fallbackUrl\", @fallback_url)\n writer.write_collection_of_object_values(\"historyItems\", @history_items)\n writer.write_date_time_value(\"lastModifiedDateTime\", @last_modified_date_time)\n writer.write_enum_value(\"status\", @status)\n writer.write_string_value(\"userTimezone\", @user_timezone)\n writer.write_object_value(\"visualElements\", @visual_elements)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"basis\", @basis)\n writer.write_object_value(\"cost\", @cost)\n writer.write_object_value(\"datePurchased\", @date_purchased)\n writer.write_object_value(\"firstPeriod\", @first_period)\n writer.write_object_value(\"period\", @period)\n writer.write_object_value(\"rate\", @rate)\n writer.write_object_value(\"salvage\", @salvage)\n writer.write_additional_data(@additional_data)\n end", "def serialize(writer) \n super\n writer.write_collection_of_primitive_values(\"categories\", @categories)\n writer.write_string_value(\"changeKey\", @change_key)\n writer.write_date_value(\"createdDateTime\", @created_date_time)\n writer.write_date_value(\"lastModifiedDateTime\", @last_modified_date_time)\n end" ]
[ "0.7951372", "0.7645999", "0.7579812", "0.7579812", "0.7440032", "0.720861", "0.720861", "0.7207583", "0.7016516", "0.70007193", "0.6992252", "0.69838214", "0.69723576", "0.69666415", "0.69666415", "0.6942002", "0.69417155", "0.6933786", "0.6913977", "0.6891677", "0.68810964", "0.687664", "0.687664", "0.687664", "0.6875119", "0.68510306", "0.68364877", "0.68364877", "0.6825542", "0.6815931", "0.68061364", "0.68006235", "0.67944074", "0.67717844", "0.67341864", "0.67289317", "0.66964674", "0.66828746", "0.6673492", "0.6668077", "0.6666333", "0.6659732", "0.6656788", "0.66513675", "0.6635875", "0.66275525", "0.66275525", "0.66275525", "0.6627384", "0.66165835", "0.66141444", "0.6611379", "0.6597342", "0.65968686", "0.6594517", "0.6592636", "0.6583964", "0.6580536", "0.65803635", "0.6575503", "0.65716475", "0.65712893", "0.6566952", "0.6560253", "0.65554273", "0.65410006", "0.65378475", "0.65346783", "0.6527361", "0.6525178", "0.65242875", "0.65235287", "0.65174305", "0.65141636", "0.6508169", "0.6499713", "0.6498714", "0.6496881", "0.6486202", "0.6482482", "0.64814615", "0.6479782", "0.6476621", "0.6475453", "0.64677024", "0.64633876", "0.64619535", "0.6461202", "0.6457243", "0.64497435", "0.6439583", "0.6433183", "0.643078", "0.6424316", "0.6420337", "0.6420337", "0.6420337", "0.6420337", "0.6420337", "0.6418776", "0.64156514" ]
0.0
-1
begins the game, alternating turns and making sure each option is a valid choice, then displays the board
def play while true current_player.en_passant = false board.formatted_grid if check_for_check if check_for_checkmate puts "Checkmate!" else puts "Check!" end end x, y = prompt_selection puts "" puts ask_move x_end, y_end = get_move if x_end == "back" board.clear_board play end while board.valid_place?(x_end, y_end) == false puts "Invalid option! Try again:" x_end, y_end = get_move board.valid_place?(x_end, y_end) end #check for en passant if board.get_cell_piece(x, y).type == "pawn" && y_end - y == 2 current_player.en_passant = true elsif board.get_cell_piece(x, y).type == "pawn" && y - y_end == 2 current_player.en_passant = true end #check for promotion if board.get_cell_piece(x, y).type == "pawn" && board.get_cell_piece(x, y).color == "white" && y_end == 0 promote(x, y) elsif board.get_cell_piece(x, y).type == "pawn" && board.get_cell_piece(x, y).color == "black" && y_end == 7 promote(x, y) end #check for castling if board.get_cell_piece(x, y).type == "king" && x_end - x == 2 board.piece_move(x + 3, y, x + 1, y) board.set_cell_color(x + 2, y, "red") elsif board.get_cell_piece(x, y).type == "king" && x - x_end == 2 board.piece_move(x - 4, y, x - 1, y) board.set_cell_color(x - 2, y, "red") end #check if taking an opponent's piece if is_taking_piece?(x_end, y_end) hash_value = other_player.pieces_left.key([x_end, y_end]) current_player.pieces_left[hash_value] = [x_end, y_end] other_player.pieces_left.delete(hash_value) board.piece_move(x, y, x_end, y_end) else hash_value = current_player.pieces_left.key([x, y]) current_player.pieces_left[hash_value] = [x_end, y_end] board.piece_move(x, y, x_end, y_end) end #if board.game_over #puts game_over_message #board.formatted_grid #return #else switch_players #end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play\n winner = false\n while(!winner)\n puts \"please input a row of four colors\"\n puts \"your options are B: for black, b: for blue\"\n puts \"g: green, y: yellow, r: red , w: white\"\n @grid.board\n input = []\n (4).times { input << gets.chomp}\n #make sure input is a game color\n if((input - @colors).empty?)\n @grid.input(input, @turns)\n else\n \"Please enter an option from the menu below\"\n play\n end\n @turns += 1\n end\n end", "def turn_front_end() \n\t\tputs \"turn number #{@turns_taken}\"\n\t\tif @game.player_won == false\n\t\t\twhile @game.swap_player == false \n\t\t\t\tputs \"#{@game.current_player.marker}, please choose a square (1-9)\"\n\t\t\t\tchosen_box = gets.chomp.to_i\n\t\t\t\tputs @game.check_box(chosen_box)\n\t\t\tend\n\t\t\tputs \"#{@game.current_player.marker} chose #{chosen_box.to_s}\"\n\t\t\t@game.turn_back_end(chosen_box)\n\t\t\tif @game.player_won\n\t\t\t\tputs \"#{@game.current_player.marker} won!\"\n\t\t\t\t@turns_taken = 100\n\t\t\tend\n\t\t\tputs @game.show_board\n\t\tend\n\tend", "def play_game\n print \"Welcome to Tic Tac Toe, a two player game where each player marks \nwith a X or O in a 3x3 board until one player achieves a line of 3 marks. Each \nplayer should type the row letter + column number eg. a1 \\n\"\n print_board\n while @turns<9 && self.three_o? == false && self.three_x? == false\n if @turn_type == \"x\"\n self.x_player_turn\n @turn_type = \"o\"\n @turns += 1\n self.print_board\n else\n self.o_player_turn\n @turn_type = \"x\"\n @turns += 1\n self.print_board\n end\n end\n if self.three_x?\n puts \"Player X Wins\" \n elsif self.three_o?\n puts \"Player O Wins\"\n else\n puts \"Tough luck it's a draw\"\n end\n end", "def create_board\n\t@a1 = Cases.new(\"a1\", \" \") \n\t@a2 = Cases.new(\"a2\", \" \")\n\t@a3 = Cases.new(\"a3\", \" \")\n\t@b1 = Cases.new(\"b1\", \" \")\n\t@b2 = Cases.new(\"b2\", \" \")\n\t@b3 = Cases.new(\"b3\", \" \")\n\t@c1 = Cases.new(\"c1\", \" \")\n\t@c2 = Cases.new(\"c2\", \" \")\n\t@c3 = Cases.new(\"c3\", \" \")\n\n puts \" ________________________________________________________________________________________________________ \"\n puts \" | __ ___ __ ________ __ ________ ________ ___ ___ ________ | \"\n puts \" | l l l l l l l ______l l l l _____l l __ l l l l l l ______l | \"\n puts \" | l l l _ l l l l l__ l l l l l l l l l l l l l l__ | \"\n puts \" | l l_l l l l_l l l __l l l l l l l l l l l_l l_l l_l l l ___l | \"\n puts \" | l l l l l l_____ l l_____ l l_____ l l__l l l l l l l l l l_____ | \"\n puts \" | l___l l___l l________l l________l l________l l________l l__l l___l l__l l________l | \"\n puts \" |____________________________________________ TO ______________________________________________| \"\n puts \" | TIC TAC TOE | \"\n puts \" |_________________________________________________________________________________________________________| \"\n\n #On cree un Board et on definit ses 9 variables (voir Classe Board) comme etant la valeur de nos 9 cases, soit \" \"\n #on affiche un Board, qui sera vide\n #on cree un array avec toutes nos cases, qui sert a garder a jour les valeurs des cases au fur et a mesure de l'avancee du jeu\n\t@the_board = Board.new(@a1.position, @a2.position, @a3.position, @b1.position, @b2.position, @b3.position, @c1.position, @c2.position, @c3.position) \n\t@the_board.display \n\t@array = [@a1, @a2, @a3, @b1, @b2, @b3, @c1, @c2, @c3] \n end", "def play\n puts \"#{current_player.name} has randomly been selected as the first player\"\n while true\n board.display\n puts \"\"\n array = to_coordinate(select_case)\n x, y = array[0], array[1]\n board.set_cell(x, y, current_player.color)\n result = board.game_over\n if result == :winner\n board.display\n puts \"Congratulation #{current_player.name} you won!\"\n return\n elsif result == :draw\n puts \"No winners. Draw.\"\n return\n else\n switch_players\n end\n end\n end", "def play_game\n\t\twhile @turn < 13\n\t\t\tputs \"Lets see if you figured out my code!\"\n\t\t\tputs \"Please select four colors as your guess. They can either mix and match or all be the same\"\n\t\t\tputs \"No spaces please!\"\n\t\t\tputs \"Your choices are 'R', 'G', 'B', 'Y', 'H', 'P'.\"\n\t\t\tguess = gets.chomp.upcase\n\t\t\tfeedback = compare(guess)\n\t\t\tif feedback == [\"O\", \"O\", \"O\", \"O\"]\n\t\t\t\tputs \"~~~~~~~~~~~\"\n\t\t\t\tputs \"You won!!!!\"\n\t\t\t\tputs \"~~~~~~~~~~~\"\n\t\t\t\tputs \"You have cracked the code of #{@master_code}\"\n\t\t\t\texit\n\t\t\telse\n\t\t\t\tputs \"Sorry! Guess again\"\n\t\t\t\tputs \"Here is currently what you have right #{feedback}\"\n\t\t\t\tputs \"---------------\"\n\t\t\t\tputs \"---------------\"\n\t\t\t\t@turn += 1\n\t\t\t\tputs \"That was turn number \" + @turn.to_s\n\t\t\t\tplay_game\n\t\t\tend\n\t\t\tputs \"You reached your max of 12 turns....game over!\"\n\t\tend\n\tend", "def start_turn \n if @game_over == false\n @game.print_grid\n puts \"Pick an empty box, \" + print_name(@game.current_player) + \". Resitance is \" + pink(\"futile.\")\n player_choice = STDIN.gets.chomp \n valid = \"123456789\".split(\"\") \n unless valid.include? player_choice\n puts \"Enter a number from \" + pink(\"1 to 9\") + \", resistance discouraged... with \" + pink(\"deadly neurotoxin\")\n start_turn\n end\n if @game.blank_box?(player_choice) \n control(player_choice) \n else \n puts blue(\"That square is taken\") + \". Since you cannot see that obvious fact we have taken points off your \" + blue(\"final grade\") + \". If you were not an \" + pink(\"orphan\") + \" your family would be ashamed\"\n start_turn\n end\n end\n end", "def display\n puts \"\\n GAME BOARD \"\n puts \" Turn #{turn_count}\"\n puts \"*************\"\n puts \"* #{self.cells[0]} | #{self.cells[1]} | #{self.cells[2]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[3]} | #{self.cells[4]} | #{self.cells[5]} *\"\n puts \"*-----------*\"\n puts \"* #{self.cells[6]} | #{self.cells[7]} | #{self.cells[8]} *\"\n puts \"*************\\n\\n\"\n end", "def start_game(columns, rows, best_score)\n cur_board = get_board(columns, rows)\n cur_completed = 0\n no_of_turns = 0\n\n while !check_win? cur_board\n # Display the current board\n print_board cur_board\n\n # In-game messages\n puts \"Current completion: #{ cur_completed }%\"\n puts \"Number of turns: #{ no_of_turns }\"\n\n # User chooses color by entering the first letter of that color\n print \"Choose a color: \"\n cur_color = gets.chomp\n\n # Convert the letter entered into a color symbol\n cur_color = to_color cur_color\n\n # Return to main menu if \"q\" entered\n if cur_color == \"q\"\n display_menu columns, rows, best_score\n end\n\n # Check if color entered is different to the previous color entered\n if cur_color != cur_board[0][0]\n # Update color of top left square and any squares connected to it\n update_adjacent cur_board, 0, 0, cur_color\n end\n\n # Update number of turns\n no_of_turns += 1\n\n # Update percentage of board completed\n cur_completed = get_amount cur_board, cur_color\n\n # Clear the screen\n clear\n end\n\n # Display message when board is completed\n puts \"You won after #{ no_of_turns } turns\"\n print \"<Press enter to continue>\"\n gets\n\n # Check if score is better than the \"best_score\"\n if no_of_turns < best_score || best_score == 0\n display_menu columns, rows, no_of_turns\n else \n display_menu columns, rows, best_score\n end\nend", "def draw_board\n # first, it updates the @board variables to get the current state of each case\n @board = [[@case_a1.case, @case_b1.case, @case_c1.case], [@case_a2.case, @case_b2.case, @case_c2.case], [@case_a3.case, @case_b3.case, @case_c3.case]]\n\n # then prints beautifully the board\n print \"\\n\" + \"=\".red * 33 + \"\\n\"\n print \"|| \".red + \" | \" + \" A | B | C \" + \" ||\".red + \"\\n\"\n print \"||\".red + \"_____\" + \"|_\" + \"______|_______|_______\" + \"||\".red + \"\\n\"\n print \"|| \".red + \" | \" + \" ||\".red\n print \"\\n\" + \"||\".red + \" 1 | #{@board[0][0]} | #{@board[0][1]} | #{@board[0][2]} \" + \" ||\".red + \"\\n\"\n print \"||\".red + \"_\" * 5 + \"| \" + \" ___ ___ ___\" + \" ||\".red + \"\\n\"\n print \"|| \".red + \" | \" + \" ||\".red\n print \"\\n\" + \"||\".red + \" 2 | #{@board[1][0]} | #{@board[1][1]} | #{@board[1][2]} \" + \" ||\".red + \"\\n\"\n print \"||\".red + \"_\" * 5 + \"| \" + \" ___ ___ ___\" + \" ||\".red + \"\\n\"\n print \"|| \".red + \" | \" + \" ||\".red\n print \"\\n\" + \"||\".red + \" 3 | #{@board[2][0]} | #{@board[2][1]} | #{@board[2][2]} \" + \" ||\".red + \"\\n\"\n print \"=\".red * 33 + \"\\n\"\n end", "def show_board\n\t\tputs \"You have use #{@turn} of 9 turns. Type \\\"save\\\" to save game and quit.\"\n\t\tshow_hangman\n\t\tputs \"Word: #{@guess.split(\"\").join(\" \")}\"\n\t\tputs\n\t\tputs \"Misses: #{@wrong_letters.split(\"\").join(\" \")}\"\n\t\tputs\n\tend", "def start_game\r\n # Read the file that contains game instructions and display on the console\r\n File.open(File.join(File.dirname(__FILE__),\"instructions.txt\")).each do |line|\r\n puts line\r\n end\r\n # Select player 1 and 2 as human or computer. If human provide a name for identification\r\n player_1 = ask(\"Player 1 option? \",Integer){|q| q.in = 1..3}\r\n if player_1 == 2\r\n player_1_name = ask(\"Name? \") { |q| q.validate = /\\w+\\Z/ }\r\n player_1_obj = Player.new(player_1_name)\r\n else\r\n player_1_obj = Player.new()\r\n end\r\n\r\n player_2 = ask(\"Player 2 option? \",Integer){|q| q.in = 1..3}\r\n if player_2 == 2\r\n player_2_name = ask(\"Name? \") { |q| q.validate = /\\w+\\Z/ }\r\n player_2_obj = Player.new(player_2_name)\r\n else\r\n player_2_obj = Player.new()\r\n end\r\n # Create an array with two player objects. Each player gets a token which is same as his index in the array\r\n players = Array.new(2){Player.new}\r\n players[0] = player_1_obj\r\n players[1] = player_2_obj\r\n # Create a new game board\r\n new_board = Board.new()\r\n puts \" To start, please select a column between 1-7\"\r\n turn = 1 # used to keep track of maximum number of turns in the game which is 7*6\r\n game_over_flag = 0 # set to 1 if game is over either by a win or a tie\r\n while(turn <= 42)\r\n players.each_with_index do |player,player_token|\r\n puts \"Player #{player.name} turn\"\r\n if player.name.eql?(\"Computer\")\r\n # currently the computer takes a random move. This can be replaced with the calculate_winning_move() method\r\n # by implementing an algorithm to calculate the best move\r\n player_selection = rand(7)\r\n else\r\n # Take human player's column selection. reduce it by 1 because array indices start with 0\r\n player_selection = ask(\"Column? \", Integer) { |q| q.in = 1..7 }\r\n end\r\n player_column = player_selection-1\r\n # call make_move which makes a move on behalf of player and checks if the move has made the player win\r\n win_flag = new_board.make_move(player_token,player_column)\r\n turn += 1\r\n if win_flag\r\n puts \"Game over : Player #{player.name} won\"\r\n game_over_flag = 1\r\n end\r\n if turn == 42\r\n puts \"Game over : Its a tie!!\"\r\n game_over_flag = 1\r\n end\r\n # if the game over flag is set, check if the players want to restart with a new game or end the game\r\n if game_over_flag == 1\r\n new_game = ask(\"Do you want to start new game ?(yes/no)\"){|q| q.validate = /(yes|no)\\Z/}\r\n if new_game.eql?('yes')\r\n start_game()\r\n else\r\n puts \"See you.Have a good day!!\"\r\n end\r\n return\r\n end\r\n end\r\nend\r\nend", "def start\n\t\twhile @playing\n\t\t\tletter, x_coordinate, y_coordinate = @player.make_decision\n\t\t\tuntil @board.draw(letter, x_coordinate, y_coordinate)\n\t\t\t\tletter, x_coordinate, y_coordinate = @player.make_decision\n\t\t\tend\n\t\t\t@board.print_board\n\t\t\tvictory_check?\n\t\t\tif @playing\n\t\t\t\tletter, x_coordinate, y_coordinate = @computer.make_decision(@board.available_spaces)\n\t\t\t\t@board.draw(letter, x_coordinate, y_coordinate)\n\t\t\t\t@board.print_board\n\t\t\t\tvictory_check?\n\t\t\tend\n\t\tend\n\n\t\tputs \"Would you like to play again?(y/n)\"\n\t\tchoice = gets.chomp.downcase\n\t\tif choice == \"y\"\n\t\t\t@board.clear_board\n\t\t\t@playing = true\n\t\t\tstart\n\t\telse\n\t\t\tputs \"Goodbye!\"\n\t\tend\n\tend", "def win(boord)\n if board[0] == 'X' && board[0] == 'X'\n end\n\n\n def display_board\n puts\n puts \" #{@board[0]} | #{@board[1]} | #{@board[2]}\"\n puts \"-\" * 11\n puts \" #{@board[3]} | #{@board[4]} | #{@board[5]}\"\n puts \"-\" * 11\n puts \" #{@board[6]} | #{@board[7]} | #{@board[8]}\"\n puts\n end\n\n def one_player_game\n turn = rand(1)\n available_turns = 9\n while available_turns > 0\n display_board\n if turn % 2 == 1\n puts \"Player 1, please pick a square from 1 to 9\"\n p1 = gets.chomp.to_i\n if @board[p1-1] == \" \"\n @board[p1-1] = \"X\"\n available_turns -= 1\n turn += 1\n else\n puts \"That square is already taken - please try another.\"\n end\n else\n p2 = rand(9)\n if @board[p2-1] == \" \"\n @board.delete_at(p2-1)\n @board.insert(p2-1, \"O\")\n puts \"Computer player chooses square #{p2}\"\n available_turns -= 1\n turn += 1\n else\n puts \"That square is already taken - please try another.\"\n end\n end\n end\n end_game\n end\n\n def two_player_game\n turn = rand(1)\n available_turns = 9\n while available_turns > 0 && win == \"no\"\n display_board\n if turn % 2 == 1\n puts \"Player 1, please pick a square from 1 to 9\"\n p1 = gets.chomp.to_i\n if @board[p1-1] == \" \"\n @board.delete_at(p1-1)\n @board.insert(p1 - 1, \"X\")\n available_turns -= 1\n turn += 1\n else\n puts \"That square is already taken - please try another.\"\n end\n else\n puts \"Player 2, please pick a square from 1 to 9\"\n p2 = gets.chomp.to_i\n if @board[p2-1] == \" \"\n @board.delete_at(p2-1)\n @board.insert(p2-1, \"O\")\n available_turns -= 1\n turn += 1\n else\n puts \"That square is already taken - please try another.\"\n end\n end\n end\n end_game\n end\n\n def start_game\n available_turns = 9\n while available_turns == 9\n puts\n puts \"*\" * 36\n puts \"Are you ready for some Tic-Tac-Toe?!\"\n puts \"*\" * 36\n puts\n input = gets.chomp.downcase\n if input == \"yes\"\n puts\n puts \"*\" * 36\n puts \"One player or two?\"\n puts \"*\" * 36\n puts\n player_num = gets.chomp.downcase\n if player_num == \"one\"\n one_player_game\n else\n two_player_game\n end\n else\n puts \"Your loss, buddy!\"\n exit!\n end\n end\n end\nend", "def startGame(player1, player2)\n\n puts \" Do you want heads(h) or tails(t)?\"\n answer = gets\n answer = answer.chomp\n first = false\n\n # flips the coin\n @coin.flip\n\n # player1 calls what face they want\n if answer == 't'\n if @coin.display == 'Heads'\n first = false\n else\n first = true\n end\n elsif answer == 'h'\n if @coin.display == 'Heads'\n first = true\n else\n first = false\n end\n else\n puts \" fix later\"\n end\n\n # assigns colours baised on who goes first\n if first\n player1.givePieces(\"#FF0000\")\n player1.colour = \"#FF0000\"\n player2.givePieces(\"#0000FF\")\n player2.colour = \"#0000FF\"\n else\n player1.givePieces(\"#0000FF\")\n player1.colour = \"#0000FF\"\n player2.givePieces(\"#FF0000\")\n player2.colour = \"#FF0000\"\n \n end\n\n if first\n puts player1.name + \", You are going first\"\n @view.refreshBoard(@board, [])\n player1.turnStart()\n else\n puts player2.name + \", You are going first\"\n @view.refreshBoard(@board, [])\n player2.turnStart()\n end\n \n while !checkWin() do\n\n if player1.isActive\n # player 1 is active\n @player1.turnEnd()\n @view.refreshUnplayedPieces(@player1)\n @view.refreshUnplayedPieces(@player2)\n @view.refreshBoard(@board, [])\n @view.refreshTurnIndicator(@player2)\n\n player2.turnStart()\n player1.updatePlayedPieces()\n else\n # player 2 is active\n @player2.turnEnd()\n @view.refreshUnplayedPieces(@player1)\n @view.refreshUnplayedPieces(@player2)\n @view.refreshBoard(@board, [])\n @view.refreshTurnIndicator(@player1)\n\n player1.turnStart()\n player2.updatePlayedPieces()\n end\n end\n\n # ask if user's want to reset.\n puts \" Do you want to reset and play another game? Please enter Y or N.\"\n answer = gets\n answer = answer.chomp\n\n # handle input\n if answer == 'Y' || answer == 'y'\n reset()\n elsif answer == 'N' || answer == 'n'\n puts \"Goodbye I hope you had fun playing the game!\"\n else\n puts \" Invalid input detected. The game will be reset\"\n reset() \n end \n end", "def not_valid\n display_board\n puts \"Input invalid please try again\"\n turn\n end", "def turn\n puts \"#{@player_1.name}'s turn.\"\n puts \"Choose your case:\"\n print \">\"\n check_if_empty(@player_1)\n if win\n @board.print_board\n return true\n end\n @board.print_board\n puts \"#{@player_2.name}'s turn.\"\n puts \"Choose your case:\"\n print \">\"\n check_if_empty(@player_2)\n if win\n @board.print_board\n return true\n end\n @board.print_board\n end", "def show_board\n\t\tputs \n\t\tputs \"-------------------\"\n\t\tputs \"Board so far: \"\n\t\t# Go through each guess and answers and display them\n\t\t@board.each_with_index { |guess, i| puts \"#{guess.join} #{@evaluate[i]}\" }\n\t\tputs \"-------------------\"\n\tend", "def display_game_board(player)\r\n \r\n move = \"\" #Assign a default value\r\n \r\n loop do #Loop forever\r\n \r\n Console_Screen.cls #Clear the display area\r\n \r\n #Display the game board\r\n puts \"\\t\\t\\tWelcome to the Ruby Tic-Tac-Toe Game! \" +\r\n \"\\n\\n\\n\\n\"\r\n puts \"\\t\\t\\t 1 2 3\\n\" \r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t A #{$A1} | #{$A2} | #{$A3}\"\r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t ---------------------\"\r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t B #{$B1} | #{$B2} | #{$B3}\"\r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t ---------------------\"\r\n puts \"\\t\\t\\t | |\"\r\n puts \"\\t\\t\\t C #{$C1} | #{$C2} | #{$C3}\"\r\n puts \"\\t\\t\\t | |\"\r\n \r\n #Prompt the player to enter a move\r\n print \"\\n\\n\\n\\n\\nPlayer \" + player + \"'s turn. \" +\r\n \"Please enter your move: \"\r\n \r\n move = STDIN.gets #Collect the player's move\r\n move.chop! #Remove the end of line marker\r\n move = move.upcase #Convert to uppercase\r\n\r\n #user enters \"H\" as hidden cheat to display statistics\r\n if move == \"H\"\r\n puts display_statistics\r\n end\r\n\r\n #user enters \"M\" to load wikipedia instructions page\r\n if move == \"M\"\r\n puts display_wikipedia\r\n end\r\n\r\n #Terminate the loop if a valid move was entered\r\n if move.length == 2 then #Must be at 2 character long\r\n if move =~ /[A-C][1-3]/i #Must be A1, A2, A3, B1, \r\n #B2, B3, C1, C2, or C3\r\n #Call method responsible for determining if the \r\n #board square was available \r\n validMove = validate_player_move(move) \r\n if validMove == true #The move was valid \r\n break #Terminate the execution of the loop\r\n else\r\n #display_error method\r\n display_error\r\n end\r\n else\r\n #display_error method\r\n display_error\r\n end\r\n else\r\n #display_error method\r\n display_error\r\n end\r\n\r\n end\r\n \r\n return move #Return the player's move back to the\r\n #calling statement\r\n \r\n end", "def menu game\n puts `clear`\n puts \"dBBBBb dB dBBBBBP dBBBBBP dBP dBBBBP dBBBBP dBP dBP dBP dBBBBBb\"\n puts \"dB dP BBB dBP dBP dBP dP dBP dBP dBP dBP dB BP\"\n puts \"dBBBK dBBBBB dBP dBP dBP dBBP `BBBBb dBBBBBP dBP dBBBP'\"\n puts \"dB db dBP BB dBP dBP dBP dP dBP dBP dBP dBP dBP\"\n puts \"dBBBBP' dBB BBB dBP dBP dBBBBP dBBBBP dBBBBP' dBP dBP dBP dBP\"\n puts\n game.show_board\n puts\n puts \" . Unknown * Hit [#{game.misses}] - Misses [#{game.hits}]\"\n puts\n puts \" MAIN MENU\"\n puts\n puts \"1 - New Game\"\n puts !game.showship ? \"2 - Show Ships (CHEATER!)\" : \"2 - Hide Ships\"\n puts \"3 - build ship\"\n puts \"99 - Exit this App\"\n puts \"A..Z## ( A-J is Column 1-10 Row) Shoot at Ship\"\n puts\n print \"Enter Menu Choice[1..2 99 ]:\"\n\n return gets.chomp\n end", "def play_game\n loop do\n puts \"\\n\\n\"\n display_board\n player_turn\n check_game_status\n end\n end", "def play\n until over?\n @board.display\n turn\n end\n @board.display\n puts draw? ? \"Cat's Game!\" : \"Congratulations #{winner}!\"\n end", "def play_game\r\n\r\n player = \"X\" #Make Player X the default player for each\r\n #new game\r\n \r\n noOfMoves = 0 #Reset the value of the variable used to\r\n #keep track of the total number of moves\r\n #made in a game\r\n\r\n #Clear out the game board to get it ready for a new game\r\n clear_game_board\r\n\r\n loop do #Loop forever\r\n\r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method that displays the game board and\r\n #collects player moves\r\n square = display_game_board(player)\r\n \r\n #Assign the selected game board square to the player\r\n #that selected it\r\n $A1 = player if square == \"A1\" \r\n $A2 = player if square == \"A2\" \r\n $A3 = player if square == \"A3\" \r\n $B1 = player if square == \"B1\" \r\n $B2 = player if square == \"B2\" \r\n $B3 = player if square == \"B3\" \r\n $C1 = player if square == \"C1\" \r\n $C2 = player if square == \"C2\" \r\n $C3 = player if square == \"C3\" \r\n\r\n #Keep count of the total number of moves that have\r\n #been made\r\n noOfMoves += 1\r\n\r\n #Call on the method that is responsible for \r\n #determining if the game has been won\r\n winner = check_results(player)\r\n \r\n #See is player X has won\r\n if winner == \"X\" then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Player X Wins!\")\r\n #Keep count of the total number of wins that $xWins has\r\n $xWins += 1\r\n break #Terminate the execution of the loop\r\n end\r\n \r\n #See if player O has won\r\n if winner == \"O\" then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Player O Wins!\")\r\n #Keep count of the total number of wins that $oWins has\r\n $oWins += 1\r\n break #Terminate the execution of the loop\r\n end \r\n \r\n #See if the game has ended in a tie\r\n if noOfMoves == 9 then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Tie\")\r\n break #Terminate the execution of the loop\r\n end\r\n \r\n #If the game has not ended, switch player turns and\r\n #keep playing\r\n if player == \"X\" then\r\n player = \"O\"\r\n else\r\n player = \"X\"\r\n end\r\n \r\n end\r\n \r\n end", "def create_board(board, board_checked, width, height, turns_taken, highest_score)\n #clears the terminal contents\n system \"clear\"\n #Sets the top left corner of the board_checked array to true as this block should automatically be completed\n board_checked[0][0] = \"t\"\n \n #Loops through the rows and columns of the board array and prints the contents of each position using the colorize gem\n (0..height-1).each do |row|\n\t(0..width-1).each do |column| \n\t print \" \".colorize(:background => board[row][column])\n end\n\tputs \"\"\n end\n \n #sets the number of completed board positions by looping through all the rows and columns of the board_checked array and incrementing by 1 \n #each time a \"t\" is detected\n completion_count = 0\n (0..height-1).each do |row|\n\t(0..width-1).each do |column|\n\t if board_checked[row][column] == \"t\"\n\t\tcompletion_count +=1 \n\t end\n\tend\n end\n \n #Calculates a percentage of the board completed\n completion_percentage = ((completion_count*100)/(width*height)).to_i\n #Everytime this method is called i run a completion check to see if the game has finished\n if (completion_percentage == 100) then\n #If the highest score has not already been set then it is set as the number of turns taken\n\tif highest_score == 0 then\n\t highest_score = turns_taken\n #however if the high score has been set but it is lower than the current number of turns it is not set\n #as the latest number of turns taken\n\telsif highest_score != 0 && turns_taken < highest_score then\n\t highest_score = turns_taken\n\tend\n #a congratualtions message is dislayed and the main menu method is called after the player presses enter\n\tputs \"You won after #{turns_taken} turns\"\n #the main menu is then displayed after the user presses enter\n gets()\n\tdisplay_main_menu(highest_score, width, height)\n end\n\t\t\n #outouts the turns taken and the completion percentage to the screen\n puts \"Number of Turns: #{turns_taken}\"\n puts \"Game completion: #{completion_percentage}%\"\n print \"choose a colour: \"\n #stores the users colour response\n colour_response = gets.chomp.downcase\n colour_block = \"\"\n \n #sets the value of the variable colourblock to the corresponding colorize value of the user's input\n if colour_response == \"r\" then\n\tcolour_block = :red\n elsif colour_response == \"b\" then\n\tcolour_block = :blue\n elsif colour_response == \"c\" then\n\tcolour_block = :cyan\n elsif colour_response == \"m\" then\n\tcolour_block = :magenta\n elsif colour_response == \"g\" then\n\tcolour_block = :green\n elsif colour_response == \"y\" then\n\tcolour_block = :yellow\n #if the user enters q they will return to the main menu\n elsif colour_response == \"q\" then\n\tdisplay_main_menu(highest_score, width, height)\n else\n #If the user tyes any unaccepted values then this method is recalled and they will be asked to enter a choice again\n create_board(board, board_checked, width, height, turns_taken, highest_score) \n end\n \n #loops through the board checked array to find any positions that are marked as completed\n (0..height-1).each do |row|\n\t(0..width-1).each do |column|\n #if a position is marked as completed then the contents of the board array position above, right, left and below of the completed array position are\n #checked to see if they match the colour the user has chosen as their input.\n #If they do match the users input choice then their board position is set as completed in the boardchecked array.\n\t if board_checked[row][column] == \"t\"\n\t\tif board[row][column+1] == colour_block && column != (width-1) then\n\t\t board_checked[row][column+1] = \"t\"\n\t\tend\n\t\tif board[(row-(height-1))][column] == colour_block && row != (height-1) then\n\t\t board_checked[(row-(height-1))][column] = \"t\"\n\t\tend\n\t\tif board[row][column-1] == colour_block && column != 0 then\n\t\t board_checked[row][column-1] = \"t\"\n\t\tend\n\t\tif board[row-1][column] == colour_block && row != 0 then\n\t\t board_checked[row-1][column] = \"t\"\n\t\tend\n\t end\n\tend\n end \n\n #loops through the board checked array and sets the value of the corresponding board array position where there is a position marked as \n #completed completed in the board checked array \n (0..height-1).each do |row|\n\t(0..width-1).each do |column|\n\t if board_checked[row][column] == \"t\"\n\t board[row][column] = colour_block\n\t end\n\tend\n end \n #increments the run counter and re-calls this method \n turns_taken +=1\n create_board(board, board_checked, width, height, turns_taken, highest_score) \nend", "def turn\n victory = false\n while victory == false do\n player_place\n @board.show_board\n end\n end", "def play\n \n puts \"#{current_player.to_s} has randomly been selected as the first player\"\n puts \"pls enter a number between 1 and 9 to make your move\"\n\n board.formatted_grid\n \n invalid_stdout = \"Ignoring this invalid step, pls try again.\"\n while human_move = gets.chomp\n valid_step = false\n if human_move =~ /\\d/ #only 1-9 number\n x, y = human_move_to_coordinate(human_move)\n valid_step = board.set_cell(x, y, current_player)\n end\n \n #ignore those invalid steps\n unless valid_step \n puts invalid_stdout\n next\n end\n\n if board.game_over\n puts game_over_message\n # board.formatted_grid\n return\n else\n switch_players\n puts solicit_move\n end\n end\n end", "def show_board\n # Show empty board at initialization and get variable at each player turn\n puts \" 1 2 3\"\n puts \" a #{@A1.content} | #{@A2.content} | #{@A3.content}\"\n puts \" ---------\"\n puts \" b #{@B1.content} | #{@B2.content} | #{@B3.content}\"\n puts \" ---------\"\n puts \" c #{@C1.content} | #{@C2.content} | #{@C3.content}\"\n\n end", "def start\n\t\tprint_series_leaderboard #shows the series leaderboard status\n\t\tturn_number=0\n\t\twhile turn_number<9 do\n\t\t\tturn_number=turn_number+1\n\t\t\tprint_board\n\t\t\tplayer_on_turn=get_player_on_turn(turn_number)\n\t\t\tputs \"#{player_on_turn.name}(#{player_on_turn.marker}) its your turn\"\n\t\t\tchoice = get_valid_empty_cell\n\t\t\tupdate_cell_status(turn_number,choice)\n\t\t\tplayer_on_turn.consider(@game_cell_vectors[choice])\n\t\t\tif player_on_turn.is_winner==true then\n\t\t\t\tprint_board\n\t\t\t\tplayer_on_turn.declare_winner\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tif turn_number==9\n\t\t\t\tputs \"Game resulted in Draw\"\n\t\t\tend\t\n\t\tend\n\tend", "def start_game\n # Infinite loop\n while\n # Draw the board on the terminal\n @board.print_board\n # Ask the player to choose where to draw the symbol\n @active_player.choose_spot\n # Check if the current player won\n if @board.check_win(@active_player.player_symbol)\n @board.print_board\n puts 'Has ganado'\n @active_player.victory\n # Ask if the player wants to play again\n play_again\n # If not, the loop is broken\n break\n else\n # Check if there is a draw\n if @board.check_draw\n puts 'Empate'\n play_again\n break\n end\n # If there isn't a draw the game switch the current player\n switch_player\n end\n end\n end", "def start_game\n loop do\n display_board\n turn\n position_available ? player_positions : turn\n (display_board; p \"#{@player} wins!\"; break) if win_game\n (display_board; p \"Draw\"; break) if draw\n next_player\n end\n end", "def game_start\n @computer.choose_word\n @board.create_board(@computer.word.length)\n Screen.clear\n game_loop\n end", "def play_game2\r\n\r\n player = \"O\" #Make Player O the default player for each\r\n #new game\r\n \r\n noOfMoves = 0 #Reset the value of the variable used to\r\n #keep track of the total number of moves\r\n #made in a game\r\n\r\n #Clear out the game board to get it ready for a new game\r\n clear_game_board\r\n\r\n loop do #Loop forever\r\n\r\n Console_Screen.cls #Clear the display area\r\n \r\n #Call on the method that displays the game board and\r\n #collects player moves\r\n square = display_game_board(player)\r\n \r\n #Assign the selected game board square to the player\r\n #that selected it\r\n $A1 = player if square == \"A1\" \r\n $A2 = player if square == \"A2\" \r\n $A3 = player if square == \"A3\" \r\n $B1 = player if square == \"B1\" \r\n $B2 = player if square == \"B2\" \r\n $B3 = player if square == \"B3\" \r\n $C1 = player if square == \"C1\" \r\n $C2 = player if square == \"C2\" \r\n $C3 = player if square == \"C3\" \r\n\r\n #Keep count of the total number of moves that have\r\n #been made\r\n noOfMoves += 1\r\n\r\n #Call on the method that is responsible for \r\n #determining if the game has been won\r\n winner = check_results(player)\r\n \r\n #See is player X has won\r\n if winner == \"X\" then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Player X Wins!\")\r\n #Keep count of the total number of wins that $xWins has\r\n $xWins += 1\r\n break #Terminate the execution of the loop\r\n end\r\n \r\n #See if player O has won\r\n if winner == \"O\" then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Player O Wins!\")\r\n #Keep count of the total number of wins that $oWins has\r\n $oWins += 1\r\n break #Terminate the execution of the loop\r\n end \r\n \r\n #See if the game has ended in a tie\r\n if noOfMoves == 9 then\r\n #Call on the method that displays the game final\r\n #results\r\n display_game_results(\"Tie\")\r\n break #Terminate the execution of the loop\r\n end\r\n \r\n #If the game has not ended, switch player turns and\r\n #keep playing\r\n if player == \"X\" then\r\n player = \"O\"\r\n else\r\n player = \"X\"\r\n end\r\n \r\n end\r\n \r\n end", "def play choice, player\n puts \"#{player}'s turn\"\n print \"Enter the input: \"\n input = gets.chomp.split(\",\")\n valid_input_arr = input.filter { |item| item.to_i <= 3 && item.to_i > 0 }\n while input.length != valid_input_arr.length\n puts \"wrong format! Insert the entries in the form: x, y. (where x => row, y => column)\"\n print \"Enter the input: \"\n input = gets.chomp.split(\",\")\n valid_input_arr = input.filter { |item| item.to_i <= 3 && item.to_i > 0 }\n end\n @board[(input[0].to_i) - 1][(input[1].to_i) - 1] = choice\n display_board\n end", "def display\n system('clear')\n puts\n # show board with pieces\n print \"\\t\\tA\\tB\\tC\\tD\\tE\\tF\\tG\\tH\\n\\n\"\n print \"\\t +\", \" ----- +\"*8,\"\\n\\n\"\n 8.downto(1) do |rank|\n print \"\\t#{rank} |\\t\"\n 'A'.upto('H') do |file|\n if board[\"#{file}#{rank}\".to_cell] then piece = board[\"#{file}#{rank}\".to_cell]\n else piece = \" \"\n end\n print \"#{piece} |\\t\"\n end\n print \"#{rank}\\n\\n\\t +\", \" ----- +\"*8,\"\\n\\n\"\n end\n print \"\\t\\tA\\tB\\tC\\tD\\tE\\tF\\tG\\tH\"\n puts \"\\n\\n\"\n # show occupancy\n print \" White occupancy: \"\n puts whitePieces.to_cells.map{ |cell| cell.to_square}.join(\", \")\n print \" Black occupancy: \"\n puts blackPieces.to_cells.map{ |cell| cell.to_square}.join(\", \")\n puts\n # show whose move it is\n case @whitesMove\n when true\n puts \" WHITE to move.\"\n when false\n puts \" BLACK to move.\"\n end\n puts\n end", "def run_game\n start_game\n new_board\n while true\n print_grid\n tour_joueur1\n tour_joueur2\n end\nend", "def play\n #TO DO : une méthode qui change la BoardCase jouée en fonction de la valeur du joueur (X, ou O)\n i= 0\n while i < 8\n puts \" #{@user_name_1} choisis un numéro entre 0 et 8 pour placer ton symbole \"\n choice_user_1 = gets.chomp.to_i\n\n if @board[choice_user_1] == \" \"\n @board[choice_user_1] = @user_1\n @board << @user_1\n aff_tab\n i +=1\n\n\n puts \" #{@user_name_2} choisis un numéro entre 1 et 8 pour placer ton symbole \"\n choice_user_2 = gets.chomp.to_i\n\n if @board[choice_user_2] == \" \"\n @board[choice_user_2] = @user_2\n @board << @user_2\n aff_tab\n i +=1\n\n\n end\n end\nend\nend", "def game_board\n puts \" 1 | 2 | 3 \"\n puts \"___________\"\n puts \" 4 | 5 | 6 \"\n puts \"___________\"\n puts \" 7 | 8 | 9 \"\nend", "def start\n puts \"Welcome! Let's play Tic-Tac-Toe\"\n print_board\n play\n end", "def play\r\n self.display_board\r\n while !self.over? do\r\n self.turn\r\n end\r\n if self.draw? \r\n puts \"Cat's Game!\"\r\n else\r\n puts \"Congratulations #{self.winner}!\"\r\n end\r\n end", "def play\n while !over?\n turn\n board.display\n end\n if won?\n puts \"Congratulations #{winner}!\" \n elsif draw?\n puts \"Cats Game!\" \n end\n end", "def start\n \t\tself.board.display_instruction\n \t\tcurrent_player = select_first_player\n \t\t(self.board.size).times do \n \t\t\tplay(current_player)\n \t\t\tcurrent_player = next_of current_player \n end\n display_winner(nil, true)\n \tend", "def play\n @board.print_board\n 9.times do |turns|\n if turn\n break\n end\n end\n end", "def play\n loop do\n prep_game\n loop do\n current_player_moves\n break if board.someone_won? || board.full?\n board.clear_screen_and_display_board(players) if human_turn?\n end\n display_result\n break unless play_again?\n reset\n end\n display_goodbye_message\n end", "def display_board(turn)\n # binding.pry\n temp_index = 0\n turn += 1\n turn.times do\n puts \"#{@board[temp_index][0]} #{@board[temp_index][1]} #{@board[temp_index][2]}\"\n temp_index += 1\n end\n end", "def play_game\n @board.print_board\n until @quit || @restart || gameover?\n cell = take_turn(@current_player)\n if !cell.nil?\n coordinates = get_coordinates(cell)\n change_board(coordinates) if valid_cell?(coordinates)\n end\n @current_player = switch_player(@current_player)\n @board.print_board unless @restart || @quit\n end\n reset_board if @restart\n ending_screen if gameover?\n\n end", "def display_board(gameState)\n puts \" #{gameState[0]} | #{gameState[1]} | #{gameState[2]} \"\n puts \"-----------\"\n puts \" #{gameState[3]} | #{gameState[4]} | #{gameState[5]} \"\n puts \"-----------\"\n puts \" #{gameState[6]} | #{gameState[7]} | #{gameState[8]} \"\nend", "def start_game(user_hash)\n\t\tflag = 0\n\t\tputs \"Welcome, lets play Tic Tac Toe:\"\n\t\tputs \"This is put board...\"\n\t\tdisplay_board(user_hash)\n\t\t\tuntil (flag == 1)\n\t\t\t\tprint \"Player 1 : \"\n\t\t\t\tplayer_1_move = gets.chomp.to_i\n\t\t\t\tchange_board(user_hash,player_1_move,1)\n\t\t\t\tif did_anyone_win?(player_1_array(user_hash)) == true and draw_condition(user_hash) == false\n\t\t\t\t\tputs \"Player 1 win!\"\n\t\t\t\t\tflag = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tif draw_condition(user_hash) \n\t\t\t\t\tputs \"DRAW!\"\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tprint \"Player 2 : \"\n\t\t\t\tplayer_2_move = gets.chomp.to_i\n\t\t\t\tchange_board(user_hash,player_2_move,2)\n\t\t\t\tif did_anyone_win?(player_2_array(user_hash)) == true and draw_condition(user_hash) == false\n\t\t\t\t\tputs \"Player 2 win!\"\n\t\t\t\t\tflag = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\tif draw_condition(user_hash) \n\t\t\t\t\tputs \"DRAW!\"\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tplay_more?\n\tend", "def turns\n while @board.game_check == false\n player_process(@player1_name,@player1_symbol,@turn)\n break if @board.game_check == true\n\n player_process(@player2_name,@player2_symbol,@turn)\n end\n @board.display\n print \"\\nDone \\n\"\n end", "def start \n game_board\n #This sets up the array that will be placed into the display_board method\n board = [\"* \",\" * \",\" * \",\" * \",\" * \",\" * \",\"* \",\" * \",\" * \"]\n display_board(board)\n game(board)\nend", "def play\n until over? == true\n turn\n end\n if self.winner == nil\n puts \"Cats Game!\"\n else\n puts \"Congratulations #{self.winner}!\"\n #Congradulate the winner of the game, using the person with the most X or O combinations\n #Code in a play again option, so players don't have to re enter name\n board.display\n end\n end", "def play\n @board.each do|index|\n is_game_over = over?\n is_game_won = won?\n is_game_draw = draw?\n if is_game_over == true\n if is_game_won.is_a?(Array)\n winner_name = winner\n puts \"Congratulations #{winner_name}!\"\n return \" \"\n elsif is_game_draw == true\n puts \"Cat\\'s Game!\"\n return \" \"\n else\n return false\n end\n else\n if is_game_won.is_a?(Array)\n winner_name = winner\n puts \"Congratulations #{winner_name}!\"\n return \" \"\n elsif is_game_draw == true\n puts \"Cat\\'s Game!\"\n return \" \"\n else\n turn\n end\n end\n end\n turn\n end", "def play\n until over?|| draw?\n @board = turn\n end\n unless winner.nil?\n puts \"Congratulations #{winner}!\"\n else\n puts \"Cat's Game!\"\n end\n end", "def display_board (game)\n puts \" #{game[0]} | #{game[1]} | #{game[2]} \"\n puts \"-----------\"\n puts \" #{game[3]} | #{game[4]} | #{game[5]} \"\n puts \"-----------\"\n puts \" #{game[6]} | #{game[7]} | #{game[8]} \"\nend", "def start\n\t\tputs \"Welcome to Tic Tac Toe\"\n puts \"How many players for this game: 0, 1, 2?\"\n players = gets.strip.to_i\n\n if players == 0\n board = Board.new\n game = Game.new(player_1=Player::Computer.new(\"X\"), player_2=Player::Computer.new(\"O\"), board=Board.new)\n game.play\n\n elsif players == 1\n puts \"Do you want to go first? (Y/N)\"\n go_first = gets.strip.upcase\n if go_first == \"Y\"\n game = Game.new(player_1=Player::Human.new(\"X\"), player_2=Player::Computer.new(\"O\"), board=Board.new)\n game.play\n else\n game = Game.new(player_1=Player::Computer.new(\"X\"), player_2=Player::Human.new(\"O\"), board=Board.new)\n game.play\n end\n\n elsif players == 2\n puts \"First player is X\"\n game = Game.new(player_1=Player::Human.new(\"X\"), player_2=Player::Human.new(\"O\"), board=Board.new)\n game.play\n end\n \n puts \"Do you want to play another game? (Y/N)?\"\n play_again = gets.strip.upcase\n if play_again == \"Y\"\n start\n else\n puts \"Thanks for playing!\"\n end\n end", "def another_game\n \tputs \" ______________________________________\"\n \tputs \" |--------------------------------------|\"\n\tputs \" |--||-- On s'en refait une ? o/n --||--|\"\n puts \" |--||----- Ou t'as la frousse -----||--|\"\n puts \" |______________________________________|\"\n\n\n @another_answer = gets.chomp.downcase\n #si la reponse est oui\n\tif another_answer == \"o\" \n\tputs \" ______________________________________\"\n \tputs \" |--------------------------------------|\"\n\tputs \" |--||-------- C'est darty ---------||--|\"\n puts \" |--||---------- Mon Kiki ----------||--|\"\n puts \" |______________________________________|\"\n\n #creation d'un nouveau board\n #on change la variable de victory a false\n #on relance une partie\n\t create_board \n\t victory == false \n\t play_until_victory\n #sinon, message d'aurevoir et exit pour sortir du programme \n\telse puts \" ______________________________________\"\n \t puts \" |--------------------------------------|\"\n\t puts \" |--||-------- Allez degage --------||--|\"\n puts \" |--||--------- FROUSSARD ----------||--|\"\n puts \" |______________________________________|\"\n\t exit\n\tend\n end", "def play_turn\n board.render\n pos = get_pos\n decision = get_decision\n if decision == \"r\"\n board.reveal(pos)\n elsif decision == \"f\"\n board.flag(pos)\n else\n @saved_board = board.to_yaml\n end\n end", "def displayBoard\n\t\tx = 0\n\t\tprint \"\\n\"\n\t\twhile x < @guesses.length\n\t\t\tprint \" -------------------\\n\"\n\t\t\ty = 0\n\t\t\twhile y < @guesses[x].length\n\t\t\t\tif y < 4\n\t\t\t\t\tprint \"| \" + @guesses[x][y].chr + \" | \" \n\t\t\t\telse\n\t\t\t\t\tprint @guesses[x][y]\n\t\t\t\tend\n\t\t\t\ty = y+1\n\t\t\tend\n\t\t\tprint \"\\n -------------------\\n\"\n\t\t\tx = x+1\n\t\tend\n\t\tprint \"\\n\"\n\t\n\tend", "def player board_new\n\tputs \"Player turn: \\n\n\tPlease Select a board option 1-9\"\n\tanswer_player = gets.chomp\n\twhile true\n\t\tif answer_player == \"1\"\n\t\t\t# key = @board_index[0][0]\n\t\t\t# puts @board_index[0][0]\n\t\t\t# puts key\n\t\t\ttrash = @board_index.at(0).at(0)\n\t\t\tdelete_if(trash.include?(1))\n\n\t\t\t# delete.at(0).insert(0, \"X\")\n\t\t\t# @board_index.insert(key, \"X\")\n\t\t\t# @board_index.insert(0 0, \"X\")\n\t\t\t@board1\n\t\t\t\n\n\t\t\tputs \"| #{@board_index [0] [0]} | #{@board_index [1] [0]} | #{@board_index [2] [0]} |\"\n\t\t\tputs \"| #{@board_index [0] [1]} | #{@board_index [1] [1]} | #{@board_index [2] [1]} |\"\n\t\t\tputs \"| #{@board_index [0] [2]} | #{@board_index [1] [2]} | #{@board_index [2] [2]} |\"\n\t\t\tbreak\n\t\telsif answer_player == \"2\"\n\t\telsif answer_player == \"3\"\n\t\telsif answer_player == \"4\"\n\t\telsif answer_player == \"5\"\n\t\telsif answer_player == \"6\"\n\t\telsif answer_player == \"7\"\n\t\telsif answer_player == \"8\"\n\t\telsif answer_player == \"9\"\t\n\t\telse \n\t\t\tputs \"That is not a valid option\"\n\t\tend\n\tend\n\n\n\n\nend", "def play\n welcome\n loop do\n #lines 17-19 are my favorite\n until @game_board.drop_token(@current_player.get_move_column,@current_player.game_token) do \n puts \"Column full! Please choose another column!\"\n binding.pry\n print \">\"\n end\n @game_board.board_render\n swap_players\n end\n end", "def play\n\n @board.render(clear=true)\n until @board.won? \n\n # should call reveal two time\n guess_1 = @board.reveal # gonna get position guess from the user and return the value\n @board.render(clear=true)\n guess_2 = @board.reveal # gonna get position guess from the user and return the value\n @board.render(clear=true)\n \n if guess_1 == guess_2\n puts \"It's a match!\" \n else\n # reset the board - set all card to face_up == false\n puts \"Try Again!\"\n @board.reset \n end\n sleep 3\n \n @board.render(clear=true)\n end\n end", "def display_main_menu(highest_score, width, height)\n #clears the terminal contents\n system \"clear\"\n #outputs the options available to the user\n puts \"Main Menu: \"\n puts \"s = Start game \"\n puts \"c = Change size \"\n puts \"q = Quit \"\n #outputs a message dependant on whether the high score has been set or not\n if highest_score == 0 then\n\tputs \"No games played yet.\"\n else\n\tputs \"Best Game: #{highest_score} turns\"\n end\n #gets the users menu choice\n puts \"Please enter your choice: \"\n answer = gets.chomp.downcase\n #Calls the associated methods depending on the users menu choice\n if answer == \"c\" then\n\tchange_board_size(highest_score, width, height)\n elsif answer == \"q\" then\n\texit\n elsif answer == \"s\" then\n #initailises the counter which tracks the user's turns\n turns_taken = 0\n #Creates a new 2d array which is used to contain the postions of all positions that are completed\n board_checked = Array.new(height) { Array.new(width, ' ')}\n #gets the board array which is initialised with random colour positions from the get board method\n\tboard = get_board(width, height)\n #Calls the create board method which is recursively falled for the duration of the game\n create_board(board, board_checked, width, height, turns_taken, highest_score)\n else\n #if the user enters an invalid choice then this method is simply recalled\n display_main_menu(highest_score, width, height) \n end\nend", "def display_board(board)\n puts \" \",\"|\",\" \",\"|\",\" \"\n puts \"-----------\"\n puts \" \",\"|\",\" \",\"|\",\" \"\n puts \"-----------\"\n puts \" \",\"|\",\" \",\"|\",\" \"\n board = [\" \",\" \",\" \",\" \",\" X \",\" \",\" \",\" \",\" \"]\n board1 = [\" O \",\" \",\" \",\" \",\" \",\" \",\" \",\" \",\" \"]\n board2 = [\" O \",\" \",\" \",\" \",\" X \",\" \",\" \",\" \",\" \"]\n board3 = [\" X \",\" \",\" \",\" \" X \" \",\" \",\" X \",\" \",\" \"]\n board4 = [\" \",\" \",\" \",\" \",\" \",\" \",\" \",\" \",\" \"]\n board5 = [\" \",\" \",\" O \",\" \",\" O \",\" \",\" O \",\" \",\" \"]\n board6 = [\" X \",\" X \",\" X \",\" X \",\" X \",\" X \",\" X \",\" X \",\" X \"]\nend", "def play_round\n loop do\n self.board.display_board\n self.player1.turn_action\n if self.player1.winner? || self.board.board_full?\n break\n end\n self.player2.turn_action\n if self.player2.winner? || self.board.board_full?\n break\n end\n end\n self.board.display_board\n end", "def computer_turn\n computer_options = AVAILABLE_SLOTS.select do |index|\n index != nil\n end\n #p computer_options.sample\n case computer_options.sample\n when 0\n BOARD[0][0] = 'o'\n AVAILABLE_SLOTS[0] = nil\n when 1\n BOARD[0][1] = 'o'\n AVAILABLE_SLOTS[1] = nil\n when 2\n BOARD[0][2] = 'o'\n AVAILABLE_SLOTS[2] = nil\n when 3\n BOARD[1][0] = 'o'\n AVAILABLE_SLOTS[3] = nil\n when 4\n BOARD[1][1] = 'o'\n AVAILABLE_SLOTS[4] = nil\n when 5\n BOARD[1][2] = 'o'\n AVAILABLE_SLOTS[5] = nil\n when 6\n BOARD[2][0] = 'o'\n AVAILABLE_SLOTS[6] = nil\n when 7\n BOARD[2][1] = 'o'\n AVAILABLE_SLOTS[7] = nil\n when 8\n BOARD[2][2] = 'o'\n AVAILABLE_SLOTS[8] = nil\n end\n\n print_board()\nend", "def begin_game\n start_game = GameState.new(true)\n p1_turn = true\n puts \"Enter name of Player 1. Player 1 will be X\"\n player_name = gets.chomp\n p1 = Player.new(player_name, \"X\")\n \n puts \"Enter name of Player 2. Player 2 will be O\"\n player_name = gets.chomp\n p2 = Player.new(player_name, \"O\")\n\n #asks player the moves they should make\n while start_game.state\n\t if start_game.game_over? == true then\n break\n else\n player_who_won = start_game.find_winner\n if player_who_won == \"p1\" || player_who_won == \"p2\"\n break\n end\n end\n\n if p1_turn\n puts \"#{p1.name}, pick a number from 1-9 on the board\"\n while true\n num_on_board = gets.chomp.to_i\n if $board[num_on_board] != \"none\"\n puts \"This place is filled. Please pick another position.\" \n\t\t elsif (num_on_board >= 1 && num_on_board <= 9) then\n break\n else\n puts \"You need to pick a number from 1-9. Pick again\"\n end\n end\n p1.place_in_board(num_on_board, p1.symbol)\n p1_turn = false \n else\n puts \"#{p2.name}, pick a number from 1-9 on the board\"\n while true\n num_on_board = gets.chomp.to_i\n if $board[num_on_board] != \"none\"\n puts \"This place is filled. Please pick another position.\"\n\t\t elsif (num_on_board >= 1 && num_on_board <= 9) then\n break\n else\n puts \"You need to pick a number from 1-9 on the board\"\n end\n end\n p2.place_in_board(num_on_board, p2.symbol)\n p1_turn = true\n end\n\n start_game.print_board\n end #end of outer while\n\n player_who_won = start_game.find_winner\n puts \"#{player_who_won} is the winner.\"\nend", "def display_board\n system \"clear\"\n puts \"Super Fight Bros. Leaderboard by Combat\"\n header = ['#', 'Player', 'Power', 'Combat']\n rows = parse_players(Superhero.order(combat: :desc).limit(10))\n table = TTY::Table.new header, rows\n puts table.render(:unicode)\n begin \n puts \"Please press M to go back to the menu\"\n end while !input_check(\"M\")\n end", "def play_turn(player)\n puts \"Tour #{@count_turn}\"\n puts \"C'est au tour de #{player.name} (#{player.symbol})\"\n puts \"Quelle case souhaitez-vous jouer ?\"\n print \"> \"\n boardcase_selected = gets.chomp.to_s\n # Check if boardcase_selected exists\n if @boardcases.count { |b_case| b_case.case_id.include?(boardcase_selected) } == 1\n @boardcases.each do |b_case|\n # Check if boardcase selected exists and its value has not been modified yet\n if b_case.case_id == boardcase_selected && b_case.case_value == \" \"\n b_case.case_value = player.symbol\n end\n end\n else\n puts \"La case sélectionnée n'est pas valide\"\n end\n Show.new.show_board(self)\n @count_turn += 1\n end", "def display_board(board,number_of_turns,progress)\n board.each do |row|\n row.each do |cell| \n # Each element of the board contains 2 space characters\n # 'colorize' gem is used to print coloured text\n # and 'cell' contains the colour which to be used\n print \" \".colorize(:background=>cell)\n end\n puts \"\"\n end\n # Show the number of turns and completion\n puts \"Current number of turns: #{number_of_turns}\"\n puts \"Current completion: #{progress}%\"\n \n # Ask the user to input the colour as long as the game is not finished\n if progress < 100\n print \"Choose a colour: \"\n end\n \nend", "def play\n # To start, the method takes two arguments, the players and board array. \n while @board.winner == false\n # Then I set up a while loop that will keep going until there is no winner.\n @board.display_board\n # I started by calling the display_board method (from the Board Class) to show \n # the array in the traditional Tic-Tac-Toe formatting. \n cell_prompt\n # I Prompt the Player to make their selection. \n get_move\n # Here is where the Player imputs their selection. \n @board.update_cell\n # Update_cell (from the Board Class) will take the Player's input and update the value of the object at the \n # corresponding Board[index]. \n if @board.winner == true \n puts @board.winner\n break\n # This ends the loop if there has been a winner.\n elsif @board.draw == true\n break\n # This ends the loop if the match is a draw. \n end\n end\n # Otherwise, the loop keeps going. \n end", "def run_game\n\t\tif @player_turn == nil\n\t\t\tputs \"white team name:\"\n\t\t\ta = gets.chomp\n\t\t\tputs \"black team name:\"\n\t\t\tb = gets.chomp\n\t\tend\n\t\t@player1 = Player.new(:white, a)\n\t\t@player2 = Player.new(:black, b)\n\t\t@player_turn == nil ? player_turn = @player1 : player_turn = @player_turn\n\t\t@check == nil ? check = false : check = @check\n\t\t#If there are no possible moves, either checkmate or stalemate\n\t\twhile @board.any_possible_moves?(player_turn.color, check)\n\t\t\t\n\t\t\t@check = check\n\t\t\t@player_turn = player_turn\n\n\t\t\tchoose_move(player_turn, check)\n\t\t\t\n\t\t\tcheck = @check\n\t\t\tplayer_turn = @player_turn\n\t\t\t\n\t\t\tif @viable_move == true\n\t\t\t\tplayer_turn = switch_player(player_turn)\n\t\t\t\t@board.turn_off_en_passant(player_turn.color)\n\t\t\tend\n\t\t\t@board.cause_check(player_turn.color, check) == true ? check = true : check = false\n\t\tend\n\t\t#Decides end of game: checkmate or stalemate\n\t\tif check == true\n\t\t\t@board.display(player_turn, check)\n\t\t\tprint \"#{player_turn.name} can no longer make a move! CHECKMATE! \\n\"\n\t\t\tprint \"#{switch_player(player_turn).name} WINS!!!\"\n\t\telse\n\t\t\tprint \"This contest ends in a stalemate.\"\n\t\tend\n\tend", "def board_setup\n puts \"\"\n puts \"**********************\".green\n puts \"1st step - Board setup\".green\n puts \"**********************\".green\n puts \"\"\n\n player1_title = @best_of3 ? \"#{@board_player1.player.wins} wins\" : \"\"\n puts \"Player #{@board_player1.player.name} #{player1_title}\".blue\n @board_player1.set_board\n\n player2_title = @best_of3 ? \"#{@board_player2.player.wins} wins\" : \"\"\n puts \"Player #{@board_player2.player.name} #{player2_title}\".blue\n @board_player2.set_board\n end", "def player1_turn \n while true\n puts \"Player 1's turn 'X' \\n Please choose a square ( in the form of a matrix cell):\"\n row1, col1 = gets.chomp.split(\" \")\n if row1==\"q\" || row1==\"quit\" || col1==\"q\" || col1==\"quit\"\n exit\n end\n row1=number_or_nil(row1)\n col1=number_or_nil(col1)\n #choice1 = @spots[row1][col1]\n if (0..@size-1).include?(row1) && (0..@size-1).include?(col1)\n break\n else\n puts \"chose according to the already selected size and must be an integer\"\n end\n end\n row1=row1.to_i\n col1=col1.to_i\n if check_if_spot_is_valid(@spots[row1][col1])\n @spots[row1][col1] = \"X\"\n @score[row1]+=1 #incrementing for the chosen row\n @score[@size+col1]+=1 #incrementing for the chosen column\n if(row1 == col1) #incrementing for the chosen diagonal (if only)\n @score[2*@size]+=1\n end\n if(@size-1-col1 == row1) #incrementing for the chosen anti diag ( if only)\n @score[2*@size+1]+=1\n end\n\t system \"cls\"\n\t puts \"----- Player 1-----\"\n game_status\n @@taken+=1\n else \n puts \"already taken chose some other spot\"\n player1_turn\n end\n check_for_winner\n end", "def play_turn(board,joueur_actuel)\n # cette variable permet de verifier les disponibilité des cases .\n input_ko = true\n # [0] ... [ 8] ça défini les emplacement \n while input_ko\n print \"#{joueur_actuel.joueur_nom}, ton symbol est le '#{joueur_actuel.joueur_symbol}', quelle case souhaites-tu jouer ? \"\n case_to_play = gets.chomp.upcase\n\n case case_to_play\n when \"A1\"\n if board.list_boardcase[0].symbol == '.'\n board.list_boardcase[0].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"A2\"\n if board.list_boardcase[1].symbol == '.'\n board.list_boardcase[1].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"A3\"\n if board.list_boardcase[2].symbol == '.'\n board.list_boardcase[2].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B1\"\n if board.list_boardcase[3].symbol == '.'\n board.list_boardcase[3].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B2\"\n if board.list_boardcase[4].symbol == '.'\n board.list_boardcase[4].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B3\"\n if board.list_boardcase[5].symbol == '.'\n board.list_boardcase[5].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C1\" \n if board.list_boardcase[6].symbol == '.'\n board.list_boardcase[6].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C2\"\n if board.list_boardcase[7].symbol == '.'\n board.list_boardcase[7].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C3\"\n if board.list_boardcase[8].symbol =='.'\n board.list_boardcase[8].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n else \n puts \"erreur de case\"\n end\n end\n\tend", "def play\n puts\n puts \"How good is your memory? Let's play a memory game.\"\n puts \"Match the cards!\"\n puts\n sleep(3)\n until game_over?\n board.render\n #get_pos from the player\n begin \n make_guess(get_player_input)\n rescue => exception\n puts \"Select a card that hasn't been flipped\"\n retry\n end\n \n end\n puts \"I guess your memory is pretty good :D\"\n end", "def game()\n\n system \"cls\"\n puts \"Enter the size of the tic-tac-toe board: \"\n size = gets.chomp.to_i\n if (size > 2) then\n init(:size => size)\n else\n puts(\"Invalid input\")\n sleep(1)\n game()\n end\n \n @taken = 0\n\n while true do\n\n if (@taken >= (@@size**2)-2) then\n system \"cls\"\n puts (\"<=============PLAYER #{@player}=============>\")\n puts ()\n show\n puts ()\n return 0\n end\n\n # player 1 is assumed to take X and player 2 assumed to take Y\n # this setting can be changed in the turn() method\n @player = 1\n if turn(@player) then\n system \"cls\"\n puts (\"<=============PLAYER #{@player}=============>\")\n puts ()\n show\n puts ()\n return 1\n end\n\n @player = 2\n if turn(@player) then\n system \"cls\"\n puts (\"<=============PLAYER #{@player}=============>\")\n puts ()\n show\n puts ()\n return 2\n end\n\n end\n end", "def turn_game\n\t\t@player_1.new_question\n\t\tcheck_score\n\t\t@player_2.new_question\n\t\tcheck_score\n\t\tcheck_status\n\t\tputs '------------NEW-TURN-------------'\n\t\tturn_game\n\tend", "def display_board\n puts \" #{@letter[0]} | #{@letter[1]} | #{@letter[2]} \"\n puts \" -------------\"\n puts \" #{@number[0]}| #{@board_array[0]} | #{@board_array[1]} | #{@board_array[2]} |\"\n puts \" |-----------|\"\n puts \" #{@number[1]}| #{@board_array[3]} | #{@board_array[4]} | #{@board_array[5]} |\"\n puts \" |-----------|\"\n puts \" #{@number[2]}| #{@board_array[6]} | #{@board_array[7]} | #{@board_array[8]} |\"\n puts \" ------------\"\n end", "def play\n until board.king_in_checkmate?(:white) || board.king_in_checkmate?(:black) || board.stalemate?\n display.render\n input = get_start\n @board.piece_in_hand = @board[input]\n make_move(input)\n @board.switch_players!\n end\n display.render\n if board.king_in_checkmate?(:white)\n puts \"White is in Checkmate\\nBlack wins!\"\n elsif board.king_in_checkmate?(:black)\n puts \"Black is in Checkmate\\nWhite wins!\"\n else\n puts \"Stalemate!\"\n end\n rescue BadInputError, BadMoveError\n @board.drop_piece\n retry\n end", "def display_board(game)\n \n puts \" #{game[0]} #{VERTBAR} #{game[1]} #{VERTBAR} #{game[2]} \"\n puts \"#{SEP}\"\n puts \" #{game[3]} #{VERTBAR} #{game[4]} #{VERTBAR} #{game[5]} \"\n puts \"#{SEP}\"\n puts \" #{game[6]} #{VERTBAR} #{game[7]} #{VERTBAR} #{game[8]} \"\n \nend", "def run\n while(!@game_over)\n valid_input = false\n input_column = -1\n \n display_board\n puts \">>> Player #{@player}'s turn.\"\n \n # Repeatedly prompts the user for input until valid input is given\n while(!valid_input)\n input_column = prompt\n \n # Requests input again if the input given is invalid\n valid_input = true if((0..6).include? input_column)\n if(!valid_input)\n puts \"Invalid input! Please try again.\"\n next\n end\n \n # Requests input again if the specified column is already full\n valid_insertion = insert_at(input_column, @player)\n if(!valid_insertion)\n puts \"\\nERROR: The column is already full! Please try again.\" \n valid_input = false\n end\n end\n \n # Check to see if game is won\n break if(win_condition_met?(@player))\n \n # Swap players after each turn\n if(@player == 1)\n @player = 2\n elsif(@player == 2)\n @player = 1\n end\n \n end\n \n display_board\n puts \">>> Player #{@player} has won!!! <<<\"\n end", "def play\n\t\tshow\n\t\twhile true\n\t\t\trow, col = input\n\t\t\tupdate row, col\n\t\t\tshow\n\n\t\t\tif is_a_winner?\n\t\t\t\tputs \"Player #{@player} won!\"\n\t\t\t\tbreak\n\t\t\telsif is_a_tie?\n\t\t\t\tputs \"Game is tied!\"\n\t\t\t\tbreak\n\t\t\tend\n\n\t\t\tswitch_players\n\t\tend\n\tend", "def play\n\t\tboard = Board.new # cree une instance de la class board\n\t\tfor i in 1..9 # fait une boucle qui vas de 1 a 9, quand on arrive a 9 ca veut dire que toutes les cases du tableau on ete remplis. \n\t\t\tboard.display_stat(@player_one.return_name, @player_two.return_name, @player_one.return_number_of_win, @player_two.return_number_of_win, @player_two.return_number_of_egality) # on appel la methode display stats qui vas servire a affichier les statistiques, nombre de parties, nom des joueurs, leur nombre de victoires...\n\t\t\tif @who_play == 1 # on cree une condition qui vas servire a afficher le nom du joueur qui doit jouer ce tours.\n\t\t\t\tputs \"A toi de jouer #{@player_one.return_name.colorize(:green)} !\\n\\n\\n\"\n\t\t\telse\n\t\t\t\tputs \"A toi de jouer #{@player_two.return_name.colorize(:green)} !\\n\\n\\n\"\n\t\t\tend\n\t\t\tboard.display_board(@board_case) # on affiche le plateau du jeux\n\t\t\tselect_board_case # on appel la methode qui demande a l'utilisateur de choisire la case sur laquel il vas jouer\n\t\t\tif is_win == true # on fait une condition qui appel la methode is_win, cette methode verifi si il y a un cas de victoire\n\t\t\t\tboard.display_board(@board_case) # on affiche le plateau une derniere fois pour montrer la derniere modification\n\t\t\t\tif @who_play == 1 # on fait une condition qui verifie qui a gagner\n\t\t\t\t\tputs \"le joueur #{@player_one.return_name} a gagner cette partie!\" # si c'est le joueur 1 qui a gagner on dit qu'il a gagner, on affiche son nom\n\t\t\t\t\t@player_one.increments_number_of_win\t# on incremente du nombre de victoire \n\t\t\t\telse\n\t\t\t\t\tputs \"le joueur #{@player_two.return_name} a gagner cette partie!\"\n\t\t\t\t\t@player_two.increments_number_of_win\n\t\t\t\tend\n\t\t\t\tbreak # On quitte la boucle car il y a eu une victoire\n\t\t\tend\n\t\t\t@who_play == 1 ? @who_play = 2 : @who_play = 1 # cette ligne sert a faire que c'est a l'autre joueur de jouer (c'est une condition de type ternaire)\n\t\tend\n\t\tif is_win == false # si on sort de la boucle et qu'il n'y a aucune victoire alor c'est un match nul\n\t\t\t@player_one.increments_number_of_egality # on incremente la variable qui compte le nombres de matchs nuls\n\t\t\t@player_two.increments_number_of_egality\n\t\t\tputs \"MATCH NULLLLLLL\".colorize(:red) # on affiche que c'est un match nul\n\t\tend\n\tend", "def show_board # show the game board\n print @board[0..2]\n puts \"\\n\"\n print @board[3..5]\n puts \"\\n\"\n print @board[6..8]\n puts \"\\n\"\n end", "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def display_board\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def show_rules\n puts '*******WELCOME AND GET READY FOR A ROUND OF TIC TAC TOE*******'\n puts 'PLEASE: make sure to follow the instruction bellow'\n puts 'STEP ONE: Two players are needed for a session: Player one and Player two'\n puts 'STEP TWO: The winner has to align atleast three marks veritically, horizontally or obliguely'\n puts 'STEP THREE: Players are not allowed to repeat their choice or select an already selected space'\n puts 'STEP FOUR: The game is a draw in case all the spaces of the board are used up and the round restarted'\n puts '***********Have fun*************'\nend", "def display_board\n puts \" | | \" \n puts \"-----------\"\n puts \" | | \"\n puts \"-----------\"\n puts \" | | \"\nend", "def play\n until @tic.win?[0] || @tic.win?[1] || @turn_count == @tic.x*@tic.y\n @tic.show_board\n puts ' '\n location_selected = get_player_input\n if check_space?(location_selected)\n place_piece(location_selected)\n else \n \tputs \"That location has already been played, or is outside of the game board. Please choose another location.\"\n end\n end\n\n @tic.show_board\n puts ' '\n\n if @tic.win?[0]\n puts \"#{@player1.name} Wins!\"\n elsif @tic.win?[1]\n puts \"#{@player2.name} Wins!\"\n else\n puts \"Tie - Game Over\"\n end\n end", "def play_loop\n puts \"Welcome to our game of Chess.\"\n puts \"You make moves by typing in the coordinate that you wish to move from, followed by the coordinate you're moving to\"\n\n turn = :white\n\n until board.checkmate?(turn)\n white_turn = turn == :white\n player = white_turn ? @white : @black\n puts self.board\n puts \"#{turn.to_s.capitalize}'s turn\".bold\n begin\n input = player.play_turn\n\n case input[:action]\n when :save\n save\n when :load\n load\n else\n board.is_color?(input[:start_pos],turn)\n self.board.move(input[:start_pos], input[:end_pos])\n end\n rescue InvalidMoveException => e\n puts e.message\n retry\n end\n turn = white_turn ? :black : :white\n end\n\n if board.checked?(:black)\n puts \"Checkmate! White Wins!\".bold\n elsif board.checked?(:white)\n puts \"Checkmate! Black Wins!\".bold\n else\n puts \"Stalemate. No one wins!\".bold\n end\n end", "def display_board\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\n puts \"-----------\"\n puts \" \" \"|\" \" \" \"|\" \" \"\nend", "def play_full_game\n Display.clear_screen\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_start_ui\n fast_forward(@data[\"moves\"].keys[-1], true)\n Display.draw_board(@cur_board, @player_white, @player_black)\n Display.game_end_ui(determine_winner)\n end", "def start_game_loop(selection)\n case selection\n when 1\n new_fight = Fight.new(superhero: todays_hero)\n new_fight.start_battle(todays_hero)\n @enemy = Villain.find_by(id: new_fight.villain_id)\n url = URI.parse(@enemy.img)\n res = test_url(url)\n print_picture(url) if res.code == \"200\"\n new_fight.battle(superhero: todays_hero, villain: self.enemy)\n when 2\n @todays_hero.train\n when 3\n run_quest\n when 4\n url = URI.parse(@todays_hero.img)\n res = test_url(url)\n print_picture(url) if res.code == \"200\"\n @todays_hero.display_stats\n when 5\n display_instructions\n when 6\n display_board\n when 7\n return \n end\n display_menu\n end", "def run\n start_key = self.display_instructions\n exit if start_key.downcase == \"q\"\n self.play_round until @board.won? || @board.lost?\n @board.lost? ? self.display_loss : self.display_win\n end", "def display_board\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\n puts\"-----------\"\n puts \" | | \"\nend", "def start\n puts \"Welcome to Tic Tac Toe.\"\n play_again = \"yes\"\n while play_again.downcase == \"y\" || play_again.downcase == \"yes\"\n valid_options_1 = [\"0\", \"1\", \"2\"]\n question_1 = puts \"What type of game do you want to play? (0, 1, or 2 players)\"\n input_1 = gets.strip\n until valid_options_1.include? input_1\n puts \"That's not a valid option, please enter 0, 1, or 2.\"\n question_1\n input_1 = gets.strip\n end\n\n if input_1.to_i == 0\n player_1 = Players::Computer.new(\"X\")\n player_2 = Players::Computer.new(\"O\")\n Game.new(player_1, player_2).play\n elsif input_1.to_i == 1\n puts \"Would you like to go first and be X?\"\n answer = gets.strip\n if answer.downcase == \"yes\" || answer.downcase == \"y\"\n player_1 = Players::Human.new(\"X\")\n player_2 = Players::Computer.new(\"O\")\n Game.new(player_1, player_2).play\n else\n player_1 = Players::Computer.new(\"X\")\n player_2 = Players::Human.new(\"O\")\n Game.new(player_1, player_2).play\n end\n elsif input_1.to_i == 2\n player_1 = Players::Human.new(\"X\")\n player_2 = Players::Human.new(\"O\")\n Game.new(player_1, player_2).play\n end\n puts \"Would you like to play again?(Yes or No)\"\n play_again = gets.strip\n if play_again.downcase == \"no\" || play_again.downcase == \"n\"\n puts \"Goodbye, play again soon!\"\n end\n end\n end", "def display_board(game_board, guesser)\r\n puts %(Color matches: 1 - #{output_color(' Black ', 1)}; 2 - #{output_color(' Cyan ', 2)}; 3 - #{output_color(' Red ', 3)}; 4 - #{output_color(' Yellow ', 4)}; 5 - #{output_color(' Magenta ', 5)}; 6 - #{output_color(' Blue ', 6)}\r\n Guessing: #{guesser.name}\r\n\r\n ___________________________\r\n | | | | | | | |\r\n | x | #{output_color(game_board.get_game(0, 0))} | #{output_color(game_board.get_game(1, 0))} | #{output_color(game_board.get_game(2, 0))} | #{output_color(game_board.get_game(3, 0))} | #{output_color(game_board.get_game(4, 0))} | #{output_color(game_board.get_game(5, 0))} |\r\n | x | #{output_color(game_board.get_game(0, 1))} | #{output_color(game_board.get_game(1, 1))} | #{output_color(game_board.get_game(2, 1))} | #{output_color(game_board.get_game(3, 1))} | #{output_color(game_board.get_game(4, 1))} | #{output_color(game_board.get_game(5, 1))} |\r\n | x | #{output_color(game_board.get_game(0, 2))} | #{output_color(game_board.get_game(1, 2))} | #{output_color(game_board.get_game(2, 2))} | #{output_color(game_board.get_game(3, 2))} | #{output_color(game_board.get_game(4, 2))} | #{output_color(game_board.get_game(5, 2))} |\r\n | x | #{output_color(game_board.get_game(0, 3))} | #{output_color(game_board.get_game(1, 3))} | #{output_color(game_board.get_game(2, 3))} | #{output_color(game_board.get_game(3, 3))} | #{output_color(game_board.get_game(4, 3))} | #{output_color(game_board.get_game(5, 3))} |\r\n |___|___|___|___|___|___|___|\r\n | #{output_color(game_board.get_game(0,4), 7)} | #{output_color(game_board.get_game(1,4), 7)} | #{output_color(game_board.get_game(2,4), 7)} | #{output_color(game_board.get_game(3,4), 7)} | #{output_color(game_board.get_game(4,4),7)} | #{output_color(game_board.get_game(5,4),7)} |\r\n | #{game_board.get_game(0,5)} | #{game_board.get_game(1,5)} | #{game_board.get_game(2,5)} | #{game_board.get_game(3,5)} | #{game_board.get_game(4,5)} | #{game_board.get_game(5,5)} |\r\n |___|___|___|___|___|___|\r\n)\r\n end", "def game_turns\n system(\"clear\")\n until @game.game_over?\n # render both boards\n puts \"COMPUTER BOARD\".center(40, \"=\") # change this to make it dynamic according to board size\n puts @game.computer_board.render\n puts \"PLAYER BOARD\".center(40, \"=\")\n puts @game.player_board.render(true)\n # instruct player to enter coordinate to shoot\n puts \"Enter the coordinate for your shot:\"\n # get user input\n user_input = nil\n loop do\n user_input = gets.chomp.upcase\n if @game.computer_board.valid_coordinate?(user_input) && !@game.computer_board.cell_fired_upon?(user_input)\n @game.computer_board.fire_upon_cell(user_input)\n break\n elsif @game.computer_board.valid_coordinate?(user_input) && @game.computer_board.cell_fired_upon?(user_input)\n puts \"You already fired upon that coordinate. Please try again:\"\n else\n puts \"That was not a valid coordinate. Use the syntax: A1\"\n end\n end\n # computer randomly fires at player board\n if @game.computer_hunting == true\n # randomly select an adjacent coord to previous hit\n chosen_adjacent_shot = @game.player_board.adjacent_coords(@game.most_recent_hit).sample\n @game.player_board.fire_upon_cell(chosen_adjacent_shot)\n @game.player_board.previous_computer_shot = chosen_adjacent_shot\n else\n @game.player_board.fire_upon_random_cell\n end\n # computer checks result of shot to see if it should be hunting nearby\n if @game.player_board.cells[@game.player_board.previous_computer_shot].render == \"H\"\n @game.computer_hunting = true\n @game.most_recent_hit = @game.player_board.previous_computer_shot\n elsif @game.player_board.cells[@game.player_board.previous_computer_shot].render == \"X\"\n @game.computer_hunting = false\n end\n # display results of both players' shots\n puts \"Your shot on #{user_input} #{@game.computer_board.shot_result(user_input)}.\"\n puts \"My shot on #{@game.player_board.previous_computer_shot} #{@game.player_board.shot_result(@game.player_board.previous_computer_shot)}.\"\n end\n end", "def play_game\n turn = 1\n while turn < @turns\n puts \"Please guess a letter in the word.\"\n puts \"\"\n user_choice = gets.chomp.to_s\n until @alphabet.include? user_choice and user_choice.length == 1 do\n puts \"Please choose a single letter in the alphabet to guess the content of the word.\"\n user_choice = gets.chomp.to_s\n end\n puts \"Evaluating user choice\"\n is_secret_word_letter(user_choice)\n self.show_game_progress\n turn +=1\n puts \"Turn #{turn} complete!\"\n self.game_over_check\n end\n end", "def play\n game_introductions\n\n loop do\n set_markers_and_first_mover\n\n loop do\n clear_screen_and_display_board\n loop_of_player_moves\n display_result\n break if someone_won_match?\n display_play_again_message\n reset\n end\n\n clear\n display_champion\n break unless rematch?\n reset_game_data\n end\n\n display_goodbye_message\n end", "def start_game(columns, rows, best_score)\n #init\n board = get_board(columns,rows)\n turns = 0\n player_color = board[0][0]\n # Gameplay loop untill the board has only one color\n loop do\n system \"clear\" or system \"cls\"\n display_board(board)\n puts \"Number of turns: #{turns}\"\n current_completion = color_in_board(board,player_color)*100/(columns*rows).to_f\n puts \"Current completion: #{current_completion.to_i}%\"\n # Check if the game is over\n if is_over?(board)\n if best_score[0] == -1\n best_score[0] = turns\n else\n best_score[0] = [best_score[0], turns].min\n end\n puts \"You won after #{turns} turns\"\n gets\n system \"clear\" or system \"cls\"\n break\n end\n # Take user's input and update the board respectively\n puts \"Possible inputs: q for quit, r for red/ b for blue/ g for green/ y for yellow/ c for cyan/ m for magenta\"\n print \"Choose a color: \"\n input = auto_complete(gets.chomp.to_sym)\n if is_a_color?(input) && input != player_color\n board = update(board, player_color, input, 0, 0)\n turns += 1\n player_color = input\n elsif input == :quit\n break\n end\n end\nend" ]
[ "0.7186195", "0.7076107", "0.70755607", "0.707066", "0.70684546", "0.7056037", "0.7018", "0.6992578", "0.6991273", "0.6918398", "0.69019485", "0.68982655", "0.6840322", "0.6835676", "0.6808182", "0.6804411", "0.678638", "0.6776162", "0.677073", "0.67694277", "0.67683727", "0.67545354", "0.6739251", "0.6739218", "0.67324346", "0.6730782", "0.67133194", "0.66976964", "0.66965204", "0.66951305", "0.66915536", "0.6691374", "0.66711086", "0.66699624", "0.66688037", "0.6643823", "0.6642287", "0.6640533", "0.6632144", "0.6630879", "0.66301894", "0.6627138", "0.6622535", "0.66116226", "0.66098094", "0.6606672", "0.6604714", "0.6601673", "0.6597505", "0.65973413", "0.65887135", "0.6586916", "0.6586766", "0.6578638", "0.65679723", "0.656711", "0.6566302", "0.6566014", "0.65638846", "0.6560779", "0.6558809", "0.6556198", "0.6550268", "0.6546192", "0.6542559", "0.65371245", "0.6536927", "0.65340364", "0.6532611", "0.6532179", "0.6525097", "0.65247345", "0.652417", "0.6515066", "0.651052", "0.6497671", "0.64951676", "0.64940524", "0.6485787", "0.6483416", "0.64825815", "0.64807934", "0.6475502", "0.6475433", "0.6475433", "0.64538455", "0.64516294", "0.64496297", "0.64491653", "0.6446828", "0.64453876", "0.64451015", "0.6438882", "0.6438871", "0.64383125", "0.64289683", "0.642773", "0.64210415", "0.6418625", "0.64176965" ]
0.6932986
9
def each counter = 0 while counter < size yield(item_at(counter)) counter += 1 end self end
def each @todos.each do |todo| yield(todo) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each\n 0.upto(item_count - 1) { | i | yield i }\n end", "def each()\n i = 0\n while i < @total\n yield at(i)\n i += 1\n end\n self\n end", "def each\n @size.times do |i|\n yield self[i]\n end\n end", "def each(&block)\n @size.times { |position| yield self[position] }\n end", "def each(&block)\n @size.times { |position| yield self[position] }\n end", "def each(&block)\n @size.times { |index| yield self[index]}\n end", "def each(&block)\n @size.times { |position| yield self.get(position) }\n end", "def each(&block)\n @size.times { |position| yield self[position] }\n end", "def each(&block)\n @size.times { |position| yield self[position] }\n end", "def each(&block)\n @size.times { |position| yield self[position] }\n end", "def my_each_with_index\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end", "def my_each_with_index\n\t\tself.length.times do |index|\n\t\t\tyield(self[index], index)\n\t\tend\n\tend", "def each\n (0...size).each {|i| yield(self[i])}\n nil\n end", "def my_each_with_index\n i = 0\n while i < self.size\n yield(self[i], i)\n i += 1\n end\n self\n end", "def each_index(&block)\n @size.times { |index| yield index}\n end", "def my_each_with_index\n i = 0\n while i < self.length\n yield(self[i], i)\n i += 1\n end\n self\n end", "def my_each_with_index\n i = 0\n while i < self.size\n yield self[i], i\n i += 1\n end\n end", "def my_each_with_index\n i = 0\n while i < self.length\n yield self[i], i\n i += 1\n end\n self\n end", "def each\n return to_enum(:each) unless block_given?\n @size.times { |position| yield self[position] }\n end", "def cycle\n if has_size?\n super\n else\n i = 0\n loop do\n yield at(i)\n i += 1\n end\n end\n end", "def each a\n\ti = 0\n\tuntil i == a.size\n\t\tyield a[i]\n\t\ti += 1\n\tend\n\ta\nend", "def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < size\n yield(self[i], i)\n i += 1\n end\n self\n end", "def each(&block) # :yields: result\n 0.upto(@size - 1) {|x| yield self[x]}\n end", "def each_index(&block)\n return enum_for(:each_index) unless block_given?\n 0.upto(size-1, &block)\n self\n end", "def each(&block)\n return to_enum(:each) unless block_given?\n size.times.each { |i| yield @elements[i] }\n self\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 i = 0\n until i == @sequence.size\n yield(@sequence[i])\n i += 1\n end\n end", "def each(&blk)\n (0..@size-1).each { |i| blk.call(self.[](i)) }\n end", "def each\n unless @array.empty?\n @array.size.times do |i|\n yield @array[i]\n end\n end\n end", "def each\n @length.times {|i|\n yield @gens.collect {|x| x[i]}\n }\n self\n end", "def each\n @items.each { |i| yield i }\n end", "def each\n i = 0\n while i < 2\n yield self[i]\n i += 1\n end\n end", "def each\n if block_given?\n (0...Count()).each { |i| yield self[i] }\n else\n (0...Count()).map { |i| self[i] }\n end\n end", "def my_each_with_index\n \ti = 0\n \twhile i < self.length\n \t\tif block_given?\n \t\t\tyield(self[i], i)\n \t\telse\n \t\t\treturn self\n \t\tend\n \t\ti +=1\n \tend\n \tself\n end", "def each(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :each ) # for 1.8.7\n end\n i = 0\n lim = self.__size\n while i < lim\n block.call(self.__at(i))\n i += 1\n end\n self\n end", "def each(&block)\n i = @elements.length - 1\n while i >= 0\n yield @elements[i]\n i -= 1\n end\n end", "def each &block\n each_with_index {|x, i| block.call(x)}\n end", "def custom_each(array)\r\n i = 0 \r\n while i < array.length \r\n yield array[i]\r\n i += 1\r\n end\r\nend", "def my_each_with_index\n for i in 0...self.length do\n yield(self[i], i)\n end\n return self\n end", "def each\n return to_enum :each unless block_given?\n 0.upto(size-1) { |i| yield self[i] }\n self\n end", "def each\n return to_enum :each unless block_given?\n 0.upto(size-1) { |i| yield self[i] }\n self\n end", "def each\n while true do\n yield\n break if ! advance\n end\n end", "def each\n (bytesize * 8).times do |pos|\n yield self[pos]\n end\n end", "def custom_each(array)\n i = 0\n while i < array.length\n yield array[i]\n i += 1\n end\nend", "def my_each_with_index\n for i in 0..self.length-1\n yield(self[i], i) if block_given?\n end\n self\n end", "def my_each_with_index\n a = (is_a? Hash) ? to_a : self\n i = 0\n while i < a.count\n yield a[i], i\n i += 1\n end\n end", "def my_each_with_index\n return to_enum unless block_given?\n\n i = 0\n while i < length\n yield(self[i], i)\n i += 1\n end\n end", "def each(array)\n counter = 0\n while counter < array.size do\n yield(array[counter])\n counter += 1\n end\n array\nend", "def each\n @items.each {|x| yield x}\n end", "def my_each_with_index\n i = 0\n while i < self.to_a.length\n yield self.to_a[i], i\n i += 1\n end\n end", "def each(arr)\n counter = 0\n \n while counter < arr.length\n yield(arr[counter])\n counter += 1\n end\n \n arr\nend", "def each_dist\n count.times do |i|\n yield( self[i])\n end\n end", "def each_with_index(&blk)\n (0..@size-1).each { |i| blk.call(self.[](i),i) }\n end", "def my_each(array)\n i = 0\n while i < array.length\n yield array[i]\n i += 1\n end\n array\nend", "def each_number_to( number )\r\n\r\n index = 0\r\n while index < number\r\n yield(index)\r\n index += 1\r\n end\r\n\r\nend", "def each\n entry_length = struct_class_length\n (length / entry_length).times do |i|\n yield self[i]\n end\n end", "def for_each_element(arr)\n index = 0\n total = arr.size\n\n while index < total\n yield(arr[index])\n index += 1\n end\nend", "def eachio_index(&block) # :yield: index\n 0.upto(length-1, &block)\n self\n end", "def my_each(array) \n n = 0\n while n < array.length \n yield(array[n])\n n = n + 1 \n end\n array\nend", "def each(array)\n index = 0\n\n while index < array.size\n element = array[index]\n yield element\n index += 1\n end\n \n array\nend", "def each(arr)\n ndx = 0\n while ndx < arr.size do\n yield(arr[ndx])\n ndx += 1\n end\n arr\nend", "def each\n\t\tyield dequeue while @last != 0\n\tend", "def my_times\n\t\tfor i in 1..self\n\t\t\tyield\n\t\tend\n\tend", "def each\n with_separate_read_io do | iterable |\n reading_lens = Obuf::Lens.new(iterable)\n @size.times { yield(reading_lens.recover_object) }\n end\n end", "def each\r\n res = self.to_a\r\n 0.upto(res.length - 1) do |x|\r\n yield res[x]\r\n end\r\n end", "def my_each(array)\n i = 0\n while i < array.length\n yield(array[i])\n array[i]\n i += 1\n end\n array\nend", "def map!\n i = 0\n while i < @total\n self[i] = yield(at(i))\n i += 1\n end\n self\n end", "def my_each(array) # put argument(s) here\n i = 0\n\n while i < array.length\n yield array[i]\n i += 1\n end\n array\nend", "def each\n @arr.each do |n|\n yield(n)\n end\n end", "def custom_each(array)\n i = 0\n while i < array.length\n #yield will pass this element to the block\n yield array[i] #each and single element of array iterate\n i += 1 #to stop infinite loop\n end\nend", "def repeater(count=1)\n count.times {|ii| yield }\nend", "def each\r\n @many = true\r\n yield(self)\r\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(start=0)\n\t\t\tcounter = wrapping_counter @head_index, @tail_index, @queue.size\n\t\t\t\n\t\t\tcounter = counter[start..-1] if start != 0\n\t\t\t\n\t\t\tcounter.each do |i|\n\t\t\t\tyield @queue[i]\n\t\t\tend\n\t\tend", "def next\n @count += 1\n self\n end", "def each\n for i in @list_of_positions\n yield self.next()\n end\n end", "def each\n current_index = size - 1\n while current_index >= 0\n value = Dictionary.db.zrange self.name, current_index, current_index\n item = DictionaryItem.new(self, value[0])\n yield item if block_given?\n current_index -= 1\n end\n end", "def each\n\n rewind\n\n n,f,q,c=next_seq\n\n while (!n.nil?)\n yield(n,f,q,c)\n n,f,q,c=next_seq\n end\n\n rewind\n\n end", "def each_index\n (0...hsize).each { |j|\n (0...vsize).each { |i|\n yield i, j\n }\n }\n self\n end", "def each(*) end", "def each_with_index &block\n latch = CountDownLatch.new(size)\n __getobj__.each_with_index {|x, index|\n @@pool << -> {\n begin\n block.call(x, index)\n rescue\n $!.print_stack_trace\n ensure\n latch.count_down\n end\n }\n }\n latch.wait\n self\n end", "def each(arr)\n # set index value, beginning with the first element at 0\n i = 0\n # while the current index value still exists in the array, run the block of code, stored in yield, on each index, then increase the index value by 1 until the end of the array\n while i < arr.length\n yield(arr[i])\n i += 1\n end\nend", "def each\n items.each { |itm| yield itm }\n end", "def each\n\n\t\t@a.each do |x|\n\t\t\tyield x\n\t\tend\n\tend", "def my_count\n i = 0\n self.my_each {|x| i += 1}\n i\n end", "def each(&block)\n @items.each(&block)\n self\n end", "def each(array)\n idx = 0\n while idx < array.size\n yield(array[idx]) if block_given?\n idx += 1\n end\n\n array\nend", "def each\n yield self\n end", "def each(&block)\n end", "def each\n if @length > 0\n item = @head\n begin\n yield item.object\n item = item.next\n end until item.nil?\n end\n end", "def each\n for each element\n yield(element)\n end\nend", "def each\n @items.each { |_item| yield _item }\n end", "def each\n @size.times do |y|\n @size.times do |x|\n yield x, y, @grid[x][y]\n end\n end\n self\n end", "def my_each(array)\n if block_given?\n counter = 0\n while counter < array.length\n yield (array[counter])\n counter += 1\n end\n array\n else\n puts \"No block given\"\n end\nend", "def each # And define each on top of next\n loop { yield self.next }\n end", "def my_each(array)\n if block_given?\n i = 0\n while i < array.length\n yield array[i]\n i = i + 1\n end\n array\n end\nend" ]
[ "0.83711296", "0.8343442", "0.81811726", "0.81114745", "0.8110655", "0.8041984", "0.80414915", "0.80196404", "0.80196404", "0.80196404", "0.78144145", "0.7655457", "0.76375073", "0.7622876", "0.7592916", "0.7476852", "0.7449554", "0.740364", "0.7391068", "0.733202", "0.73077875", "0.72620696", "0.7201847", "0.71979654", "0.7142177", "0.7121823", "0.70766133", "0.70626426", "0.705928", "0.7055552", "0.7052835", "0.70527524", "0.70509195", "0.70337737", "0.70317674", "0.70067346", "0.70030916", "0.6988849", "0.69675136", "0.6943519", "0.6943519", "0.6888015", "0.6887883", "0.68863785", "0.68822265", "0.6858113", "0.68288964", "0.68124187", "0.68076235", "0.6797923", "0.67752683", "0.67699605", "0.6768673", "0.6746687", "0.672932", "0.67082644", "0.6702614", "0.66893494", "0.66835564", "0.66740674", "0.66719854", "0.6669122", "0.6664247", "0.6628737", "0.66221154", "0.66156274", "0.66141975", "0.65751517", "0.65731245", "0.65723586", "0.6571258", "0.6565851", "0.656416", "0.656416", "0.656416", "0.656416", "0.656416", "0.656416", "0.6562668", "0.6538659", "0.65291697", "0.6504228", "0.65040976", "0.64994335", "0.64986897", "0.6493722", "0.6489658", "0.6483652", "0.64783114", "0.646281", "0.64548844", "0.6449551", "0.6441062", "0.642589", "0.6418529", "0.6414828", "0.6405074", "0.63931924", "0.63857913", "0.63698775", "0.63695574" ]
0.0
-1
def select counter = 0 selected = [] while counter < self.size item = item_at(counter) selected << item if yield(item) counter += 1 end selected end def select
def select new_list = TodoList.new("Selected Items") each do |todo| new_list.add(todo) if yield(todo) end new_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_select\n i = 0\n result = []\n self.my_each do |x|\n if yield(x)\n result[i] = x\n i += 1\n end\n end\n return result\n end", "def my_select\n result = []\n i = 0\n while i < self.to_a.length\n if yield self.to_a[i] \n result << self.to_a[i]\n end\n i += 1\n end\n result\n end", "def my_select(collection)\n holder = [] #for collection at the end\n counter = 0 #start at beginning of array\n\n while counter < collection.length # condition to be met\n if yield(collection[counter]) == true #if the mumbojumbo results in true *which select gives\n holder.push(collection[counter]) #then push that element into the new array\n end\n counter += 1 #iterate throughout the array incremently\n end\n holder #show everyone your new array\nend", "def select\n a = []\n @set.each do |e,_|\n if yield(e)\n a << e\n end\n end\n a\n end", "def select\n out = []\n\n each { |e| out << e if yield(e) }\n\n out\n end", "def selecting(&blk)\n Enumerator.new do |yielder|\n each do |*item|\n yielder.yield *item if blk.call(*item)\n end\n end\n end", "def select\n new_array = []\n @array.size.times do |index|\n value = @array[index]\n if yield(value)\n new_array << value\n end\n end\n\n new_array\n end", "def my_select\n\n\t\tselect_array = []\n\t\t# call my each\n my_each do | num |\n \tif yield( num )\n \t\tselect_array << num\n \telse\n \t\tnext\n \tend\n\n\n end\n\n return select_array\n\n\tend", "def my_select\n array = []\n self.my_each do |item|\n if (yield item) == true\n array << item\n end\n end\n array\n end", "def select_items(collection:, num_of_items: )\n selection = []\n collection.each_with_index do |item, i|\n selection.push(item)\n if i == num_of_items - 1\n break\n end\n end\n selection\n end", "def my_select(&prc)\n selection = []\n i = 0\n while i < self.length\n if prc.call(self[i])\n selection << self[i]\n end\n i += 1\n end\n return selection\n end", "def my_select\n return to_enum unless block_given?\n\n selected = []\n my_each { |i| selected << i if yield(i) }\n selected\n end", "def select(array)\n counter = 0\n ret_array = []\n while counter < array.size\n ret = yield(array[counter])\n ret_array << array[counter] if ret\n counter += 1\n end\n ret_array\nend", "def my_select\n if block_given?\n new_array = []\n self.my_each{|item| array_new << item if yield(self)}\n # This is the same as:\n # for i in 0..self.length-1\n # new_array << self[i] if yield(self[i])\n # end\n new_array\n end\n end", "def my_select\n\ti = 0\n\tarr = Array.new\n\tself.my_each do |a| \n\t\tif yield (a)\n\t\t\tarr[i] = a\n\t\t\ti +=1\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend\n\tarr\nend", "def my_select\n arr = []\n self.my_each {|x| arr << x if yield x}\n arr\n end", "def select(array)\n counter = 0\n result = []\n until counter == array.size do\n result << array[counter] if yield(array[counter])\n counter += 1\n end\n result\nend", "def select(array)\n counter = 0\n result = []\n\n while counter < array.size\n current_element = array[counter]\n result << current_element if yield(current_element)\n counter += 1\n end\n\n result\nend", "def my_select(coll)\n # your code here!\n mod_coll = []\n i=0\n while i < coll.length\n if (yield(coll[i]))\n mod_coll.push(coll[i])\n end\n i = i+1\n end\n mod_coll\nend", "def my_select(array)\n counter = 0\n new_array = []\n while counter < array.size\n if yield(array[counter])\n new_array << array[counter]\n else\n end\n counter += 1\n end\n return new_array\nend", "def select how_much\n res = []\n how_much.times { res << select_one }\n res\n end", "def select(array)\n counter = 0\n return_array = []\n while counter < array.size\n return_array << array[counter] if yield(array[counter])\n counter += 1\n end\n return_array\nend", "def my_select(arr)\ncounter = 0\nresults = []\nwhile counter < arr.length\n if yield(arr[counter]) == true\n results.push(arr[counter])\n end\n counter += 1\nend\nresults\nend", "def my_select (collection)\n if block_given?\n i = 0 \n new_collection = []\n \n while i < collection.length \n if yield(collection[i]) \n new_collection << collection[i]\n end\n i += 1\n end\n \n else\n puts \"Hey! No block was given!\"\n end\n new_collection \nend", "def select(arr)\n result_arr = []\n \n counter = 0\n while counter < arr.size\n result_arr << arr[counter] if yield(arr[counter])\n end\n \n result_arr\nend", "def my_select\n new_arr = []\n self.my_each do |ele|\n new_arr << ele if yield ele\n end\n new_arr\n end", "def select(array)\n counter = 0\n new_array = []\n while counter < array.size\n value = yield(array[counter])\n if value\n new_array << array[counter]\n end\n counter += 1\n end\n\n new_array\nend", "def select(array)\n final_selections = []\n\n for elem in array do\n result = yield(elem)\n final_selections << elem if result\n end\n \n final_selections\nend", "def my_select\n\t\treturn_array = []\n\t\tself.my_each do |element|\n\t\t\tif yield(element) == true\n\t\t\t\treturn_array << element\n\t\t\tend\n\t\tend\n\t\treturn return_array\n\tend", "def my_select(array)\n i = 0\n select = []\n while i < array.length\n if (yield(array[i]))\n select << array[i]\n end\n i+=1\n end\n select\nend", "def my_select(&block)\n result = []\n my_each do |elem|\n result << elem if block.call(elem) == true\n end\n result\n end", "def select\n counter = 0\n new_list = TodoList.new(title)\n\n while counter < @todos.length do\n if yield(@todos[counter])\n new_list << @todos[counter]\n end\n counter += 1\n end\n\n new_list\n end", "def thread_select\n selection = Array.new\n thread_each do |e|\n selection << e if yield(e)\n end\n selection\n end", "def my_select\n return self unless block_given?\n new_arr = []\n self.my_each { |s| new_arr << s if yield(s) }\n return new_arr\n end", "def my_select(list)\n result = []\n list.each do |n|\n result << n if yield(n)\n end\n result\nend", "def my_select(&prc)\n\t\tnew_array = []\n\n\t\tself.my_each do |ele|\n\t\t\tnew_array << ele if prc.call(ele)\t\t\t\t\n\t\tend\n\n\t\tnew_array\n\tend", "def select!(&block)\n block or return enum_for(__method__)\n n = size\n keep_if(&block)\n size == n ? nil : self\n end", "def select; end", "def select; end", "def select_by_index(input)\r\n raise \"Index must be 0 or greater\" if input < 0\r\n begin\r\n expand_combo\r\n list_items[input].select\r\n ensure\r\n collapse_combo\r\n end\r\n end", "def my_select\n new_array = []\n each do |value|\n new_array << value if yield(value)\n end\n new_array\nend", "def select(&block); end", "def my_select(&prc)\n arr = []\n self.my_each { |el| arr << el if prc.call(el) }\n arr\n end", "def my_select(&prc)\n result_array = []\n self.my_each {|el| result_array << el if prc.call(el)}\n result_array\n end", "def select(*) end", "def select(&block)\n result = empty_copy\n values.select(&block).each{|mach| result << mach}\n result\n end", "def selected\n @selected ||= @cache.select { |i,s,c| s }.map { |i,s,c| i }\n end", "def my_select\n return to_enum unless block_given?\n array = []\n to_a.my_each { |n| array << n if yield(n) }\n array\n end", "def select( &block )\r\n\t\t\treturn @contents.select( &block )\r\n\t\tend", "def select_item\n @selected = @current\n\n items\n end", "def select(*rest) end", "def select(*rest) end", "def lselect(&blk)\n Enumerator.new do |out|\n self.each do |i|\n out.yield i if blk.call(i)\n end\n end\n end", "def select!(&block)\n block or return enum_for(__method__) { size }\n n = size\n keep_if(&block)\n self if size != n\n end", "def select!(&block); end", "def select(&block)\n @select = block if block\n @select\n end", "def lazy_select(&block)\n Enumerator.new do |y|\n self.each do |x|\n y.yield(x) if block.call(x)\n end\n end\n end", "def lazy_select\n lazify.call(S.select)\n end", "def pluck selector = {}, &block\n quantity = (selector.delete :quantity).to_i\n if blocks?\n unless (result = find_by selector, &block).empty?\n result = result[0..(quantity - 1)] if quantity > 0\n result.each {|b| b.set_attr 'skip-option', '' }\n end\n else\n result = []\n end\n quantity == 1 ? result[0] : result\n end", "def pick &block\n value = nil\n detect {|i| value = yield(i) }\n value\n end", "def my_select\n if block_given?\n arr = Array.new\n self.my_each do |x|\n if yield x\n arr << x\n end\n end\n arr\n else\n self.to_enum\n end\n end", "def my_select(parameter = nil)\n arr = []\n if block_given?\n my_each { |value| arr.push(value) if yield(value) }\n elsif parameter.nil?\n return Enumerator.new(arr)\n else\n my_each { |value| arr.push(value) if parameter.call(value) }\n end\n arr\n end", "def select!\n return enum_for(:select!) if not block_given?\n each { |n| remove(n) if not yield n }\n self\n end", "def select(&block)\n @_componentable_container.select(&block)\n end", "def select(&blk); end", "def getSelectedItems\r\n assert_exists\r\n returnArray = []\r\n #element.log \"There are #{@o.length} items\"\r\n @o.each do |thisItem|\r\n #puts \"#{thisItem.selected}\"\r\n if thisItem.selected\r\n #element.log \"Item ( #{thisItem.text} ) is selected\"\r\n returnArray << thisItem.text \r\n end\r\n end\r\n return returnArray \r\n end", "def select_from(list, &instructions)\n list.map do |item|\n if instructions.call(item)\n item\n end\n end.compact\nend", "def selected_values &block\n ar = []\n selected_rows().each do |i|\n val = @list[i]\n if block_given?\n yield val\n else\n ar << val\n end\n end\n return ar unless block_given?\n end", "def selected\r\n #TODO: find a way to not need to expand and collapse before getting the selected item\r\n expand_combo\r\n collapse_combo\r\n #get_selection.first\r\n get_selection.first\r\n end", "def select!\n return Enumerator.new(self, :select!) unless block_given?\n\n set_hash.each do |regexp, hash|\n hash.delete_if { |key, val| !yield(key, val) }\n end\n end", "def select(&block)\n self.class.new @members.select(&block)\n end", "def select(used, &block)\n candidates = find_candidates(used) # In subclasses\n if block_given?\n yield(candidates)\n else\n candidates[rand(candidates.size)]\n end\n end", "def select\n # new_list = TodoList.new(\"Selected Todos\")\n new_list = TodoList.new(title) # should probably keep the original title\n self.each do |todo| # don't need to use 'self.each' here (just use 'each')\n new_list.add(todo) if yield(todo)\n end\n new_list # rtn a TodoList obj\n end", "def my_select(collection)\n new_collection = [] #create new empty array\n i = 1 #counter variable i set to 1 (not 0, which is even)\n while i < collection.length #start while loop, execute code below as long as i is less than the length of the array\n (new_collection << i) if i.even? # each number gets appended to new_collection that is even\n i = i + 1 #increment value of i variable\n end #end do loop\n new_collection #return new_collection array\nend", "def items\n items = []\n @collection.each_with_index do |item, index|\n if index == @current && index == @selected\n items << [true, true, item]\n\n elsif index == @current\n items << [false, true, item]\n\n elsif index == @selected\n items << [true, false, item]\n\n else\n items << [false, false, item]\n\n end\n end\n items\n end", "def select_all\n buffer_current.select_all\n end", "def chosen\n the_set = []\n self.itemlist.each { |k,v| the_set << self.object(k).chosen }\n the_set\n end", "def select\n C.curry.(\n ->(f, xs) {\n _f = ->(acc, x) {\n f.(x) == true ? concat.(acc, [x]) : acc\n }\n\n C.fold.([], _f, xs)\n }\n )\n end", "def return_quantity_selection\n\n iterations = self.quantity_available\n\n quantity_options = []\n\n iterations.times do |number|\n quantity_options << number + 1\n end\n\n return quantity_options\n end", "def select_list; end", "def select(&blk)\n alter do\n @lines = @lines.select(&blk)\n end\n end", "def select(numbers)\r\nreturn numbers.select { |x| x < 5 }\r\nend", "def [](sel); end", "def items\n load_selection\n import_selection or render_select\n end", "def select(collection_of_people, num)\n result = []\n collection_of_people.map do |age|\n result << age if age > num\n end\n return result\nend", "def do_select(opts, &block)\n\n skip = opts[:offset] || opts[:skip]\n limit = opts[:limit]\n count = opts[:count]\n\n hwis = fetch_all({})\n hwis = hwis.select(&block)\n\n hwis = hwis[skip..-1] if skip\n hwis = hwis[0, limit] if limit\n\n return hwis.size if count\n\n hwis.collect { |hwi| Ruote::Workitem.new(hwi) }\n end", "def my_select\n return self unless block_given?\n\n result = self.class.new\n\n if is_a? Array\n my_each { |val| result.push(val) if yield(val) }\n elsif is_a? Hash\n my_each { |key, val| result[key] = val if yield(key, val) }\n else\n warn 'Incompatible type!'\n end\n result\n end", "def selection\n @tg.clear\n s1_temp = -1\n s2_temp = -1\n s1_temp = @ep.sample(@ss).max until s1_temp != -1\n s2_temp = @ep.sample(@ss).max until s2_temp != -1\n @s1 = @ep.index(s1_temp)\n @s2 = @ep.index(s2_temp)\n @tg[@s1] = @cg[@s1]\n @tg[@s2] = @cg[@s2]\n end", "def select_nodes(&block)\n each_node.select &block\n end", "def test_0275_select\n @@log.debug \"test_0275_select starts\" if @@log.debug?\n assert_respond_to(@list, :select, \"test_0275_select_respond\")\n # Basic select check\n ta = @list.select {|obj| obj.first <= \"Bob\" }\n assert_equal([@aen, @bsb], ta, \"test_0275_select_eq01\")\n # Check Enumerator or Enumerable::Enumerator return, no block given\n new_list = @list.select\nif RUBY_VERSION >= \"1.9\"\n result = new_list.is_a? Enumerator\n assert(result, \"test_0275_select_enumcheck\")\nelse\n # Note: the author's version of the 1.8 Pickaxe documents this\n # as an Array. Note however that this form is not documented by\n # that publication at all.\n # YMMV.\n result = new_list.is_a? Enumerable::Enumerator\n assert(result, \"test_0275_select_enumenumcheck\")\nend\n @@log.debug \"test_0275_select ends\" if @@log.debug?\n end", "def select(&block)\n alter do\n @lines = @lines.select(&block)\n end\n end", "def get_selected_indices; @selected_indices; end", "def test_array_select\n a = [2, 5, 2, 2, 3]\n num = a.select {|n| n == 1}\n assert_equal([], num)\n end", "def selected_item\n return (self.index < 0 ? nil : @data[self.index])\n end", "def selected_item\n return (self.index < 0 ? nil : @data[self.index])\n end", "def selected_item\n return (self.index < 0 ? nil : @data[self.index])\n end", "def selected; end", "def selector(array)\n array.sample\n end", "def select(*args)\n @results = nil\n except(:select)\n @builder = builder.select(*args)\n self\n end", "def select(&block)\n append(Filter.new(&block))\n end" ]
[ "0.78333724", "0.7656714", "0.74749136", "0.7465597", "0.7375105", "0.7368831", "0.73671216", "0.7361724", "0.7281646", "0.7267998", "0.7226581", "0.71985614", "0.71862906", "0.71840125", "0.7170346", "0.7160385", "0.71523285", "0.7138043", "0.71304107", "0.7115363", "0.70727074", "0.7039827", "0.7034233", "0.7020792", "0.70161974", "0.700088", "0.6995357", "0.6966379", "0.6959276", "0.6840976", "0.6822035", "0.68008286", "0.6747121", "0.6732833", "0.67156637", "0.67069405", "0.66754574", "0.66561866", "0.66561866", "0.6636193", "0.66232383", "0.65982807", "0.6570336", "0.65505993", "0.65303123", "0.64904076", "0.6473341", "0.6471856", "0.64489686", "0.64233524", "0.64194417", "0.64194417", "0.6361845", "0.63408905", "0.6299737", "0.6286902", "0.6255908", "0.62349004", "0.62194127", "0.61417055", "0.6136478", "0.61334026", "0.6099473", "0.6094354", "0.6073759", "0.6065666", "0.6060527", "0.6013894", "0.6000522", "0.59873956", "0.5987258", "0.59868026", "0.59785944", "0.5942476", "0.5929456", "0.5914905", "0.59120715", "0.5905998", "0.59029865", "0.5890308", "0.58897066", "0.58896375", "0.58878225", "0.5882339", "0.5872787", "0.5850322", "0.5847837", "0.58088166", "0.579863", "0.5796741", "0.5792177", "0.57774276", "0.57723886", "0.5764553", "0.5764553", "0.5764553", "0.57618904", "0.5761226", "0.5741994", "0.5741418" ]
0.63060445
54
Kill off the ability for recursive conversion
def deep_update(other_hash) other_hash.each_pair do |k,v| key = convert_key(k) regular_writer(key, convert_value(v, true)) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert!; end", "def recursive => nil", "def convert(tree, options = T.unsafe(nil)); end", "def normalize!; end", "def convert\n end", "def convert\n end", "def stop_casting(name); end", "def shouldConvert()\n\t\tfalse\n\tend", "def normalizer; end", "def shouldConvert\n false\n end", "def transform; end", "def flatten!() end", "def normalize; end", "def converter; end", "def convert(object); end", "def unnormalized; end", "def do_conversion!(*args)\n raise NotImplementedError\n end", "def flatten!\n # buggerit\n raise NotImplementedError\n end", "def normalize!\n end", "def deconvert\n # release magic!\n eval(abstract_object[:_magic])\n end", "def transform(tree); end", "def normalize!\n nil\n end", "def convert_children\n children.map {|ch| convert ch }.compact\n end", "def normalize!\n end", "def scrubbed\n end", "def convertUnits(el, parentMap, childMap, allIds)\n id = el[:id] || el[:ref] || \"root\"\n allIds << id\n #puts \"name=#{el.name} id=#{id.inspect} name=#{el[:label].inspect}\"\n\n # Create or update the main database record\n if el.name != \"ref\"\n puts \"Converting unit #{id}.\"\n unitType = id==\"root\" ? \"root\" : id==\"lbnl\" ? \"campus\" : el[:type]\n Unit.update_or_replace(id,\n type: unitType,\n name: id==\"root\" ? \"eScholarship\" : el[:label],\n status: el[:directSubmit] == \"moribund\" ? \"archived\" :\n el[:hide] == \"eschol\" ? \"hidden\" :\n \"active\"\n )\n\n # We can't totally fill in the brand attributes when initially inserting the record,\n # so do it as an update after inserting.\n attrs = {}\n el[:directSubmit] and attrs[:directSubmit] = el[:directSubmit]\n el[:hide] and attrs[:hide] = el[:hide]\n attrs.merge!(convertUnitBrand(id, unitType))\n Unit[id].update(attrs: JSON.generate(attrs))\n\n addDefaultWidgets(id, unitType)\n end\n\n # Now recursively process the child units\n UnitHier.where(unit_id: id).delete\n el.children.each { |child|\n if child.name != \"allStruct\"\n id or raise(\"id-less node with children\")\n childID = child[:id] || child[:ref]\n childID or raise(\"id-less child node\")\n parentMap[childID] ||= []\n parentMap[childID] << id\n childMap[id] ||= []\n childMap[id] << childID\n end\n convertUnits(child, parentMap, childMap, allIds)\n }\n\n # After traversing the whole thing, it's safe to form all the hierarchy links\n if el.name == \"allStruct\"\n puts \"Linking units.\"\n linkUnit(\"root\", childMap, Set.new)\n\n # Delete extraneous units from prior conversions\n deleteExtraUnits(allIds)\n end\nend", "def flatten!\n nil\n end", "def recursive_solution\n\n end", "def flatten() end", "def process(el, do_conversion = T.unsafe(nil), preserve_text = T.unsafe(nil), parent = T.unsafe(nil)); end", "def fix_boolean(node)\n node.children.map! do |child|\n if child.is_a?(AST::Node) &&\n child.type == :coerce_b\n child.children.first\n else\n child\n end\n end\n end", "def convert\n raise NotImplementedError\n end", "def transformations; end", "def dematerialize ; end", "def converters=(_arg0); end", "def transformation\n end", "def convert_binary\n end", "def fix_numerals\n hash = self.clone\n traverse hash\n hash\n end", "def normalize; self.dup.normalize!; end", "def transform!(transform)\n end", "def transform!(transform)\n end", "def my_flatten!\n self.replace(my_flatten)\n end", "def normalize\n end", "def flatten!\n self.replace(flatten)\n end", "def convertAllUnits\n # Let the user know what we're doing\n puts \"Converting units.\"\n startTime = Time.now\n\n # Load allStruct and traverse it. This will create Unit and Unit_hier records for all units,\n # and delete any extraneous old ones.\n DB.transaction do\n allStructPath = \"/apps/eschol/erep/xtf/style/textIndexer/mapping/allStruct.xml\"\n open(allStructPath, \"r\") { |io|\n convertUnits(Nokogiri::XML(io, &:noblanks).root, {}, {}, Set.new)\n }\n end\nend", "def transforms; end", "def convert!\n # Fonts and headings\n semanticize_font_styles!\n semanticize_headings!\n\n # Tables\n remove_paragraphs_from_tables!\n semanticize_table_headers!\n\n # list items\n remove_paragraphs_from_list_items!\n remove_unicode_bullets_from_list_items!\n remove_whitespace_from_list_items!\n remove_numbering_from_list_items!\n end", "def to_recursive\n self\n end", "def ignores; end", "def ignore_parent_exclusion=(_arg0); end", "def normalize!\n new_contents = []\n @contents.each{|c|\n if c.is_a? String\n next if c == \"\"\n if new_contents[-1].is_a? String\n new_contents[-1] += c\n next\n end\n else\n c.normalize!\n end\n new_contents.push c\n }\n @contents = new_contents\n end", "def converters; end", "def converters; end", "def converters; end", "def safe_dump_recurse(object, limit = @limit, objects = default_objects)\n\t\t\t\tif limit <= 0 || objects[object]\n\t\t\t\t\treturn replacement_for(object)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tcase object\n\t\t\t\twhen Hash\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\tobject.to_h do |key, value|\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tString(key).encode(@encoding, invalid: :replace, undef: :replace),\n\t\t\t\t\t\t\tsafe_dump_recurse(value, limit - 1, objects)\n\t\t\t\t\t\t]\n\t\t\t\t\tend\n\t\t\t\twhen Array\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\tobject.map do |value|\n\t\t\t\t\t\tsafe_dump_recurse(value, limit - 1, objects)\n\t\t\t\t\tend\n\t\t\t\twhen String\n\t\t\t\t\tobject.encode(@encoding, invalid: :replace, undef: :replace)\n\t\t\t\twhen Numeric, TrueClass, FalseClass, NilClass\n\t\t\t\t\tobject\n\t\t\t\telse\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\t# We could do something like this but the chance `as_json` will blow up.\n\t\t\t\t\t# We'd need to be extremely careful about it.\n\t\t\t\t\t# if object.respond_to?(:as_json)\n\t\t\t\t\t# \tsafe_dump_recurse(object.as_json, limit - 1, objects)\n\t\t\t\t\t# else\n\t\t\t\t\t\n\t\t\t\t\tsafe_dump_recurse(object.to_s, limit - 1, objects)\n\t\t\t\tend\n\t\t\tend", "def ignore_parent_exclusion; end", "def demolish\n @children.each_value(&:demolish)\n end", "def clear_ruby_converters\n @ruby_converters = []\n end", "def normalize!\n self.replace self.normalize\n end", "def convert(*args)\n raise NoMethodError.new('convert')\n end", "def _recursively_flatten_to!(array, out)\n array.each do |o|\n if NodeList === o\n _recursively_flatten_to!(o.nodes, out)\n elsif o.respond_to?(:to_ary)\n ary = Array === o ? o : o.to_ary\n _recursively_flatten_to!(ary, out)\n else\n out << o\n end\n end\n end", "def strict_value_coercions; end", "def topping; end", "def convert(content); end", "def convert(content); end", "def simplify; self; end", "def flatten\n raise\n end", "def inversed=(_arg0); end", "def to_recursive\n self\n end", "def normalize!\n normalize self\n end", "def should_convert?\n !dumped_ids.include?(abstract_object.object_id)\n end", "def convert(number)\n drops = drops(number)\n#Here the check and return if no drop is get. As the test request \n drops.empty? ? number.to_s : drops\n end", "def check_marshallable(object, stack = ValueSet.new)\n if !object.kind_of?(DRbObject) && object.respond_to?(:each) && !object.kind_of?(String)\n if stack.include?(object)\n Distributed.warn \"recursive marshalling of #{obj}\"\n raise \"recursive marshalling\"\n end\n\n stack << object\n begin\n object.each do |obj|\n marshalled = begin\n check_marshallable(obj, stack)\n rescue Exception\n raise TypeError, \"cannot dump #{obj}(#{obj.class}): #{$!.message}\"\n end\n\n \n if Marshal.load(marshalled).kind_of?(DRb::DRbUnknown)\n raise TypeError, \"cannot load #{obj}(#{obj.class})\"\n end\n end\n ensure\n stack.delete(object)\n end\n end\n Marshal.dump(object)\n end", "def convert\n original = __getobj__.to_s\n\n unless irregular_number?( __getobj__ )\n # Split up the number into triplets\n trios_reverse = create_reversed_grouped_numbers( original )\n\n # Generate the number based on the triplets\n multi_triplet = trios_reverse.length > 1\n result = []\n trios_reverse.each_with_index do |e, factor|\n result << (convert_triplet( e, factor, multi_triplet ) + ' ' + MEGA[factor]).strip\n end\n\n # And finaly join the triplets in the correct order\n result.reverse.join ' '\n else\n convert_irregular_number( original )\n end\n end", "def post_process_kramdown_tree!(kramdown_tree)\n # override this to post process elements in the kramdown tree\n # NOTE: It's important to call the methods below for correct results.\n # You have two options:\n # 1. call super if you override this method\n # 2. copy the methods below into your own method if you need different sequence\n recursively_process_temp_em_class!(kramdown_tree, 'tmpNoBold')\n recursively_process_temp_em_class!(kramdown_tree, 'tmpNoItalics')\n recursively_merge_adjacent_elements!(kramdown_tree)\n recursively_clean_up_nested_ems!(kramdown_tree) # has to be called after process_temp_em_class\n recursively_push_out_whitespace!(kramdown_tree)\n # needs to run after whitespace has been pushed out so that we won't\n # have a leading \\t inside an :em that is the first child in a para.\n # After whitespace is pushed out, the \\t will be a direct :text child\n # of :p and first char will be easy to detect.\n recursively_sanitize_whitespace_during_import!(kramdown_tree)\n # merge again since we may have new identical siblings after all the\n # other processing.\n recursively_merge_adjacent_elements!(kramdown_tree)\n recursively_clean_up_tree!(kramdown_tree)\n # Run this again since we may have new locations with leading or trailing whitespace\n recursively_sanitize_whitespace_during_import!(kramdown_tree)\n # merge again since we may have new identical siblings after cleaning up the tree\n # e.g. an italic span with whitespace only between two text nodes was removed.\n recursively_merge_adjacent_elements!(kramdown_tree)\n end", "def transform\n end", "def canonicize!\n complement! if !canonical?\n end", "def flatten\n # strip & remove the space surrounding '/'\n str = strip.gsub(%r{\\s*\\/\\s*}, '/')\n return str unless str.include? '/'\n return f_semicolon(str) if str.include?(';')\n return f_parenthese(str) if str.include? '('\n f_convert(str)\n end", "def convert!\n @output = convert\n self\n end", "def recurse(zipper, acc)\n if zipper.node.simple? or zipper.node.component?\n if zipper.node.invalid?\n if zipper.node.date?\n acc.ik403(zipper, \"R\", \"8\", \"is not a valid date\")\n elsif zipper.node.time?\n acc.ik403(zipper, \"R\", \"8\", \"is not a valid time\")\n elsif zipper.node.numeric?\n acc.ik403(zipper, \"R\", \"6\", \"is not a valid number\")\n else\n acc.ik403(zipper, \"R\", \"6\", \"is not a valid string\")\n end\n elsif zipper.node.blank?\n if zipper.node.usage.required?\n acc.ik403(zipper, \"R\", \"1\", \"must be present\")\n end\n elsif zipper.node.usage.forbidden?\n acc.ik403(zipper, \"R\", \"I10\", \"must not be present\")\n elsif not zipper.node.allowed?\n acc.ik403(zipper, \"R\", \"7\", \"is not an allowed value\")\n elsif zipper.node.too_long?\n acc.ik403(zipper, \"R\", \"5\", \"is too long\")\n elsif zipper.node.too_short?\n acc.ik403(zipper, \"R\", \"4\", \"is too short\")\n end\n\n elsif zipper.node.composite?\n if zipper.node.blank?\n if zipper.node.usage.required?\n acc.ik403(zipper, \"R\", \"1\", \"must be present\")\n end\n elsif zipper.node.usage.forbidden?\n acc.ik403(zipper, \"R\", \"I10\", \"must not be present\")\n else\n if zipper.node.present?\n zipper.children.each{|z| recurse(z, acc) }\n\n d = zipper.node.definition\n d.syntax_notes.each do |s|\n zs = syntax_note_errors(s, zipper)\n ex = s.reason(zipper) if zs.present?\n zs.each{|c| acc.ik403(c, \"R\", \"2\", ex) }\n end\n end\n end\n\n elsif zipper.node.repeated?\n zipper.children.each{|z| recurse(z, acc) }\n\n elsif zipper.node.segment?\n if zipper.node.valid?\n zipper.children.each do |element|\n recurse(element, acc)\n end\n\n zipper.node.definition.tap do |d_|\n d_.syntax_notes.each do |s|\n es = syntax_note_errors(s, zipper)\n ex = s.reason(zipper) if es.present?\n es.each{|c| acc.ik403(c, \"R\", \"2\", ex) }\n end\n end\n else\n acc.ik304(zipper, \"R\", \"2\", \"unexpected segment\")\n end\n\n elsif zipper.node.loop?\n group = Hash.new{|h,k| h[k] = [] }\n\n zipper.children.each do |child|\n # Child is either a segment or loop\n recurse(child, acc)\n\n if child.node.loop?\n group[child.node.definition] << child\n elsif child.node.valid?\n group[child.node.usage] << child\n end\n end\n\n # Though we're iterating the definition tree, we need to track\n # the last location before a required child was missing.\n last = zipper\n\n zipper.node.definition.children.each do |child|\n repeat = child.repeat_count\n matches = group.at(child)\n\n if matches.blank? and child.required?\n if child.loop?\n acc.ik304(last, \"R\", \"I7\", \"missing #{child.id} loop\")\n else\n acc.ik304(last, \"R\", \"3\", \"missing #{child.id} segment\")\n end\n elsif repeat < matches.length\n matches.drop(repeat.max).each do |c|\n if child.loop?\n acc.ik304(c, \"R\", \"4\", \"loop occurs too many times\")\n else\n acc.ik304(c, \"R\", \"5\", \"segment occurs too many times\")\n end\n end\n end\n\n last = matches.last unless matches.blank?\n end\n\n elsif zipper.node.table?\n group = Hash.new{|h,k| h[k] = [] }\n\n zipper.children.each do |child|\n # Child is either a segment or loop\n recurse(child, acc)\n\n if child.node.loop?\n group[child.node.definition] << child\n elsif child.node.valid?\n group[child.node.usage] << child\n end\n end\n\n # Though we're iterating the definition tree, we need to track\n # the last location before a required child was missing.\n last = zipper\n\n zipper.node.definition.children.each do |child|\n matches = group.at(child)\n repeat = child.repeat_count\n\n if matches.blank? and child.required?\n if child.loop?\n acc.ik304(last, \"R\", \"I7\", \"missing #{child.id} loop\")\n else\n acc.ik304(last, \"R\", \"3\", \"missing #{child.id} segment\")\n end\n elsif repeat < matches.length\n matches.drop(repeat.max).each do |c|\n if child.loop?\n acc.ik304(c, \"R\", \"4\", \"loop occurs too many times\")\n else\n acc.ik304(c, \"R\", \"5\", \"segment occurs too many times\")\n end\n end\n end\n\n last = matches.last unless matches.blank?\n end\n\n elsif zipper.node.transaction_set?\n group = Hash.new{|h,k| h[k] = [] }\n\n zipper.children.each do |table|\n recurse(table, acc)\n group[table.node.definition] << table\n end\n\n zipper.node.definition.tap do |d_|\n d_.table_defs.each do |table|\n # @todo: How do we know which tables are required? It isn't\n # obvious because some tables have more than one entry segment,\n # and perhaps each has a different requirement designator.\n end\n end\n end\n end", "def rubyversed (obj); @template.rubyversed(obj); end", "def ascii_tree; end", "def no_circular_reference\n\n end", "def maybe_convert_extension(ext); end", "def recursively_flatten_finite(array, out, level)\n ret = nil\n if level <= 0\n out.concat(array)\n else\n array.each do |o|\n if ary = Backports.is_array?(o)\n recursively_flatten_finite(ary, out, level - 1)\n ret = self\n else\n out << o\n end\n end\n end\n ret\n end", "def recursively_flatten_finite(array, out, level)\n ret = nil\n if level <= 0\n out.concat(array)\n else\n array.each do |o|\n if ary = Backports.is_array?(o)\n recursively_flatten_finite(ary, out, level - 1)\n ret = self\n else\n out << o\n end\n end\n end\n ret\n end", "def __convert(key); end", "def conversion_variable\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 15 )\n\n\n return_value = ConversionVariableReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __K_CONVERSION72__ = nil\n __LPAR73__ = nil\n __Identificador74__ = nil\n __RPAR76__ = nil\n __EOL77__ = nil\n var_local75 = nil\n\n\n tree_for_K_CONVERSION72 = nil\n tree_for_LPAR73 = nil\n tree_for_Identificador74 = nil\n tree_for_RPAR76 = nil\n tree_for_EOL77 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 91:4: K_CONVERSION LPAR ( Identificador | var_local ) RPAR EOL\n __K_CONVERSION72__ = match( K_CONVERSION, TOKENS_FOLLOWING_K_CONVERSION_IN_conversion_variable_379 )\n if @state.backtracking == 0\n tree_for_K_CONVERSION72 = @adaptor.create_with_payload( __K_CONVERSION72__ )\n @adaptor.add_child( root_0, tree_for_K_CONVERSION72 )\n\n end\n\n __LPAR73__ = match( LPAR, TOKENS_FOLLOWING_LPAR_IN_conversion_variable_381 )\n if @state.backtracking == 0\n tree_for_LPAR73 = @adaptor.create_with_payload( __LPAR73__ )\n @adaptor.add_child( root_0, tree_for_LPAR73 )\n\n end\n\n # at line 91:22: ( Identificador | var_local )\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0 == Identificador )\n alt_9 = 1\n elsif ( look_9_0 == DOUBLEDOT )\n alt_9 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n\n\n raise NoViableAlternative( \"\", 9, 0 )\n\n end\n case alt_9\n when 1\n # at line 91:23: Identificador\n __Identificador74__ = match( Identificador, TOKENS_FOLLOWING_Identificador_IN_conversion_variable_384 )\n if @state.backtracking == 0\n tree_for_Identificador74 = @adaptor.create_with_payload( __Identificador74__ )\n @adaptor.add_child( root_0, tree_for_Identificador74 )\n\n end\n\n\n when 2\n # at line 91:37: var_local\n @state.following.push( TOKENS_FOLLOWING_var_local_IN_conversion_variable_386 )\n var_local75 = var_local\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, var_local75.tree )\n end\n\n\n end\n __RPAR76__ = match( RPAR, TOKENS_FOLLOWING_RPAR_IN_conversion_variable_389 )\n if @state.backtracking == 0\n tree_for_RPAR76 = @adaptor.create_with_payload( __RPAR76__ )\n @adaptor.add_child( root_0, tree_for_RPAR76 )\n\n end\n\n __EOL77__ = match( EOL, TOKENS_FOLLOWING_EOL_IN_conversion_variable_391 )\n if @state.backtracking == 0\n tree_for_EOL77 = @adaptor.create_with_payload( __EOL77__ )\n @adaptor.add_child( root_0, tree_for_EOL77 )\n\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 15 )\n\n\n end\n\n return return_value\n end", "def lenient_value_coercions; end", "def process_tree_with_renew\n @process_tree = nil\n process_tree\n end", "def ignore_parent_exclusion?; end", "def break_types!(types)\n self.each_node do |node|\n # Need to break only in the case of a cast.\n if node.is_a?(Cast) then\n node.type.break_types!(types)\n end\n end\n end", "def inversed; end", "def rescan\n\n roots = MissingTypes::missing_roots\n types = MissingTypes::missing_types\n\n types.each_with_index do |missing, i|\n\n # if missing type itself contains missing items, we need to fix that root first !\n next if(MissingTypes::missing_root_key?( missing.type ) )\n\n # Clone missing type nodes as children of the composer.\n # TODO - Right now, flag no update MissingTypes and delete it from types regardless\n # if found or not to stop infinite recursion when Type never defined !\n # this is because we only check in memory - the single read_from_xsd,\n # so need better persistent mechanism to flag missing types to enable rescan\n # after another file read\n #\n clone_or_share_existing( missing.type, missing.composer, false)\n \n types.delete_at(i)\n\n # Decrement the missing root count, and delete all together once no nodes left\n roots.delete_if { |k,v| roots[k] = roots[k] - 1 if(k == missing.root); roots[k] == 0 }\n end \n \n # Try to ensure infinite loop not possible\n rescan unless(roots.nil? || roots.empty? || types.nil? || types.empty?)\n end", "def normalise!(tree)\n tree.each.with_index do |node, i|\n if node.is_a?(Array)\n if node.first == :loop && tree[i+1]\n key = tree[i+1][0]\n if key == :block\n tree[i+1][0] = :lblock\n elsif key == :query # wrap queries like `c.each(&:destroy)` \n tree[i+1] = [:lblock, tree[i+1]]\n end\n end\n tree[i] = normalise!(node)\n end\n end\n tree\n end", "def convert_to_base_8(n)\r\n #n.method_name.method_name # replace these two method calls\r\n n.to_s(8).to_i\r\nend", "def deconvert\n result = []\n yield result\n array.each do |converted_item|\n result << UniversalDumper.deconvert(converted_item)\n end\n result\n end", "def ignore_encoding_error=(_arg0); end", "def fix_encoding!(thing)\n case thing\n when Net::LDAP::Entry\n thing.each_attribute do |k|\n fix_encoding!(thing[k])\n end\n when Hash\n thing.each_pair do |k, v|\n thing[k] = fix_encoding!(v)\n end\n when Array\n thing.collect! do |v|\n fix_encoding!(v)\n end\n when String\n sanitize_utf8(thing)\n end\n end", "def converted_arrays; end", "def converter\n end" ]
[ "0.6794795", "0.6213863", "0.578648", "0.56332576", "0.5609805", "0.5609805", "0.5574148", "0.5563094", "0.5555391", "0.54968554", "0.54897976", "0.54874873", "0.54529744", "0.5439778", "0.5401186", "0.53278136", "0.53083485", "0.5303176", "0.52817994", "0.5265869", "0.52171177", "0.52127534", "0.5199994", "0.5191422", "0.51835287", "0.5143693", "0.51350546", "0.5133272", "0.51133215", "0.5106857", "0.5106733", "0.5095347", "0.50950897", "0.5093104", "0.5089498", "0.5088407", "0.50635916", "0.5057025", "0.50370955", "0.50095016", "0.50095016", "0.50078446", "0.50071067", "0.50028455", "0.49985465", "0.49969766", "0.49921796", "0.49780214", "0.49706048", "0.49659088", "0.49308556", "0.4929759", "0.4929759", "0.4929759", "0.4929685", "0.49291426", "0.49207255", "0.49117342", "0.49086607", "0.48923093", "0.4892296", "0.48666847", "0.486267", "0.48588178", "0.48588178", "0.48527566", "0.48371387", "0.48367405", "0.48326066", "0.48276156", "0.4823691", "0.48226124", "0.48205033", "0.4816256", "0.4815206", "0.4814657", "0.48106295", "0.48085475", "0.48040244", "0.4802743", "0.48023438", "0.48022977", "0.48017618", "0.47908574", "0.47838148", "0.47838148", "0.47807845", "0.47790286", "0.47669372", "0.4760944", "0.47597498", "0.47587636", "0.47489756", "0.4741302", "0.47364563", "0.47330117", "0.47311738", "0.4721916", "0.47217122", "0.47209835", "0.47200638" ]
0.0
-1
las variables fuera de las clases van con $ sin signo las variables son locales
def MostrarMenu() puts "Bienvenido a la calculadora" puts "Por favor seleccion el calculo que desea hacer" @opcion hola = "hola" << " y chau" #print hola # hola.each_char{|c| print c #print "letra\n" #todo lo que va a aca es parte del each, se puede agregar codigo #con \n hago el salto d linea #} #hola = hola.center(40) #print hola #la funcion center lo que hace #es extender la cantidad de caracteres de un string. si tiene menos queda igual, si tiene mas lo que hace es agregar espacios al rededor. Se lepuede agregar un texto para que aparezca a los costados hola = hola.center(20, "-----") print hola << "\n" nro = 12 if nro > 20 #puts "es otra forma de imprimir texto" else puts "pasa por else" end if not nro > 20 puts "para negar se utiliza la palabra not" puts "para and se utiliza la palabra and" #nro1 == 1 and nro2 == 2 #tambien se puede usar unless que es lo mismo que if not puts "para or se utiliza la palabra or" #nro1 == 1 or nro2 == 2 end #ciclo for for i in (1..10) puts i #el puts imprime el salto de linea #next es el break #para repetir se puede usar redo if i == 2 # redo end end puts *(1..10) #esto va a imprimir del i al 10 #operador when es similar al switch case edad = 2 case edad when 0..11 then print "esta entre 0 y 11" when 12..22 then print "esta entre 12 y 22" #para finalizar el case uso un end else print "hace otra cosa" end gets() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_variables\n @countries = Country.sorted\n @time_periods = TimePeriod.sorted\n\n @locales = []\n I18n.available_locales.sort.each do |locale|\n @locales << [I18n.t(\"shared.locale.long.#{locale}\"), locale]\n end\n end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def locale; end", "def translations; end", "def locale=(_arg0); end", "def apply_locale; end", "def global_vars\n @title = 'Wytwarzanie Pomocy Dydaktycznych: Pomoce dydaktyczne, szkolne i naukowe dla przedszkoli szkoł'\n @desription = ''\n @keywords = 'pomoce dydaktyczne, pomoce szkolne, pomoce naukowe, pomoce dydaktyczne dla szkół, pomoce dydaktyczne dla przedszkoli, radosna szkoła, Wytwarzanie Pomocy Dydaktycznych, wpd, wpd.pl'\n end", "def lang=(_arg0); end", "def lang=(_arg0); end", "def myConstructor\n @language = \"EN\"\n end", "def initialize(args)\n super\n @languages = {\"af\" => \"Afrikaans\", \"sq\" => \"Albanian\",\n \"ar\"=>\"Arabic\",\"be\"=>\"Belarusian\",\"bg\"=>\"Bulgarian\",\"ca\"=>\"Catalan\",\"zh-CN\"=>\"Simplified Chinese\",\n \"zh-TW\"=>\"Traditional Chinese\",\"hr\"=>\"Croatian\",\"cs\"=>\"Czech\",\"da\"=>\"Danish\",\"nl\"=>\"Dutch\",\"en\"=>\"English\",\n \"et\"=>\"Estonian\",\"tl\"=>\"Filipino\",\"fi\"=>\"Finnish\",\"fr\"=>\"French\",\"gl\"=>\"Galician\",\"de\"=>\"German\",\"el\"=>\"Greek\",\n \"iw\"=>\"Hebrew\",\"hi\"=>\"Hindi\",\"hu\"=>\"Hungarian\",\"is\"=>\"Icelandic\",\"id\"=>\"Indonesian\",\"ga\"=>\"Irish\",\"it\"=>\"Italian\",\n \"ja\"=>\"Japanese\",\"ko\"=>\"Korean\",\"lv\"=>\"Latvian\",\"lt\"=>\"Lithuanian\",\"mk\"=>\"Macedonian\",\"ms\"=>\"Malay\",\"mt\"=>\"Maltese\",\n \"no\"=>\"Norwegian\",\"fa\"=>\"Persian\",\"pl\"=>\"Polish\",\"pt\"=>\"Portuguese\",\"ro\"=>\"Romanian\",\"ru\"=>\"Russian\",\"sr\"=>\"Serbian\",\n \"sk\"=>\"Slovak\",\"sl\"=>\"Slovenian\",\"es\"=>\"Spanish\",\"sw\"=>\"Swahili\",\"sv\"=>\"Swedish\",\"th\"=>\"Thai\",\"tr\"=>\"Turkish\",\n \"uk\"=>\"Ukranian\",\"vi\"=>\"Vietnamese\",\"cy\"=>\"Welsh\",\"yi\"=>\"Yiddish\"}\n end", "def class_variables() end", "def translation\r\n translation_for(Mongoid::Globalize.locale)\r\n end", "def initialize(parametros)\n # En cada variable intanciada le asignamos un hash con la variable correspondiente\n @villano = parametros[:villano]\n @frase = parametros[:frase]\n end", "def gluck_french; end", "def customize_es_pr_dictionary(dict)\n dict.add('Alert')\n dict.add('Fahrenheit')\n dict.add('infórmeles')\n dict.add('intentemoslo')\n dict.add('ltr')\n dict.add('org')\n dict.add('oxímetro')\n dict.add('recordándole')\n dict.add('Sara')\n dict.add('saraalert')\n end", "def initialize myaso, language\n @myaso, @language = myaso, language\n end", "def lang; end", "def lang; end", "def lang; end", "def lang; end", "def available_translations\n {\n 'en' => 'English',\n 'es' => 'Español',\n 'pt-BR' => 'Português do Brasil'\n }\n end", "def init_translations; end", "def locale=(locale); end", "def locale_to_name\n \t\t{'fr' => 'Français',\n 'en' => 'English',\n 'po' => 'portugues',\n 'sp' => 'Spanish',\n 'de' => 'Deutsch',\n 'it' => 'Italiano'}\n\tend", "def translations_hash; end", "def default_locale; end", "def makena_classes_u_p_sym\n makena_classes_u.map{|a| a.underscore.pluralize.to_sym}\n end", "def variables\n @countries = [\"Australia\",\"Canada\",\"France\",\"Mexico\",\"Spain\",\"Norway\",\"Netherlands\",\"United States\"]\n @categories = [\"Art\",\"Music\",\"Film and Video\",\"Tech\",\"Dance\",\"Fashion\",\"Games\",\"Photography\",\"Theather\",\"Food\"]\n end", "def locale=(value); end", "def class_variables; end", "def as_ca_dollar; end", "def lang(orig); end", "def mozart_italian; end", "def translation_class\n const_get translation_class_name\n end", "def class_variables\n end", "def initialize(language)\n @lang = language\n end", "def translatable\n self._translatable[base_name]\n end", "def to_s\n #$\"#{nombre} #{pais}\"\n #%(#{nombre} #{pais})\n nombre\n end", "def localize(object, locale: T.unsafe(nil), format: T.unsafe(nil), **options); end", "def set_form_variables\n @articles = CriminalCode.all.includes(:articles).with_translations\n @tags = Tag.includes(:translations).order(:name)\n @prisons = Prison.includes(:translations).order(:name)\n\n gon.select_charges = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.charge', count: 999))\n gon.select_tags = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.tag', count: 999)) \n end", "def initialize()\n @mano = $sin_jugada\n end", "def format_fecha_conversion(fecha)\n unless fecha.to_s ==''\n\n if I18n.locale.to_s==\"es\" || I18n.locale.to_s==\"fr\" || I18n.locale.to_s==\"ar\" || I18n.locale.to_s==\"cs\" || I18n.locale.to_s==\"da\" || I18n.locale.to_s==\"de\" || I18n.locale.to_s==\"fi\" || I18n.locale.to_s==\"hu\" || I18n.locale.to_s==\"it\" || I18n.locale.to_s==\"ru\" || I18n.locale.to_s==\"nl\" || I18n.locale.to_s==\"pl\" || I18n.locale.to_s==\"pt\" || I18n.locale.to_s==\"sl\" || I18n.locale.to_s==\"sv\"\n fecha_busqueda = fecha[6,4].to_s + '-' + fecha[3,2].to_s + '-' + fecha[0,2].to_s\n elsif I18n.locale.to_s==\"ja\"\n fecha_busqueda = fecha[0,4].to_s + '-' + fecha[5,2].to_s + '-' + fecha[8,2].to_s\n else\n fecha_busqueda = fecha[6,4].to_s + '-' + fecha[0,2].to_s + '-' + fecha[3,2].to_s\n end\n\n else\n fecha_busqueda = \"\"\n end\n end", "def translated_month_names; end", "def hecho_en\n 'china'\n end", "def mongoize(object)\n { ::I18n.locale.to_s => type.mongoize(object) }\n end", "def localize\n helpers.localize\n end", "def available_locales; end", "def available_locales; end", "def verificar_locale\n \n end", "def gaceta\n %Q(gaceta #{publicacion} del #{I18n.l publicacion_fecha})\n end", "def available_locales=(locales); end", "def set_variables\n I18n.locale = MySettings.locale || I18n.default_locale\n\n @articles = Article.all\n @categories = Category.all\n @most_used_tags = ActsAsTaggableOn::Tag.most_used(10)\n end", "def initialize(nombre,edad) #--> se crean los metodos, y se inicializan para darles un valor al crear el objeto \n @nombre = nombre #-->la variable local nombre es asignada a la var. de instancia @nombre, al realizar esto cada instancia tendra un valor propio.\n @edad = edad #--> lo mismo para edad\n\nend", "def localize(object, **options); end", "def localize(object, **options); end", "def initialize(language = :english)\n @language = language\n end", "def substitutions\n subs = self.instance_variables\n subs.delete(config.format_key)\n subs.map { |s| s.to_s.gsub('@', '').to_sym }\n end", "def initialize(texto_portugues, texto_ingles)\n @texto_portugues = texto_portugues\n @texto_ingles = texto_ingles\n end", "def presentacion\n \"La marca del Ventilador es #{@marca}\"\n end", "def translations\n @translations ||= {}\n end", "def localize_instance_variables(code, ivars = code.scan(/@\\w+/).uniq.sort)\n ivars = ivars.map {|ivar| ivar.to_s[1..-1] }\n\n inits, finals = [], []\n ivars.each do |ivar|\n lvar = \"__#{ ivar }__\"\n inits << \"#{ lvar } = @#{ ivar }\"\n finals << \"@#{ ivar } = #{ lvar }\"\n end\n\n code = code.gsub(/@(#{ ivars * \"|\" })\\b/) { \"__#{ $1 }__\" }\n\n gen(\n \"begin\",\n indent(2, inits.join(\"\\n\")),\n indent(2, code),\n \"ensure\",\n indent(2, finals.join(\"\\n\")),\n \"end\",\n )\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def customize_fr_dictionary(dict)\n dict.add('Alert')\n dict.add('ltr')\n dict.add('org')\n dict.add('Other')\n dict.add('Sara')\n dict.add('saraalert')\n end", "def french_siret_number; end", "def _(key)\n#puts key.to_s + \" => \" + FLAVOUR[key.to_sym]\n FLAVOUR[key.to_sym] || key.to_s\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def localize(*args)\n I18n.localize(*args)\n end", "def create_local\n template \"config/locales/en.rb\", \"config/locales/#{class_name.underscore}.en.yml\"\n end", "def locale\n @locales = Ramaze::Tool::Localize.languages.map{ |lang|\n [\n Ramaze::Tool::Localize.localize('locale_menu_descrition', lang),\n Ramaze::Tool::Localize.localize('locale_name', lang),\n lang\n ]\n }\n end", "def integrate_locale_attributes \n self.class.locale_class_name.constantize.column_names.each{|key|\n attrs = self.attributes.keys\n if !attrs.include?(key) && !self.respond_to?(key)&&\n self.class.to_s.underscore+\"_id\" != key &&\n # except these keys\n ![\"id\",\"created_at\",\"updated_at\"].include?(key)\n self.class.class_eval <<-EOF\n \n def #{key}\n if locales.loaded?\n l = correct_locale\n l && l.#{key}\n else\n (current_locale || locales.first).#{key}\n end\n end\n EOF\n \n end\n }\n end", "def translated_in=(locales)\n self._locales = locales.map(&:to_sym)\n end", "def initialize (nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal)\n\t\t@nombre, @saturadas, @monoinsaturadas, @polinsaturadas, @azucares, @polialcoles, @almidon, @fibra, @proteinas, @sal = nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal\n\tend", "def as_us_dollar; end", "def set_locale\n end", "def localize(*args)\n I18n.localize *args\n end", "def localize(*args)\n I18n.localize *args\n end", "def word2\n return ($en_cz == 'Y') ? @czech : @english\n end", "def translate(field)\n super(\"#{@_i18n_scope}.#{field}\")\n end", "def prep_variables\n end", "def set_locale\n if cookies[:locale]\n # si hay una cookie en el navegador\n # traela y haz locale igual a esa variable\n locale = cookies[:locale]\n else\n # si no hay cookie en el navegador busca\n # en la respuesta del navegador el lenguaje\n # por defecto\n locale = extract_locale_from_accept_language_header\n end\n # Toma la variable locale de arriba y la vuelve\n # un simbolo\n I18n.locale = I18n.available_locales.include?(locale.strip.to_sym) ? locale.strip.to_sym : I18n.default_locale\n # crea una cookie con el simbolo\n cookies[:locale] = locale\n end", "def names\n [\n \"Charge de travail\" , #00\n \"Travail en groupe\" , #01\n \"Maths\" , #02\n \"Codage\" , #03\n \"Théorique\" , #04\n \"Technique\" , #05\n \"Satisfaction\" , #06\n \"Dur à valider\" , #07\n \"Fun\" , #08\n \"Pipo\" , #09\n \"Économie\" , #10\n \"fondamental\" , #11\n \"Difficile à suivre\" , #12\n \"Calcul\" , #13\n \"Professionalisant\" , #14\n \"Étendue du cours\" , #15\n \"Interactivité\" , #16\n \"Culture générale\" , #17\n ]\n end", "def use_i18n; end", "def lookup_chain = locale(true).lookup", "def available_locales\r\n ::LinguaFranca.available_locales\r\n end", "def t(...)\n I18n.t(...)\nend", "def getVariablesToInstantiate\n return {\n :ProjectUnixName => 'myproject'\n }\n end", "def cala\n @prueba = \"esto es una variable\"\n end", "def utf8_locale\n if params[:lang]\n cookies[:lang] = params[:lang]\n elsif cookies[:lang]\n params[:lang] = cookies[:lang]\n end\n I18n.locale = params[:lang]\n # TODO remove blood with Dean\n Dean.columns\n end", "def name_display\n self.name[I18n.locale]\n end", "def used_locales\r\n locales = globalize.stash.keys.concat(globalize.stash.keys).concat(translations.translated_locales)\r\n locales.uniq!\r\n locales\r\n end", "def formatta_locale(format)\n if defined? I18n\n I18n.l self, format: format\n else\n formattazione = strftime format\n formattazione\n .gsub(/January/i, \"Gennaio\")\n .gsub(/February/i, \"Febbraio\")\n .gsub(/March/i, \"Marzo\")\n .gsub(/April/i, \"Aprile\")\n .gsub(/May/i, \"Maggio\")\n .gsub(/June/i, \"Giugno\")\n .gsub(/July/i, \"Luglio\")\n .gsub(/August/i, \"Agosto\")\n .gsub(/September/i, \"Settembre\")\n .gsub(/October/i, \"Ottobre\")\n .gsub(/November/i, \"Novembre\")\n .gsub(/December/i, \"Dicembre\")\n end\n end", "def initialize(language)\r\n @lang = language\r\n end", "def initialize(language)\r\n @lang = language\r\n end", "def solicitudes_atrasadas\n end" ]
[ "0.63007", "0.59990424", "0.59990424", "0.59990424", "0.59990424", "0.59990424", "0.59990424", "0.59990424", "0.5946603", "0.5936303", "0.58379185", "0.57742393", "0.5765312", "0.5765312", "0.5734248", "0.5724293", "0.5696144", "0.5695971", "0.56837225", "0.5678516", "0.56455076", "0.56405467", "0.56072515", "0.56072515", "0.56072515", "0.56072515", "0.5514857", "0.55101717", "0.5481134", "0.547465", "0.5441297", "0.5414447", "0.5409234", "0.540191", "0.5392806", "0.5378251", "0.53778356", "0.53546023", "0.5338", "0.5332364", "0.53263783", "0.532576", "0.5325248", "0.5317858", "0.5304061", "0.53038186", "0.5301534", "0.529791", "0.52968377", "0.52945244", "0.52930605", "0.52898633", "0.5289471", "0.5289471", "0.5277414", "0.52728266", "0.5271296", "0.52693087", "0.52640516", "0.52637476", "0.52637476", "0.52610624", "0.5259744", "0.5257223", "0.52390623", "0.52356064", "0.52269083", "0.5220473", "0.52168787", "0.519536", "0.51930934", "0.5189231", "0.5189231", "0.5189231", "0.51699024", "0.5168333", "0.51654243", "0.51626515", "0.5161012", "0.51606065", "0.5160324", "0.5157287", "0.5157287", "0.51467055", "0.5144917", "0.514359", "0.5142563", "0.5137823", "0.51366925", "0.51361346", "0.5116284", "0.5108307", "0.51078176", "0.51058924", "0.5103072", "0.51026785", "0.5099266", "0.5098771", "0.50979304", "0.50979304", "0.5097661" ]
0.0
-1
GPS version Returns an array of projects that are similar if project exists
def project_exists if self.check_project_exists == true return (Project.select{ |proj| proj.project_type == self.project_type } && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.02), (self.street1.to_f + 0.02))} && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02 ))}) else return [] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def known_omnibus_projects\n # iterate through min/max versions for all product names\n # and collect the name for both versions\n projects = %w{ 0.0.0 1000.1000.1000 }.collect do |v|\n @version = v\n omnibus_project\n end\n # remove duplicates and return multiple known names or return the single\n # project name\n projects.uniq || projects\n end", "def check_project_exists\n\n # if latitude is within +/- 2 ten-thounsandths of another project's latitude it is the same\n (Project.select{ |proj| proj.project_type == self.project_type }.count > 0 && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.002), (self.street1.to_f + 0.002))}.count > 0 && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02))}.count > 0)\n end", "def projects\n map(&:projects).flatten.uniq.sort\n end", "def ring_projects\n @ring_projects ||= [\n ObsProject.new(\"#{name}#{RINGS_PREFIX}0-Bootstrap\", '0'),\n ObsProject.new(\"#{name}#{RINGS_PREFIX}1-MinimalX\", '1'),\n ObsProject.new(\"#{name}#{RINGS_PREFIX}2-TestDVD\", '2') ]\n end", "def check_projects\n # Nasledujici kod si vyzaduje urcitou pozornost a vysvetleni komentarem. Jeho smyslem je z pole @projects_current\n # odebrat vsechny projekty, ktere jsou jiz hotove (pocet odpracovanych dni je vetsi nebo roven poctu dni potrebnemu\n # k dokonceni projektu) a tyto projekty umistit do pomocneho pole currently_done.\n # V podmince bloku metody reject! vyuzivame toho, ze pokud jeste neni odpracovan dostatecny pocet dni, bude hned\n # prvni cast podminky vyhodnocena jako false a diky zkracenemu vyhodnocovani vyrazu se druha cast podminky vubec\n # neprovede. V pripade, ze uz je odpracovano dostatecne mnozstvi dni, pridani zkoumaneho projektu do currently_done\n # se provede a vyslednou hodnotou celeho bloku bude objekt currently_done samotny, coz v podminkovem kontextu\n # znamena pravdivou hodnotu, a tedy projekt bude metodou reject! odebran z @projects_current.\n # Pokud vam takovato konstrukce pripada ponekud slozita a nepruhledna, nevadi, muzete si predstavit, ze bychom\n # misto toho pouzili nasledujici kod -- vysledek by byl stejny:\n # currently_done = @projects_current.select { |project| project.man_days_done >= project.man_days }\n # @projects_current.reject! { |project| project.man_days_done >= project.man_days }\n currently_done = []\n @projects_current.reject! { |project| project.man_days_done >= project.man_days && currently_done << project }\n\n currently_done.each do |project|\n project.state = :done\n @projects_done << project\n @budget += project.price\n end\n end", "def check_by_project\n _r = false\n # global_project_breakdown returns multidimensional array containing different project in each line\n # Each line contains 5 elements: Project Id, max_order_total, max_order_price, Net amount sum by project & Item net price\n a = global_project_breakdown(purchase_order_items.order(:project_id))\n d = a.detect { |f| (f[1] > 0 && (f[3] > f[1])) || (f[2] > 0 && (f[4] > f[2])) }\n _r = d.nil? ? false : true\n end", "def project_versions(project,issues)\n issues.collect(&:fixed_version).compact.uniq\n end", "def compute_knowns\n Set.new(@files.map { |f| Albacore::Project.new f }.map { |p| p.id })\n end", "def find_projects\n \turi = URI(BASE_URL+\"projects.json?limit=100\")\n \treq = Net::HTTP::Get.new(uri)\n \treq['Authorization']=BASIC_AUTHORIZATION\n \tres = Net::HTTP.start(uri.hostname, uri.port) {|http|\n \t http.request(req)\n \t}\n\n \tprojects_full_json = JSON.parse(res.body)[\"projects\"]\n \tres = []\n \tprojects_full_json.each do |json_project|\n \t\tp = ProjectForm.new(json_project)\n \t\tres << p\n \tend\n\n \tres.each do |project|\n #Recorremos los proyectos, si no existen los creamos, en otro caso los actualizamos.\n project_db = Project.find_or_create_by(:identifier=>project.identifier)\n\n project_db.update(\n :name => project.name,\n :description => project.description,\n :identifier => project.identifier,\n :trackers=>[]\n );\n\n correspond = Correspond.where(:id_remote=>project.id,:remote_type=>0).first_or_create\n correspond.id_local=project_db.id\n correspond.remote_type=0\n correspond.save\n\n if(!project_db.errors.empty?)\n puts project_db.errors.full_messages\n end\n end\n return res\n end", "def ring_projects\n @ring_projects ||= strategy.rings.each_with_index.map do |r,idx|\n ObsProject.new(\"#{rings_project_name}:#{idx}-#{r}\", \"#{idx}-#{r}\")\n end\n end", "def projects\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:proj, RDF.type, Ruta::Class.project],\n [:proj, RDF::FOAF.member, :mir],\n [:mir, Ruta::Property.has_member, uri]\n )\n projs = []\n query.each_solution { |sol| projs.push(sol.proj.as(Organisation)) }\n projs\n end", "def cross_project\n []\n end", "def projects_by_path\n strong_memoize(:projects_by_path) do\n Project.eager_load(:route, namespace: [:route])\n .where_full_path_in(unique_project_paths)\n .index_by(&:full_path)\n end\n end", "def projects_tracked\n timings = Timing.for_period_of_time(self.id, 1.month.ago, Time.now)\n if timings.present?\n timings.map(&:project_id).uniq\n else\n []\n end\n end", "def projects(params = nil)\n params = params.merge({ :current_user => @options[:current_user]})\n params = params.except(:manufacturer_id, :catg_slug, :office_id, :max_matches)\n params[:order] ||= 'recently_active'\n\n @projects_response = ProjectsIndexPresenter.new(params[:current_user], params).response\n projects = @projects_response[:projects] || []\n projects\n end", "def project?(p)\r\n projects.include?(p)\r\n end", "def projects_supported\n @pledges = Pledge.all\n project_list = {}\n @pledges.each do |pledge|\n if pledge.user_id == self.id\n if project_list.has_key?(pledge.project_id)\n project_list[pledge.project_id] += pledge.dollar_amount\n else\n project_list[pledge.project_id] = pledge.dollar_amount\n end\n end\n end\n return project_list\n end", "def show\n @projects = @dataset.experiments.collect { |experiment| experiment.project }.uniq\n end", "def project_by_name(project_name)\n projects.find { |project| project['name'].casecmp(project_name) == 0 }\n end", "def projects\n PivotalTracker::Project.all\n end", "def is_a_conditional_version_project?(project_name)\n @version_projects ||= group_conditional_custom_field.possible_values\n @version_projects.include?(project_name)\n end", "def reachable_projects\n path.ascend.find_all { |p| p.exist? && p.directory? }.flat_map do |dir|\n dir.children.select { |p| p.extname == '.xcodeproj' }\n end\n end", "def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end", "def find_projects\n #binding.pry\n ProjectBacker.all.select do |element|\n element.backer == self\n end\n end", "def project_all\n prj = { '_id' => 0 }\n prj.merge!(make_grp_prj_periods[1])\n prj.merge!(make_grp_prj_nodes[1])\n prj.merge!(project_bookingnet)\n prj.merge!(project_baselist) unless @sensitivity >= 2\n prj.merge!(project_standardcost) unless @sensitivity >= 1\n { '$project' => prj }\n end", "def reachable_projects\n path.ascend.find_all{ |p| p.directory? }.flat_map do |dir|\n dir.children.select{ |p| p.extname == '.xcodeproj' }\n end\n end", "def open_projects\n Project.where(status: :open, service_id: services)\n end", "def assign_new_projects\n # IMPLEMENTUJTE TUTO METODU\n # Pro kazdeho volneho programatora hledejte projekt k prideleni nasledovne:\n # - Pokud existuje nejaky projekt v @projects_waiting, vyberte prvni takovy.\n # (Nezapomente mu zmenit stav a presunout jej do @projects_current.)\n # - Pokud ne, vyberte takovy projekt z @projects_current, na kterem zbyva\n # nejvice nedodelane prace.\n @programmers.each_with_index do |prg,i|\n if @programmers[i].project == nil #programator bez projektu\n if @projects_waiting.length > 0\n cur_prj=@projects_waiting.shift\n cur_prj.state=:current\n @programmers[i].project=cur_prj\n @projects_current << cur_prj\n else\n if @projects_current.length >0\n #p \"vyber ten kde je nejvic prace\"\n #p @projects_current\n @projects_current.sort! { |a,b| (a.man_days-a.man_days_done) <=> (b.man_days-b.man_days_done) }\n # @projects_current.sort_by! {|rem| -(rem.man_days - rem.man_days_done) }\n @programmers[i].project=@projects_current[0] if @projects_current.length >0\n end\n end\n end\n end\n end", "def find_all_issues\n version_id_sql = \"project_id =\\\"#{@project.id}\\\" \" + \\\n \"AND name = \\\"#{@version}\\\"\"\n # obtaining the unique ID from the chosen project version\n version = Version.all(conditions: [version_id_sql]).at(0).id.to_s \\\n if Version.all(conditions: [version_id_sql]) != []\n issues_sql = \"project_id = \\\"#{@project.id}\\\" \" + \\\n \"AND fixed_version_id = \\\"#{version}\\\"\"\n populate_issues_array(issues_sql)\n end", "def available_projects_list\n uri = \"#{@api_url}?access_token=#{@access_token}\"\n get uri\n end", "def project_varsion_id_pair(proj)\n Issue.cross_project_scope(proj, 'descendants')\n .select('project_id, fixed_version_id, MIN(due_date) as due_date')\n .where(\"#{SQL_COM} AND fixed_version_id IS NOT NULL\")\n .group(:project_id, :fixed_version_id)\n .order('MIN(due_date)')\n .collect { |issue| [issue.project_id, issue.fixed_version_id] }\n end", "def projects \n ProjectBacker.all.select {|project| project.backer == self}\n end", "def show\n @projects = @setting.experiments.collect { |experiment| experiment.project }.uniq\n end", "def project(key)\n @tracker.getProjects.detect { |pro| pro.key == key }\n end", "def my_projects\n # Look at all the project\n # see which project's creator is equal to self\n Project.all.select do |project|\n project.creator == self\n end\n end", "def test_it_can_get_list_of_projects\n VCR.insert_cassette 'projects'\n projects = @api.projects('writer1')\n\n assert_kind_of Array, projects\n assert_equal 3, projects.size\n\n assert_kind_of Hash, projects.first\n assert_kind_of Hash, projects.last\n\n assert_equal \"xjywplmhejceb6j3ezzlxiganmjavqio\", projects.last[\"pid\"]\n assert_equal \"l7eqkx6daomtv5iw2912p019anskzt1n\", projects.first[\"pid\"]\n assert_equal 1, projects.first[\"active\"]\n assert_equal 1, projects.first[\"main\"]\n end", "def fetchUntestedProjects \r\n @logger.debug \"search untested projects: #{@workspaceFolder}\"\r\n\t\tprojectFolders = FileList.new(@workspaceFolder+\"/*/\")\r\n\t\tprojectFolders.exclude(@workspaceFolder+\"/.*/\") # no meta-data\t\t\r\n\t\tprojectFolders.each do |projectFolder|\r\n\t\t\tsourceFiles = FileList.new(projectFolder+\"/**/*.{h,hpp,c,cpp}\")\r\n\t\t\tif sourceFiles.size() > 0 then\r\n\t\t\t\r\n\t\t\t\tprojectPath = Pathname.new(projectFolder).cleanpath.to_s\r\n\t\t\t\tif @testedProjects.find{ |item| item.projectFolder.eql?(projectPath) } == nil then\r\n @logger.debug \"=> untested project: #{File.basename(projectPath)}\" \r\n\t\t\t\t\t@untestedProjects << projectPath\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def replace_project_versions proj_files\r\n\r\n begin\r\n # iterate each package file, replace version numbers and save\r\n proj_files.each{ |file|\r\n puts \"Updating references in: #{file}...\"\r\n doc = Nokogiri::XML File.read file\r\n nodes = doc.search 'Reference'\r\n nodes.each { |node|\r\n ref_val = node['Include']\r\n # grab the identifier\r\n id = ref_val.split(',')[0]\r\n # clean out file version\r\n node['Include'] = id\r\n\r\n # replace version in hint path\r\n hint_path = node.search 'HintPath'\r\n if hint_path && hint_path[0] != nil\r\n hint_path_value = hint_path[0].children.to_s\r\n # this identifier is not the same as the node['Include'] one.\r\n # For ex., Runtime, Core and Storage assemblies will be referred to from within other packages like Management, Test etc\r\n hint_path_id = id_from_hint_path hint_path_value\r\n if @versions.has_key? hint_path_id\r\n hint_path_parts = hint_path_value.split '\\\\'\r\n hint_path_parts[2] = hint_path_id + GlobalConstants::DOT + @versions[hint_path_id]\r\n hint_path[0].children = hint_path_parts.join '\\\\'\r\n end\r\n end\r\n }\r\n File.write file, doc.to_xml\r\n }\r\n rescue\r\n puts $!\r\n return false\r\n end\r\n\r\n return true\r\n\r\n end", "def compare_to(project_name)\n compare_contents @project_path, project_fixture(project_name)\n end", "def test_checklist_for_project\n login\n project = projects(:one_genus_two_species_project)\n expect = Name.joins(observations: :project_observations).\n where({ observations: { project_observations:\n { project_id: project.id } } }).\n with_rank(\"Species\").distinct\n\n get(:show, params: { project_id: project.id })\n assert_match(/Checklist for #{project.title}/, css_select(\"title\").text,\n \"Wrong page\")\n\n prove_checklist_content(expect)\n end", "def options_for_project(projects, needBlankRow=false)\n\t\tprojArr = Array.new\n\t\tif needBlankRow\n\t\t\tprojArr << [ \"\", \"\"]\n\t\tend\n\t\t\n\t\t#Project.project_tree(projects) do |proj_name, level|\n\t\tif !projects.blank?\n\t\t\tproject_tree(projects) do |proj, level|\n\t\t\t\tindent_level = (level > 0 ? ('&nbsp;' * 2 * level + '&#187; ').html_safe : '')\n\t\t\t\tsel_project = projects.select{ |p| p.id == proj.id }\n\t\t\t\tprojArr << [ (indent_level + sel_project[0].name), sel_project[0].id ]\n\t\t\tend\n\t\tend\n\t\tprojArr\n\tend", "def getActiveProjects(projects)\n projects.select { |p| Asana::Project.find(p.id).color == \"dark-green\" }\nend", "def projectDetails\r\n projectUrl = params[:url]\r\n projectUrl = projectUrl[4..-2]\r\n puts projectUrl\r\n result = Hashie::Mash.new HTTParty.get(\"http://api.ravelry.com/projects/akaemi/progress.json?status=finished&key=0e3904e749b478766294964e01322c78b53ef411\") \r\n \r\n # find the right project\r\n result[\"projects\"].each{|key, value| \r\n thumbnail = key[\"thumbnail\"]\r\n puts thumbnail[\"src\"]\r\n if (thumbnail[\"src\"].eql? projectUrl) \r\n puts \"found a match\"\r\n @project = key;\r\n end\r\n }\r\n \r\n respond_to do |format|\r\n format.json\r\n end\r\n \r\n end", "def projects_stores(_projects)\n _array = []\n _ret = nil\n\n # Adding global stores, not JIT, belonging to current company\n if session[:company] != '0'\n _ret = Store.where(\"company_id = ? AND office_id IS NULL AND supplier_id IS NULL\", session[:company].to_i)\n else\n _ret = session[:organization] != '0' ? Store.where(\"organization_id = ? AND office_id IS NULL AND supplier_id IS NULL\", session[:organization].to_i) : Store.all\n end\n ret_array(_array, _ret)\n\n # Adding stores belonging to current projects (projects have company and office)\n _projects.each do |i|\n if !i.company.blank? && !i.office.blank?\n _ret = Store.where(\"(company_id = ? AND office_id = ?)\", i.company_id, i.office_id)\n elsif !i.company.blank? && i.office.blank?\n _ret = Store.where(\"(company_id = ?)\", i.company_id)\n elsif i.company.blank? && !i.office.blank?\n _ret = Store.where(\"(office_id = ?)\", i.office_id)\n end\n ret_array(_array, _ret)\n end\n\n # Adding JIT stores\n _ret = session[:organization] != '0' ? Store.where(\"organization_id = ? AND company_id IS NULL AND NOT supplier_id IS NULL\", session[:organization].to_i) : Store.where(\"(company_id IS NULL AND NOT supplier_id IS NULL)\")\n ret_array(_array, _ret)\n\n # Returning founded stores\n _ret = Store.where(id: _array).order(:name)\n end", "def findProjs service\r\n slnFile = Util.getSln(service)\r\n return nil if slnFile.nil?\r\n projs = []\r\n slnFile.readlines.each do |line|\r\n if line =~ /^Project\\(\\\"[^\\\"]+\\\"\\)\\s*=\\s*\\\"([^\\\"]+)\\\"/\r\n projs.push line.match(/^Project\\(\\\"[^\\\"]+\\\"\\)\\s*=\\s*\\\"([^\\\"]+)\\\"/)[1]\r\n end\r\n end\r\n return projs\r\nend", "def find_all_projects()\n @scenario_look_up_map.keys\n end", "def internal_projects\n internal_projects = Project.joins(:client).where(\"company_id = #{self.id} AND internal = true\")\n return internal_projects if internal_projects.length > 0\n \n internal_project = Project.new(name: \"#{self.name} (Internal)\", internal: true, deadline: Date.today, description: \"Holds tasks that are accessed by all users\")\n internal_project.client = internal_client\n internal_project.save!\n\n [internal_project]\n end", "def get_version(project_name)\n tries ||= 5\n all_versions = []\n\n #get all versions xml\n response = @client.call(:get_versions, message: {:token => @token, :key => project_name.upcase})\n\n #get next version from hash\n next_version_id = response.to_hash[:get_versions_response][:get_versions_return][:'@soapenc:array_type']\n next_version_id = next_version_id.match(/RemoteVersion\\[(\\d+)\\]/)[1]\n\n #get actual version from the array of version id's\n actual_version_id = (self.get_all_version_ids response.to_hash).sort.last - 1\n\n response.to_hash[:multi_ref].each do |version|\n all_versions << version[:name]\n @next_version = version[:name] if next_version_id.to_i == version[:sequence].to_i\n @actual_version = version[:name] if actual_version_id.to_i == version[:sequence].to_i\n end\n\n @all_versions = all_versions.sort_by { |x| x.split('.').map &:to_i }\n raise Exceptions::CouldNotGetNextVersion, 'Problem getting Next Version number' if @next_version.nil?\n raise Exceptions::CouldNotGetActualVersion, 'Problem getting Actual Version number' if @actual_version.nil?\n return true\n rescue Savon::SOAPFault => e\n tries = tries -= 1\n if (tries).zero?\n return false\n else\n sleep 5\n self.token\n puts \"Jira connection failed. Trying to connect again. (Num tries: #{tries})\"\n retry\n end\n end", "def discover_projects!\n self.discover_projects.each(&:save!)\n end", "def options_for_wktime_project(projects, needBlankRow=false)\n\t\tprojArr = Array.new\n\t\tif needBlankRow\n\t\t\tprojArr << [ \"\", \"\"]\n\t\tend\n\t\t\n\t\t#Project.project_tree(projects) do |proj_name, level|\n\t\tproject_tree(projects) do |proj, level|\n\t\t\tindent_level = (level > 0 ? ('&nbsp;' * 2 * level + '&#187; ').html_safe : '')\n\t\t\tsel_project = projects.select{ |p| p.id == proj.id }\n\t\t\tprojArr << [ (indent_level + sel_project[0].name), sel_project[0].id ]\n\t\tend\n\t\tprojArr\n\tend", "def suitable_for_all?\n<<<<<<< HEAD:app/models/project.rb\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n=======\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/models/project.rb\n end", "def create_solution_projects(ovr = nil)\n raise ArgumentError, 'projects must be an array' unless @projects.is_a?(Array)\n if @projects.count < 1\n LOGGER.warn(\"projects array for #{@fname} is empty\") if LOGGER.warn?\n return false\n end\n\n @projects.each {|prj|\n raise ArgumentError unless prj.is_a?(SolutionFile::ProjectAttributes)\n o = Project.find_by_guid(prj.prj_guid) ||\n Project.new(\n guid: prj.prj_guid,\n dir_name: (ovr || File.join(@dir_name,File.dirname(prj.fname))),\n file_name: File.basename(prj.fname),\n name: prj.name,\n ptype: File.extname(prj.fname)\n )\n if o.new_record?\n unless o.valid?\n pp o, o.errors\n LOGGER.fatal(\n StringIO.open do |s|\n s.puts \"Project '#{prj.name}' could not be saved to projects table\"\n s.puts \"fname : #{prj.fname}\"\n s.puts LogProject.msg(o,'Project information')\n s.puts sprintf('name %s',o.errors[:name].join(', ')) if o.errors.has_key?(:name)\n s.puts sprintf('fname %s',o.errors[:fname].join(', ')) if o.errors.has_key?(:fname)\n s.string\n end\n )\n raise ArgumentError, \"Project could not be saved [#{o.guid}]\"\n end\n o.save!\n # LOGGER.debug(LogProject.msg(o,'Project information')) if LOGGER.debug?\n\n end\n\n prj.id = o.id\n }\n true\n end", "def projects\n return [] unless basecamp\n @projects ||= basecamp.projects\n end", "def has_project?(name)\n available_projects.has_key?(name)\n end", "def getProjects(response)\r\n\t\t\t\tprojects_all_json = JSON.parse response\r\n\t\t\t\tprojects_all_array = projects_all_json[\"projects\"]\r\n\t\t\t\tprojects_class_array = Array.new\r\n\t\t\t\tfor i in 0...projects_all_array.length\r\n\t\t\t\t\tprojects_class_array.push(jsonToProject(projects_all_array[i]))\r\n\t\t\t\tend\r\n\t\t\t\treturn projects_class_array\r\n\t\t\tend", "def projects=(projs)\n return false unless projs.is_a? Array\n removed = @projects - projs\n added = projs - @projects\n @text << \" \" << added.map{|t| \"+#{t}\"}.join(\" \")\n removed.each {|r| @text.gsub!(\" +#{r}\",\"\")}\n @projects=projs\n end", "def projects_map\n {\n private_files_project: {\n old: projects_old_names_map[@user.private_files_project],\n new: projects_new_names_map[@user.private_files_project],\n },\n private_comparisons_project: {\n old: projects_old_names_map[@user.private_comparisons_project],\n new: projects_new_names_map[@user.private_comparisons_project],\n\n },\n public_files_project: {\n old: projects_old_names_map[@user.public_files_project],\n new: projects_new_names_map[@user.public_files_project],\n },\n public_comparisons_project: {\n old: projects_old_names_map[@user.public_comparisons_project],\n new: projects_new_names_map[@user.public_comparisons_project],\n },\n }\n end", "def projects\n Project.all.select { |project| project.creator == self }\n end", "def projects\n result = []\n load_attributes\n @attributes['projects'].each do |project|\n result << project['name']\n end\n puts \"Workspace projects #{result}\"\n result\n end", "def projects\n Project.where('constructors @> ARRAY[?]::integer[]', [id])\n end", "def fetch_pe_version_map\n [\n { 'name' => '2017.3.x', 'puppet_range' => '5.3.x', 'puppet' => '5.3.2' },\n { 'name' => '2017.2.x', 'puppet_range' => '4.10.x', 'puppet' => '4.10.1' },\n { 'name' => '2017.1.x', 'puppet_range' => '4.9.x', 'puppet' => '4.9.4' },\n { 'name' => '2016.5.x', 'puppet_range' => '4.8.x', 'puppet' => '4.8.1' },\n { 'name' => '2016.4.x', 'puppet_range' => '4.7.x', 'puppet' => '4.7.0' },\n { 'name' => '2016.2.x', 'puppet_range' => '4.5.x', 'puppet' => '4.5.2' },\n { 'name' => '2016.1.x', 'puppet_range' => '4.4.x', 'puppet' => '4.4.1' },\n { 'name' => '2015.3.x', 'puppet_range' => '4.3.x', 'puppet' => '4.3.2' },\n { 'name' => '2015.2.x', 'puppet_range' => '4.2.x', 'puppet' => '4.2.3' },\n ]\n end", "def update_projects_version(version)\n projects.each do |project|\n project.update_version version\n end\n end", "def display_pending_refund_payments_projects_name\n source.pending_refund_payments_projects.map(&:name).uniq\n end", "def unique_project_paths\n embeds_by_node.values.map(&:project_path).uniq\n end", "def list\n current_workspace = framework.db.workspace.name\n project_list.each do |p|\n if current_workspace == p\n print_line(\"%red* #{p}%clr\")\n else\n print_line(\" #{p}\")\n end\n end\n return true\n end", "def select_project\n project_list.map { |id, hash| [hash['name'], id] }\n end", "def combined_projects\n self.projects + self.owned_projects + self.all_teams.map(&:projects).flatten(1)\n end", "def projects\n @projects ||= Project.all\n end", "def projects\n return @projects if @projects\n @projects = []\n IO.readlines(@file).each do |line|\n @projects << Project.new(line, @dir) if /^Project.*\\.csproj/ =~ line\n end\n end", "def show_all_projects\r\n json = GoodData.get GoodData.profile.projects\r\n puts \"You have this project available:\"\r\n json[\"projects\"].map do |project|\r\n pid = project[\"project\"][\"links\"][\"roles\"].to_s\r\n puts \"Project name: #{project[\"project\"][\"meta\"][\"title\"].bright} Project PID: #{pid.match(\"[^\\/]{32}\").to_s.bright}\"\r\n end\r\n end", "def project_list\n project_folders = Dir::entries(::File.join(Msf::Config.log_directory, 'projects'))\n projects = []\n framework.db.workspaces.each do |s|\n if project_folders.include?(s.name)\n projects << s.name\n end\n end\n return projects\n end", "def lookup_server_from_project pid\n PT2TODO_CONFIG.each do |token, p|\n if p[:project_ids].include? pid\n return {:token => token, :url => p[:url], :project_ids => p[:project_ids], :append => p[:append]}\n end\n end\n return nil\nend", "def assigned_version_roadways\n version = assigned_version\n\n if version # you need to ensure that there is even an inspection that was moved through assigned\n typed_version = TransamAsset.get_typed_version(version)\n\n if version.respond_to? :reify # if the highway structure returns a version you can use its version to find the versions associated with roadways\n return typed_version.roadways\n else # otherwise you have a highway structure that is \"live\" ie what is the DB right now and you have to figure out what versions of roadways are associated\n # given the time of assignment\n # you know that if a roadway wasnt updated since the time of assignment that those roadways were like that at assignment. they can be included in roadways of the assigned version\n time_of_assignment = assigned_inspection_version.created_at\n results = typed_version.roadways.where('updated_at <= ?', time_of_assignment).to_a\n\n # therefore you only need to check roadways updated after time of assignment\n # for those roadways, you find the version that is closest and before the time of assignment\n # versions save the object BEFORE the change\n # therefore to get the version at time of assignment you need the first version that happened after the time of assignment\n typed_version.roadways.where('updated_at > ?', time_of_assignment).each do |roadway|\n ver = roadway.versions.where('created_at > ?', time_of_assignment).where.not(event: 'create').order(:created_at).first\n results << ver.reify if ver\n end\n return results\n end\n end\n end", "def projects_new_names_map\n {\n @user.private_files_project => \"precisionfda-personal-files-#{orgname}\",\n @user.private_comparisons_project => \"precisionfda-personal-comparisons-#{orgname}\",\n @user.public_files_project => \"precisionfda-public-files-#{orgname}\",\n @user.public_comparisons_project => \"precisionfda-public-comparisons-#{orgname}\",\n }\n end", "def projectbackers\n ProjectBacker.all.select do |pb_instance|\n pb_instance.project == self \n end \n end", "def find_projects\n @projects = Project.all\n end", "def poolplay_games\n self.games.select { |game| game.version == 'poolplay'}\n end", "def all_projects()\n @endpoint = \"/projects.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"projects\"].sort_by { |proj| proj[\"name\"] }\n end", "def getprojects()\n printRepoHeader\n \n loop do\n # Print each of the new returned repositories\n begin\n get.each do |repo|\n printRepo(repo) if (@slugs.add?(repo['slug']))\n\n # Flush to prevent data loss if we crash\n STDOUT.flush\n end\n rescue Exception => msg\n STDERR.puts \"WARNING: Poll failed at #{Time.now}\"\n STDERR.puts msg\n end\n\n # Poll every 5 minutes\n sleep 300\n end\n end", "def projects ; end", "def normalize_projects_harvest(projects)\n\n projects.each do |project|\n \n found_project = Project.find_by(original_id: project[\"resource_original_id\"])\n if found_project\n found_project.due_date = project[\"payload\"][\"ends_on\"]\n found_project.start_date = project[\"payload\"][\"starts_on\"]\n found_project.workspace_id = harvest_workspace.id\n found_project.name = project[\"payload\"][\"name\"]\n else\n found_project = Project.create!(\n original_id: project[\"resource_original_id\"],\n name: project[\"payload\"][\"name\"],\n due_date: project[\"payload\"][\"ends_on\"],\n start_date: project[\"payload\"][\"starts_on\"],\n workspace_id: harvest_workspace.id,\n )\n end\n end\n end", "def developer_can_see_this_project?\n developer = Developer.where(:gamer_id => current_gamer.id).first\n projects_owned = Project.where(:owner_id => developer.id)\n projects_shared1 = developer.projects_shared\n current_project = Project.find(params[:id])\n if !projects_owned.include?(current_project) && !projects_shared1.include?(current_project)\n flash[:error] = t(:developer_cant_see_project)\n redirect_to projects_path\n end \n end", "def projects\n projects = object.projects.select { |p| !current_user || p.users.include?(current_user) }\n projects.map { |p| p.id }\n end", "def test_ut_da10b_t1_15\n p \"Test 15\"\n # gets a list of pjs belong to selected pu\n pjs = @pu.get_pjs_belong_to_pu\n expected_pj = [[\"\", 0], [\"SamplePJ1\", 1], [\"SamplePJ2\", 2]]\n assert_equal expected_pj, pjs\n end", "def project_exists?(name)\n projects.include?(name)\n end", "def projects\n my_proj = self.my_projects\n my_memb = self.collaborations\n my_proj + my_memb\n end", "def pu_track_project_has_changed\n project = params[:order]\n projects = projects_dropdown\n if project != '0'\n @project = Project.find(project)\n @work_order = @project.blank? ? projects_work_orders(projects) : @project.work_orders.order(:order_no)\n @charge_account = @project.blank? ? projects_charge_accounts(projects) : charge_accounts_dropdown_edit(@project)\n @store = @project.blank? ? projects_stores(projects) : project_stores(@project)\n else\n @work_order = projects_work_orders(projects)\n @charge_account = projects_charge_accounts(projects)\n @store = projects_stores(projects)\n end\n @json_data = { \"work_order\" => @work_order, \"charge_account\" => @charge_account, \"store\" => @store }\n render json: @json_data\n end", "def projects\n Harvest::Resources::Project\n end", "def projects\n if is_deploy_key\n [project]\n else\n user.authorized_projects\n end\n end", "def projects_old_names_map\n @projects_old_names_map ||= [\n @user.private_files_project,\n @user.private_comparisons_project,\n @user.public_files_project,\n @user.public_comparisons_project,\n ].each_with_object({}) do |dxid, memo|\n memo[dxid] = @user_api.project_describe(dxid)[\"name\"]\n memo\n end\n end", "def version_euristic(urls, regex = nil)\n urls.each do |url|\n puts \"Trying with url #{url}\" if ARGV.debug?\n match_version_map = {}\n case\n when DownloadStrategyDetector.detect(url) <= GitDownloadStrategy\n puts \"Possible git repo detected at #{url}\" if ARGV.debug?\n\n git_tags(url, regex).each do |tag|\n begin\n # Remove any character before the first number\n tag_cleaned = tag[/\\D*(.*)/, 1]\n match_version_map[tag] = Version.new(tag_cleaned)\n rescue TypeError\n end\n end\n when url =~ %r{(sourceforge\\.net|sf\\.net)/}\n project_name = url.match(%r{/projects?/(.*?)/})[1]\n page_url = \"https://sourceforge.net/api/file/index/project-name/\" \\\n \"#{project_name}/rss\"\n\n if ARGV.debug?\n puts \"Possible SourceForge project [#{project_name}] detected\" \\\n \"at #{url}\"\n end\n\n if regex.nil?\n regex = %r{/#{project_name}/([a-zA-Z0-9.]+(?:\\.[a-zA-Z0-9.]+)*)}i\n end\n\n page_matches(page_url, regex).each do |match|\n version = Version.new(match)\n # puts \"#{match} => #{version.inspect}\" if ARGV.debug?\n match_version_map[match] = version\n end\n when url =~ /gnu\\.org/\n project_name_regexps = [\n %r{/(?:software|gnu)/(.*?)/},\n %r{//(.*?)\\.gnu\\.org(?:/)?$},\n ]\n match_list = project_name_regexps.map do |r|\n url.match(r)\n end.compact\n\n if match_list.length > 1\n puts \"Multiple project names found: #{match_list}\"\n end\n\n unless match_list.empty?\n project_name = match_list[0][1]\n page_url = \"http://ftp.gnu.org/gnu/#{project_name}/?C=M&O=D\"\n\n if ARGV.debug?\n puts \"Possible GNU project [#{project_name}] detected at #{url}\"\n end\n\n if regex.nil?\n regex = /#{project_name}-(\\d+(?:\\.\\d+)*)/\n end\n\n page_matches(page_url, regex).each do |match|\n version = Version.new(match)\n match_version_map[match] = version\n end\n end\n when regex\n # Fallback\n page_matches(url, regex).each do |match|\n version = Version.new(match)\n match_version_map[match] = version\n end\n end\n\n if ARGV.debug?\n match_version_map.each do |match, version|\n puts \"#{match} => #{version.inspect}\"\n end\n end\n\n empty_version = Version.new(\"\")\n match_version_map.delete_if { |_match, version| version == empty_version }\n\n # TODO: return nil, defer the print to the caller\n return match_version_map.values.max unless match_version_map.empty?\n end\n\n fail TypeError, \"Unable to get versions for #{Tty.blue}#{name}#{Tty.reset}\"\nend", "def find_existing_sca_projects(school)\n self.sca_projects.find {|sca_projects| sca_projects[:uid] == school[:uid]}\n end", "def [] project\n Project.new(project) if Profile.projects[project]\n end", "def assign_projects\n assigned_projects = []\n team_index = 0\n PROJECTS.each do |project_name|\n team = @teams[team_index]\n project = Project.new(project_name, team.lead, team.all_members)\n assigned_projects << project\n next unless assigned_projects.size == 2\n\n team.assign_projects(assigned_projects)\n assigned_projects = []\n if (team_index += 1) > (@teams.size - 1)\n team_index = 0\n end\n end\n end", "def ensure_unique_project_name!\n dup_name_projects = @user.projects.where(\"name=?\", @project.name)\n dup_name_projects.each do |project|\n raise RuntimeError, 'Duplicated project name' if project.id != @project.id\n end\n end", "def project_names\n repositories.map { |s| s.match(/[^\\/]*$/)[0] }\n end", "def query_5\n relevant_team_members = []\n all_projects = Perpetuity[Project].all.to_a\n all_projects.each do |proj|\n ptms = Perpetuity[ProjectsTeamMember].select {|ptm| ptm.project.id == proj.id }.to_a\n Perpetuity[ProjectsTeamMember].load_association! ptms, :team_member\n Perpetuity[ProjectsTeamMember].load_association! ptms, :project\n\n ptms.each do |pt|\n tm_created_at = pt.team_member.created_at\n pt_created_at = pt.project.created_at\n\n if tm_created_at < pt_created_at\n relevant_team_members << pt.team_member\n end\n end\n\n return relevant_team_members.size\n end\nend", "def projects_select_id_equals(form, projects)\n form.select :project_id_equals, to_form_select(projects),\n {:include_blank => ''}\n end", "def geoid_table\n # Get the dates released projects were emailed\n # If a project doens't have a date, mark it\n @future_date = Date.parse(\"2112-12-21\") # Fake later-than-latest date for un-notified-yet projects\n @past_date = Date.parse(\"2002-02-20\") # Fake 'earliest' date for the first group of projects\n reported_projects = Hash.new{@future_date}\n \n seen_dates = Array.new # Array of encountered Date objects\n File.open(self.class.geo_reported_projects_path).each{|rep_proj|\n next if rep_proj.empty? || rep_proj.strip[0] == \"#\"\n fields = rep_proj.split(\"\\t\")\n # Make a hash of ProjectID => date release notified\n notified_date = fields[1].nil? ? nil : Date.parse(fields[1])\n reported_projects[fields[0].to_i] = notified_date\n seen_dates.push notified_date unless (notified_date.nil?) || (seen_dates.include? notified_date)\n }\n seen_dates.sort!\n\n oldest_release_date = seen_dates[0]\n newest_release_date = seen_dates.last\n\n seen_dates.insert(0, \"any time\")\n \n # Then separate out the date lists into start and end for filtering\n @start_dates = Array.new seen_dates\n @end_dates = Array.new seen_dates\n \n # And add special dates\n @start_dates.insert(1, \"before #{@start_dates[1]}\") # Before earliest date\n @end_dates.push(\"after #{seen_dates.last.to_s}\") # Or after latest date\n \n # Open the NIH spreadsheet table\n # and parse out the relevant information\n cols = ReportsController.get_geoid_columns \n @projects = []\n ReportsController.get_released_submissions.each{|proj|\n proj_id = proj[cols[\"Submission ID\"]].to_i\n projhash = \n {\n :id => proj_id,\n :name => proj[cols[\"Description\"]],\n :date_notified => reported_projects[proj_id]\n }\n (projhash[:geoids], projhash[:sraids]) = separate_geo_sra_ids(proj[cols[\"GEO/SRA IDs\"]]) \n @projects.push(projhash)\n }\n # Remove hidden projects\n # Hide nothing by default\n session[:hidden_geo_projs] = :no_projs if session[:hidden_geo_projs].nil?\n # Otherwise, hide if it's been given in a parameter\n session[:hidden_geo_projs] = params[:hide_projs].nil? ? session[:hidden_geo_projs] : params[:hide_projs].to_sym\n case session[:hidden_geo_projs]\n when :no_ids then\n @projects.reject!{|proj| proj[:geoids].empty? && proj[:sraids].empty? }\n when :has_id then\n @projects.reject!{|proj| !(proj[:geoids].empty? && proj[:sraids].empty?) }\n when :no_projs then \n else # show all projects\n end\n\n @hidden_projs = session[:hidden_geo_projs]\n \n # Filtering by date\n # If prev_start & end don't exist, set them to oldest & newest\n \n if params[\"prev_time_start\"] =~ /before/ then\n previous_start = @past_date\n else\n previous_start = params[\"prev_time_start\"].nil? ? @past_date : Date.parse(params[\"prev_time_start\"])\n end\n if params[\"prev_time_end\"] =~ /after/ then\n previous_end = @future_date\n else\n previous_end = params[\"prev_time_end\"].nil? ? @future_date : Date.parse(params[\"prev_time_end\"])\n end\n \n # If there's not a current date filter, roll forward the previous one\n if params[\"commit\"] != \"Go\" then\n @earliest = previous_start\n @latest = previous_end\n else\n # Set up the current filter\n if params[\"time_start\"] =~ /before/ then\n curr_start = @past_date\n else\n curr_start = params[\"time_start\"] == \"any time\" ? @past_date : Date.parse(params[\"time_start\"])\n end\n # If we want them only from one week, set them the same\n if params[\"same_week\"] == \"on\" then\n @latest = @earliest = curr_start # We'll increment latest in a moment\n else\n curr_end = (( params[\"time_end\"] == \"any time\") || (params[\"time_end\"] =~ /after/ )) ? @future_date : Date.parse(params[\"time_end\"])\n @earliest, @latest = [curr_start, curr_end].sort\n end\n # Then, if earliest = latest then increment latest by one date since these are half-open\n if @earliest == @latest then\n @latest = case @earliest\n when @past_date then oldest_release_date\n when newest_release_date then @future_date \n else seen_dates[seen_dates.index(@earliest) + 1]\n end\n end\n\n end\n # -- Remove all projects that don't fit within boundaries --\n # Projects with a date_notified of X were released in the week *BEFORE* X. So\n # If start is Z - \"released from Z to...\" -- we want all projects with date > Z;\n # If end is Y, we want projects with release date <= Y.\n # So, reject all projects where the date is too early (ie, release date INCLUDES earliest) and\n # where the date is too late -- ie, is anything LATER than latest.\n @projects.reject!{|proj| proj[:date_notified] <= @earliest || proj[:date_notified] > @latest }\n\n # Sorting\n @new_sort_direction = Hash.new { |hash, column| hash[column] = 'forward' }\n # If sort param given, update sort_list \n if params[:sort] then\n session[:sort_geo_list] = Hash.new unless session[:sort_geo_list]\n params[:sort].each_pair { |column, direction| session[:sort_geo_list][column.to_sym] = [ direction, Time.now ] }\n end\n \n # If there's non-default sorting, apply the sorts\n if session[:sort_geo_list] then\n sorts = session[:sort_geo_list].sort_by { |column, sortby| sortby[1] }.reverse.map { |column, sortby| column } \n @projects = @projects.sort { |p1, p2|\n p1_attrs = sorts.map { |col|\n col = col.to_sym\n session[:sort_geo_list][col] = [] if session[:sort_geo_list][col].nil?\n sort_attr = (session[:sort_geo_list][col][0] == 'backward') ? p2[col] : p1[col]\n sort_attr = sort_attr.nil? ? -999 : sort_attr\n } << p1.id\n p2_attrs = sorts.map { |col|\n session[:sort_geo_list][col] = [] if session[:sort_geo_list][col].nil?\n sort_attr = (session[:sort_geo_list][col][0] == 'backward') ? p1[col] : p2[col] \n sort_attr = sort_attr.nil? ? -999 : sort_attr\n } << p2.id\n p1_attrs.nil_flatten_compare p2_attrs\n } \n session[:sort_geo_list].each_pair { |col, srtby| @new_sort_direction[col] = 'backward' if srtby[0] == 'forward' && sorts[0] == col }\n else \n @projects = @projects.sort { |p1, p2| p1[:name] <=> p2[:name] }\n end\n\n end", "def install_projects\n if @project.include? ','\n projects = @project.split ','\n projects.each do |p|\n @project = p\n check_core\n install_project \n puts\n end \n else\n check_core\n install_project\n end\n end" ]
[ "0.6690948", "0.6394917", "0.5990774", "0.5943927", "0.5851132", "0.5848677", "0.5834253", "0.5830118", "0.57999", "0.5787687", "0.5622428", "0.56071115", "0.56039155", "0.5595532", "0.55241996", "0.5422615", "0.5381047", "0.53718483", "0.53706586", "0.5354612", "0.5352882", "0.5342946", "0.5293814", "0.5279979", "0.5276979", "0.5258821", "0.5254504", "0.52481335", "0.52318716", "0.52317464", "0.5220659", "0.5215258", "0.52123725", "0.51972985", "0.51902467", "0.5178746", "0.5173832", "0.5144983", "0.51435024", "0.5136358", "0.5125575", "0.5123344", "0.51176316", "0.5113405", "0.51076114", "0.5093479", "0.5092739", "0.50915456", "0.5086536", "0.50832874", "0.50821304", "0.5075361", "0.50695044", "0.5069358", "0.5064827", "0.50643986", "0.50598013", "0.5052598", "0.505174", "0.5040869", "0.50383437", "0.501882", "0.5013985", "0.49899542", "0.49880806", "0.49823663", "0.49799946", "0.49791732", "0.4975738", "0.4970837", "0.49419978", "0.49410298", "0.493172", "0.4929094", "0.49271873", "0.4927069", "0.49166423", "0.4915928", "0.49101", "0.49079317", "0.490157", "0.49012148", "0.4894548", "0.4879687", "0.48794264", "0.48777065", "0.48740986", "0.4868265", "0.48682225", "0.4858647", "0.4857549", "0.48560226", "0.48481908", "0.48462677", "0.4844713", "0.48445448", "0.48367292", "0.48367104", "0.48344025", "0.48333937" ]
0.64128435
1
GPS version check for projects that have similar streets reversing street order as necessary.
def check_project_exists # if latitude is within +/- 2 ten-thounsandths of another project's latitude it is the same (Project.select{ |proj| proj.project_type == self.project_type }.count > 0 && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.002), (self.street1.to_f + 0.002))}.count > 0 && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02))}.count > 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_build_vers(loc_ver,rem_ver)\n if loc_ver.to_s.match(/No/)\n result = 0\n else\n if rem_ver.to_s.match(/-/) and !rem_ver.to_s.match(/beta/)\n if $verbose == 1\n puts \"Local build date: \"+loc_ver.to_s\n puts \"Remote build date: \"+rem_ver.to_s\n end\n if rem_ver.to_time > loc_ver.to_time\n result = 0\n else\n result = 1\n end\n else\n if $verbose == 1\n puts \"Local build version: \"+loc_ver\n puts \"Remote build version: \"+rem_ver\n end\n if loc_ver !~ /No/\n loc_ver = Versionomy.parse(loc_ver)\n rem_ver = Versionomy.parse(rem_ver)\n if rem_ver > loc_ver\n result = 0\n else\n result = 1\n end\n else\n result = 2\n end\n end\n end\n if result == 0\n puts \"Remote version of build is newer than local\"\n else\n if result == 1\n puts \"Local version of build is up to date\"\n else\n puts \"Local version could not be accurately determined\"\n end\n end\n return result\nend", "def nmap_version_at_least?(test_ver=nil)\n raise ArgumentError, \"Cannot compare a Float, use a String or Integer\" if test_ver.kind_of? Float\n unless test_ver.to_s[/^([0-9]+(\\x2e[0-9]+)?)/n]\n raise ArgumentError, \"Bad Nmap comparison version: #{test_ver.inspect}\"\n end\n test_ver_str = test_ver.to_s\n tnum_arr = $1.split(/\\x2e/n)[0,2].map {|x| x.to_i}\n installed_ver = get_nmap_ver()\n vtag = installed_ver.split[2] # Should be [\"Nmap\", \"version\", \"X.YZTAG\", \"(\", \"http..\", \")\"]\n return false if (vtag.nil? || vtag.empty?)\n return false unless (vtag =~ /^([0-9]+\\x2e[0-9]+)/n) # Drop the tag.\n inum_arr = $1.split(/\\x2e/n)[0,2].map {|x| x.to_i}\n return true if inum_arr[0] > tnum_arr[0]\n return false if inum_arr[0] < tnum_arr[0]\n inum_arr[1].to_i >= tnum_arr[1].to_i\nend", "def project_exists\n\n if self.check_project_exists == true\n return (Project.select{ |proj| proj.project_type == self.project_type } && Project.select{ |proj| proj.street1.to_f.between?((self.street1.to_f - 0.02), (self.street1.to_f + 0.02))} && Project.select{ |proj| proj.street2.to_f.between?((self.street2.to_f - 0.02), (self.street2.to_f + 0.02 ))})\n else\n return []\n end\n end", "def direction_touching_number?\n return false unless @confirmed[:street_direction] && @confirmed[:street_number]\n\n @confirmed[:street_direction].min - 1 == @confirmed[:street_number].max\n end", "def breaking_changes?(version)\n\t\t\tDownloadTV::VERSION.split(\".\").zip(version.split(\".\")).find_index { |x, y| y > x }&.< 2\n\t\tend", "def address_correlate\n return nil unless (self.community.respond_to?(:launch_date) && Community.find_by_name(\"Lexington\").respond_to?(:launch_date))\n return nil if self.community.launch_date.to_date < Community.find_by_name(\"Lexington\").launch_date.to_date\n likeness = 0.94\n addr = []\n street = self.community.street_addresses\n street.each do |street_address|\n st_addr = street_address.address\n test = st_addr.jarowinkler_similar(address.split(\",\").first)\n if test > likeness\n likeness = test\n addr.clear\n addr << street_address\n elsif test == likeness\n addr << street_address\n end\n end\n\n if addr.empty?\n addr << create_st_address\n end\n\n addr.first\n end", "def assigned_version_roadways\n version = assigned_version\n\n if version # you need to ensure that there is even an inspection that was moved through assigned\n typed_version = TransamAsset.get_typed_version(version)\n\n if version.respond_to? :reify # if the highway structure returns a version you can use its version to find the versions associated with roadways\n return typed_version.roadways\n else # otherwise you have a highway structure that is \"live\" ie what is the DB right now and you have to figure out what versions of roadways are associated\n # given the time of assignment\n # you know that if a roadway wasnt updated since the time of assignment that those roadways were like that at assignment. they can be included in roadways of the assigned version\n time_of_assignment = assigned_inspection_version.created_at\n results = typed_version.roadways.where('updated_at <= ?', time_of_assignment).to_a\n\n # therefore you only need to check roadways updated after time of assignment\n # for those roadways, you find the version that is closest and before the time of assignment\n # versions save the object BEFORE the change\n # therefore to get the version at time of assignment you need the first version that happened after the time of assignment\n typed_version.roadways.where('updated_at > ?', time_of_assignment).each do |roadway|\n ver = roadway.versions.where('created_at > ?', time_of_assignment).where.not(event: 'create').order(:created_at).first\n results << ver.reify if ver\n end\n return results\n end\n end\n end", "def assume_parts\n # Check if unit is in street number\n # 1) If street number has - or / unit is the smallest length\n # 2) If street number is all nums except 1 letter, letter is unit\n search_for_unit_in_street_num if @parts[:unit].nil? && @parts[:street_number]\n\n # Search for the street_name elsewhere\n search_for_street_name if @parts[:street_name].nil?\n\n # set puerto rico as the state\n @parts[:state] = @parts[:country] if @parts[:state].nil? && @parts[:country] == 'pr'\n\n return if @parts[:bus].nil? || @parts[:bus].empty?\n\n search_for_label_in_bus if @parts[:street_label].nil?\n search_for_state_in_bus if @parts[:state].nil?\n\n end", "def test_rbs_have_matching_osm_tests\n # List of tests that don't have a matching OSM test for a valid reason\n # No \"Warn\" will be issued for these\n # input the ruby file name, eg `xxxx.rb` NOT `test_xxx_rb`\n noMatchingOSMTests = ['ExampleModel.rb',\n 'autosize_hvac.rb',\n # Not enabled\n 'afn_single_zone_ac.rb']\n\n base_dir = $ModelDir\n all_ruby_paths = Dir.glob(File.join(base_dir, '*.rb'));\n all_ruby_filenames = all_ruby_paths.map{|p| File.basename(p)};\n\n all_ruby_filenames.each do |filename|\n if !noMatchingOSMTests.include?(filename)\n # Check if there is a matching OSM file\n matching_osm = File.join(base_dir, filename.sub('.rb', '.osm'))\n\n # If you want to be stricter than warn, uncomment this\n # assert File.exists?(matching_osm), \"There is no matching OSM test for #{filename}\"\n\n if File.exists?(matching_osm)\n v = OpenStudio::IdfFile.loadVersionOnly(matching_osm)\n # Seems like something we should definitely fix anyways, so throwing\n if not v\n fail \"Cannot find versionString in #{matching_osm}\"\n end\n\n # If there is a version, check that it's not newer than current bindings\n model_version = v.get.str\n\n if Gem::Version.new(model_version) > Gem::Version.new($SdkVersion)\n # Skip instead of fail\n skip \"Matching OSM Model version is newer than the SDK version used (#{model_version} versus #{$SdkVersion})\"\n end\n else\n # If there isn't a matching, we warn, but we'll still run it\n # It might make sense if you have just added it recently\n warn \"There is no matching OSM test for #{filename}\"\n end\n end\n end\n end", "def compare_versions(local_version,depot_version,mode)\n if local_version.match(/-/)\n local_version = local_version.split(/-/)[1]\n end\n if depot_version.match(/-/)\n depot_version = depot_version.split(/-/)[1]\n end\n puts \"Current: \"+local_version\n puts \"Available: \"+depot_version\n if mode =~ /up|check/\n avail_fw = compare_ver(local_version,depot_version)\n if avail_fw.to_s != local_version.to_s\n puts \"Depot patch level is newer than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n else\n if depot_version.to_i < local_version.to_i\n puts \"Depot patch level is lower than installed version\"\n update_available = \"y\"\n else\n update_available = \"n\"\n puts \"Local patch level is up to date\"\n end\n end\n if mode == \"check\"\n exit\n end\n return update_available\nend", "def street_areSame?(street)\n if(@street == street)\n true\n else\n false\n end\nend", "def check_addresses\n\n if location = @found_params.entities.detect {|entity| entity.name == \"from\"} || @ride.start_address\n if @ride.start_address\n address = @ride.start_address\n else\n address = geocode(location.value)\n end\n\n @ride.start_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @start_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n @time = UberService.new(@ride).time_estimates\n @time = @time / 60 if @time.class == Fixnum\n\n end\n\n if location = @found_params.entities.detect {|entity| entity.name == \"to\"} || @ride.end_address\n if @ride.end_address\n address = @ride.end_address\n else\n address = geocode(location.value)\n end\n\n @ride.end_address = address\n @ride.save\n\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n @end_address_nice = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n end\n\n if (location = @found_params.entities.detect {|entity| entity.name == \"address\"}) && (@ride.end_address || @ride.start_address)\n\n address = geocode(location.value)\n geo = Geocoder.search(\"#{address.latitude},#{address.longitude}\").first.address_components\n nice_address = geo.first[\"short_name\"] + \" \" + geo.second[\"short_name\"] + \" à \" + geo.third[\"short_name\"]\n\n\n if @ride.start_address\n @ride.end_address = address\n @end_address_nice = nice_address\n else\n @ride.end_address = address\n @start_address_nice = nice_address\n end\n\n @ride.save\n end\n\n if !@ride.end_address.nil? && !@ride.start_address.nil?\n @price = UberService.new(@ride).price_estimates\n end\n end", "def compare_versions\n if @local_version && \n (@local_version.to_machine_format >= @website_version.to_machine_format)\n display_versions\n puts \"You have the most recent version.\"\n puts \"Exiting...\"\n exit 0\n end\nend", "def test_version\n check_current_version(current_ways(:visible_way).id)\n check_current_version(current_ways(:used_way).id)\n check_current_version(current_ways(:way_with_versions).id)\n end", "def gotPoint(lat,lon)\n\n nearby_place_found = false\n\n # call get_close_places to get nearby OSM places\n # (as per the grid squares)\n get_close_places(lat,lon).each do |place|\n\n #for each place\n plat,plon,name = place\n\n if is_close([lat, lon], [plat.to_f, plon.to_f])\n #It's vaguely close by. Let's do the actual distance calculation\n dist = spherical_distance([lat, lon], [plat.to_f, plon.to_f])\n if dist < Buffer\n nearby_place_found = true\n break\n end\n end\n end\n if not nearby_place_found\n #No nearby places found (which is the intersting case!)\n $missingcount+=1\n puts \"gpx point \" + $count.to_s + \" - No nearby place. \" + lat.to_s + \" \" + lon.to_s #+ \" \" + shortest_dist.to_s + \"km (\" + shortest_place.to_s + \" \" + splat.to_s + \" \" + splon.to_s + \")\"\n\n #Write a waypoint to the output GPX file\n File.open(OutputGPX, 'a') {|f| f.write( \"<wpt lat=\\\"\" + lat.to_s + \"\\\" lon=\\\"\" + lon.to_s + \"\\\"></wpt>\\n\" ) }\n\n end\nend", "def highway_structure_version_roadways\n typed_version = TransamAsset.get_typed_version(highway_structure_version)\n if state == 'final'\n if highway_structure_version.respond_to? :reify\n typed_version.roadways\n else\n time_of_finalization = versions.last.created_at\n results = typed_version.roadways.where('updated_at <= ?', time_of_finalization).to_a\n\n typed_version.roadways.where('updated_at > ?', time_of_finalization).each do |roadway|\n ver = roadway.versions.where('created_at > ?', time_of_finalization).where.not(event: 'create').order(:created_at).first\n results << ver.reify if ver\n end\n return results\n end\n else\n return highway_structure.roadways\n end\n end", "def needs_geocoding?\n self.new_record? || self.city_changed? || self.street_address_changed?\n end", "def prerelease?(version)\n !!PRERELEASE_STRINGS.detect do |string|\n version.match(/[^\\w]#{string}[^\\w]/)\n end\n end", "def sputnik?(expected_version = nil)\n Sputnik.new(ua).match? && detect_version?(full_version, expected_version)\n end", "def solution_correct?\n current = params[:solution].strip\n current.gsub!(/\\/\\*[\\w\\s]*\\*\\//,\"\") \n current.gsub!(/--.*\\n/,\"\")\n existing = format_str(@lesson.solution.strip)\n current = format_str(current.strip)\n if existing == current\n return true\n else\n existing_arr = existing.split\n current_arr = current.split\n len= existing_arr.length\n err =[]\n j=0 \n for i in 0..len\n if existing_arr[i]!=current_arr[i]\n err[j]= existing_arr[i]\n j=j+1 \n end\n end\n return err\n end \n end", "def no_change_in_version?\n latest_resolvable_version <= existing_version\n end", "def valid_address?( delta = 1.0 )\n @required = [:ups_account, :ups_user, :ups_password]\n \n state = STATES.has_value?(@state.downcase) ? STATES.index(@state.downcase) : @state\n \n @data = String.new\n b = Builder::XmlMarkup.new :target => @data\n \n b.instruct!\n b.AccessRequest {|b|\n b.AccessLicenseNumber @ups_account\n b.UserId @ups_user\n b.Password @ups_password\n }\n b.instruct!\n b.AddressValidationRequest {|b|\n b.Request {|b|\n b.RequestAction \"AV\"\n b.TransactionReference {|b|\n b.CustomerContext \"#{@city}, #{state} #{@zip}\"\n b.XpciVersion API_VERSION\n }\n }\n b.Address {|b|\n b.City @city\n b.StateProvinceCode state\n b.PostalCode @zip\n }\n }\n \n \t get_response \"https://wwwcie.ups.com/ups.app/xml/AV\"\n \n \t\tif REXML::XPath.first(@response, \"//AddressValidationResponse/Response/ResponseStatusCode\").text == \"1\" && REXML::XPath.first(@response, \"//AddressValidationResponse/AddressValidationResult/Quality\").text.to_f >= delta\n \t\t return true\n \t\telse\n \t\t return false\n \t\tend\n end", "def compare_for_near_match(guess_index)\n (0..3).each do |code_index|\n next unless guess[guess_index] == code[code_index]\n\n key.push(\"O\")\n code[code_index] = 0\n break\n end\n end", "def routes_are_correct?\n @solution.each do |route|\n return false if route.demand > @vehicle_capacity\n end\n return true\n end", "def scanSameNameWithDifferentSimilarTrackCount()\n problemCount = 0;\n SimilarTracksVersionControl.find(:all, :conditions => [\"version = ? and status = ? and similar_track_count > ?\" , 1, 1, 0]).each do |strack|\n puts \"track_id:\" + strack.track_id.to_s();\n \n\n scs = SimilarTracksVersionControl.find(:all, :order => \"similar_track_count desc\", :limit => 1, :conditions => [\"track_name = ? and track_artist_id = ? and track_id != ? and status = ? and similar_track_count > ?\", strack.track_name, strack.track_artist_id, strack.track_id, 1, 0]);\n status = 0;\n if (scs != nil and !scs.empty?)\n sc = scs.first;\n puts \"matched track_id:\" + sc.track_id.to_s();\n if (strack.similar_track_count < sc.similar_track_count)\n strack.same_name_with_different_similar_track_count_fix = sc.track_id;\n strack.status = 200;\n strack.save();\n puts \"need fix:\" + strack.similar_track_count.to_s + \" < \" + sc.similar_track_count.to_s;\n problemCount = problemCount + 1;\n end\n\n end\n \n \n end #end of loop\n puts \"total needs fix:\" + problemCount.to_s();\n \n end", "def srss?\n lat != 0.0 && long != 0.0 #there should not be an airfield, somewhere in the ocean\n end", "def in_same_release_line?(other)\n major == other.major &&\n # minor and patch always match if one or the other is nil (~>-like behavior)\n ( minor.nil? || other.minor.nil? || minor == other.minor ) &&\n ( patch.nil? || other.patch.nil? || patch == other.patch )\n end", "def suitable_for_all?\n<<<<<<< HEAD:app/models/project.rb\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n=======\n \treturn self.disciplines.count(:all) == Discipline.count(:all)\n>>>>>>> 336471e6be257cf55c9afa2a65f928fde34e41fe:app/models/project.rb\n end", "def internal_or_core?(pin); end", "def remove_duplicate_direction\n spl = @parts[:street_name].split\n return unless @parts[:street_direction].include? spl.first\n\n @parts[:street_name] = spl[1..].join\n end", "def upgrades_to?(from, to, special = false)\n return false if from.name == '470'\n # double dits upgrade to Green cities in gray\n return gray_phase? if to.name == '14' && %w[55 1].include?(from.name)\n return gray_phase? if to.name == '15' && %w[56 2].include?(from.name)\n\n # yellow dits upgrade to yellow cities in gray\n return gray_phase? if to.name == '5' && from.name == '3'\n return gray_phase? if to.name == '57' && from.name == '4'\n return gray_phase? if to.name == '6' && from.name == '58'\n\n # yellow dits upgrade to plain track in gray\n return gray_phase? if to.name == '7' && from.name == '3'\n return gray_phase? if to.name == '9' && from.name == '4'\n return gray_phase? if to.name == '8' && from.name == '58'\n\n # Certain green cities upgrade to other labels\n return to.name == '127' if from.color == :green && from.hex.name == BARRIE_HEX\n return to.name == '126' if from.color == :green && from.hex.name == LONDON_HEX\n # You may lay the brown 5-spoke L if and only if it is laid on a L hex -\n # NOT EVEN IF YOU GREEN A DOUBLE DIT ON A LAKE EDTGE\n return to.name == '125' if from.color == :green && LAKE_HEXES.include?(from.hex.name)\n # The L hexes on the map start as plain yellow cities\n return %w[5 6 57].include?(to.name) if LAKE_HEXES.include?(from.hex.name) && from.color == :white\n # B,L to B-L\n return to.name == '121' if from.color == :yellow && [BARRIE_HEX, LONDON_HEX].include?(from.hex.name)\n # Hamilton OO upgrade is yet another case of ignoring labels in upgrades\n return to.name == '123' if from.color == :brown && from.hex.name == HAMILTON_HEX\n\n super\n end", "def street_address\n\t\treturn \"#96, Railway Layout, Vijaynagar\"\n\tend", "def version_mismatch_detected\n end", "def address_is_local?(address)\n Rails.configuration.local_addresses.any? { |spec| address_matches spec.strip.split('.'), address.strip.split('.') }\nend", "def meshcode2_coordinate(gps_info)\n grid_square_code = gps_info.to_s\n \n # calc from 1st grid square code\n lat = grid_square_code[0..1].to_f / 1.5; lon = grid_square_code[2..3].to_f + 100\n\n # calc from 2nd grid square code\n latcode = grid_square_code[4].to_f; loncode = grid_square_code[5].to_f\n lat += latcode * 5 / 60; lon += loncode * 7.5 / 60\n\n # calc from 3rd grid square code \n latcode = grid_square_code[6].to_f; loncode = grid_square_code[7].to_f\n lat += latcode * 0.5 / 60; lon += loncode * 0.75 / 60\n\n # calc from 4th grid square code \n num = grid_square_code[8].to_f - 1; latcode = (num / 2).to_i\n loncode = (num - latcode * 2).to_f; \n lat += latcode * 0.5 / 2 / 60; lon += loncode * 0.75 / 2 / 60\n\n # calc from 5th grid square code \n num = grid_square_code[9].to_f - 1\n latcode = (num / 2).to_i; loncode = (num - latcode * 2).to_f\n lat += latcode * 0.5 / 4 / 60; lon += loncode * 0.75 / 4 / 60\n\n # calc from 6th grid square code \n num = grid_square_code[10].to_f - 1\n latcode = (num / 2).to_i; loncode = (num - latcode * 2).to_f\n lat += latcode * 0.5 / 8 / 60; lon += loncode * 0.75 / 8 / 60\n\n mlat = 0.5 / 8; mlon = 0.75 / 8\n \n # left-down lat/ lon\n lat0 = lat; lon0 = lon\n # right-up lat/ lon\n lat1 = lat0 + mlat / 60; lon1 = lon0 + mlon / 60\n \n return lon0, lat0, lon1, lat1\n end", "def street(with_suite = true)\n if precise?\n string = geocoded_street\n else\n string = user_given_street\n end\n\n if with_suite and suite.present?\n \"#{string}, #{suite}\"\n else\n string\n end\n end", "def verifierCorrect()\n return @solution.equals(@partie.getCurrentGrid())\n end", "def test_street_connection\r\n\t\thillman = Location::new(\"Hillman\", \"Foo St.\", nil)\r\n\t\tassert_equal \"Foo St.\", hillman.street\r\n\tend", "def exact_matches(loc=@counter)\n matches = 0\n 4.times{ |x| matches += 1 if @guessgrid[loc][x] == @code[x] }\n matches\n end", "def find_st_address\n matched = StreetAddress.where(\"address ILIKE ?\", \"%#{self.address}%\")\n\n return matched.first if matched.count == 1\n\n # This should not happen when verify_address is written\n if matched.count == 0\n # matched = create_st_address\n return nil\n else\n return nil\n # We somehow...have the same street address more than once D=\n # This should never happen\n end\n\n return matched\n end", "def vat_number_expected?\n return false unless has_billing?\n billing_address.country != store.country\n end", "def invalid_longitude_roads\n north = 80\n east = -178\n south = 79\n west = -181\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def test_locations_of_fourth_ave\n\t\tassert_equal \"Cathedral\", @road2.locations[0]\n\tend", "def test_history_equals_versions\n check_history_equals_versions(current_ways(:visible_way).id)\n check_history_equals_versions(current_ways(:used_way).id)\n check_history_equals_versions(current_ways(:way_with_versions).id)\n end", "def set_partial_name_match\n return if waypoints.length == 0\n #Only need to compute partial name match if new or a name has changed.\n return unless self.id.nil? || self.name_changed? || self.alternate_names_changed?\n #For each place look for trimmed name inside the places full names\n Place.find_by_radius(averageLatitude, averageLongitude, 70).each do |place|\n next if place == self\n trimmed_names.each do |trimmed| #Look for trimmed names in neighbour places names\n\tplace.raw_names.each do |name|\n\t if name.match(trimmed)\n\t self.partial_name_match = false\n\t return\n\t end\n\tend\n end\n end\n self.partial_name_match = true\n end", "def have_version?(major, minor = nil, update = nil, build = nil)\n if major.class == Float\n major = major.to_s\n end\n if major.class == String\n major,minor,update = major.split('.').collect { |x| x.to_i }\n end\n if major == @major\n return false if minor != nil && minor != @minor\n return false if update != nil && update != @update\n return false if build != nil && build != @build\n return true\n else\n return false\n end\n end", "def IsThereNewTrackers?(last_refresh, known_trackers, m_id, numMaxCoords, offset)\n trackers=[]\n attempts=Attempt.where(\"mission_id = ?\",m_id)\n #.order(tracker_id: :asc)\n # allTrackers=[]\n # attempts.each_cons(2) do |element, next_element|\n # if next_element.tracker_id != element.tracker_id\n # allTrackers.push(element.tracker_id.to_s)\n # end\n # allTrackers.push(element.tracker_id.to_s)\n # end\n # .where({ tracker_id: allTrackers})\n if (last_refresh != \"10000101\" && last_refresh != nil)#the map already contains coordinates\n datetime = last_refresh.to_datetime\n newCoords = (Coordinate.where(id: Coordinate.order(datetime: :desc).limit(numMaxCoords).where(\"datetime > ?\", datetime).where.not(tracker_id: known_trackers))).where(\"datetime > ?\", datetime).where.not(tracker_id: known_trackers).order(tracker_id: :asc)\n if (newCoords != [])\n newCoords.each_cons(2) do |element, next_element|\n if next_element.tracker_id != element.tracker_id\n if (attempts.find_by_tracker_id(element.tracker_id)!=nil) # && trackers.find(element.tracker_id.to_s) == nil)\n trackers.push(element.tracker_id.to_s)\n end\n end\n end\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n end\n return trackers\n else #the map does not have any coordinates\n if getMissionIds.size > 0 #if there is currently a mission\n if offset.to_i == 0\n start = Mission.find(m_id).start\n else\n start = (Time.now.utc-offset.to_f)\n end\n newCoords = (Coordinate.where(id: Coordinate.order(datetime: :desc).limit(numMaxCoords).where(\"datetime > ?\", start).where.not(tracker_id: known_trackers))).where(\"datetime > ?\", start).where.not(tracker_id: known_trackers).order(tracker_id: :asc)\n\n if (newCoords != [])\n \tif newCoords.size > 1\n\t\t newCoords.each_cons(2) do |element, next_element|\n\t\t if next_element.tracker_id != element.tracker_id\n if (attempts.find_by_tracker_id(element.tracker_id)!=nil) # && trackers.find(element.tracker_id.to_s) == nil)\n\t\t trackers.push(element.tracker_id.to_s)\n end\n\t\t end\n\t\t end\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n else\n if (attempts.find_by_tracker_id(newCoords.last.tracker_id)!=nil) # && trackers.find(newCoords.last.tracker_id.to_s) == nil)\n trackers.push(newCoords.last.tracker_id.to_s)\n end\n end\n end\n return trackers\n end\n end\n end", "def full_hq_address_changed?\n hq_address_changed? || hq_zip_code_changed? || hq_city_changed? || hq_country_changed?\n end", "def upgrades_to_correct_label?(from, to)\n (%w[8 9].include?(from.name) && to.label&.to_s == '$20') || super\n end", "def next_station_available?\n current_station_index != @route.stations.length - 1\n end", "def if_goal_reachable(num_gas_stand, course_distance, init_gas_amount, gas_stand_spot, gas_amounts)\n track = Track.new(init_gas_amount)\n gas_stand_spot.each_with_index do |dist, index|\n print \"index: #{index}, dist: #{dist}\\n\"\n track.run(dist - track.location)\n while track.check_gasoline_necessary\n if_successful = track.consume_gasoline\n print \"gasoline_necessary. consume gasoline_successful? #{if_successful}\\n\"\n return -1 unless if_successful\n end\n track.gasoline_right_provided(gas_amounts[index])\n end\n\n # From last gas stop to the goal\n track.run(course_distance - track.location)\n if track.check_gasoline_necessary\n if_successful = track.consume_gasoline\n return -1 unless if_successful\n end\n print \"gas_station_used: #{track.show_gas_station_used}\\n\"\n return track.count_gas_stand_used\nend", "def find_city(lat,lng)\n if Geocoder::Calculations.distance_between([lat,lng], [40.698390,-73.98843]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [40.76813,-73.96439]) < 20\n \"newyork\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76423,-122.47743]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [37.76912,-122.42593]) < 20\n \"sanfrancisco\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.85887,2.30965]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [48.86068,2.36389]) < 20\n \"paris\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [51.51,-0.13]) < 20\n \"london\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.57664,-46.69787]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [-23.55838,-46.64362]) < 20\n \"saopaulo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.64446,139.70695]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [35.70136,139.73991]) < 20\n \"tokyo\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.06901,-118.35904]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.07499,-118.28763]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [34.02663,-118.45998]) < 20\n \"losangeles\"\n elsif\n Geocoder::Calculations.distance_between([lat,lng], [50.07832,14.41619]) < 20\n \"prague\"\n else\n \"unknown\"\n end\n end", "def invalid_latitude_roads\n north = 91\n east = -100\n south = 90\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def check_version(major_version, minor_version)\n @ole.CheckVersion(major_version, minor_version)\n end", "def valid_routing_number?\n d = routing.to_s.split('').map(&:to_i).select { |d| (0..9).include?(d) }\n case d.size\n when 9 then\n checksum = ((3 * (d[0] + d[3] + d[6])) +\n (7 * (d[1] + d[4] + d[7])) +\n (d[2] + d[5] + d[8])) % 10\n case checksum\n when 0 then true\n else false\n end\n else false\n end\n end", "def test_final_trans_false\n assert_equal(false, @bv.final_trans?([\"FROM_ADDR\", \"TO_ADDR\", \"46\"], 3, 4))\n end", "def new_version?\n package_branch.new_version?(self.unit)\n end", "def dev_or_test_and_have_geo_unchanged?\n (Rails.env.development? || Rails.env.test?) &&\n (!latitude.nil? && !longitude.nil?) &&\n (self.new_record? || !((self.changed & GEO_FIELDS).any?) )\n end", "def major_place\n if numeric_place?\n 0\n elsif rejected?\n 5\n elsif place.blank? || place == 0\n 1\n elsif place.casecmp(\"DNF\").zero?\n 2\n elsif place.casecmp(\"DQ\").zero?\n 3\n elsif place.casecmp(\"DNS\").zero?\n 4\n else\n 6\n end\n end", "def latlng_good?\n self.addr_latlng && self.addr_latlng.lat && self.addr_latlng.lng\n end", "def version_gte_81?\n version >= v81\n end", "def validLocation(collectable, str, ave)\n oldLoc = Location.find(collectable.location_id)\n a = oldLoc.ave\n st = oldLoc.street\n\n if(Location.find_by(ave: \"#{a.to_i + ave}\"))\n new_ave = a.to_i + ave\n else\n new_ave = a.to_i - ave\n end\n\n if(Location.find_by(street: \"#{st.to_i + str}\"))\n new_str = st.to_i + str\n else\n new_str = st.to_i - str\n end\n\n Location.find_by(street: new_str, ave: new_ave)\nend", "def do_full_address_assertions(res)\n assert_equal \"California\", res.state\n assert_equal \"San Francisco\", res.city\n assert_equal \"37.792391,-122.394024\", res.ll\n assert res.is_us?\n assert_equal \"Spear Street 100, San Francisco, California, 94105, US\", res.full_address\n assert_equal \"osm\", res.provider\n end", "def not_duplicate_route\n return unless waypoints.length != 0 && self.name_changed? && self.name != \"Trip route\"\n Route.find_by_radius(waypoints.first.latitude,waypoints.first.longitude, 20).each do |route|\n next if self.id == route.id #Prevents self testing on update\n if route.name == name\n\tputs \"There is already another #{type.titleize.tableize.singularize} in this area with that name. This #{type.titleize.tableize.singularize} might have already been submitted.\"\n errors.add(:route, \"There is already another #{type.titleize.tableize.singularize} in this area with that name. This #{type.titleize.tableize.singularize} might have already been submitted.\")\n end\n end\n end", "def outdated_state(scraper_version, latest_version)\n scraper_parts = scraper_version.to_s.split(/[-.]/).map(&:to_i)\n latest_parts = latest_version.to_s.split(/[-.]/).map(&:to_i)\n\n # Only check the first two parts, the third part is for patch updates\n [0, 1].each do |i|\n break if i >= scraper_parts.length or i >= latest_parts.length\n return 'Outdated major version' if i == 0 and latest_parts[i] > scraper_parts[i]\n return 'Outdated minor version' if i == 1 and latest_parts[i] > scraper_parts[i]\n return 'Up-to-date' if latest_parts[i] < scraper_parts[i]\n end\n\n 'Up-to-date'\n end", "def pcb_pn_equal?(part_number)\n self.pcb_prefix == part_number.pcb_prefix &&\n self.pcb_number == part_number.pcb_number &&\n self.pcb_dash_number == part_number.pcb_dash_number &&\n self.pcb_revision == part_number.pcb_revision\n end", "def address_changed?\n \tstreet_changed? || city_changed? || state_changed?\n end", "def allow_package_level_reference_numbers(shipment)\n origin, destination = shipment.origin.country.code, shipment.destination.country.code\n [['US', 'US'], ['PR', 'PR']].include?([origin, destination])\n end", "def check_versions(json)\n # *_url fields are generated per board requirements, not in db\n=begin\n assert_equal(Firmware::HTTP_ROOT + 'external/v2/' +\n ActiveSupport::TestCase.EXTERNAL_VERSION,\n json[\"external_url\"],\n \"external_url must be correctly constructed\")\n=end\n assert_equal(Firmware::FTP_ROOT + 'internal/v2/' +\n ActiveSupport::TestCase.INTERNAL_VERSION,\n json[\"internal_url\"],\n \"internal_url must be correctly constructed\")\n assert_equal(Firmware::HTTP_BUCKET + 'external/v2/',\n json[\"external_path\"],\n \"external_path must be correctly constructed\")\n assert_equal('/internal/v2/',\n json[\"internal_path\"],\n \"internal_path must be correctly constructed\")\n # *_ip is temporary for alpha so the lock http code doesn't\n # have to resolve dns.\n resolver = Resolv::DNS.new\n external_ip = resolver.getaddress(Firmware::HTTP_HOST).to_s\n internal_ip = resolver.getaddress(Firmware::FTP_HOST).to_s\n resolver.close\n assert_equal(external_ip, json[\"external_ip\"],\n \"external_ip must be correctly constructed\")\n assert_equal(internal_ip, json[\"internal_ip\"],\n \"internal_ip must be correctly constructed\")\n assert_equal(Firmware::HTTP_HOST, json[\"external_host\"],\n \"external_host must be correctly constructed\")\n assert_equal(Firmware::FTP_HOST, json[\"internal_host\"],\n \"internal_host must be correctly constructed\")\n assert_equal(Firmware::FTP_USER, json[\"internal_user\"],\n \"internal_user must be correctly constructed\")\n assert_equal(Firmware::FTP_PASS, json[\"internal_pass\"],\n \"internal_pass must be correctly constructed\")\n end", "def check_waypoint(in_lat, in_long, in_time, in_id)\n is_lat_float = float?(in_lat)\n is_long_float = float?(in_long)\n is_sent_date = date?(in_time)\n\n # Se podria agregar una verificacion del\n # identificador del vehiculo\n\n if !is_lat_float || !is_long_float || !is_sent_date || !in_id\n return false\n end\n\n true\n end", "def find_invalid_primary_st_ops_filenames\n # TODO: Validate that st-ops-files in primary repo have no\n # duplicate time stamps, and that from and to commits form a\n # contiguos, linear sequence.\n true\n end", "def validate_address(street,sid,house_nr) \n\n url = 'http://ags2.lojic.org/ArcGIS/rest/services/External/Address/MapServer/exts/AddressRestSoe/ValidateAddress?' +\n \"token=XByufiRcTeZJOARKuu3jJV2mNkBRSCD--D1YqeBZDCuEij4BnbkuzNL3QcE-l3mwAnR7Rs9CoaKo-Xp8j4Tsuw..\" +\n '&Houseno='+ house_nr.to_s + \n '&SifID='+sid.to_s + \n '&Apt='+\n '&f=json'+\n 'callback=dojo.io.script.jsonp_dojoIoScript52._jsonpCallback'\n\n html = cache \"house\" + sid + \"_house\" + house_nr ,url\n\n json = JSON.parse(html)\n\n if json \n if json.include?('Candidates')\n json['Candidates'].each{ |house|\n\n # creat the source point in meters\n srcPoint = Proj4::Point.new( house[\"X\" ] * 0.3048006 , house[\"Y\" ] * 0.3048006 , )\n\n # transform it \n point = @srcPrj.transform(@destPrj, srcPoint)\n\n # covert to degrees\n lat = point.x * Proj4::RAD_TO_DEG\n lon= point.y * Proj4::RAD_TO_DEG\n\n p = Node.new(lon,lat)\n p.kv 'addr:housenumber', house[\"Houseno\"].to_s\n#<tag k=\"addr:housenumber\" v=\"{\"Houseno\"=>4305, \"Hafhouse\"=>\"\", \"Apt\"=>\"\", \"Roadname\"=>\"W MUHAMMAD ALI BLVD\", \"FullAddress\"=>\"4305 W MUHAMMAD ALI BLVD\", \"ZIPCode\"=>\"40212\", \"Sitecad\"=>1110234909, \"X\"=>1188974.2500012815, \"Y\"=>280104.8749201}\"/>\n# p.kv 'addr:full', house[\"FullAddress\"]\n p.kv 'addr:suite', house[\"Apt\"]\n p.kv 'addr:Hafhouse', house[\"Hafhouse\"]\n p.kv 'addr:street', street\n p.kv 'addr:postcode', house[\"ZIPCode\"]\n p.kv 'building', \"yes\"\n\n @properties.push(p)\n }\n end \n end\n\n end", "def valid_routing_number?\n d = routing_number.to_s.split('').map(&:to_i).select { |d| (0..9).include?(d) }\n case d.size\n when 9 then\n checksum = ((3 * (d[0] + d[3] + d[6])) +\n (7 * (d[1] + d[4] + d[7])) +\n (d[2] + d[5] + d[8])) % 10\n case checksum\n when 0 then true\n else false\n end\n else false\n end\n end", "def S(n1, n2); Ladds.street(n1, n2); end", "def check_version(v)\n return true if (!version || version[0..4].gsub(\".\",\"\").to_i>=v)\n return false\n end", "def has_timestamp?(version)\n _ver, build_info = version.split(\"+\")\n return false if build_info.nil?\n\n build_info.split(\".\").any? do |part|\n Time.strptime(part, Omnibus::BuildVersion::TIMESTAMP_FORMAT)\n true\n rescue ArgumentError\n false\n end\n end", "def no_duplicate_places\n\n return if (self.latitude.nil? || self.longitude.nil?) && border_points.length < 3\n return unless name_changed? || self.id.nil? || self.latitude_changed? || self.longitude_changed?\n places = Place.find_by_radius(centerLatitude,centerLongitude,0.02,0)\n if(places.length > 1 || (places.length == 1 && places.first != self))\n errors.add(:latitude, \"Must be at least 20 meters from other places\")\n end\n\n Place.find_by_radius(centerLatitude, centerLongitude, 10, 0).each do |place|\n if place.id != self.id && place.name == self.name\n errors.add(:name, \"There is already a #{self.class.to_s} with that name in this area\")\n end\n end\n end", "def check_history_collision\n # puoi rientarre nello stesso momento in cui sei uscito\n # puoi uscire nello stesso momento in cui sei entrato\n if self.profile.punches\n .where('(punches.arrival <= ? AND punches.departure > ?) OR (punches.arrival < ? AND punches.departure >= ?)', self.arrival, self.arrival, self.departure, self.departure)\n .where('punches.id != ?', self.id || 0).any?\n self.errors.add(:base, \"Si interseca con altre entrate. Controllare le presenze incomplete dello studente.\")\n return false\n end\n true\n end", "def location_for(place_or_version, fake_version = nil)\n if place_or_version =~ /^((?:git|https)[:@][^#]*)#(.*)/\n [fake_version, { :git => $1, :branch => $2, :require => false }].compact\n elsif place_or_version =~ /^file:\\/\\/(.*)/\n ['>= 0', { :path => File.expand_path($1), :require => false }]\n else\n [place_or_version, { :require => false }]\n end\nend", "def check_ort_ll(ort_array, ort)\n unless ort_array.include? ort\n ort_array << ort if ort and ort.lon and ort.lat\n end\n end", "def previous_station_available?\n current_station_index != 0\n end", "def south_greater_than_north_roads\n north = 78\n east = -100\n south = 79\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend", "def test_rubygems_to_standard_equality_comparison\n assert_operator(::Versionomy.parse('1.2.0', :rubygems), :==, ::Versionomy.parse('1.2'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :==, ::Versionomy.parse('1.2b3'))\n end", "def version_euristic(urls, regex = nil)\n urls.each do |url|\n puts \"Trying with url #{url}\" if ARGV.debug?\n match_version_map = {}\n case\n when DownloadStrategyDetector.detect(url) <= GitDownloadStrategy\n puts \"Possible git repo detected at #{url}\" if ARGV.debug?\n\n git_tags(url, regex).each do |tag|\n begin\n # Remove any character before the first number\n tag_cleaned = tag[/\\D*(.*)/, 1]\n match_version_map[tag] = Version.new(tag_cleaned)\n rescue TypeError\n end\n end\n when url =~ %r{(sourceforge\\.net|sf\\.net)/}\n project_name = url.match(%r{/projects?/(.*?)/})[1]\n page_url = \"https://sourceforge.net/api/file/index/project-name/\" \\\n \"#{project_name}/rss\"\n\n if ARGV.debug?\n puts \"Possible SourceForge project [#{project_name}] detected\" \\\n \"at #{url}\"\n end\n\n if regex.nil?\n regex = %r{/#{project_name}/([a-zA-Z0-9.]+(?:\\.[a-zA-Z0-9.]+)*)}i\n end\n\n page_matches(page_url, regex).each do |match|\n version = Version.new(match)\n # puts \"#{match} => #{version.inspect}\" if ARGV.debug?\n match_version_map[match] = version\n end\n when url =~ /gnu\\.org/\n project_name_regexps = [\n %r{/(?:software|gnu)/(.*?)/},\n %r{//(.*?)\\.gnu\\.org(?:/)?$},\n ]\n match_list = project_name_regexps.map do |r|\n url.match(r)\n end.compact\n\n if match_list.length > 1\n puts \"Multiple project names found: #{match_list}\"\n end\n\n unless match_list.empty?\n project_name = match_list[0][1]\n page_url = \"http://ftp.gnu.org/gnu/#{project_name}/?C=M&O=D\"\n\n if ARGV.debug?\n puts \"Possible GNU project [#{project_name}] detected at #{url}\"\n end\n\n if regex.nil?\n regex = /#{project_name}-(\\d+(?:\\.\\d+)*)/\n end\n\n page_matches(page_url, regex).each do |match|\n version = Version.new(match)\n match_version_map[match] = version\n end\n end\n when regex\n # Fallback\n page_matches(url, regex).each do |match|\n version = Version.new(match)\n match_version_map[match] = version\n end\n end\n\n if ARGV.debug?\n match_version_map.each do |match, version|\n puts \"#{match} => #{version.inspect}\"\n end\n end\n\n empty_version = Version.new(\"\")\n match_version_map.delete_if { |_match, version| version == empty_version }\n\n # TODO: return nil, defer the print to the caller\n return match_version_map.values.max unless match_version_map.empty?\n end\n\n fail TypeError, \"Unable to get versions for #{Tty.blue}#{name}#{Tty.reset}\"\nend", "def verify_version(wrap_op = true)\n model = Sketchup.active_model\n mvers = model.get_attribute('MSPhysics', 'Version')\n cvers = MSPhysics::VERSION\n cver = cvers.gsub(/\\./, '').to_i\n bmake_compatible = false\n if mvers.is_a?(String)\n mver = mvers.gsub(/\\./, '').to_i\n if mver == cver\n return true\n elsif mver < cver\n bmake_compatible = true\n elsif mver > cver\n return false if ::UI.messagebox(\"This model was created with MSPhysics #{mvers}. Your version is #{cvers}. Using an outdated version may result in an improper behaviour! Would you like to continue?\", MB_YESNO) == IDNO\n end\n end\n te = nil\n model.entities.each { |e|\n if e.is_a?(Sketchup::Text) && e.get_attribute('MSPhysics', 'Name') == 'Version Text'\n te = e\n break\n end\n }\n if wrap_op\n op = 'MSPhysics - Utilizing Version'\n Sketchup.version.to_i > 6 ? model.start_operation(op, true, false, false) : model.start_operation(op)\n end\n make_compatible(false) if bmake_compatible\n if te\n te.set_text(\"Created with MSPhysics #{cvers}\\n#{te.text}\")\n else\n te = add_watermark_text(10, 10, \"Created with MSPhysics #{cvers}\", 'Version Text')\n end\n model.set_attribute('MSPhysics', 'Version', cvers)\n model.commit_operation if wrap_op\n true\n end", "def sierra_856_perfect?\n @url == self.proper.proper_856_content\n end", "def valid_placement?(ship, coordinates_array)\n #tracks if previous coord iteration was \"same\" or \"different\"\n situation = \" \"\n #tracks if coordinate is valid or not\n valid = true\n #checks ship length vs num coordinates\n if coordinates_array.length != ship.length\n false\n else\n if coordinates_array.all? {|coor| @cells[coor].empty?} == true\n coordinates_array.each_cons(2) do |coord1, coord2|\n #enters here if coord letters are the same\n if coord1[0] == coord2[0] && situation != \"different\"\n situation = \"same\"\n #checks numbers sequential\n if coord1[1].to_i != (coord2[1].to_i-1)\n valid = false\n break\n end\n #enters here if letters are sequential\n elsif (coord1[0].ord == (coord2[0].ord - 1)) && (situation != \"same\")\n situation = \"different\"\n #checks numbers the same\n if coord1[1] != coord2[1]\n valid = false\n break\n end\n else\n valid = false\n break\n end\n end\n #returns valid\n valid\n else\n valid = false\n end\n end\n\n end", "def coordinates_changed?\n if self.address_changed?\n unless self.lat_changed? || self.lng_changed?\n self.errors.add(:address, 'cannot be geo-located. Please try to be more specific')\n return false\n end\n end\n true\n end", "def test_rubygems_to_standard_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.3', :rubygems), :<, ::Versionomy.parse('1.2.4'))\n assert_operator(::Versionomy.parse('1.2.b.3', :rubygems), :>, ::Versionomy.parse('1.2b2'))\n assert_operator(::Versionomy.parse('1.2', :rubygems), :>, ::Versionomy.parse('1.2b1'))\n end", "def check_zone_is_installed()\n if options['host-os-name'].to_s.match(/SunOS/)\n if options['host-os-release'].split(/\\./)[0].to_i > 10\n exists = true\n else\n exists = false\n end\n else\n exists = false\n end\n return exists\nend", "def detect_location\n if self.text\n LOCATION_PATTERNS.find { |p| self.text[p] }\n self.location = Location.geocode($1) if $1\n self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)\n end\n if !self.location && self.zip\n self.location = Location.geocode(self.zip)\n end\n self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location\n ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon\n true\n end", "def detect_location\n if self.text\n LOCATION_PATTERNS.find { |p| self.text[p] }\n self.location = Location.geocode($1) if $1\n self.zip = location.postal_code if !self.zip && (self.location && location.postal_code)\n end\n if !self.location && self.zip\n self.location = Location.geocode(self.zip)\n end\n self.location = self.reporter.location if !self.location && self.reporter && self.reporter.location\n ll, self.location_accuracy = self.latlon.split(/:/) if self.latlon\n true\n end", "def test_equality_parsed\n value1_ = ::Versionomy.parse(\"1.8.7p72\")\n value2_ = ::Versionomy.parse(\"1.8.7.0-72.0\")\n assert_equal(value2_, value1_)\n assert_equal(value2_.hash, value1_.hash)\n end", "def sort_snps\n @snps.sort!{|x,y| x.location <=> y.location}\n end", "def check_conflict_rook(start_item, end_item)\n res = ''\n rook_list = get_piece_list(:torr, start_item.color_piece)\n if rook_list.size > 2\n raise \"Error More then 2 rooks. why?\"\n end\n rook_list.each do |rook|\n if rook.row == start_item.row and \n rook.col == start_item.col\n # same pice as start_item\n next\n end\n # here we have the second rook\n # check if the final position is on the same row of the second rook\n if rook.row == end_item.row\n # check if the second rook could also reach the final position\n num = num_pieces_onrow(end_item, rook)\n if ( num == 0)\n #free street between, need more info: column of the start position\n #p \"extra info rook row #{start_item.color_piece}\"\n #print_board\n res = start_item.colix_tostr\n end\n end\n # check if they are on the same column\n if rook.col == end_item.col\n num = num_pieces_oncolumn(end_item, rook)\n if ( num == 0)\n #free street between, need more info: row of the start position\n #p \"extra info rook column #{start_item.color_piece}\"\n #print_board\n res = \"#{start_item.row + 1}\"\n end\n end\n end\n return res\n end", "def street_suffix; end", "def near_match\n (0..3).each do |guess_index|\n compare_for_near_match(guess_index)\n end\n end", "def find_residency\n a = residence_different ? res_address : address\n z = residence_different ? res_zip : zip\n a = a.gsub(\"STREET\",\"ST\");\n a = a.gsub(\"DRIVE\",\"DR\");\n a = a.gsub(\"AVENUE\",\"AVE\");\n a = a.gsub(\"ROAD\",\"RD\");\n a = a.gsub(\"LANE\",\"LN\");\n a = a.gsub(\" \",\" \");\n\n a.delete! ','\n a.delete! '.'\n a.strip!\n p = Parcel.find :first, :conditions => ['address like ? and left(PAR_ZIP, 5) = ?', a, z[0, 5]]\n if p\n exp_fire = Fire.find_by_gis_name p.DISTRICT\n exp_school = School.find_by_gis_name p.SCH_NAME\n exp_swis = SwisCode.find_by_swis_code p.SWIS\n self.fire = exp_fire ? exp_fire.pstek_name : ''\n self.school = exp_school ? exp_school.pstek_name : ''\n self.village = exp_swis ? exp_swis.pstek_village_name : ''\n self.town = exp_swis ? exp_swis.pstek_town_name : ''\n save\n end\n end", "def test_standard_to_rubygems_inequality_comparison\n assert_operator(::Versionomy.parse('1.2.4'), :>, ::Versionomy.parse('1.2.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2.beta.3', :rubygems))\n assert_operator(::Versionomy.parse('1.2b2'), :<, ::Versionomy.parse('1.2', :rubygems))\n end", "def compare_locations?(locatin_from, location_to)\n\t\t# location_to.title == locatin_from.title &&\n\t\tlocation_to.city == locatin_from.city &&\t\t\n\t\tlocation_to.custom_address == locatin_from.custom_address &&\n\t\t# location_to.custom_address_use == locatin_from.custom_address_use &&\n\t\t# location_to.gmap_use == locatin_from.gmap_use &&\n\t\t# location_to.gmaps == locatin_from.gmaps &&\n\t\tlocation_to.latitude == locatin_from.latitude &&\n\t\tlocation_to.longitude == locatin_from.longitude\n\t\t# location_to.title == locatin_from.title\n end" ]
[ "0.56617856", "0.5622213", "0.53688985", "0.52612925", "0.52385014", "0.5199634", "0.5196009", "0.5139134", "0.5099616", "0.5096459", "0.50687355", "0.500505", "0.4997049", "0.49902913", "0.4971103", "0.4854134", "0.48421282", "0.48408216", "0.48359808", "0.48330972", "0.48234797", "0.47994715", "0.47903886", "0.47710383", "0.47677606", "0.4761987", "0.47616184", "0.47557905", "0.47421023", "0.47405288", "0.47324774", "0.4731782", "0.47076076", "0.46901166", "0.4689727", "0.4686818", "0.46764618", "0.46673617", "0.46671528", "0.46613428", "0.46603176", "0.4656733", "0.46517083", "0.46455923", "0.46428046", "0.46393076", "0.46358097", "0.4633901", "0.462983", "0.46298137", "0.46228063", "0.46208283", "0.46165702", "0.4601798", "0.45936096", "0.45923918", "0.45900053", "0.45884478", "0.45876944", "0.45839906", "0.45814732", "0.45773992", "0.45772615", "0.45732576", "0.45725226", "0.45612428", "0.4554636", "0.45543495", "0.45462292", "0.45390117", "0.4535289", "0.45322376", "0.45246696", "0.45196384", "0.45188975", "0.451523", "0.4514077", "0.45133698", "0.45133573", "0.45123687", "0.45097345", "0.45094424", "0.4507533", "0.45060322", "0.4504601", "0.4503372", "0.45016536", "0.44959742", "0.44881654", "0.4482044", "0.44815388", "0.44815388", "0.44810373", "0.44810018", "0.44756636", "0.44756106", "0.44661927", "0.44655022", "0.44592047", "0.44507778" ]
0.65193725
0
Deafults to BUH BYE!
def initialize @assailant_header = "X-AIKIDO-ASSAILANT" @get_redirect_status = 301 @other_redirect_status = 303 @get_redirect_url = @other_redirect_url = "https://google.com" @get_redirect_query_params = @other_redirect_query_params = {} @get_redirect_message = @other_redirect_message = "BUH BYE!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bye; end", "def berlioz; end", "def buzzword; end", "def buzzword; end", "def weber; end", "def schubert; end", "def ibu; end", "def bellini; end", "def celebration; end", "def jack_handey; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def berg; end", "def leeway; end", "def leeway; end", "def suivre; end", "def faint; end", "def faint; end", "def gounod; end", "def big_bad; end", "def probers; end", "def hiss; end", "def blg; end", "def check_bingo\n\t\t\n\tend", "def surge; end", "def placebo?; false end", "def remaining; end", "def terpene; end", "def bizet; end", "def reap; end", "def waiver\n end", "def br3ak\n raise RuntimeError, \"OMFG!!1!\"\n end", "def dead?; end", "def upc_e; end", "def mitch_hedberg; end", "def gen_washing\r\r\n end", "def who_we_are\r\n end", "def boom\n raise \"boom\"\n end", "def pour_bottle?; true end", "def private; end", "def ygg_attacker() ; return nil ; end", "def incomplete\r\n\r\n end", "def whiny; end", "def strain; end", "def pausable; end", "def silly_adjective; end", "def dh; end", "def herald; end", "def bug\n end", "def borked?; @borked; end", "def villian; end", "def anchored; end", "def chondromyxoma(buckshee, uncongenially_chiquitan)\n end", "def zuruecksetzen()\n end", "def big_blind\n START_BIG_BLIND\n end", "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "def mech; end", "def mech; end", "def pass; end", "def pass; end", "def blam!\n berzerk? ? w00t! : super\n end", "def miss_reason; end", "def used?; end", "def sharp; accidental; end", "def refutal()\n end", "def attemp_buying\n\n end", "def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend", "def discard; end", "def discard; end", "def ignores; end", "def celebrity; end", "def celebrity; end", "def bs; end", "def semact?; false; end", "def under; end", "def jewelry; end", "def boomtown!\n e = ArgumentError.new(\"BOOMTOWN\")\n report(e)\n end", "def hijacked; end", "def dead\n end", "def bang!\n \"bang!ed method\"\n end", "def reason; end", "def reason; end", "def too_many_hops?; end", "def delelte\n\n end", "def make_bomb\n @has_bomb = true\n end", "def ignore; end", "def king_richard_iii; end", "def set_bomb\n @bombed = true\n end", "def transact; end", "def escaper; end", "def bark\n say('ouah ouah')\n nil\n end", "def mascot; end", "def dead\n \nend", "def delicious?\n\t\treturn true\n\tend", "def circuit_breaker; end", "def usable?; end", "def unused\n end", "def behold_nothing_happens!\n behold! {}\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end" ]
[ "0.6878167", "0.68227845", "0.67997295", "0.67997295", "0.67609125", "0.67543983", "0.6723086", "0.67045325", "0.66406775", "0.66302615", "0.66055566", "0.6591478", "0.65901834", "0.65901834", "0.65256226", "0.64736736", "0.64736736", "0.6469229", "0.64250207", "0.63404584", "0.6336017", "0.6334085", "0.6326963", "0.62981987", "0.6288044", "0.6287506", "0.6269265", "0.6247776", "0.62469", "0.6244938", "0.6237433", "0.6220568", "0.62137043", "0.6194438", "0.6150666", "0.6140837", "0.61390483", "0.61271954", "0.61143434", "0.6112016", "0.6096011", "0.60936886", "0.6065357", "0.60278404", "0.60003626", "0.5987747", "0.59834164", "0.5979241", "0.5966158", "0.59643716", "0.5955524", "0.59491956", "0.5943218", "0.5924553", "0.591904", "0.5904659", "0.5904659", "0.589105", "0.589105", "0.5880438", "0.58696204", "0.58682", "0.58652884", "0.58603054", "0.5843158", "0.58422095", "0.5837826", "0.5837826", "0.5834931", "0.5817856", "0.5817856", "0.5814465", "0.58090866", "0.57974267", "0.5782977", "0.5777975", "0.5774689", "0.57721335", "0.57673824", "0.5761103", "0.5761103", "0.5751757", "0.5750311", "0.5742854", "0.5718256", "0.57093054", "0.57090634", "0.5706177", "0.57010293", "0.56989014", "0.56943494", "0.56848633", "0.56776166", "0.56696105", "0.5660044", "0.565826", "0.5657719", "0.5656866", "0.5656866", "0.5656866", "0.5656866" ]
0.0
-1
Implements the Singleton design pattern
def initialize @connection = PG::Connection.open dbname: 'hospital', host: 'localhost' @password = (OpenSSL::Digest.new 'SHA256').digest 'password' @iv = (OpenSSL::Digest.new 'SHA256').digest 'iv' self.add_observer CLogger.new self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def singleton!\n include Singleton\n end", "def singleton\n class << self; self end\n end", "def singleton\n @singleton = true\n end", "def _singleton_class\n class << self\n self\n end\n end", "def singleton_cache; end", "def singleton_class\n\t\tclass << self; self; end\n\tend", "def singleton0_cache; end", "def singleton_state\n super\n end", "def singleton_class\n class << self; self; end\n end", "def get_instance \n @instance = init_instance unless @instance\n return @instance\n end", "def singleton_class\r\n class<<self; self end\r\n end", "def instance\n @instance ||= new\n @instance.startup!\n end", "def singleton_instance_eval(&block)\n singleton_class.instance_eval(&block)\n end", "def singleton_methods; end", "def singletonify\n class_eval { include Singleton }\n end", "def instance\n @instance ||= new\n end", "def instance; end", "def instance; end", "def instance; end", "def singleton?\n false\n end", "def instance\n @instance || self\n end", "def instance\n raise \"Instance is not set for #{self.klass}\" if self.inst.nil?\n self.inst\n end", "def initialize\n @mutex = Mutex.new\n end", "def instantiate!; end", "def initialize()\n @mutex = Mutex.new\n end", "def instance\n @@instance\n end", "def newSingleton\n AppConfig.new\n #=> NoMethodError: private method `new' called for AppConfig:Class\n\t\tfirst, second = AppConfig.instance, AppConfig.instance\n\t\tfirst == second\n\t\t#=> true\n \n\tAppConfig.instance.data = {enabled: true}\n\t\t=> {:enabled=>true}\n\tAppConfig.instance.version\n\t\t=> \"1.0.0\"\n\t\n\tsecond = AppConfig.instance\n\tsecond.data = {enabled: false}\n\t\t=> {:enabled=>false}\n\tAppConfig.instance.data\n\t\t=> {:enabled=>false}\nend", "def obj_singleton_class\n @cache[:obj_singleton] ||= begin\n class << obj #:nodoc:\n self\n end\n rescue\n nil\n end\n end", "def meta_singletonify\n meta_eval { include Singleton }\n end", "def cached_instance\n @cached_instance ||= read_instance\n end", "def instance_cache; end", "def singleton_class\n `Opal.get_singleton_class(self)`\n end", "def singleton_class_eval &block\n self.singleton_class.class_eval &block\n end", "def inherited(sub_klass)\n super\n Singleton.__init__(sub_klass)\n end", "def singleton_method_added(*) end", "def >>\n get_once\n end", "def singleton_methods(all=true) end", "def test_is_effectively_a_singleton\n assert_equal AX::SystemWide.new, AX::SystemWide.new\n end", "def run_instance\n Souffle::Log.info \"Single instance runs are not currently implemented...\"\n # system = Souffle::System.from_hash(data)\n # provider = Souffle::Provider.plugin(system.try_opt(:provider)).new\n # system_tag = provider.create_system(system)\n end", "def handle_singleton sclass_var, class_var\n class_name = @known_classes[class_var]\n\n @known_classes[sclass_var] = class_name\n @singleton_classes[sclass_var] = class_name\n end", "def instance(refresh=false)\n @instance = nil if refresh\n @instance ||= resource.new\n end", "def cls; end", "def initialize\n @@global_state = {}\n @@semaphore= Mutex.new\n end", "def intern\n self\n end", "def initialize\n @mutex = Mutex.new\n @ghash = Hash.new\n end", "def produce_instance\n @instance ||= super\n end", "def only_once\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def build_singleton0(type_name); end", "def create_abstract_singleton_method(name); end", "def target_singleton_class\n class << @obj; self; end\n end", "def one_singleton_ancestors_cache; end", "def _sumac_singleton_expose_preferences\n @_sumac_singleton_expose_preferences ||= ExposePreferences.new\n end", "def start_instance\n Instance.start(self)\n end", "def once\n @once\n end", "def instance\n Monitor.instance\n end", "def instances; end", "def instances; end", "def instance\n\t\t\tthread = Thread.current\n\t\t\tname = self.name\n\t\t\t\n\t\t\tunless instance = thread.thread_variable_get(name)\n\t\t\t\tif instance = self.local\n\t\t\t\t\tthread.thread_variable_set(name, instance)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\treturn instance\n\t\tend", "def initialize\n @grabbers = {}\n self.logger = Logger.new(STDOUT)\n \n self.class.instance = self\n end", "def once\n end", "def setup_instance\n @buffer = ''\n @discard = ''\n @thread = nil\n @out_mutex = Mutex.new\n @interact = false\n end", "def get_instance\n @redis\n end", "def initialize\n @mutex = Mutex.new\n @config_hash = {}\n set_defaults\n end", "def define_singleton_method name, &body\r\n singleton_class = class << self; self; end\r\n singleton_class.send(:define_method, name, &body)\r\n end", "def initialize(docroot)\n @model_mutex = Mutex.new\n self.class.iowa_root\n self.class.log_root\n if self.class.Config && FileTest.exist?(self.class.Config)\n Iowa.readConfiguration(self.class.Config)\n else\n Iowa.checkConfiguration\n end\n self.class.Logger = nil unless self.class.Logger\n\n# begin\n# mylog = Logger[Ciowa_log]\n# raise \"need a default logger\" unless mylog\n# rescue Exception\n# # Logger must not be defined. Make sure a basic default exists!\n# require 'logger'\n# Iowa.const_set(:Logger, {Ciowa_log => ::Logger.new(nil)})\n# mylog = Logger[Ciowa_log]\n# end\n\n mylog = Iowa::Log\n @myclass = self.class\n @keep_statistics ||= false\n @docroot = docroot\n Iowa.config[Capplication][Cdocroot_caching] = false if Iowa.config[Capplication][Cdocroot_caching].nil?\n Iowa.config[Capplication][Cdispatcher][Cclass] = 'iowa/Dispatcher' unless Iowa.config[Capplication][Cdispatcher][Cclass]\n Iowa.config[Capplication][Cpolicy][Cclass] = 'iowa/Policy' unless Iowa.config[Capplication][Cpolicy][Cclass]\n unless Iowa.config[Capplication][Csessioncache][Cclass]\n Iowa.config[Capplication][Csessioncache][Cclass] = 'iowa/caches/LRUCache'\n Iowa.config[Capplication][Csessioncache][Cmaxsize] = 300\n Iowa.config[Capplication][Csessioncache][Cttl] = nil\n end\n\n Iowa.config[Capplication][Cpath_query_interval] = int_or_nil(Iowa.config[Capplication][Cpath_query_interval])\n Iowa.config[Capplication][Creload_interval] = int_or_nil(Iowa.config[Capplication][Creload_interval])\n\n self.class.Dispatcher = nil unless self.class.Dispatcher\n self.class.SessionCache = nil unless self.class.SessionCache\n self.class.SessionCache.add_finalizer {|key, obj| obj.lock = nil}\n self.class.Policy = nil unless self.class.Policy\n @sessions = self.class.SessionCache\n @policy = self.class.Policy\n self.class.ViewFileSuffixes = %w(htm html vew view) unless self.class.ViewFileSuffixes\n Iowa.config[Capplication][Cserialize_templates] = false unless Iowa.config[Capplication][Cserialize_templates] and (Iowa.config[Capplication][Cserialize_templates] == true or !Iowa.config[Capplication][Cserialize_templates].empty?)\n @templateCache = {}\n @templateMTimes = Hash.new {|h,k| h[k] = Time.at(1)}\n @templateLTimes = {}\n @templateRTimes = Hash.new {|h,k| h[k] = Time.at(1)}\n @pathNameCache = {}\n @appLock = Mutex.new\n @statistics = Iowa::ApplicationStats.new(@sessions)\n @reload_scan_mode = Csingular\n $iowa_application = self\n\n Iowa.config[Capplication][Cmodel][Cinterval] ||= 300\n Iowa.config[Capplication][Cmodel][Cvariation] ||= 60\n if self.class.Models.empty?\n bn = File.basename($0)\n ['models/','model.rb',bn.sub(/\\.\\w+$/,'.mdl'),bn.sub(/\\.\\w+$/,'.model')].each do |m|\n self.class.Models << m if FileTest.exist? m\n end\n end\n model_monitor\n Thread.start {model_monitor(true)}\n\n self.class.doc_root\n self.class.cgi_root\n self.class.log_root\n\n mylog.info \" Application with docroot of #{docroot} initialized.\"\n mylog.info \" docroot_caching is #{Iowa.config[Capplication][Cdocroot_caching] ? 'enabled' : 'disabled'}\"\n end", "def class() end", "def meta_eval(&block)\n singleton_class.instance_eval(&block)\n end", "def initialize(x) # constructor \n @inst = x # instance variables start with @ \n @@cla += 1 # each object shares @@cla \n end", "def init; end", "def init\n\n end", "def singleton_class(&block)\n\t\tif block_given?\n\t\t(class << self; self; end).class_eval(&block)\n\t\tself\n\t\telse\n\t\t(class << self; self; end)\n\t\tend\n\tend", "def singleton_ancestors_cache; end", "def instance=(instance); end", "def init\n end", "def init\n end", "def init\n end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end", "def global\n raise NotImplementedError\n end", "def refinit\n return if defined?(@_references)\n\n @_references = 1\n @_references_mutex = Mutex.new\n\n self\n end", "def registry; end", "def registry; end", "def init\n self\n end", "def lock_instance\n @lock_instance ||= lock_class.new(item, after_unlock_hook, @redis_pool)\n end", "def initialize() end", "def initialize\n @registry = Registry.new\n end", "def abstract_singleton_method(*names)\n names.each(&method(:create_abstract_singleton_method))\n self\n end", "def method_context_class\n SingletonMethodContext\n end", "def type\n singleton ? 'class' : 'instance'\n end" ]
[ "0.8225489", "0.8186632", "0.8080607", "0.76473933", "0.7592297", "0.72845936", "0.7242165", "0.71727926", "0.714887", "0.71324277", "0.7124301", "0.70828354", "0.70589", "0.70553416", "0.69794065", "0.69012237", "0.68976885", "0.68976885", "0.68976885", "0.6723564", "0.6590059", "0.6510662", "0.6473165", "0.6418438", "0.64152205", "0.63833016", "0.6378452", "0.63750565", "0.6366221", "0.6345251", "0.6313722", "0.625238", "0.62473065", "0.61542416", "0.6039818", "0.60001904", "0.598884", "0.5977829", "0.59376955", "0.591309", "0.59116185", "0.5878936", "0.5864451", "0.5861012", "0.5858371", "0.58499855", "0.58434397", "0.5838974", "0.5838974", "0.5838974", "0.5838974", "0.58219904", "0.5800719", "0.5782531", "0.5753042", "0.5747213", "0.5738879", "0.57347244", "0.5730551", "0.5724613", "0.5724613", "0.5703169", "0.56754917", "0.56576765", "0.56575364", "0.56430966", "0.5617118", "0.5612121", "0.56074363", "0.56024283", "0.55931807", "0.55930483", "0.55898255", "0.558462", "0.5584433", "0.55759555", "0.556425", "0.5552921", "0.5552921", "0.5552921", "0.5548706", "0.5548706", "0.5548706", "0.5548706", "0.5548706", "0.5548706", "0.5548706", "0.5548706", "0.5548706", "0.554115", "0.5526794", "0.5521081", "0.55151075", "0.55151075", "0.5513357", "0.5511734", "0.55032355", "0.5491177", "0.5490416", "0.54827154", "0.5481889" ]
0.0
-1
Data encryption and decryption
def encrypt(data) cipher = OpenSSL::Cipher.new 'AES-256-CBC' cipher.encrypt cipher.key, cipher.iv = @password, @iv data.nil? ? '' : (cipher.update(data) + cipher.final).unpack('H*')[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt; end", "def decrypt_and_encrypt(data)\n ## ** Decrypt\n keys = @keys\n begin\n #@@window.puts(\"Attempting to decrypt with primary key\")\n data = _decrypt_packet_internal(keys, data)\n #@@window.puts(\"Successfully decrypted with primary key\")\n\n # If it was successfully decrypted, make sure the @old_keys will no longer work\n @old_keys = nil\n rescue Encryptor::Error => e\n # Attempt to fall back to old keys\n if(@old_keys.nil?)\n @@window.puts(\"No secondary key to fallback to\")\n raise(e)\n end\n\n @@window.puts(\"Attempting to decrypt with secondary key\")\n keys = @old_keys\n data = _decrypt_packet_internal(@old_keys, data)\n @@window.puts(\"Successfully decrypted with secondary key\")\n end\n\n # Send the decrypted data up and get the encrypted data back\n data = yield(data, ready?(keys))\n\n # If there was an error of some sort, return nothing\n if(data.nil? || data == '')\n return ''\n end\n\n # If encryption is turned off, return unencrypted data\n if(!ready?(keys))\n @@window.puts(\"Returning an unencrypted response\")\n return data\n end\n\n ## ** Encrypt\n #@@window.puts(\"Encrypting the response\")\n\n # Split the packet into a header and a body\n header, body = data.unpack(\"a5a*\")\n\n # Encode the nonce properly\n nonce = [keys[:my_nonce]].pack(\"n\")\n\n # Encrypt the body\n encrypted_body = Salsa20.new(keys[:my_write_key], nonce.rjust(8, \"\\0\")).encrypt(body)\n\n # Sign it\n signature = SHA3::Digest::SHA256.digest(keys[:my_mac_key] + header + nonce + encrypted_body)\n\n # Arrange things appropriately\n return [header, signature[0,6], nonce, encrypted_body].pack(\"a5a6a2a*\")\n end", "def encrypt; end", "def decrypt\n unless @encrypted_data.blank?\n plaintext_data\n end\n end", "def decrypt_and_encrypt(d_data)\n _ensure_shared_secret!()\n\n ## Figure out which key to use\n keys = @keys\n begin\n d_data = _decrypt_packet_internal(keys, d_data)\n\n # If it was successfully decrypted, make sure the @old_keys will no longer work\n @old_keys = nil\n rescue Error => e\n # Attempt to fall back to old keys\n if(@old_keys.nil?)\n raise(e)\n end\n\n keys = @old_keys\n d_data = _decrypt_packet_internal(@old_keys, d_data)\n end\n\n # Send the decrypted data up and get the encrypted data back\n e_data = yield(d_data)\n\n return _encrypt_packet_internal(keys, e_data)\n end", "def decrypt encrypted_data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final \n end", "def encrypt(data)\n crypto_key.encrypt64(data)\n end", "def encrypt(data)\n cipher = OpenSSL::Cipher.new(\"AES-256-CBC\")\n cipher.encrypt\n cipher.iv = @enc_iv\n cipher.key = @enc_key\n encrypted = cipher.update(data) + cipher.final\n enc = Base64.strict_encode64(encrypted)\nend", "def encrypt_data(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end", "def crypt(decrypt_or_encrypt, data, key, iv)\n c = OpenSSL::Cipher.new(CIPHER)\n c.send(decrypt_or_encrypt.to_sym)\n c.key = key\n c.iv = iv\n c.update(data) << c.final\n end", "def decrypt_data(encrypted_data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.decrypt\n aes.key = key\n aes.padding = 0\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final\n end", "def _encrypt\n cryptor_files(@encrypting)\n end", "def encrypt data, key, iv, cipher_type\n aes = OpenSSL::Cipher::Cipher.new cipher_type\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final \n end", "def decrypt\n self\n end", "def crypt( decrypt_or_encrypt, data, pwhash, iv )\n c = OpenSSL::Cipher.new CIPHER\n c.send decrypt_or_encrypt.to_sym\n c.key = pwhash\n c.iv = iv\n c.update( data ) << c.final\n end", "def decrypt phrase, key\n decrypt = encrypt phrase, key\n return decrypt\nend", "def encryption_oracle\n # From an early-on AES-128-ECB exercise. 'YELLOW SUBMARINE' is the 128-bit key.\n ciphertext = URL::decode64('http://cryptopals.com/static/challenge-data/25.txt')\n plaintext = AES_128.decrypt(ciphertext, 'YELLOW SUBMARINE', :mode => :ECB)\n\n AES_128.encrypt(plaintext, AES_KEY, :mode => :CTR)\nend", "def encrypt(data)\n _encrypt(data, \"#{NOT_SEARCHABLE.chr}\\0#{@key_id.chr}\\0\")\n end", "def aes_key\n self.encrypted_data_will_change!\n \"dfdsdsfsdfsdfwefsdfds\"\n end", "def aes_encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, \"randomString\", 1024, aes.key_len)\n aes.iv = iv if iv != nil\n aes.update(data.to_s) + aes.final \n end", "def decrypt_data(data, private_key, iv)\n aes = OpenSSL::Cipher::AES.new(256, :CBC)\n aes.decrypt\n aes.iv = iv\n aes.key = private_key\n aes.update(data) + aes.final\n end", "def encrypt(data)\n pipe_to_stdin command('--encrypt'), data\n end", "def encrypt\n self\n end", "def encrypt(data)\n return nil if !@key\n Base64::encode64(@key.private_encrypt(data)).delete(\"\\n\").strip\n end", "def decrypt\n self\n end", "def decrypt(data)\n crypto_key.decrypt64(data)\n end", "def uncrypt file, data, part\n cypher = WodaCrypt.new\n cypher.decrypt\n cypher.key = file.content.crypt_key.from_hex\n cypher.iv = WodaHash.digest(part.to_s)\n cypher.update(data) + cypher.final\n end", "def decrypt(encrypted_data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.decrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(encrypted_data) + aes.final\n end", "def encrypt( data )\n rsa = OpenSSL::PKey::RSA.new( File.read( @public_pem ) )\n\n # encrypt with 256 bit AES with CBC\n aes = OpenSSL::Cipher::Cipher.new( 'aes-256-cbc' )\n aes.encrypt\n\n # use random key and IV\n aes.key = key = aes.random_key\n aes.iv = iv = aes.random_iv\n\n # this will hold all primitives and ciphertext\n primitives = {}\n\n primitives['ciphertext'] = aes.update( data )\n primitives['ciphertext'] << aes.final\n\n primitives['key'] = rsa.public_encrypt( key )\n primitives['iv'] = rsa.public_encrypt( iv )\n\n # serialize everything and base64 encode it\n Base64.encode64( primitives.to_yaml )\n end", "def encrypt(data, key, iv, cipher_type)\n aes = OpenSSL::Cipher::Cipher.new(cipher_type)\n aes.encrypt\n aes.key = key\n aes.iv = iv if iv != nil\n aes.update(data) + aes.final\n end", "def decrypt\n self.class.decrypt(@encrypted_name, @id)\n end", "def decrypt data, key, salt, iter, iv, key_length = 32\n decipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n decipher.decrypt\n decipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n decipher.iv = iv\n decipher.update(data) + decipher.final\n end", "def encrypt(data)\n\tarray = splitencrypt(data)\n\tencryptedBlock = ''\n\tfor i in 0...array.length\n\t encryptedBlock << @blowfish.encrypt_block(array[i])\n\tend\n\treturn encryptedBlock\n end", "def decrypt(data)\n\tarray = splitdencrypt(data)\n\tdecryptedBlock = ''\n\tfor i in 0...array.length\n\t val = array[i]\n\t decryptedBlock << @blowfish.decrypt_block([val].pack('H*'))\n\tend\n\treturn decryptedBlock\n end", "def decrypt(data)\n pipe_to_stdin command('--decrypt'), data\n end", "def encrypt_data(plaintext, &encrypted)\n written = @engine.write plaintext\n\n if written < plaintext.length\n exit -1\n end\n\n read_data = []\n\n while(read_chunk = @engine.extract)\n read_data << read_chunk\n end\n\n if block_given?\n read_data.each do |data|\n encrypted.call data\n end\n else\n read_data.join\n end\n end", "def scramble( data )\n cipher = OpenSSL::Cipher::Cipher.new( @@algorithm )\n cipher.encrypt\n cipher.pkcs5_keyivgen( @@key, @@salt )\n @@salt + cipher.update( data ) + cipher.final\n end", "def decrypt\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t_rt = Encryptor.decrypt(Base64.decode64(@data))\r\n\t\t\t\r\n\t\treturn _rt\r\n\t\t\t\r\n\t end", "def encrypt\n self\n end", "def encrypt(data, password = nil)\n salt = random_bytes(@salt_len)\n iv = random_bytes(@salt_len)\n aes_key, mac_key = keys(salt, password)\n\n aes = cipher(aes_key, iv, true)\n ciphertext = aes.update(data) + aes.final\n mac = sign(iv + ciphertext, mac_key)\n\n encrypted = salt + iv + ciphertext + mac\n encrypted = Base64.strict_encode64(encrypted) if @base64\n encrypted\n rescue TypeError, ArgumentError => e\n error_handler e\n end", "def searchable_encrypt(data)\n _encrypt(data, _search_prefix(data, SEARCHABLE, @key_id, @key))\n end", "def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end", "def encrypt(data)\n # Create a random 32 byte string to act as the initialization vector.\n iv = SecureRandom.random_bytes(32)\n # Pyro pads the data with zeros\n cipher = FirebugMcrypt.new(:rijndael_256, :cbc, @key, iv, :zeros)\n add_noise(iv + cipher.encrypt(data))\n end", "def decrypt(base64_encrypted_data,key,base64_init_vector,ciper='aes-128-cbc')\n SymmetricEncryption.cipher = SymmetricEncryption::Cipher.new(:key => key,:iv => Base64.urlsafe_decode64(base64_init_vector), :cipher => ciper )\n SymmetricEncryption.decrypt(Base64.urlsafe_decode64(base64_encrypted_data))\n end", "def decrypt_or_encrypt(operation,password)\n\tif operation == 'encrypt'\n\t\tencrypt(password) # the secret agent would like to encrypt so we call the encryption method \n\t\t\telsif operation == 'decrypt'\n\t\t\t\tdecrypt(password) # the secret agent would like to decrypt so we call the decryption method \n\t\t\telse \n\tend\nend", "def decrypt(data)\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.decrypt\n cipher.key = @passphrase\n cipher.iv = @iv\n decrypted = cipher.update(data)\n decrypted << cipher.final\n json = JSON.parse(decrypted)\n self.identifier = json['identifier']\n @expiry = Time.parse(json['expiry'])\n rescue OpenSSL::Cipher::CipherError => e\n raise Kennedy::BadTicketException, \"Given data was not decryptable\"\n end", "def crypt( decrypt_or_encrypt, data, pwhash )\n unless @iv\n raise RuntimeError, \n \"Initialization Vector (iv) must be set before doing #{decrypt_or_encrypt}\"\n end\n\n begin\n cipher = OpenSSL::Cipher.new(CIPHER)\n cipher.send decrypt_or_encrypt.to_sym\n cipher.key = pwhash\n cipher.iv = @iv\n cipher.update( data ) << cipher.final\n\n rescue OpenSSL::Cipher::CipherError => ce\n $stderr.puts ce\n $stderr.puts ce.inspect\n raise BadPassword.new\n\n rescue Exception => e\n puts \"ERROR: Unable to #{decrypt_or_encrypt}: #{e.class}: #{e}\"\n raise e\n end\n end", "def public_decrypt(data)\n @key.public_decrypt(Base64.decode64(data))\n end", "def cipher(cipher_mode, data)\n expect! cipher_mode => [ :decrypt, :encrypt ]\n\n case cipher_mode\n when :decrypt\n expect! data => /^envy:/\n cipher_op(:decrypt, data: Base64.decode64(data[5..-1]))\n when :encrypt\n \"envy:\" + Base64.strict_encode64(cipher_op(:encrypt, data: data))\n end\n end", "def encrypt(data)\n self.class.encrypt(data + salt.to_s)\n end", "def encrypt string\n string\n end", "def decrypt\n data = Tools.get_data4\n potential_payloads = []\n \n data.each do |encrypted|\n potential_payloads << xor_cypher(encrypted)\n end\n \n potential_payloads.flatten(1)\n .sort { |a,b| a[1] <=> b[1] }\n .last(5)\n end", "def decrypt!(encrypted_data, options = {})\n secret = options[:secret]\n cipher = Gibberish::AES.new(secret)\n cipher.decrypt(encrypted_data).strip\n end", "def protecting_encrypted_data(&block)\n with_encryption_context encryptor: ActiveRecord::Encryption::EncryptingOnlyEncryptor.new, frozen_encryption: true, &block\n end", "def encryptHex\r\n\t \r\n\t \tif @IV.empty?\r\n\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\telse\r\n\t\t\t_iv= @IV\r\n\t\tend\r\n\t\t\r\n\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\r\n\t\t_cyper_text = Encryptor.encrypt(@data)\t\r\n\t\t_rt = _cyper_text.unpack(\"H*\")[0]\r\n\t\t\r\n\t\treturn _rt\r\n\t\t\r\n\t end", "def encrypt(data, passphrase)\n cipher = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n cipher.encrypt\n\n cipher.key = Digest::SHA256.digest(passphrase)\n cipher.iv = obtain_iv(passphrase)\n\n rsize = rand(32)\n data = '' << rsize << random_data(rsize) << data\n\n encrypted = cipher.update(data)\n encrypted << cipher.final\n\n return encrypted\n end", "def decrypt_letter alphabet, cipherbet, letter\ndecrypt_letter = encrypt_letter cipherbet, alphabet, letter\nreturn decrypt_letter\nend", "def decrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).decrypt(data)\n end", "def decrypt(txt)\n x = -1\n return txt.unpack('U*').pack('S*').unpack(\"U*\").collect do |i| \n x += 1\n x %= CRYPT.size\n i - CRYPT[x].unpack('U').first > 0 ? i - CRYPT[x].unpack('U').first : i\n end.pack('U*')\n end", "def decrypt(sentence, combination)\n encrypt(sentence, combination)\nend", "def set_data(data)\n data = data.pack('c*') if data.class == Array\n raise \"No increment has been set. It is necessary to encrypt the data\" if @increment.nil?\n \n # Set the length\n self.length = data.length+2\n \n # Save the decrypted message\n @decrypted_data = @data\n \n # Set the message\n @data = TkCrypt::encrypt(data, self.increment)\n end", "def public_encrypt(data)\n Base64.encode64(@key.public_encrypt(data))\n end", "def encrypt_message plaintext\n key_pair.encrypt plaintext\n end", "def decrypt(data)\n data = remove_noise(data)\n # The first 32 bytes of the data is the original IV\n iv = data[0..31]\n cipher = FirebugMcrypt.new(:rijndael_256, :cbc, @key, iv, :zeros)\n cipher.decrypt(data[32..-1])\n end", "def encrypt(value,key,context)\n cyphertext = @vault.logical.write(\"transit/encrypt/#{key}\", plaintext: Base64.encode64(value).gsub('\\n',''), context: Base64.encode64(context).gsub('\\n',''))\n return cyphertext.data[:ciphertext]\n end", "def ebsin_decode(data, key)\n rc4 = RubyRc4.new(key)\n (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n end", "def ebsin_decode(data, key)\n rc4 = RubyRc4.new(key)\n (Hash[ rc4.encrypt(Base64.decode64(data.gsub(/ /,'+'))).split('&').map { |x| x.split(\"=\") } ]).slice(* NECESSARY )\n end", "def encryption_oracle(data)\n # prepend and append some random chars to the data\n # (why are we doing this?)\n pre = rand(6)+5\n post = rand(6)+5\n plain_text = data\n plain_text.prepend( (1..pre).map {rand(256).chr}.join )\n plain_text.concat( (1..post).map {rand(256).chr}.join )\n plain_text = CBCEncryptor.pad(plain_text, KEYSIZE)\n\n key = (1..16).map {rand(256).chr}.join\n\n if rand(2) > 0\n puts \"[Oracle using ECB]\"\n ecb = ECBEncryptor.new(key)\n ecb.encrypt(plain_text)\n else\n puts \"[Oracle using CBC]\"\n iv = (1..16).map {rand(256).chr}.join\n cbc = CBCEncryptor.new(key)\n cbc.encrypt(plain_text, iv)\n end\nend", "def encrypt(data, key=nil)\n Crypto.new(key.nil? ? config.key : key).encrypt(data)\n end", "def encrypt \r\n\t \r\n\t \tif validateParams\r\n\t \t \t\t \t\t \t \t\r\n\t \t\tif @IV.empty?\r\n\t\t\t\t_iv = OpenSSL::Cipher::Cipher.new(\"aes-#{ @cipher }-#{ @mode }\").random_iv\r\n\t\t\telse\r\n\t\t\t\t_iv= @IV\r\n\t\t\tend\t\t\r\n\t\t\t\r\n\t\t\tEncryptor.default_options.merge!(:algorithm => \"aes-#{ @cipher }-#{ @mode }\", :key => @key, :iv => _iv)\t\t\r\n\t\t\t_cyper_text = Encryptor.encrypt(@data)\t\t\t\r\n\t\t\t_rt = Base64.strict_encode64(_cyper_text)\r\n\t\t\t\t\t\t\r\n\t\t\treturn _rt\t\r\n\t\telse\r\n\t\t\traise \"Provide valid details to get transaction token\" \t\t\r\n\t \tend\r\n\t \t\r\n\t end", "def write_encrypted(data)\n @writer.print(@encrypter.encrypt(data))\n end", "def encrypt(\n data, key, salt, iter, iv = SecureRandom.random_bytes(16), key_length = 32\n )\n cipher = OpenSSL::Cipher.new \"AES-256-CBC\"\n cipher.encrypt\n cipher.key = OpenSSL::PKCS5.pbkdf2_hmac_sha1(key, salt, iter, key_length)\n cipher.iv = iv\n {\n data: cipher.update(data) + cipher.final,\n iv: iv\n }\n end", "def encryption_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n\tdata_encrypting_key.key\n end", "def set_data_encrypting_key\n\tself.data_encrypting_key ||= DataEncryptingKey.primary\n end", "def decrypt( encrypt)\n @shift = @shift * -1\n encrypt( encrypt)\n end", "def encrypt(data, key = nil, iv = nil)\n key ||= @request[:secret]\n iv ||= @request[:iv]\n\n @cipher.encrypt\n @cipher.key = key\n @cipher.iv = iv\n\n @cipher.update(data)\n end", "def decrypt_data(encrypted, &decrypted)\n injected = @engine.inject encrypted\n\n unless injected\n exit -1\n end\n\n read_data = []\n\n begin\n while(read_chunk = @engine.read)\n read_data << read_chunk\n end\n rescue Exception => e\n unless @engine.state == 'SSLOK '\n raise e\n end\n end\n\n if block_given? then\n read_data.each do |data|\n decrypted.call data\n end\n else\n read_data.join\n end\n end", "def encrypt(string)\n CRYPTO.encrypt_string(string).to_64\nend", "def run_test1\n\t\tdata=random_string 256\n\t\tenc=encode_data @key, @iv, data\n\t\tdec=decode_data @key, data\n\t\tputs data\n\t\tputs dec\n\tend", "def encrypt(alg, password, string)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'aes256')\n when \"Blowfish\" then key =EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'blowfish')\n when 'Plaintext' then return string\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256') \n end\n encrypted_text = key.encrypt64(string)\n rescue => e\n p e.message\n end\n return encrypted_text\n \n end", "def read_encrypted_secrets=(_arg0); end", "def read_encrypted_secrets=(_arg0); end", "def encrypted_data\n formatted_data = formatted_event_data\n encryptor_obj = LocalCipher.new(GlobalConstant::SecretEncryptor.webhook_event_secret_key)\n r = encryptor_obj.encrypt(formatted_data)\n fail \"r: #{r}, params: #{@params}\" unless r.success?\n\n r.data[:ciphertext_blob]\n end", "def read_encrypted_secrets; end", "def read_encrypted_secrets; end", "def encrypt(data)\n\t\t# The limit of the encryption scheme is 235 bytes, so if the string is longer than that we need to limit it\n\t\tif data.length > 234\n\t\t\tdata = data[0..234] + \"\\n\"\n\t\tend\n\n\t\tkey = OpenSSL::PKey::RSA.new File.read '../keys/attacker.pub'\n\t\treturn key.public_key.public_encrypt(data)\n\tend", "def vigenere_cipher(string, key_sequence)\n\nend", "def decrypt(data, key = nil, iv = nil)\n key ||= @request[:secret]\n iv ||= @request[:iv]\n\n @cipher.decrypt\n @cipher.key = key\n @cipher.iv = iv\n\n @cipher.update(data)\n end", "def decrypt()\n \t@private_key = AES.decrypt(self.encrypted_private_key, ENV[\"DECRYPTION_KEY\"])\n end", "def encrypt(data, key_hex)\n key = hex_to_bytes(key_hex)\n (encrypted_data_bytes, iv_bytes) = encrypt_bytes(data, key)\n encrypted_data_hex = bytes_to_hex(encrypted_data_bytes)\n iv_hex = bytes_to_hex(iv_bytes)\n [encrypted_data_hex, iv_hex]\n end", "def urlsafe_base64_symmetric_encrypt(data, key, iv)\n raise 'Initialization Vector must have 16 hexadecimal characters.' unless iv.length == 16\n raise 'Key must have 16 hexadecimal characters.' unless key.length == 16\n\n bin_iv = [iv].pack('H*')\n raise 'Initialization Vector is not valid, must contain only hexadecimal characters.' if bin_iv.empty?\n\n # Appends first 8 Bytes to Key\n key += key.byteslice(0,8)\n\n # Create Cipher\n cipher = OpenSSL::Cipher.new(CIPHER_ALGORITHM)\n # Initialize cipher mode\n cipher.encrypt\n # Set initialization vector\n cipher.iv = bin_iv\n # Set key\n cipher.key = key\n\n # Encrypt data\n encrypted_data = cipher.update(data) + cipher.final\n # Encode data\n custom_base64_urlsafe_encode(encrypted_data)\n end", "def _decode_aes256 cipher, iv, data\n aes = OpenSSL::Cipher::Cipher.new \"aes-256-#{cipher}\"\n aes.decrypt\n aes.key = @encryption_key\n aes.iv = iv\n aes.update(data) + aes.final\n end", "def crypt(p0) end", "def cipher; end", "def encrypt_string(clear_text)\n enc = OpenSSL::Cipher::Cipher.new('DES-EDE3-CBC')\n enc.encrypt(RAM_SALT)\n data = enc.update(clear_text)\n Base64.encode64(data << enc.final)\n end", "def decrypt(data)\n @cert_chain[0].public_key.public_decrypt(Base64::decode64(data))\n end", "def decrypt(x)\n @aes_key.decrypt(x)\n end", "def aes_ecb_encrypt(data, key, params: {})\n key_arr = key.unpack(\"C*\")\n\n data = pad_data(data, 16)\n encrypted_data = data.unpack(\"C*\").each_slice(16).map do |slice|\n state = array_to_matrix(slice)\n encrypted_state = aes_encrypt_block(state, key_arr)\n matrix_to_array(encrypted_state).pack(\"C*\")\n end\n\n # return base64 encoded data\n [encrypted_data.join].pack(\"m\")\n end", "def encode(data)\n @encryptor.encrypt_and_sign(data)\n end", "def encrypt!(block) \n Bes.new(material).encrypt block\n end" ]
[ "0.7835696", "0.75955725", "0.75672233", "0.7288976", "0.72487855", "0.70930153", "0.6996837", "0.6994795", "0.69863945", "0.6929069", "0.692115", "0.69125944", "0.6907265", "0.6900832", "0.68806857", "0.68227226", "0.6774302", "0.677255", "0.6767245", "0.67495674", "0.67373973", "0.67290395", "0.6722805", "0.6720916", "0.6705826", "0.66802895", "0.66792476", "0.6667271", "0.665504", "0.66462064", "0.6631593", "0.6625893", "0.66254824", "0.65993345", "0.6591045", "0.6565912", "0.6546297", "0.65453047", "0.653254", "0.6522209", "0.6491204", "0.6489408", "0.6485346", "0.64751595", "0.64600426", "0.64539546", "0.64524955", "0.6447816", "0.64409673", "0.6437644", "0.640039", "0.63949555", "0.63900524", "0.63855815", "0.63738847", "0.6362882", "0.63442266", "0.63369715", "0.6323083", "0.63229746", "0.6315225", "0.6304522", "0.6278656", "0.62680477", "0.6254337", "0.6252629", "0.6252629", "0.6248408", "0.62472314", "0.6243625", "0.6236581", "0.6236234", "0.6233991", "0.6229159", "0.6224353", "0.62242496", "0.6211477", "0.62067455", "0.6206132", "0.62056553", "0.6198279", "0.6198279", "0.6184644", "0.6181573", "0.6181573", "0.6176556", "0.61742", "0.6169797", "0.6161452", "0.61608267", "0.6159367", "0.6154014", "0.61530375", "0.61488676", "0.6147308", "0.6124258", "0.6124082", "0.611835", "0.6108406", "0.61070555" ]
0.68780655
15
do_run, do_example, do_list, do_file, do_help
def do_run ready aim fire! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_work()\n\n show_help()\n ::Twiga.say_info \"\\ntwiga> \"\n\n while (cmd = gets) do\n cmd.strip!\n tokens = cmd.split(/ /)\n unless tokens.empty?\n\n item = tokens[1] || 'test'\n \n case tokens.first.downcase\n\n when 'quit','exit' then break\n\n when 'register' then do_register( item )\n when 'refresh' then do_refresh( item )\n when 'list' then do_list( item )\n when 'fetch' then do_fetch( item )\n when 'delete' then do_delete( item )\n\n when 'save' then update_gcp_seed_tokens( item )\n when 'seed' then show_seed()\n when 'ready' then do_ready_state( item )\n when 'time' then show_time( item )\n when 'devices' then show_devices()\n\n when 'connect' then do_connect( item )\n\n when 'help' then show_help() \n when 'cups' then do_cups_work() \n when 'gcp' then show_gcp( item )\n\n else\n ::Twiga.say_err \"? unknown command: #{cmd}\"\n end # case\n \n end # unless no command\n\n ::Twiga.say_info \"\\ntwiga> \"\n end\n\n end", "def usage\n puts \"Usage: akaza exec|wsrb|exec_wsrb FILE_NAME\"\nend", "def _perform(args); 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 run(args)\n if args.size > 0\n # show details of given commands\n show_details(args)\n else\n # print full list of commands\n list_commands\n end\n end", "def do_action(cmd, options = {})\n # XXX Finish this\n end", "def help\n puts \"To add a task, type 'add task'.\"\n puts \"To update a task, type 'update'.\"\n puts \"To delete a task, type 'complete'.\"\n puts \"To view the To Do List, type 'view'.\"\n puts \"To quit, type 'done'.\"\nend", "def amethod( doThis )\n if (doThis == :deletefiles) then\n puts( 'Now deleting files...')\n elsif (doThis == :formatdisk) then\n puts( 'Now formatting disk...')\n else\n puts( \"Sorry, command not understood.\" )\n end\nend", "def help\n \n end", "def help\n\t\tputs \"Commands: pick up (weapons/items) , move to, drop, examine myself, describe me, look at me, inventory, look\"\n\t\tputs \"Commands: grab (food items), examine food (details about your food), eat (food), drink (beverages)\" \n\tend", "def do_help(commands)\n return commands.usage\n end", "def exec; end", "def exec; end", "def help; end", "def help; end", "def help; end", "def run_cmd(cmd)\n\tend", "def do_something(study,work,clean)\n puts study\n puts work\n puts clean\nend", "def run(_); end", "def run(_); end", "def runner; end", "def do_work\n # does things\n end", "def launch!\n\t\tintroduction\n\t\t\taction = nil\n\t\t\tuntil action == :quit\n\t\t\t# action loop\n\t\t\t# what do you want to do? (list, find, add, quit)\n\t\t\tprint \"> \"\n\t\t\tuser_response = gets.downcase.strip!.split(' ')\n\t\t\t# do that action\n\t\t\taction,args = do_action(user_response[0],user_response[1])\n\t\tend\n\t\tconclusion\n\tend", "def when_running(*args); end", "def help\r\n end", "def help\r\n end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def run(*args); end", "def how_it_works\r\n end", "def do_a_thing\n puts \"We are doing a thing!!!!!!!!!!!!!!!! #{file_name}\"\n end", "def run_actions; end", "def help\n\nend", "def do_something(swim, bike, run)\nend", "def runner\n\nend", "def execute_todo\n\ncommand = ARGV[0]\n\ncase command\nwhen'add'\n\tdescription = ARGV[1]\n\tstatus = ARGV[2]\n\tTaskMethods.add(description,status)\n\n\t#add method\nwhen 'list'\n\tTaskMethods.list\n\nwhen 'update'\n\tindex = ARGV[1].to_i\n\tdescription = ARGV[2]\n\tstatus = ARGV[3]\n\tTaskMethods.update(index,description,status)\n\t\nwhen 'remove'\n\tindex = ARGV[1]\n\tTaskMethods.remove(index)\n\nend\n\nend", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def do()\r\n\tend", "def shell_commands(cmd, args); end", "def test(cmd, file1, file2=\"foo\") end", "def examples_page\n Format.usage('This is my examples page, I\\'ll show you a few examples of how to get me to do what you want.')\n Format.usage('Running me with a file: whitewidow.rb -f <path/to/file> keep the file inside of one of my directories.')\n Format.usage('Running me default, if you don\\'t want to use a file, because you don\\'t think I can handle it, or for whatever reason, you can run me default by passing the Default flag: whitewidow.rb -d this will allow me to scrape Google for some SQL vuln sites, no guarentees though!')\n Format.usage('Running me with my Help flag will show you all options an explanation of what they do and how to use them')\n Format.usage('Running me without a flag will show you the usage page. Not descriptive at all but gets the point across')\nend", "def call(*command); end", "def help\n end", "def test_directives_list\n with_fixture do\n out = capture(:out) do\n assert_raises(SystemExit) { Dotrun.new.run(\"-?\") }\n end\n assert_includes out, \"echo default\"\n assert_includes out, \"echo sample\"\n end\n end", "def runner(&blk); end", "def runner(&blk); end", "def shell_commands(cmd, *args); end", "def run\n if @list_doc_dirs then\n puts @doc_dirs\n elsif @list then\n list_known_classes @names\n elsif @server then\n start_server\n elsif @interactive or @names.empty? then\n interactive\n else\n display_names @names\n end\n rescue NotFoundError => e\n abort e.message\n end", "def usage; end", "def usage; end", "def help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Usage:\"\n puts \" bin/run [command]\"\n puts\n puts \"Available Commands:\"\n puts \" [list | l] <age=> <type=> list all available animals\"\n puts \" [create | c] <name=> <type=> create a animal with name\"\n puts \" [delete | d] <name=> delete a animal\"\n puts \" [search | s] <name=> search a animal\"\n puts \" [food | f] <name=> give food to a animal\"\n puts \" [wash | w] <name=> give a shower to a animal\"\n puts \" [alive | a] <name=> show if a animal is alive\"\n puts \" [help | h] help about commands\"\n puts \"\"\n puts \"Flags:\"\n puts \" -v, --version show the app version\"\n puts \"\"\n puts \"Use bin/run [command] --help for more information about a command.\"\n end", "def run_all\n end", "def run_all\n end", "def run_list; end", "def launch!\n\t\tintroduction\n\n\t\tresult = nil\n\t\tuntil result == :quit\n\t\t\tprint \"> Choose one of these options: List, Sort, Find or Add.\\n\\n\"\n\t\t\tuser_response = gets.chomp\n\t\t\tresult = do_action(user_response)\n\t\tend\n\t\tconclusion\n\tend", "def commands; end", "def run_all()\n end", "def usage( examples, explanation = nil )\n puts \"Script #{@name} #{version} - Usage:\"\n (examples.respond_to?(:split) ? examples.split(\"\\n\") : examples).map {|line| puts \" #{@name} #{line}\"}\n puts explanation if explanation\n exit 1\n end", "def perform(*args); end", "def runner\n \nend", "def help(*args)\n if args.count == 0\n test_runner = TestRunner.new\n set_options(test_runner)\n message_tidy = \"version #{test_runner.tidy.version}\"\n message_cases = File.exists?(test_runner.dir_cases) ? '' : '(directory not found; test will not run)'\n message_results = File.exists?(test_runner.dir_results) ? '(will try to use)' : '(will try to create)'\n puts <<-HEREDOC\n\nThis script (#{File.basename($0)}) is a Tidy regression testing script that can execute\nevery test in the suite, or optionally individual files. It also has the ability\nto generate new benchmark files into the suite.\n\nDefault Locations:\n------------------\n Tidy: #{ test_runner.tidy.path }, #{ message_tidy }\n Cases: #{ test_runner.dir_cases } #{ message_cases }\n Results: #{ test_runner.dir_results } #{ message_results }\n \nYou can also run this help command with the --tidy, --cases, and/or --results\noptions to test them, and check the results in the table above.\n\nComplete Help:\n--------------\n HEREDOC\n end\n\n super\n end", "def run(cmd, *args)\n dispatch(cmd, *args)\n end", "def things_to_do(task, errand)\n puts \"Well, I really need to #{task}.\"\n puts \"But I'm kind of restless.\"\n puts \"I might as well get out of the house and go to the #{errand}.\"\n puts \"I wonder if I can do both at the same time?\"\nend", "def runner\n # code runner here\nend", "def runner\n # code runner here\nend", "def runner\n # code runner here\nend", "def runner\n # code runner here\nend", "def runner\n # code runner here\nend", "def runner\n # code runner here\nend", "def run(args)\n if args.size > 1\n cmd_name = args[1]\n if cmd_name == '*'\n msg(\"All command names:\")\n msg columnize_commands(@proc.commands.keys.sort)\n elsif CATEGORIES.member?(cmd_name)\n show_category(args[1], args[2..-1])\n elsif @proc.commands.member?(cmd_name) or @proc.aliases.member?(cmd_name)\n real_name = \n if @proc.commands.member?(cmd_name) \n cmd_name\n else\n @proc.aliases[cmd_name]\n end\n cmd_obj = @proc.commands[real_name]\n help_text = \n cmd_obj.respond_to?(:help) ? cmd_obj.help(args) : \n cmd_obj.class.const_get(:HELP)\n if help_text\n msg(help_text) \n if cmd_obj.class.constants.member?(:ALIASES) and\n args.size == 2\n msg \"Aliases: #{cmd_obj.class.const_get(:ALIASES).join(', ')}\"\n end\n end\n else \n matches = @proc.commands.keys.grep(/^#{cmd_name}/).sort rescue []\n if matches.empty?\n errmsg(\"No commands found matching /^#{cmd_name}/. Try \\\"help\\\".\")\n else\n msg(\"Command names matching /^#{cmd_name}/:\")\n msg columnize_commands(matches.sort)\n end\n end\n else\n list_categories\n end\n return false # Don't break out of cmd loop\n end", "def do_something(something, something_else, another_thing)\n\nend", "def say_hello(anything)\n # write code\n puts anything\n puts \"Hello World!\"\nend", "def run\n @arguments = ArgumentParser.get_arguments VALID_ARGUMENTS\n print_help if (@arguments[:options][:help])\n print_version if (@arguments[:options][:version])\n if (@arguments[:keywords][:export])\n handle_export\n elsif (@arguments[:keywords][:import])\n handle_import\n else\n print_help\n end\n end", "def run\n end", "def run(*args)\n end", "def run(robot, script)\n\nend", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def _test_text ; process_test_case(\"text\") ; end", "def process(input)\n full_input = input\n args = input.split(\" \")\n\n case args[0]\n when \"quit\"\n bye()\n when \"help\"\n displayHelp()\n when \"modules\"\n printModules()\n when \"use\"\n options = get_options(args[1])\n if options == false \n puts \"Wrong module\"\n elsif args[1] == \"http_module\"\n http_fuzz()\n else\n setup_module(args[1], options)\n end\n else\n puts \"Wrong options\"\n displayHelp()\n end\n\nend", "def run\n cmd = \"default\"\n until cmd == \"end\" do\n cmd = Readline.readline(\"[issue ##{@issue.id}] \") || \"\"\n cmd.chomp!\n\n case cmd\n when /^new/ then new_entry\n when /^(ls|show)/ then show_entries\n when /^desc/ then describe_issue\n when /^delete/ then delete_entry(cmd.split.drop 1)\n when /^edit/ then EditHandler.new(@issue).edit_what(cmd.split.drop 1)\n when /^concat/ then concat_description\n when /^replace/ then replace_pattern\n when /^search/ then search_term((cmd.split.drop 1).join ' ')\n when /^lt/ then time(cmd.split.drop 1) # lt for log time\n when /^forget/ then cmd = \"end\"\n when /^finish/ then finish ? cmd = \"end\" : nil\n when /^attachout/ then output_attach\n when /^attachls/ then show_attach\n when /^attach/ then attach\n when /^help/ then print_help\n when /^end/ then next\n else puts \"Type 'help' for help\"\n end\n end\n end", "def say_hello(anything)\n #write code here\n puts anything\nend", "def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end", "def run\n\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n\n end", "def run\n if options_valid? && option_combinations_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end", "def main\n\n end", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend" ]
[ "0.66309196", "0.632287", "0.6314614", "0.6268893", "0.62588394", "0.6228285", "0.61985123", "0.6195078", "0.6161546", "0.6157726", "0.6139158", "0.61307466", "0.61307466", "0.61242706", "0.61242706", "0.61242706", "0.60949206", "0.60684407", "0.6063103", "0.6063103", "0.6045046", "0.6035807", "0.6035394", "0.6022103", "0.6012723", "0.6012723", "0.60121334", "0.60121334", "0.60121334", "0.60121334", "0.60121334", "0.60121334", "0.60121334", "0.60121334", "0.60064554", "0.6000162", "0.599936", "0.59963864", "0.5988623", "0.5979342", "0.5965434", "0.59571266", "0.59571266", "0.59571266", "0.59571266", "0.59571266", "0.59571266", "0.59571266", "0.5950656", "0.5944767", "0.5942707", "0.59391236", "0.59130055", "0.5902062", "0.589477", "0.5886031", "0.5886031", "0.5879525", "0.58637255", "0.5858945", "0.5858945", "0.5852264", "0.58512276", "0.58512276", "0.5851205", "0.58385247", "0.5835806", "0.58343595", "0.58293116", "0.5815805", "0.579779", "0.57920307", "0.5773699", "0.5770725", "0.57695323", "0.57695323", "0.57695323", "0.57695323", "0.57695323", "0.57686335", "0.5761981", "0.575998", "0.57435954", "0.57410026", "0.57408726", "0.5738822", "0.573858", "0.5738269", "0.573656", "0.573409", "0.5733939", "0.5731219", "0.57311326", "0.57295597", "0.57265323", "0.5716032", "0.57031715", "0.57031715", "0.57031715", "0.57031715", "0.57031715" ]
0.0
-1
ready, aim, fire! (implementation of run) Set up the library path.
def ready includes = @options.includes unless Array === includes error "Invalid value for @options.includes: #{includes.inspect}" end includes.each do |dir| $:.unshift dir end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def setup\n switch_dir\n end", "def load_libs; end", "def setup()\n end", "def run_init_script; end", "def test_library\n\tputs \"Library Loaded!\"\nend", "def lib\n\tDir.mkdir('lib')\nend", "def setup\r\n end", "def lybunt_setup\n end", "def lib_path=(_arg0); end", "def lib_path=(_arg0); end", "def lib_path=(_arg0); end", "def lib_path; end", "def lib_path; end", "def lib_path; end", "def run\n header\n what_is_installed?\n install_pianobar\n setup_config_file\n make_fifos\n setup_auto_play_station\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup(install_dir, jar_dir)\n @install_dir = install_dir\n @jar_dir = jar_dir\n end", "def library; end", "def library; end", "def test_automatically_sets_library_path_argument\n assert_equal( [ 'libs/bin' ], @cmd.library_path )\n end", "def test_automatically_sets_library_path_argument\n assert_equal( [ 'libs/bin' ], @cmd.library_path )\n end", "def setup\n install_latest_ruby\n\n install_global_gems\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup\n @wheel = Wheel.new(26,1.5)\n @gear = Gear.new(52,11,@wheel)\n end", "def initial_setup\n # Copy across the application_record_loader.rb unless it already exists\n copy_file '../static_files/application_record_loader.rb',\n 'lib/record_loader/application_record_loader.rb',\n skip: true\n # Copy across the record_loader.rake unless it already exists\n copy_file '../static_files/record_loader.rake',\n 'lib/tasks/record_loader.rake',\n skip: true\n end", "def setup!\n drb_input!\n drb_retrieve_output!\n drb_store_output!\n drb_restart!\n drb_start!\n drb_status!\n drb_stop!\n end", "def setup\n mutex.synchronize do\n break if @setup\n\n actual_root_dirs.each do |root_dir, namespace|\n set_autoloads_in_dir(root_dir, namespace)\n end\n\n on_setup_callbacks.each(&:call)\n\n @setup = true\n end\n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n\n end", "def setup\n\n end", "def initialize()\n @fan_home = ENV[\"fan_home\"]\n @fan_adm = File.join(@fan_home, \"adm\")\n @fan_bin = File.join(@fan_home, \"bin\")\n @fan_lib = File.join(@fan_home, \"lib\")\n @fan_lib_java = File.join(@fan_lib, \"java\")\n @sys_jar = File.join(@fan_lib_java, \"sys.jar\")\n @fan_lib_fan = File.join(@fan_lib, \"fan\")\n @fan_lib_net = File.join(@fan_lib, \"net\")\n @fan_src = File.join(@fan_home, \"src\")\n @src_jfan = File.join(@fan_src, \"sys\", \"java\")\n @src_nfan = File.join(@fan_src, \"sys\", \"dotnet\")\n @src_compiler = File.join(@fan_src, \"compiler\")\n\n @java_home = ENV[\"java_home\"]\n @javac = File.join(@java_home, \"bin\", \"javac.exe\")\n @jar = File.join(@java_home, \"bin\", \"jar.exe\")\n end", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def setup\n\t\tend", "def setup\n\t\tend", "def setup\n # Create Object from CPBI Library (cpbi_lib.rb)\n @cpbi_backend = CPBI_lib.new\n @driver = @cpbi_backend.driver\n @wait = @cpbi_backend.wait\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def static_setup (so_list)\n $stderr.puts \"setup: dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/fonts\"\n cp_r \"fonts\", \"#{TGT_DIR}\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp \"lib/shoes.rb\", \"#{TGT_DIR}/lib\"\n cp_r \"lib/shoes\", \"#{TGT_DIR}/lib\"\n cp_r \"lib/exerb\", \"#{TGT_DIR}/lib\"\n cp_r \"lib/package\", \"#{TGT_DIR}/lib\"\n cp_r \"samples\", \"#{TGT_DIR}/samples\"\n cp_r \"static\", \"#{TGT_DIR}/static\"\n cp \"README.md\", \"#{TGT_DIR}/README.txt\"\n cp \"CHANGELOG\", \"#{TGT_DIR}/CHANGELOG.txt\"\n cp \"COPYING\", \"#{TGT_DIR}/COPYING.txt\"\n #mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\", remove_destination: true\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n so_list.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # the things we do for love...\n ReNames.each_pair do |k, v|\n if File.exist? \"#{TGT_DIR}/#{k}\"\n mv \"#{TGT_DIR}/#{k}\", \"#{TGT_DIR}/#{v}\"\n $stderr.puts \"renamed #{k} to #{v}\"\n end\n end \n # copy/setup etc/share\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp \"#{ShoesDeps}/share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n if ENABLE_MS_THEME\n ini_path = \"#{TGT_DIR}/etc/gtk-3.0\"\n mkdir_p ini_path\n File.open \"#{ini_path}/settings.ini\", mode: 'w' do |f|\n f.write \"[Settings]\\n\"\n f.write \"#gtk-theme-name=win32\\n\"\n end\n end\n mkdir_p \"#{ShoesDeps}/lib\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" \n bindir = \"#{ShoesDeps}/bin\"\n if File.exist?(\"#{bindir}/gtk-update-icon-cache-3.0.exe\")\n cp \"#{bindir}/gtk-update-icon-cache-3.0.exe\",\n \"#{TGT_DIR}/gtk-update-icon-cache.exe\"\n else \n cp \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n end\n cp APP['icons']['win32'], \"shoes/appwin32.ico\"\n end", "def setup(*_)\n require 'reaper-man'\n location = ReaperMan::Signer::HELPER_COMMAND\n if(location.include?('jar!'))\n tmp_file = Tempfile.new('reaper-man')\n new_location = File.join(Dir.home, File.basename(tmp_file.path))\n tmp_file.delete\n File.open(new_location, 'w') do |file|\n file.puts File.read(location)\n end\n File.chmod(0755, new_location)\n ReaperMan::Signer.send(:remove_const, :HELPER_COMMAND)\n ReaperMan::Signer.const_set(:HELPER_COMMAND, new_location)\n warn \"Updated ReaperMan utility script location: #{new_location}\"\n end\n end", "def before(*args)\n require_libs\n require_ing_file\n end", "def start_setup\n\t\tread_config()\n\n\t\tputs \"Initializing annotation for project: #{self.project_file_name} ...\"\n\t\tputs \"=================================\"\n\n\t\tif add_annotation_target()\n\t\t\tputs \"=================================\"\n\t\t\tputs \"Annotation initialization for project #{self.project_file_name} done.(●'◡'●)ノ♥\"\n\t\tend\n\tend", "def setup!\n if @options.has_key?(:home)\n @home = Pathname.new(@options[:home])\n elsif not ENV['COMMITSU_HOME'].nil?\n @home = Pathname.new(ENV['COMMITSU_HOME'])\n else\n @home = Environment.default_home\n end\n load_config!\n @gui = @options.has_key?('gui')\n if @options.has_key?('issuetracker')\n begin\n @tracker = Commitsu::Trackers.get(@options['issuetracker'],self)\n rescue LoadError => le\n puts \"Unable to load tracker. Gem not found: #{le}\"\n @tracker = Commitsu::Trackers.none\n end\n else\n @tracker = Commitsu::Trackers.none\n end\n end", "def startup\nend", "def setup\r\n $LOG = Logger.new(STDERR)\r\n $LOG.level = Logger::DEBUG\r\n @baseDir = File.dirname(__FILE__)\r\n @dataDir = File.join(@baseDir, \"data\")\r\n \r\n end", "def setup()\n create_directories\n end", "def set_load_path!\n load_paths = configuration.load_paths || [] # TODO: from script/console the configuration isn't ran.\n load_paths.reverse_each { |dir| $LOAD_PATH.unshift(dir) if File.directory?(dir) } unless Rucola::RCApp.test? # FIXME: why??\n $LOAD_PATH.uniq!\n end", "def setup; end", "def initialize_environment\n env = ws.env\n\n config = ws.config\n\n env.add_path 'PATH', File.join(ws.prefix_dir, 'gems', 'bin')\n env.add_path 'PATH', File.join(config.bundler_gem_home, 'bin')\n env.add_path 'PATH', File.join(ws.dot_autoproj_dir, 'autoproj', 'bin')\n env.set 'GEM_HOME', config.gems_gem_home\n env.set 'GEM_PATH', config.bundler_gem_home\n\n root_dir = File.join(ws.prefix_dir, 'gems')\n gemfile_path = File.join(root_dir, 'Gemfile')\n if File.file?(gemfile_path)\n env.set('BUNDLE_GEMFILE', gemfile_path)\n end\n\n if !config.private_bundler? || !config.private_autoproj? || !config.private_gems?\n env.set('GEM_PATH', *Gem.default_path)\n end\n Autobuild.programs['bundler'] = File.join(ws.dot_autoproj_dir, 'bin', 'bundler')\n\n if config.private_bundler?\n env.add_path 'GEM_PATH', config.bundler_gem_home\n end\n\n env.init_from_env 'RUBYLIB'\n env.inherit 'RUBYLIB'\n # Sanitize the rubylib we get from the environment by removing\n # anything that comes from Gem or Bundler\n original_rubylib =\n (env['RUBYLIB'] || \"\").split(File::PATH_SEPARATOR).find_all do |p|\n !p.start_with?(Bundler.rubygems.gem_dir) &&\n !Bundler.rubygems.gem_path.any? { |gem_p| p.start_with?(p) }\n end\n # And discover the system's rubylib\n if system_rubylib = discover_rubylib\n # Do not explicitely add the system rubylib to the\n # environment, the interpreter will do it for us.\n #\n # This allows to use a binstub generated for one of ruby\n # interpreter version on our workspace\n env.system_env['RUBYLIB'] = []\n env.original_env['RUBYLIB'] = (original_rubylib - system_rubylib).join(File::PATH_SEPARATOR)\n end\n\n ws.config.each_reused_autoproj_installation do |p|\n reused_w = ws.new(p)\n reused_c = reused_w.load_config\n env.add_path 'PATH', File.join(reused_w.prefix_dir, 'gems', 'bin')\n end\n\n prefix_gems = File.join(ws.prefix_dir, \"gems\")\n FileUtils.mkdir_p prefix_gems\n gemfile = File.join(prefix_gems, 'Gemfile')\n if !File.exists?(gemfile)\n File.open(gemfile, 'w') do |io|\n io.puts \"eval_gemfile \\\"#{File.join(ws.dot_autoproj_dir, 'autoproj', 'Gemfile')}\\\"\"\n end\n end\n\n if bundle_rubylib = discover_bundle_rubylib(silent_errors: true)\n update_env_rubylib(bundle_rubylib, system_rubylib)\n end\n end", "def setup_context\n self['console'] = Console.new\n load RUNTIME_PATH\n\n opal = self['opal']\n opal['loader'] = Loader.new opal, self\n opal['fs'] = FileSystem.new opal, self\n opal['platform']['engine'] = 'opal-gem'\n\n # eval \"opal.require('core');\", \"(opal)\"\n require_file 'core'\n end", "def post_setup\n end", "def initialize\n require 'java'\n \n naether_jar = Naether::Configuration.naether_jar\n \n @loaded_paths = []\n \n load_paths(naether_jar) \n @class_loader = com.tobedevoured.naether.PathClassLoader.new()\n internal_load_paths(naether_jar) \n end", "def _init(explaination='no explaination given', initial_debug_state = $DEBUG_INIT)\n $RELOAD_DEBUG = false # \n deb \"pre init '#{explaination}'\" if $RELOAD_DEBUG\n $INIT_DEBUG = false # dice se debuggare la mia intera infrastruttura o no...\n $RELOADED_ONCE = 0 # aiuta a capuire quante volte includo sta cazo di lib! Sempre 2!!!\n $RIC_LIB_MODULES = %w{ classes/debug_ric } # to be explicitly included in this order.\n $HOME = File.expand_path('~')\n $DEBUG ||= initial_debug_state \n $PROG = File.basename($0)\n case $PROG\n when 'irb'\n print \"[DEB] Welcome to Sakura within IRB! Happy playing. Try 'Sakuric.VERSION'\"\n when 'ruby'\n print \"[DEB] Welcome to Sakura within RUBY! Happy playing. Try 'Sakuric.VERSION'\"\n default\n # do nothing\n end\n \n ################################################################################\t\n # Path to riccardo's Library... Library stuff\n $LOAD_PATH << './lib' \n $LOAD_PATH << \"#{$SAKURADIR}/lib/\"\n\n # BEWARE: ORDER *IS* RELEVANT!\n $RICLIB = Hash.new unless defined?($RICLIB)\n $RICLIB['VERSION'] = $RICLIB_VERSION\n $RICLIB['libs'] ||= []\n $RICLIB['nreloaded'] ||= 0\n $RICLIB['nreloaded'] += 1 \n $RICLIB['help'] =<<-BURIDONE\nThis library contains all my enciclopedic knowledge (that is, notionistic). :\nFinally solved the bug of double inclusion (crisbio, files included this!)\nBURIDONE\n\n load_sakura_modules!(initial_debug_state)\n $CONF = RicConf.new()\n pyellow($CONF.info()) if debug?() \n puts \"post init delle #{Time.now}\" if $RELOAD_DEBUG\n print \"Sakuric.n_called(): #{ Sakuric.n_called() }\"\nend", "def set_up_libraries\n R.eval <<-EOR\n suppressMessages(library(ROCR, warn.conflicts = FALSE, quietly=TRUE))\n suppressMessages(library(bestglm, warn.conflicts = FALSE, quietly=TRUE))\n suppressMessages(library(lsr, warn.conflicts = FALSE, quietly=TRUE))\n suppressMessages(library(FactoMineR, warn.conflicts = FALSE, quietly=TRUE))\n source('#{File.dirname(__FILE__)}/experience_functions.R')\n EOR\n end", "def setup\n self.class.load_yard\n\n if File.exist?(@doc_dir)\n raise Gem::FilePermissionError, @doc_dir unless File.writable?(@doc_dir)\n else\n FileUtils.mkdir_p @doc_dir\n end\n end", "def initialize\n set_root_path!\n \n self.frameworks = default_frameworks\n self.autoload_paths = default_autoload_paths\n self.autoload_once_paths = default_autoload_once_paths\n self.dependency_loading = default_dependency_loading\n self.eager_load_paths = default_eager_load_paths\n self.log_path = default_log_path\n self.log_level = default_log_level\n self.binder_paths = default_binder_paths\n self.marshal_path = default_marshal_path\n self.cache_classes = default_cache_classes\n self.whiny_nils = default_whiny_nils\n self.database_configuration_file = default_database_configuration_file\n self.app_config_file = default_app_config_file\n self.plugin_glob = default_plugin_glob\n self.helper_glob = default_helper_glob\n self.initializer_glob = default_initalizer_glob\n self.first_run_glob = default_first_run_glob\n self.publisher = default_publisher\n self.copyright = default_copyright\n \n for framework in default_frameworks\n self.send(\"#{framework}=\", Bowline::OrderedOptions.new)\n end\n end", "def startup\n end" ]
[ "0.65512484", "0.63643533", "0.6259009", "0.6179743", "0.61171234", "0.6106498", "0.6076977", "0.604382", "0.6035016", "0.5977818", "0.5977818", "0.5977818", "0.5973664", "0.5973664", "0.5973664", "0.5968676", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.5963836", "0.59619474", "0.59619474", "0.59619474", "0.59619474", "0.59619474", "0.5941305", "0.5933384", "0.5933384", "0.59262997", "0.59262997", "0.58771557", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.5868006", "0.58624786", "0.58607453", "0.5857243", "0.58521086", "0.5841306", "0.5841306", "0.5841306", "0.5841306", "0.5841306", "0.5841306", "0.5841306", "0.58129054", "0.58129054", "0.5812862", "0.5786957", "0.5770737", "0.5770737", "0.5768015", "0.57549", "0.57549", "0.57549", "0.57549", "0.57549", "0.57549", "0.57524514", "0.5723906", "0.5714433", "0.5694071", "0.5692587", "0.56909126", "0.56901056", "0.5683186", "0.5679036", "0.5678697", "0.56752414", "0.5672466", "0.5669747", "0.5669021", "0.56657505", "0.5665106", "0.566508", "0.56575847", "0.56551343" ]
0.0
-1
Load and run the tests. Run the setup file first if it exists.
def fire! if @setup_file vmsg "Running #{@setup_file} first" load @setup_file else vmsg "No setup file #{@setup_file} to run" end if @options.run_separately @files.each { |file| _print_banner(file) load file Whitestone.run(_whitestone_options) } else @files.each { |file| vmsg "Loading file: #{file}" load file } Whitestone.run(_whitestone_options) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test\n require File.expand_path(File.join(File.dirname(__FILE__), \"tests/tests\"))\n Test.run\nend", "def setup\n # runs before every test\n # wipe and recreate .test directory, switch pwd \n Dir.chdir(@@start_dir)\n if File.exist?('.test')\n FileUtils.rm_rf('.test')\n end\n \n Dir.mkdir('.test')\n Dir.chdir('.test')\n end", "def setup\n @suite.p \"\\n:: [SETUP]\\n\"\n # -- let's print the description of each test first:\n Dir.glob(\"#{@suite.suite_root}/tests/**/*_test.rb\") {|f|\n file_contents = File.read(f)\n @suite.p \"\\n [description] : \" + /^#.*@description(.*$)/.match(file_contents)[0].gsub(/^#.*@description/, '') + \"\\n\\n\" if /#{self.class.name}/.match(file_contents)\n }\n end", "def load_setup\n setupFile = @properties[\"config/setup_file\"]\n return unless (setupFile and File.exist?(setupFile))\n file = File.new(setupFile)\n setup = file.read\n file.close\n instance_eval(setup)\n end", "def test_load(options={})\n options = test_configuration(options)\n\n tests = options['tests']\n loadpath = options['loadpath']\n requires = options['requires']\n live = options['live']\n exclude = options['exclude']\n\n files = Dir.multiglob_r(*tests) - Dir.multiglob_r(*exclude)\n\n return puts(\"No tests.\") if files.empty?\n\n max = files.collect{ |f| f.size }.max\n list = []\n\n files.each do |f|\n next unless File.file?(f)\n if r = system(\"ruby -I#{loadpath.join(':')} #{f} > /dev/null 2>&1\")\n puts \"%-#{max}s [PASS]\" % [f] #if verbose?\n else\n puts \"%-#{max}s [FAIL]\" % [f] #if verbose?\n list << f\n end\n end\n\n puts \" #{list.size} Load Failures\"\n\n if verbose?\n unless list.empty?\n puts \"\\n-- Load Failures --\\n\"\n list.each do |f|\n print \"* \"\n system \"ruby -I#{loadpath} #{f} 2>&1\"\n #puts\n end\n puts\n end\n end\n end", "def before_load(test_files); end", "def run(arguments, options)\n setup_path = nil\n selectors = BareTest.process_selectors(arguments)\n options = selectors.merge(options)\n options[:persistence] ||= Persistence.new\n\n # Load the setup file, all helper files and all test files\n BareTest.load_standard_test_files(\n :verbose => options[:verbose],\n :setup_path => options[:setup_path],\n :files => options[:files],\n :chdir => '.'\n )\n\n # Run the tests\n puts if options[:verbose]\n ARGV.clear # IRB is being stupid\n runner = BareTest::Run.new(BareTest.toplevel_suite, options)\n runner.run_all\n\n # Return whether all tests ran successful\n runner.global_status == :success\n end", "def setup\n\t\t# If there's no test database, we'll use the return statement to stop\n\t\t# executing the rest of this code block.\n\t\treturn unless File.exists?('test.sqlite3')\n\t\t# We'll delete everything in our database so that the results of one\n\t\t# test don't affect other tests.\n\t\tdb = SQLite3::Database.new('test.sqlite3')\n\t\tdb.execute \"DELETE FROM guestbook WHERE 1;\"\n\tend", "def setup_test_files\n project.test_sources.each do |src|\n compile_task objectsify(src), src\n end\n end", "def setup\n\t\t\t\tp \"mytest1 setup\"\n\t\tend", "def setup\n # wipe and recreate .test directory \n Dir.chdir(@@start_dir)\n if File.exist?('.test')\n FileUtils.rm_rf('.test')\n end\n \n # NOTE: I don't think we want to kill .repository in pwd from running test\n if File.exist?('.repository')\n FileUtils.rm_rf('.repository')\n end\n Dir.mkdir('.test')\n Dir.chdir('.test')\n end", "def test_setup\n TestEngine.install_tasks\n Rake::Task['test:engine:setup'].invoke\n assert app_path.join('db/schema.rb').exist?\n assert app_path.join('db/test.sqlite3').exist?\n end", "def setup_test\n require_dependencies 'bacon', :group => 'test'\n insert_test_suite_setup BACON_SETUP, :path => 'test/test_config.rb'\n create_file destination_root(\"test/test.rake\"), BACON_RAKE\n end", "def setup_test\n\n assert(File.exist?(model_path))\n\n if !File.exist?(run_dir)\n FileUtils.mkdir_p(run_dir)\n end\n assert(File.exist?(run_dir)) \n\n if File.exist?(report_path)\n FileUtils.rm(report_path)\n end\n\n if !File.exist?(sql_path)\n puts \"Running EnergyPlus\"\n\n osw_path = File.join(run_dir, 'in.osw')\n osw_path = File.absolute_path(osw_path)\n\n workflow = OpenStudio::WorkflowJSON.new\n workflow.setSeedFile(File.absolute_path(model_path))\n workflow.setWeatherFile(File.absolute_path(epw_path))\n workflow.saveAs(osw_path)\n\n cli_path = OpenStudio.getOpenStudioCLI\n cmd = \"\\\"#{cli_path}\\\" run -w \\\"#{osw_path}\\\"\"\n puts cmd\n system(cmd)\n end\n end", "def test() \n @runner.prepareForFile(@filename)\n testIfAvailable(codeFilename())\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def run_setup(config)\n config_dir = File.join(Dir.pwd, 'test', 'specs', 'config')\n path = Dir.glob(File.join(config_dir, \"#{config}*\")).first\n\n msg = \"No file matching #{config} found in #{config_dir}\"\n raise msg unless path\n\n Thread.abort_on_exception = true\n runner = Thread.new do\n Jackal::Utils::Spec.system_runner.run!(:config => path)\n end\n source_wait(:setup)\n runner\nend", "def load_setup( name )\n reader = create_fixture_reader( name ) ### \"virtual\" method - required by concrete class\n\n reader.each do |fixture_name|\n load( fixture_name )\n end\n end", "def prepare_test_stand\n unless CONFIG_DIR.exist?\n puts \"Unable to rum specs - .ini not found. Put all your .ini files into #{CONFIG_DIR}!\"\n RSpec.wants_to_quit=true\n end\n\n FileUtils.rm_rf TMP_DIR\n FileUtils.cp_r SOURCE_DIR, TEST_DIR #TMP_DIR\nend", "def run_tests()\n @loaded_modules.each do |module_name|\n module_class = Object.const_get(module_name.to_s).const_get(module_name.to_s).new\n if module_class.respond_to?( 'run' )\n module_class.run()\n else\n puts \"\\e[31mWARNING\\e[0m: Module #{(module_name)} not implemented\"\n end\n end\n end", "def exec_test\n $stderr.puts 'Running tests...' if verbose?\n\n runner = config.testrunner\n\n case runner\n when 'auto'\n unless File.directory?('test')\n $stderr.puts 'no test in this package' if verbose?\n return\n end\n begin\n require 'test/unit'\n rescue LoadError\n setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'\n end\n autorunner = Test::Unit::AutoRunner.new(true)\n autorunner.to_run << 'test'\n autorunner.run\n else # use testrb\n opt = []\n opt << \" -v\" if verbose?\n opt << \" --runner #{runner}\"\n if File.file?('test/suite.rb')\n notests = false\n opt << \"test/suite.rb\"\n else\n notests = Dir[\"test/**/*.rb\"].empty?\n lib = [\"lib\"] + config.extensions.collect{ |d| File.dirname(d) }\n opt << \"-I\" + lib.join(':')\n opt << Dir[\"test/**/{test,tc}*.rb\"]\n end\n opt = opt.flatten.join(' ').strip\n # run tests\n if notests\n $stderr.puts 'no test in this package' if verbose?\n else\n cmd = \"testrb #{opt}\"\n $stderr.puts cmd if verbose?\n system cmd #config.ruby \"-S tesrb\", opt\n end\n end\n end", "def start_tests(files)\n end", "def run(*args)\n files = args.select { |arg| arg !~ /^-/ }\n\n files = parse_files(files)\n examples = parse_examples(files)\n\n add_pwd_to_path\n\n generate_tests(examples)\n run_tests\n end", "def setup\n # reload the fixtures since each test is NOT wrapped in a transaction\n self.class.fixtures :all\n self.class.open_browser(@@testing_browser)\n end", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def initialize(files, options)\n @files = files\n\n Rails.application.load_tasks\n Rake::Task['db:test:load'].invoke\n\n if options.delete(:fixtures)\n if defined?(ActiveRecord::Base)\n ActiveSupport::TestCase.send :include, ActiveRecord::TestFixtures\n ActiveSupport::TestCase.fixture_path = \"#{Rails.root}/test/fixtures/\"\n ActiveSupport::TestCase.fixtures :all\n end\n end\n\n MiniTest::Unit.runner.options = options\n MiniTest::Unit.output = SilentUntilSyncStream.new(MiniTest::Unit.output)\n end", "def test_setup\r\n \r\n end", "def setup\n FileUtils.remove_dir(File.expand_path(TEST_DIR), true)\n @wd = WebDump.new :base_dir => TEST_DIR\n end", "def setup\n add_standard_properties\n #\n create_banner\n create_standard_options\n create_advanced_options\n create_mode_options\n create_application_options\n create_feature_options\n create_tail_options\n #\n parse_options\n load_config_configuration\n create_result_directory\n load_results_archive\n end", "def setup\n debug 'No custom setup defined'\n end", "def setup\n templates = ['default']\n templates << @opts[:testkitchen] if @opts[:testkitchen]\n\n templates.each { |type| create_file(type) }\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def run(files)\n file = files.first\n puts \"** Running #{file}\"\n \n class_filename = file.sub(self.class::CLASS_MAP, '')\n \n # get the class\n test_class = resolve_classname(class_filename)\n \n # create dummy wrapper modules if test is in subfolder\n test_class.split('::').each do |part|\n eval \"module ::#{part}; end\" if !part.match('Test')\n end\n \n begin \n clear_class(test_class.constantize) \n rescue NameError \n \n end\n \n # TODO: make this reload use load_file\n $\".delete(file)\n \n begin\n require file\n rescue LoadError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n rescue ArgumentError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n rescue SyntaxError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n end\n \n # TODO: change that to run multiple suites\n #klass = Kernel.const_get(test_class) - this threw errors\n klass = eval(test_class)\n \n Test::Unit::UI::Console::TestRunner.run(klass)\n Test::Unit.run = false\n \n # Invoke method to test that writes to stdout.\n result = test_io.string.to_s.dup\n\n # clear the buffer \n test_io.truncate(0)\n \n # sent result to notifier\n notifier.result(file, result.split(\"\\n\").compact.last)\n\n # sent result to stdio\n puts result\n \n end", "def exec_setup\n exec_task_traverse 'setup'\n end", "def pre_setup_suite()\n @cfg['pre_setup'] =\"defined\"\n return true\n end", "def setup\n make_config\n make_users_file\n end", "def run_app_tests\n end", "def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end", "def setup\n FileUtils.mkdir TEMP_SITE_PATH\n FileUtils.cp_r File.join(TEST_SITE_PATH, '.'), TEMP_SITE_PATH\n # FIXME: I don't like this; change it when we can handle multiple ruhohs\n Ruhoh::Utils.stub(:parse_yaml_file).and_return('theme' => 'twitter')\n Ruhoh::Paths.stub(:theme_is_valid?).and_return(true)\n Ruhoh::Manager.setup :source => TEMP_SITE_PATH\nend", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def setup\n end", "def runFixtureAndTests(testDirPath, collectionName, fixtureFileName)\n setFixture(collectionName,fixtureFileName) {runTests(testDirPath)}\nend", "def setup_test_app\n gemfile_path = if CORE_GEMS.include?(self.name)\n ROOT_GEMFILE\n else\n './Gemfile'\n end\n\n system(\"bundle exec --gemfile=#{gemfile_path} rake test_app \") || raise('Failed to setup the test app')\n end", "def test_script\n spec_directory = @config_manager['test_pack.spec_directory']\n spec_file = File.join(spec_directory, \"#{@name}_spec.rb\")\n @logger.info(\"Starting spec '#{spec_file}'...\")\n RSpec::Core::Runner.run([spec_file])\n end", "def setup\r\n end", "def setup()\n end", "def setupTestDir\r\n @start = Dir.getwd\r\n teardownTestDir\r\n begin\r\n\tDir.mkdir(\"_test\")\r\n rescue\r\n $stderr.puts \"Cannot run a file or directory test: \" + \r\n \"will destroy existing directory _test\"\r\n\t# VMS maps exit status 99 (octal 143) as a meaningless\r\n\t# message \"%SYSTEM-?-DRVERR, fatal drive error\".\r\n\texit\r\n# exit(99)\r\n end\r\n File.open(File.join(\"_test\", \"_file1\"), \"w\", 0644) {}\r\n File.open(File.join(\"_test\", \"_file2\"), \"w\", 0644) {}\r\n @files = %w(. .. _file1 _file2)\r\n end", "def load\n\n return unless Plan.where(name: name, postcode: postcode).empty?\n\n setup_events\n require 'csv'\n Dir.glob(File.join(Rails.root,\"fixtures/#{name_as_directory}/*\")).each do |filename|\n load_all_tasks_and_tag_for filename\n end\n setup_the_plan\n end", "def define_test_tasks!\n require 'rake/testtask'\n\n namespace(:test) do\n Rake::TestTask.new(:basic) do |t|\n t.pattern = test_pattern\n t.verbose = true\n t.libs << 'test'\n end\n end\n\n desc \"Run all unit tests for #{gemspec.name}\"\n task(:test => ['test:basic'])\n end", "def define_test_tasks\n default_tasks = []\n\n if File.directory? \"test\" then\n desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'\n task :test do\n ruby make_test_cmd\n end\n\n desc 'Run the test suite using multiruby.'\n task :multi do\n ruby make_test_cmd(:multi)\n end\n\n desc 'Show which test files fail when run alone.'\n task :test_deps do\n tests = Dir[\"test/**/test_*.rb\"] + Dir[\"test/**/*_test.rb\"]\n\n paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)\n null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'\n\n tests.each do |test|\n if not system \"ruby -I#{paths} #{test} #{null_dev}\" then\n puts \"Dependency Issues: #{test}\"\n end\n end\n end\n\n default_tasks << :test\n end\n\n if File.directory? \"spec\" then\n begin\n require 'spec/rake/spectask'\n\n desc \"Run all specifications\"\n Spec::Rake::SpecTask.new(:spec) do |t|\n t.libs = self.rspec_dirs\n t.spec_opts = self.rspec_options\n end\n rescue LoadError\n # do nothing\n end\n default_tasks << :spec\n end\n\n desc 'Run the default task(s).'\n task :default => default_tasks\n\n desc 'Run ZenTest against the package.'\n task :audit do\n libs = %w(lib test ext).join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}\"\n end\n end", "def setup\n @start = Dir.pwd\n fixture = File.join(fixtures, 'compc')\n Dir.chdir(fixture)\n \n @mxmlc_output = 'bin/MXMLC.swf'\n @compc_input = 'SomeProject'\n @compc_output = 'bin/COMPC.swc'\n @src = 'src'\n @test = 'test'\n\n remove_file(@compc_output)\n end", "def setup()\n create_directories\n end", "def test\n return\n # TODO\n # skips test framework, but we can probably just bastardize the options in the same way as with :skip_bundle\n # either make `test` build the actual directories etc., or use a script\n # either way, this method is stupid.\n end", "def test\n return\n # TODO\n # skips test framework, but we can probably just bastardize the options in the same way as with :skip_bundle\n # either make `test` build the actual directories etc., or use a script\n # either way, this method is stupid.\n end", "def setup\n switch_dir\n end", "def run_tests t, libr = :cascade, test_files=\"test_*.rb\"\n require 'test/unit/testsuite'\n require 'test/unit/ui/console/testrunner'\n require 'tests/testem'\n \n base_dir = File.expand_path(File.dirname(__FILE__) + '/../') + '/'\n \n runner = Test::Unit::UI::Console::TestRunner\n \n $eventmachine_library = libr\n EmTestRunner.run(test_files)\n \n suite = Test::Unit::TestSuite.new($name)\n\n ObjectSpace.each_object(Class) do |testcase|\n suite << testcase.suite if testcase < Test::Unit::TestCase\n end\n\n runner.run(suite)\nend", "def setup_tests\n Rake::TestTask.new do |t|\n t.libs << \"test\"\n t.test_files = FileList['test/test*.rb']\n t.verbose = true\n end\nend", "def setup\n load_users\n end", "def sub_test\n shell(test_script, source_dir)\n end", "def setup_test_1(test_name, epw_path)\n\n co = OpenStudio::Runmanager::ConfigOptions.new(true)\n co.findTools(false, true, false, true)\n\n if !File.exist?(sql_path(test_name))\n puts \"Running EnergyPlus\"\n\n wf = OpenStudio::Runmanager::Workflow.new(\"modeltoidf->energypluspreprocess->energyplus\")\n wf.add(co.getTools())\n job = wf.create(OpenStudio::Path.new(run_dir(test_name)), OpenStudio::Path.new(model_out_path(test_name)), OpenStudio::Path.new(epw_path))\n\n rm = OpenStudio::Runmanager::RunManager.new\n rm.enqueue(job, true)\n rm.waitForFinished\n end\n end", "def testing_begin(files)\n end", "def add_testing\n setup_rspec\n setup_rspec_generators\n setup_rails_helper\n setup_factories_file\nend", "def setup\n # NOTE: We do not yet assume any contents of the depot. When we do,\n # I have some code for populating test fixtures, although it leans a bit\n # toward Rails' conventions. We can probably 'derail' it. :)\n\n # Specify the environment, e.g. development vs. test, etc. It is assumed to be\n # test. This is done mainly so that the right configuration is used for connecting to\n # Perforce. This should probably be moved to a generic 'test_helper' which is\n # included in all tests.\n ENV['APP_ENV'] ||= 'test'\n end", "def setup(description=nil, &procedure)\n if procedure\n @_setup = TestSetup.new(@test_case, description, &procedure)\n end\n end", "def init(arguments, options)\n core = %w[\n test\n test/external\n test/helper\n test/helper/suite\n test/suite\n ]\n mirror = {\n 'bin' => %w[test/helper/suite test/suite],\n 'lib' => %w[test/helper/suite test/suite],\n 'rake' => %w[test/helper/suite test/suite],\n }\n baretest_version = BareTest::VERSION.to_a.first(3).join('.').inspect\n ruby_version = RUBY_VERSION.inspect\n files = {\n 'test/setup.rb' => <<-END_OF_SETUP.gsub(/^ {10}/, '')\n # Add PROJECT/lib to $LOAD_PATH\n $LOAD_PATH.unshift(File.expand_path(\"\\#{__FILE__}/../../lib\"))\n\n # Ensure baretest is required\n require 'baretest'\n\n # Some defaults on BareTest (see Kernel#BareTest)\n BareTest do\n require_baretest #{baretest_version} # minimum baretest version to run these tests\n require_ruby #{ruby_version} # minimum ruby version to run these tests\n use :support # Use :support in all suites\n end\n END_OF_SETUP\n }\n\n puts \"Creating all directories and files needed in #{File.expand_path('.')}\"\n core.each do |dir|\n if File.exist?(dir) then\n puts \"Directory #{dir} exists already -- skipping\"\n else\n puts \"Creating #{dir}\"\n Dir.mkdir(dir)\n end\n end\n mirror.each do |path, destinations|\n if File.exist?(path) then\n destinations.each do |destination|\n destination = File.join(destination,path)\n if File.exist?(destination) then\n puts \"Mirror #{destination} of #{path} exists already -- skipping\"\n else\n puts \"Mirroring #{path} in #{destination}\"\n Dir.mkdir(destination)\n end\n end\n end\n end\n files.each do |path, data|\n if File.exist?(path) then\n puts \"File #{path} exists already -- skipping\"\n else\n puts \"Writing #{path}\"\n File.open(path, 'wb') do |fh|\n fh.write(data)\n end\n end\n end\n end", "def setup\r\n puts 'starting a new test: ' + self.name\r\n cfT1 = CustomField.new(\"testField\", \"kuku\")\r\n cfT2 = CustomField.new(\"tester\", \"new_tester\")\r\n @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder\r\n\t .withCustomFields(cfT1, cfT2)\r\n .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest')\r\n .build()))\r\n end", "def application_flow\n if @check\n # run just the suite setup test if requested\n if @configuration.suite_setup\n exit @engine.run(@configuration.suite_setup)\n else\n raise Rutema::RutemaError,\"There is no suite setup test defined in the configuration.\"\n end\n else\n # run everything\n exit @engine.run(@test_identifier)\n end\n end", "def run_rails_tests\n message \"Running tests. This may take a minute or two\"\n \n in_directory install_directory do\n if system_silently(\"rake -s test\")\n message \"All tests pass. Congratulations.\"\n else\n message \"***** Tests failed *****\"\n message \"** Please run 'rake test' by hand in your install directory.\"\n message \"** Report problems to #{@@support_location}.\"\n message \"***** Tests failed *****\"\n end\n end\n end", "def setup\n\n # Save the Global variable's original settings so that they can be changed in this\n # test without affecting other test, so long as they are restored by teardown\n @@VERBOSE_ORIG = $VERBOSE\n @@DEBUG_ORIG = $DEBUG\n @@FAST_SPEED_ORIG = $FAST_SPEED\n @@HIDE_IE_ORIG = $HIDE_IE\n\n @@tTestCase_StartTime = Time.now\n\n end", "def load_test(tc)\n data = Hash.new\n File.open(tc, \"r\") do |infile|\n while (line = infile.gets)\n #test = /^.*\\/(.*\\.rb)/.match(tc)[1]\n test = /^.*\\/([A-Za-z0-9_-]*[T|t]est.*)/.match(tc)[1]\n data['execute_class'] = /^([A-Za-z0-9_-]*[T|t]est.*)/.match(tc)[1]\n data['path'] = /(.*)\\/#{test}/.match(tc)[1]\n data['execute_args'] = /^#[\\s]*@executeArgs[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@executeArgs/.match(line)\n data['author'] = /^#[\\s]*@author[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@author/.match(line)\n data['keywords'] = /^#[\\s]*@keywords[\\s]*(.*)/.match(line)[1].gsub(/,/,'').split if /^#[\\s]*@keywords/.match(line)\n data['description'] = /^#[\\s]*@description[\\s]*(.*)/.match(line)[1] if /^#[\\s]*@description/.match(line)\n end\n end\n @tests << Test.new(data, @test_data) if data['keywords'] != nil and data['keywords'] != \"\"\nend", "def setup\n # no setup\n\tend", "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "def initial_setup\n # Copy across the application_record_loader.rb unless it already exists\n copy_file '../static_files/application_record_loader.rb',\n 'lib/record_loader/application_record_loader.rb',\n skip: true\n # Copy across the record_loader.rake unless it already exists\n copy_file '../static_files/record_loader.rake',\n 'lib/tasks/record_loader.rake',\n skip: true\n end", "def setup\r\n\t\t@controller = Admin::UserController.new\r\n\t\t@request = ActionController::TestRequest.new\r\n\t\t@response = ActionController::TestResponse.new\r\n\t\t# Retrieve fixtures via their name\r\n\t\t# @first = users(:first)\r\n\t\t@first = User.find_first\r\n\tend", "def setup_test_suite\n return unless config.dig(\"test_suite\") == \"rspec\"\n\n generate \"rspec:install\"\n run \"rm -r test\"\n end", "def setup\n true\n end", "def test_autoload\n with_fixture 'autoload' do\n assert system(\"ruby\", ocra, \"autoload.rb\", *DefaultArgs)\n assert File.exist?(\"autoload.exe\")\n File.unlink('foo.rb')\n assert system(\"autoload.exe\")\n end\n end", "def set_up_test_env\n\t\t`ruby expect_test_v1.rb`\n\tend", "def setup\n\n end", "def setup\n\n end", "def test(argv = ARGV)\n if spec_file?(argv) && defined?(RSpec)\n # disable autorun in case the user left it in spec_helper.rb\n RSpec::Core::Runner.disable_autorun!\n exit RSpec::Core::Runner.run(argv)\n else\n Zeus::M.run(argv)\n end\n end", "def setup(*args)\n force = (args.empty? ? false : true)\n current_project.setup(force)\n\n # output\n show_jmeter_plans\n show_load_agents\n show_target_hosts\n end", "def run\n begin\n self.class.roby_should_run(self, Roby.app)\n super\n rescue MiniTest::Skip => e\n puke self.class, self.name, e\n end\n end", "def pass?\n chdir do\n setup_test_app\n run_tests\n end\n end" ]
[ "0.6915171", "0.6847431", "0.6780932", "0.67183346", "0.66953987", "0.6670278", "0.66423607", "0.66323376", "0.6609081", "0.65928465", "0.6550431", "0.6481675", "0.6443065", "0.64173007", "0.6409073", "0.6401322", "0.6391273", "0.63834727", "0.63688993", "0.63684595", "0.63628626", "0.63466376", "0.6339529", "0.6326606", "0.61510736", "0.61085355", "0.6098744", "0.6096368", "0.60787004", "0.60688794", "0.60414565", "0.6012856", "0.6012856", "0.6005815", "0.59971315", "0.5996507", "0.59925705", "0.5983453", "0.5983429", "0.59788597", "0.59682167", "0.59682167", "0.59682167", "0.59682167", "0.59682167", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.59657115", "0.5957951", "0.59568167", "0.59472746", "0.5945331", "0.5938508", "0.59367156", "0.59348273", "0.5927056", "0.5922521", "0.59210867", "0.59071684", "0.5899204", "0.5899204", "0.589497", "0.5894273", "0.58913106", "0.58851933", "0.5879471", "0.58721024", "0.5865112", "0.58592767", "0.5850895", "0.5848263", "0.58438426", "0.5825158", "0.5819339", "0.58004695", "0.57924193", "0.5786748", "0.578637", "0.5776798", "0.57721287", "0.5771749", "0.5767392", "0.5761068", "0.5759276", "0.5759099", "0.5753346", "0.5753346", "0.575207", "0.5741715", "0.5729661", "0.5718576" ]
0.65411377
11
Return a hash suitable for passing to Whitestone.run
def _whitestone_options() { :filter => @options.filter, :full_backtrace => @options.full_backtrace } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n if @_hash.nil?\n @_hash = {}\n run\n end\n @_hash\n end", "def get_entry_script_hash(*params); raise('Stub or mock required.') end", "def hash\n hash_args.hash\n end", "def get_executing_script_hash(*params); raise('Stub or mock required.') end", "def get_script_hash(*params); raise('Stub or mock required.') end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n [device, duration, execution_rule, location, result_id, retries, status, test_name, test_public_id, test_type].hash\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n _window.hash\n end", "def hash\n [name, args].hash\n end", "def to_hash\n hsh = {\n id: id,\n status: status.to_sym,\n connect: running? ? connect.to_h : nil,\n time: info.wallclock_time.to_i / 60 # only update every minute\n }\n Digest::SHA1.hexdigest(hsh.to_json)\n end", "def get_calling_script_hash(*params); raise('Stub or mock required.') end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash()\n #This is a stub, used for indexing\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 to_hash\n { :setup => @setup, :windows => @windows }\n end", "def hash\n [check_id, exceptions, key, links, port, proof, protocol, since, status].hash\n end", "def get_hash_data\r\n return CallInitiate.decode_call_params(get_variable(\"CallInitiate_hashdata\"))\r\n\tend", "def hash\n @hash\n end", "def hash\n guid.hash\n end", "def hash\n [allow_insecure_certificates, basic_auth, body, body_type, cookies, device_ids, follow_redirects, headers, locations, metadata, public_id, _retry, start_url, variables].hash\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash\n [web_url, project, parallel_runs, started_at, latest_workflow, name, executor, parallelism, status, number, pipeline, duration, created_at, messages, contexts, organization, queued_at, stopped_at].hash\n end", "def hash\r\n return to_s.hash\r\n end", "def hash(*) end", "def hash\r\n [user_id, project_id, release, build, _module, requirement, test_case, test_cycle, test_suite, test_run, defect, report, project_setting, session, project, schedule].hash\r\n end", "def hash\n return to_s.hash\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 output_hash; end", "def makehash(body)\n if ENV.include?(\"MCOLLECTIVE_PSK\")\n psk = ENV[\"MCOLLECTIVE_PSK\"]\n else\n raise(\"No plugin.psk configuration option specified\") unless @config.pluginconf.include?(\"psk\")\n psk = @config.pluginconf[\"psk\"]\n end\n \n Digest::MD5.hexdigest(body.to_s + psk)\n end", "def get_hash()\n return @@hash;\n end", "def hash\n code.hash\n end", "def hash(option_json)\n\t\tif(File.exist?(GROWTH::GROWTH_REPOSITORY))then\n\t\t\tg = Git.open(GROWTH::GROWTH_REPOSITORY)\n\t\t\treturn {status: \"ok\", hash: g.log()[-1].sha}\n\t\telse\n\t\t\treturn {status: \"error\", message: \"GRWOTH git repository '#{GROWTH::GROWTH_REPOSITORY}' not found \"}\n\t\tend\n\tend", "def hash\n [is_disabled, action_type, external_url, target_slide_index, target_frame, tooltip, history, highlight_click, stop_sound_on_click, color_source, sound_base64].hash\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 hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def hash\n @hash ||= @client.get_hash(path)\n @hash\n end", "def hash\n to_s.hash\n end", "def get_hash()\n\t\t\treturn @config.clone()\n\t\tend", "def hash\n\t\t(language + type + klass + thing).hash\n\tend", "def hash\n [hint,name,ordinal,module_name].hash\n end", "def hash\n code.hash\n end", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def job_hash\n [@image,@config].hash\n end", "def job_hash\n [@image,@config].hash\n end", "def get_hash(*params); raise('Stub or mock required.') end", "def hash=(_arg0); end", "def sha\n result_hash['sha']\n end", "def to_hash\n {\n :argv => @argv,\n :started => @started.to_i,\n :ended => @ended.to_i,\n :elapsed => elapsed,\n :pid => @pid,\n :retval => ((@status.nil? and @status.exited?) ? nil : @status.exitstatus)\n }\n end", "def to_hash() end", "def hash\n [hardware_baseboard, public_key, memory, processors, cpu_logical_count, connection_url, operating_system, cpu_physical_cores, status, operating_system_uptime, cpu_model, owner, cpu_family, cpu_frequency, hardware_firmware].hash\n end", "def hash\n return Digest::MD5.hexdigest(self.describe(' '))\n end", "def hash\n [code, scope].hash\n end", "def config_hash\n digest = Digest::MD5.hexdigest(\n \"#{@x}-#{@y}-#{@hires_factor}-#{@render_type}-#{@format}-#{CONVERTER_VERSION}\")\n digest\n end", "def hash\n @hash || calculate_hash!\n end", "def hash\n [application, authorized_entity, platform, attest_status, app_signer, connection_type, connect_date, rel].hash\n end", "def hash()\n #This is a stub, used for indexing\nend", "def hash\n [accept_tos, verify_sms, kyc_check, documentary_verification, selfie_check, watchlist_screening, risk_check].hash\n end", "def hash\n swap\n scatter\n completed_string\n end", "def hash\n @hash.hash\n end", "def hash\n [class_id, object_type, action, cache_state, cached_time, last_access_time, md5sum, original_sha512sum, path, registered_workflows, used_count, file, network_element].hash\n end", "def to_hash\n {\n type: self.class.name,\n secret: secret,\n salt: salt,\n iterations: iterations,\n hash_function: hash_function.class.name\n }\n end", "def hash\n Digest::SHA256.hexdigest( \"#{nonce}#{time}#{difficulty}#{prev}#{data}\" )\n end", "def hash\n [specs, platform, requires_frameworks].hash\n end", "def unit_hash\n end", "def hash\n state.hash\n end", "def hash\n state.hash\n 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 knife_output_as_hash(sub_cmd)\n sub_cmd = [sub_cmd, '-F json'].join(' ')\n output_lines = execute(knife_cmd(sub_cmd)).split(/\\n/)\n output_lines = output_lines.reject { |line| KNIFE_JSON_OUTPUT_IGNORE.include? line }\n json = JSON.parse output_lines.join(' ')\nrescue StandardError => e\n puts \"ERROR: #{e}\"\n exit 1\nend", "def hash\n @hash ||= @trace_id.hash ^ @is_new.hash ^ @span_id.hash ^\n @sampled.hash ^ @capture_stack.hash\n end", "def hash\n raw = [name, type, values.join('/')].join(' ')\n Digest::MD5.hexdigest(raw)\n end", "def hash\n [admin, created_at, customer_id, description, event_type, ip, metadata, service_id, user_id, token_id].hash\n end", "def hash\n [custom_headers, encode_as, name, payload, url].hash\n end", "def hash\n [type, page_access_token, app_id, app_secret, account_sid, auth_token, phone_number_sid, token, channel_access_token, encoding_aes_key, from_address, certificate, password, auto_update_badge, server_key, sender_id, consumer_key, consumer_secret, access_token_key, access_token_secret].hash\n end", "def as_hash\n @hash\n end", "def hash\n [account_id, active, avalara_oid, company_id, enable_upc, estimate_only, guest_customer_code, last_test_dts, license_key, sandbox, send_test_orders, service_url, test_results].hash\n end", "def hash\n [clean_result, contains_executable, contains_invalid_file, contains_script, contains_password_protected_file, contains_restricted_file_format, contains_macros, contains_xml_external_entities, contains_insecure_deserialization, contains_html, contains_unsafe_archive, verified_file_format, found_viruses, content_information].hash\n end", "def run_result; result['run_cyber_dojo_sh']; end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n to_s.hash\n end", "def hash\n to_s.hash\n end", "def hash\n 0\n end" ]
[ "0.6792897", "0.6644945", "0.6619084", "0.6583516", "0.65285563", "0.64861715", "0.64861715", "0.64861715", "0.6468073", "0.64588356", "0.64588356", "0.64588356", "0.64588356", "0.64588356", "0.64588356", "0.64588356", "0.6358151", "0.633395", "0.63233596", "0.6323112", "0.6320557", "0.63050693", "0.6270269", "0.6270269", "0.6270269", "0.6270269", "0.6270269", "0.6270269", "0.6270269", "0.6270269", "0.6270269", "0.6270269", "0.62470126", "0.62058157", "0.6176161", "0.61506456", "0.61489713", "0.61371654", "0.61208946", "0.61208946", "0.61208946", "0.61188334", "0.611471", "0.61127", "0.60978895", "0.6095846", "0.60732746", "0.6057427", "0.6039299", "0.60184795", "0.60026115", "0.5999434", "0.5988168", "0.5984045", "0.5969677", "0.5969677", "0.59647113", "0.5949142", "0.59463865", "0.59459525", "0.59406435", "0.5933429", "0.5923757", "0.5923757", "0.5917708", "0.59172887", "0.5906026", "0.5897016", "0.58899456", "0.588163", "0.5881096", "0.5881075", "0.5879955", "0.5873306", "0.5856049", "0.5854117", "0.58406454", "0.5816876", "0.5810934", "0.5806278", "0.58043236", "0.5804023", "0.5802403", "0.57949126", "0.5794432", "0.5794432", "0.57862586", "0.57719964", "0.57673734", "0.5763228", "0.57613707", "0.575745", "0.5756846", "0.57497", "0.5743836", "0.5743658", "0.5739734", "0.57251084", "0.5713935", "0.5713935", "0.5696471" ]
0.0
-1
GET /users GET /users.json
def index authorize User query = flash[:query] = params[:query].to_s @query = query.dup @count = {} sort = {sort_by: 'created_at', :order => 'desc'} case params[:sort_by] when 'username' sort[:sort_by] = 'username' end case params[:order] when 'asc' sort[:order] = 'asc' when 'desc' sort[:order] = 'desc' end if params[:query].to_s.strip == '' user_query = '*' else user_query = params[:query] end if user_signed_in? role_ids = Role.where('id <= ?', current_user.role.id).pluck(:id) else role_ids = [1] end query = { query: { filtered: { query: { query_string: { query: user_query, fields: ['_all'] } } } }, sort: [ {:"#{sort[:sort_by]}" => sort[:order]} ] } search = User.search(query, routing: role_ids) @users = search.page(params[:page]).records #search.build do # order_by sort[:sort_by], sort[:order] #end respond_to do |format| format.html # index.html.erb format.json { render json: @users } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def list_users\n self.class.get('/users')\n end", "def users\n get('get_users')\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n users = User.all\n render json: users \n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n json_response(User.all) \n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def index\n users = User.all \n render json: users \n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def list\n render json: User.all\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def user\n render :json=> User.find(params[:id])\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def list\n get('users')['users']\n end", "def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n render json: User.all\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def index\n render json: User.all\n end", "def index\n render json: User.all\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\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 }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\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 decoded.map { |element| User.from_hash(element) }\r\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def index \n render json: User.all\n end", "def index\n @myusers = Myuser.all\n\n render json: @myusers\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end" ]
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.7372414", "0.736885", "0.7368531", "0.7367068", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7351495", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.73463756", "0.73426867", "0.7331111", "0.73231107", "0.73227614", "0.73126787", "0.7295692", "0.7274169", "0.7265484", "0.72624177", "0.72607577", "0.722517", "0.72189873", "0.71941674", "0.71883225", "0.7187108", "0.71815044", "0.717089", "0.71695215", "0.7156781", "0.71546155", "0.71546155", "0.7140691", "0.7135879", "0.7134857", "0.71316093", "0.71315825", "0.712011", "0.7114429", "0.7112858", "0.7107888", "0.7098051", "0.70957917", "0.70957917", "0.7093039", "0.70904744", "0.70890427", "0.70889443", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685" ]
0.0
-1
GET /users/1 GET /users/1.json
def show if @user == current_user redirect_to my_account_url return end session[:user_return_to] = nil #unless @user.agent # redirect_to new_user_agent_url(@user); return #end if defined?(EnjuBookmark) @tags = @user.bookmarks.tag_counts.sort{|a,b| a.count <=> b.count}.reverse end @manifestation = Manifestation.pickup(@user.keyword_list.to_s.split.sort_by{rand}.first) rescue nil respond_to do |format| format.html # show.html.erb format.html.phone format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def get \n render :json => User.find(params[:id])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def user\n render :json=> User.find(params[:id])\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n\n render json: @user\n end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def show\n render json: User.find(params[\"id\"])\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\nend", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def show\n @user = User.find(params[:id])\n render json: {user: @user}\n end", "def list_users\n self.class.get('/users')\n end", "def show\n user = User.find(params[:id])\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 render :json => User.find(params[:id])\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @user = ActiveRecord::Base.connection.execute(\"\n SELECT * \n FROM users \n WHERE username = '#{params[:username].downcase}' \n LIMIT 1\").first\n\n respond_to do |format|\n format.html\n format.json {render json: User.find(@user[0])}\n end\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def index\n json_response(User.all) \n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def show\n # @user = User.first\n user = User.find(params[:id])\n render json: user\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def show_user_profile\n @user = User.find(username: params[:username])\n render json: @user\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def index\n \n @user = User.find(current_user.id) \n\n respond_to do |format|\n format.html { render action: \"show\" }\n format.json { render json: @user }\n end\n end", "def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @user }\n end\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def show\n # puts params[:id]\n render json: User.find(params[:id])\n end", "def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end", "def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def show\n @user = User.find(params[:id])\n render json: {\n username: @user.username,\n first_name: @user.first_name,\n last_name: @user.last_name,\n email: @user.email,\n phone_number: @user.phone_number,\n contacts: @user.contacts\n }, status: :ok\n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def show\n @user = User.find(params[:id])\n render 'api/v1/users/show'\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n users = User.all\n render json: users \n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def index\n users = User.all \n render json: users \n end", "def list\r\n users = User.all\r\n render json: users\r\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 index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end", "def show\n render json: UserService.get_user(params[:id]), includes: 'questions, answers'\n end", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def index\n render :json => User.all, status: 200\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end" ]
[ "0.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.7225407", "0.72222257", "0.72165024", "0.72137505", "0.72096044", "0.71930283", "0.7182953", "0.7182144", "0.7182144", "0.7180289", "0.71750754", "0.7173851", "0.71640617", "0.71636444", "0.71453786", "0.7145053", "0.7129776", "0.71256554", "0.71160513", "0.7095665", "0.70941204", "0.70772994", "0.7070785", "0.7070607", "0.7063351", "0.70552826", "0.7025071", "0.7014598", "0.70047677", "0.6998373", "0.69910055", "0.6984177", "0.6979766", "0.6972448", "0.6972228", "0.6968384", "0.69666255", "0.6956339", "0.69506294", "0.6945614", "0.6943135", "0.69351804", "0.6932212", "0.6932212", "0.6932212", "0.6932212", "0.6927094", "0.69255126", "0.6925136", "0.6917375", "0.6907744", "0.68947464", "0.6882589", "0.6875701", "0.68749416", "0.68633634", "0.6861618", "0.6858055", "0.6855495", "0.68530583", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.685255", "0.6849599", "0.6847195", "0.6847074", "0.6847074" ]
0.0
-1
GET /users/new GET /users/new.json
def new #unless current_user.try(:has_role?, 'Librarian') # access_denied; return #end @user = User.new authorize @user prepare_options @user_groups = UserGroup.all @user.user_group = current_user.user_group @user.library = current_user.library @user.locale = current_user.locale end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n end\n end", "def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n # When a http GET request to '/users/new' is received, have it render:\n # a view file with an empty form to create a new user.\n end", "def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @users = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @users }\n end\n end", "def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end" ]
[ "0.8287397", "0.8169197", "0.8155916", "0.80483407", "0.8022376", "0.8021751", "0.8009459", "0.7950995", "0.793078", "0.793078", "0.7873476", "0.7873476", "0.7873476", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956", "0.7860956" ]
0.0
-1
POST /users POST /users.json
def create authorize User @user = User.new(user_params) @user.operator = current_user @user.set_auto_generated_password respond_to do |format| if @user.save role = Role.where(:name => 'User').first user_has_role = UserHasRole.new user_has_role.assign_attributes({:user_id => @user.id, :role_id => role.id}) user_has_role.save flash[:temporary_password] = @user.password format.html { redirect_to @user, notice: t('controller.successfully_created', model: t('activerecord.models.user')) } format.json { render json: @user, :status => :created, :location => @user } else prepare_options flash[:error] = t('user.could_not_setup_account') format.html { render action: "new" } format.json { render json: @user.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end", "def create\n user= User.create(user_params)\n render json: user\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend", "def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end", "def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end", "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end", "def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend", "def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend", "def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\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 header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(body)\n post 'create_user', body\n end", "def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end", "def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end", "def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end", "def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end", "def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end", "def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end", "def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end", "def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end", "def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end", "def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end", "def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end", "def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end", "def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end" ]
[ "0.77171224", "0.7520082", "0.7383616", "0.72409296", "0.71978706", "0.71414214", "0.7104655", "0.7059102", "0.7041023", "0.70248663", "0.7003639", "0.7002607", "0.7002607", "0.7002607", "0.6992824", "0.6990796", "0.6980945", "0.69801277", "0.6979133", "0.6979133", "0.6976736", "0.69628066", "0.6952299", "0.69458276", "0.69458276", "0.6920878", "0.69177127", "0.6914779", "0.690185", "0.6898782", "0.6894556", "0.6890304", "0.68806", "0.6880408", "0.6880394", "0.6879843", "0.68770224", "0.68696827", "0.68556935", "0.68510425", "0.68430406", "0.681474", "0.68036735", "0.677813", "0.67770576", "0.6767577", "0.6757646", "0.67477995", "0.6738948", "0.6734951", "0.6734288", "0.67212176", "0.6711618", "0.6670208", "0.6658757", "0.6657401", "0.66544783", "0.6638575", "0.66329575", "0.6620139", "0.66150504", "0.661426", "0.6597142", "0.65911335", "0.65787804", "0.65784776", "0.6572848", "0.65728176", "0.65565026", "0.65537417", "0.65510815", "0.65467125", "0.65401846", "0.65399927", "0.653856", "0.6536532", "0.6533164", "0.65255886", "0.6510124", "0.650851", "0.6507321", "0.65030104", "0.64904314", "0.6488193", "0.6487274", "0.6473675", "0.64712363", "0.6470449", "0.6470449", "0.646918", "0.6467537", "0.64622897", "0.6461711", "0.646106", "0.64549834", "0.64536315", "0.6450451", "0.6447741", "0.6446953", "0.64457166", "0.6442127" ]
0.0
-1
PUT /users/1 PUT /users/1.json
def update @user.assign_attributes(user_params) if @user.auto_generated_password == "1" @user.set_auto_generated_password flash[:temporary_password] = @user.password end respond_to do |format| @user.save if @user.errors.empty? format.html { redirect_to @user, notice: t('controller.successfully_updated', model: t('activerecord.models.user')) } format.json { head :no_content } else prepare_options format.html { render action: 'edit' } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end", "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit(id, options={})\n request(:put, \"/users/#{id}.json\", default_params(options))\n end", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user.update(user_params)\n respond_with @user\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n authorize @user\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n\t\tif @user.update(users_params)\n \t\tjson_response(@user, \"User Update Successfully.\")\n \telse\n \t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n \tend\n\tend", "def update\n @user = current_user\n if @user.update(update_user_params)\n render 'api/v1/users/show'\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update(context, name, should)\n res = context.transport.put_request(context, \"security/users/#{name}\", keys_to_camelcase(should))\n\n context.err(name, res.body) unless res.success?\n end", "def update!(options: {})\n\t\t\tuser = User.perform_request User.api_url(\"users/#{id}\"), :put, options, true\n\n\t\t\tif user\n\t\t\t\toptions.each do |key, value|\n\t\t\t\t\tself.send(\"#{key}=\", user['data'][\"#{key}\"])\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tnil\n\t\t\tend\n\t\tend", "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_name(user_id:, name:)\n path = '/users/{userId}/name'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"name\"')\n end\n\n params = {\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'PATCH',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_user\n @user = User.find(params[:id])\n @user.update(params[:user])\n redirect \"/users/#{@user.id}\"\nend", "def update\n @api_user = ApiUser.find(params[:id])\n\n if @api_user.update(api_user_params)\n head :no_content\n else\n render json: @api_user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.update(params[:user])\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def api_v11_users_user_name_put_with_http_info(user_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_users_user_name_put ...\"\n end\n \n # verify the required parameter 'user_name' is set\n fail \"Missing the required parameter 'user_name' when calling api_v11_users_user_name_put\" if user_name.nil?\n \n # resource path\n path = \"/api/v11/users/{userName}\".sub('{format}','json').sub('{' + 'userName' + '}', user_name.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = []\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 = []\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_users_user_name_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_user\n user = current_user\n if user.update(update_params)\n render json: { status: { updated: \"Ok\" } }\n else\n render json: user.errors.full_messages\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n redirect_to @user\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\nend", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.username} successfully updated!\"\n format.html { redirect_to @user }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n authorize! :update, user\n if user.update_attributes(user_params)\n render :json => {:ok => true, :message => 'successful updated'}, :head => :no_content\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end" ]
[ "0.74114245", "0.73920554", "0.73041475", "0.7254177", "0.7202618", "0.70756376", "0.70535713", "0.7029043", "0.70075685", "0.69883573", "0.6983195", "0.694263", "0.69409895", "0.692315", "0.6909438", "0.687742", "0.68486536", "0.6834162", "0.6821841", "0.6801179", "0.67703044", "0.6763487", "0.6761313", "0.6761313", "0.67482305", "0.67473894", "0.6713073", "0.6703807", "0.6693307", "0.66886777", "0.66886777", "0.66646844", "0.66617274", "0.66572624", "0.6653578", "0.66406506", "0.6625279", "0.66213304", "0.66192704", "0.6614916", "0.6612626", "0.6604333", "0.65851104", "0.65851104", "0.65785134", "0.65615654", "0.65518224", "0.65518224", "0.6549094", "0.6530534", "0.6530534", "0.65275174", "0.6523527", "0.6520384", "0.6520384", "0.6516204", "0.65145653", "0.65104014", "0.6504922", "0.6499594", "0.64987266", "0.64906204", "0.64810187", "0.64798295", "0.64702576", "0.64496434", "0.6436427", "0.6433962", "0.64330167", "0.6428237", "0.6406415", "0.6402615", "0.6399288", "0.63881207", "0.63877773", "0.6353986", "0.63537806", "0.633806", "0.63360107", "0.6334851", "0.632672", "0.63260114", "0.63179153", "0.63173646", "0.6317282", "0.6316377", "0.6316055", "0.63120025", "0.6293317", "0.62857985", "0.6282219", "0.6280316", "0.6264061", "0.62624925", "0.625522", "0.62549126", "0.62547195", "0.625327", "0.625269", "0.6252329", "0.6245382" ]
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy if @user.deletable_by(current_user) @user.destroy else flash[:notice] = @user.errors[:base].join(' ') redirect_to current_user return end respond_to do |format| format.html { redirect_to users_url, notice: t('controller.successfully_destroyed', model: t('activerecord.models.user')) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7245172", "0.7242216", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177" ]
0.0
-1
Details: Finish the solution so that it sorts the passed in array of numbers. If the function passes in an empty array or null/nil value then it should return an empty array. For example: solution([1, 2, 10, 50, 5]) should return [1,2,5,10,50] solution(nil) should return []
def solution(nums) nums.to_a.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_array(nums)\n nums.nil? ? [] : nums.sort\nend", "def my_sort(nums, sorted=[])\n\t# get min\n\t# Remove min from nums\n\t# recursion until nums.size == 0 with new nums and new sorted\n\t# Return sorted\n\n\tmin = nums.min\n\tsorted << min\n\n\tnums.delete_if {|n| n == min}\n\n\tif nums.size > 0\n\t\tmy_sort nums, sorted\n\telse\n\t\tsorted\n\tend\nend", "def sort some_array\n\trecursive_sort some_array, []\nend", "def sort some_array\n\trecursive_sort some_array, []\nend", "def sort_nums_ascending(arr)\n return arr.sort\nend", "def sort some_array\n recursive_sort some_array, []\nend", "def sort some_array\n recursive_sort some_array, []\nend", "def sorting(numbers)\n numbers.sort\nend", "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def take_array(array)\r\n array.sort\r\nend", "def sort1(array)\n\nend", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n array.sort\nend", "def sort some_array\n\tsorted_array = []\n\trecursive_sort some_array, sorted_array\nend", "def sort(arr)\n recursive_sort(arr, [])\n# This is called a \"wrapper\", a method that wraps up another method,\n# in this case the recursive_sort method. The sort method takes\n# one argument, the given array, which in turn is passed into the\n# recursive sort method along with an empty array as the second\n# argument.\nend", "def merge_sort(arr)\n return arr if arr.length <= 1\nend", "def using_sort(array)\n sorted_array=array.sort\nend", "def recursive_sort_wrap some_array\n recursive_sort some_array, []\nend", "def sort_array_asc(integers)\n integers.sort\nend", "def sort arr\n recursive_sort arr, []\nend", "def sort arr\n recursive_sort arr, []\nend", "def merge_sort numbers, si=0, ei=nil\n\n # TODO: your cool code goes here\n\nend", "def sort array # This \"wraps\" recursive_sort.\n recursive_sort array, []\nend", "def sort(to_sort)\n # if the array is of length 0 or 1, consider it is already sorted\n if to_sort.length <= 1\n then return to_sort\n end\n\n # otherwise split the remaining elements in two\n # I had to look this line on the web (sourcerefactormycode.com)\n second_array = to_sort.slice!((to_sort.length / 2.0).round..to_sort.length)\n\n # recursive method call on both arrays\n first_sorted_array = sort(to_sort)\n second_sorted_array = sort(second_array)\n\n # merge the two sorted arrays together\n return merge(first_sorted_array, second_sorted_array)\nend", "def lomuto(array)\n lomuto_sort(array, 0, array.length - 1)\nend", "def merge_sort(numbers)\n # Base case\n # Rearrangement is no longer possible, there's only 1 element in `numbers`!\n return numbers if numbers.size == 1\n\n # Partition unsorted elements into groups\n # Continue until n sublists, each containing 1 element (i.e. all reached base case)\n mid = numbers.size / 2\n left = numbers[0...mid] # alternatively: numbers.take(mid)\n right = numbers[mid..-1] # alternatively: numbers.drop(mid)\n\n # Recursively break down sublists into smaller problems\n # until each list has 1 element\n left_nums = merge_sort(left)\n right_nums = merge_sort(right)\n\n # Merge individual sublists to produce sorted sublists when\n # left_nums && right_nums are available\n merge(left_nums, right_nums)\nend", "def custom_sort (unsorted, sorted = [])\n return sorted.uniq if unsorted.length == 0\n smallest = unsorted[0]\n unsorted.each {|x| smallest = x if x <= smallest}\n\n unsorted.each {|x| sorted << x if x <= smallest }\n\n unsorted.delete(smallest)\n custom_sort(unsorted, sorted)\nend", "def sort arr\n return arr if arr.length <= 1\n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n sort(less) + [middle] + sort(more)\nend", "def my_min_2(array)\n array.sort!\n array.first\nend", "def sort arr\n return arr if arr.length <= 1\n \n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n\n sort(less) + [middle] + sort(more)\nend", "def sort arr\n return arr if arr.length <= 1\n \n middle = arr.pop\n less = arr.select{|x| x < middle}\n more = arr.select{|x| x >= middle}\n\n sort(less) + [middle] + sort(more)\nend", "def merge_sort(input_array)\n array_length = input_array.length\n if array_length <= 1\n input_array\n else\n left_side = merge_sort(input_array.slice(0, (array_length/2.0).round))\n right_side = merge_sort(input_array.slice((array_length/2.0).round, array_length))\n merge_halves(left_side, right_side)\n end\nend", "def smallest_integer(list_of_nums)\n if list_of_nums.count > 0\n list_of_nums.sort!\n else\n return nil\n end\nreturn list_of_nums[0]\nend", "def sort arr\n rec_sort arr, []\nend", "def mergeSort(arr)\r\n # if we have an array that only contains one element or nothing, theres nothing to sort then\r\n if(arr == nil)\r\n return []\r\n end\r\n if(arr.length <= 1)\r\n return arr # simply just return what we got\r\n else\r\n # else we have an array that is sortable, split up the arrays down the midpoint and send them into the driver function\r\n midpoint = arr.length/2\r\n half1 = mergeSort(arr.slice(0...midpoint))\r\n half2 = mergeSort(arr.slice(midpoint...arr.length))\r\n mergeHelper(half1,half2)\r\n end\r\n\r\n end", "def sort arr\n return arr if arr.length <= 1\n middle = arr.pop\n lesss = arr.select{|x| x < middle}\n more = arr.select{|x| x>= middle}\n\n sort(less) + [middle] + sort(more)\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort arr\r\n\treturn arr if arr.length <= 1\r\n\r\n\tmiddle = arr.pop\r\n\tless = arr.select{|x| x < middle}\r\n\tmore = arr.select{|x| x >= middle}\r\n\r\n\tsort(less) + [middle] + sort(more)\r\nend", "def smallest_integer(list_of_nums)\n if list_of_nums == []\n return nil\n else\n list_of_nums.sort!\n return list_of_nums[0]\n end\nend", "def foo arr\n arr.sort\nend", "def sort2(num_array)\n return num_array if num_array.empty?\n pivot = num_array.pop\n left = []\n right = []\n\n num_array.each do |x|\n if x < pivot\n left << x\n else\n right << x\n end\n end\n return (sort(left) << pivot << sort(right)).flatten\nend", "def improved_poorly_written_ruby(*arrays)\n sorted = []\n arrays.flatten.each do |v|\n size = sorted.size\n if sorted.empty?\n sorted.push(v)\n else\n i = 0\n while i < size\n item = sorted[i]\n if item > v\n sorted.insert(i, v)\n break\n elsif i == size - 1\n sorted.push(v)\n break\n end\n i += 1\n end\n end\n end\n sorted\nend", "def sort2(array, max_value)\n\nend", "def sort(arr)\n return arr if arr.length < 1\n\n pivot = arr.pop\n less = arr.select { |item| item < pivot}\n more = arr.select { |item| item >= pivot}\n\n sort(less) + [pivot] + sort(more)\nend", "def sort(num_array)\r\n new_num_arr = num_array.each_with_object([]) { |num, arr|\r\n [*arr].each_with_index do |new_arr_num, index|\r\n if arr[0] > num\r\n arr.prepend(num)\r\n elsif arr[index + 1].nil?\r\n arr.push(num)\r\n elsif num >= new_arr_num && num < arr[index + 1]\r\n arr.insert(index + 1, num)\r\n break\r\n end\r\n end\r\n if arr.empty?\r\n arr.push(num)\r\n end\r\n }\r\n return new_num_arr\r\nend", "def merge_sort(numbers)\n return numbers if numbers.size == 1\n mid = numbers.size / 2\n left = numbers[0...mid]\n right = numbers[mid..-1]\n merge(merge_sort(left), merge_sort(right))\nend", "def merge_sort(numbers)\n return numbers if numbers.size == 1\n mid = numbers.size / 2\n left = numbers[0...mid]\n right = numbers[mid..-1]\n merge(merge_sort(left), merge_sort(right))\nend", "def sort_array_desc(integers)\n integers.sort.reverse\nend", "def sort_array_desc(integers)\n integers.sort.reverse\nend", "def two(array)\n array.sort\nend", "def sort_array_desc (integers)\n integers.sort.reverse\nend", "def sort_array_asc(array)\n\tarray.sort\nend", "def my_array_sorting_method(array, number)\n\nend", "def sort(input)\n # If the length of the array is < or = 1, then we already\n # know it's sorted, so exit\n return input if input.length <= 1\n\n # Now we want to run this algorithm in a loop for forever\n # until we know that the entire array is sorted. That\n # will be our \"break\" condition - the condition to\n # break out of the loop.\n\n swapped = true\n while swapped do\n # We set swapped equal to false here, because we\n # basically want to set it only to true when we've\n # actually swapped something. If we never swap anything\n # in this iteration of the loop, it means that the\n # array is sorted and we're done.\n swapped = false\n\n # We use upto, which is a function from Enumerators\n # https://ruby-doc.org/core-2.2.0/Integer.html#method-i-upto\n # We basically are saying we are going to access through the\n # array we're given, up until the length of it -2. Why?\n # We're accessing each of the array elements by index.\n # Example: [1,2,3,4]\n # If we want to get 1 from the array, we access element 0.\n # In this example, we want to access the current index and the\n # index ahead of it. So, in this loop, we only want to try\n # and access the length of the array minus 2, because otherwise\n # we'll run out of the bounds of the array.\n 0.upto(input.length - 2) do |index|\n # If the number at our current index is greater than the one\n # in front of it... swap!\n if input[index] > input[index+1]\n # Here's a neat trick you can do so you don't have to assign\n # any variables to hold onto a value.\n input[index], input[index+1] = input[index+1], input[index]\n swapped = true\n end\n end\n end\n\n input\nend", "def sortArray(array)\n\tnewArray = []\n\tuntil array.length == 0\n\t\tminNo = array[0]\n\t\tx = 1\n\t until x == array.length\n\t if array[x] <= minNo\n\t minNo = array[x]\n\t x += 1\n\t else\n\t \tx += 1\n\t end\n\t end\n\t newArray << minNo\n\t array[array.index(minNo)] = nil\n\t array.delete(nil)\n\tend\n\treturn newArray\nend", "def sort arr \n\trec_sort arr, []\nend", "def my_array_sorting_method(source)\n source.reject{|x| x.is_a? String}.sort + source.reject{|x| x.is_a? Numeric}.sort\nend", "def sort arr\r\n\trec_sort arr, []\r\nend", "def poorly_written_sort(*arrays)\n combined_array = []\n arrays.each do |array|\n array.each do |value|\n combined_array << value\n end\n end\n\n sorted_array = [combined_array.delete_at(combined_array.length-1)]\n\n for val in combined_array\n i = 0\n while i < sorted_array.length\n if val <= sorted_array[i]\n sorted_array.insert(i, val)\n break\n elsif i == sorted_array.length - 1\n sorted_array.insert(i, val)\n break\n end\n i+=1\n end\n end\n\n # Return the sorted array\n sorted_array\nend", "def dictionary_sort(arr)\r\n\twhile \r\n\t\tinput.empty? break\r\n\tend\r\n # Your code here to sort the array\r\nend", "def sort1(num_array)\n sorted_array = []\n while num_array.length > 0\n sorted_array.push(num_array.min)\n num_array.delete(num_array.min)\n end\n return sorted_array\nend", "def my_array_sorting_method(array)\n\t@array=array\n\t@array.sort\n\treturn @array\nend", "def improvement_four(*arrays)\n arrays.flatten.sort\nend", "def merge_sort(arr)\n if arr.length <= 2\n return merge(arr[0], arr[-1])\n end\nend", "def merge_sort(array)\r\n if array.size == 1\r\n return array\r\n end\r\n\r\n arr1 = merge_sort(array[0...(array.length/2)])\r\n arr2 = merge_sort(array[(array.length/2)..-1])\r\n\r\n return merge1(arr1, arr2)\r\nend", "def sort some_array\n\tsome_array = some_array.downcase.split\n\trecursive_sort some_array, []\nend", "def smallest_integer(array)\n\tif array == []\n\t return nil\n\telse array.sort!\n \t return array[0]\n end\nend", "def merge_sort(array, &prc)\n return array if array.length <= 1\n\n prc ||= Proc.new { |el1, el2| el1 - el2 }\n\n mid_idx = array.length / 2\n sorted_left = merge_sort(array[0...mid_idx], &prc)\n sorted_right = merge_sort(array[mid_idx..-1], &prc)\n\n sorted = []\n until sorted_left.empty? || sorted_right.empty?\n if prc.call(sorted_left.first, sorted_right.first) <= 0\n sorted << sorted_left.shift\n else\n sorted << sorted_right.shift\n end\n end\n\n sorted + sorted_left + sorted_right\nend", "def mysort(arr)\n # The computational complexity of this algorithm is O(n^^2), and is similar\n # to selection sort. This is not idiomatically ideal Ruby - I've tried to\n # mostly use language constructs common to many languages.\n\n sorted = []\n\n smallest_index = 0\n while (arr.length > 0) do\n for i in (0..(arr.length - 1))\n if arr[i] < arr[smallest_index]\n smallest_index = i\n end\n end\n sorted.push arr.delete_at(smallest_index) \n smallest_index = 0\n end\n\n return sorted \n\nend", "def sort(unsorted_array)\n @sorted_array << unsorted_array.delete_at(unsorted_array.min)\n sort(unsorted_array) until unsorted_array.length == 0\n# This is the RECURSION - latest value of unsorted_array after each iteration\n# is then re-run through the sort method until everything is sorted.\n @sorted_array\nend", "def merge_sort(array)\n return [] if array.length == 0\n return array if array.length == 1\n middle_idx = array.length / 2\n arr_1 = array[0...middle_idx]\n arr_2 = array[middle_idx..-1]\n merge(merge_sort(arr_1), merge_sort(arr_2))\nend", "def merge_sort(array)\n if array.length <= 1\n return array\n end\n merge(merge_sort(array[0...array.length/2]), merge_sort(array[array.length/2...array.length]))\nend", "def my_array_sorting_method(source)\n return source.partition{|x| x.is_a? Integer}.map(&:sort).flatten\nend", "def funny_sort(array)\n\tputs array.sort{ |a, b| findEarliestDigits(a) <=> findEarliestDigits(b) }\nend", "def sorting_an_array(arr, order)\n if order == \"asc\"\n return arr.sort\n elsif order == \"dsc\"\n return arr.sort{|a,b| b <=> a}\n else order == \"none\"\n return arr\n end\nend", "def sort\n limit = array.size\n while limit.positive?\n 0.upto(limit).each do |index|\n next if array[index + 1].nil?\n next unless array[index] > array[index + 1]\n\n array[index], array[index + 1] = array[index + 1], array[index]\n end\n limit -= 1\n end\n array\n end", "def sort(arr)\n return arr unless arr.size > 1\n\n mid = arr.size / 2\n left, right = sort(arr[0...mid]), sort(arr[mid..-1])\n\n merge(left, right)\nend", "def merge_sort(array)\n return [] if array.empty?\n return array if array.count == 1\n retu_arr = []\n left = array[0...(array.length/2)]\n right = array[(array.length/2)..-1]\n left_sort = merge_sort(left)\n right_sort = merge_sort(right)\n \n puts \"left sort is #{left_sort}\"\n puts \"right sort is #{right_sort}\"\n \n while left_sort.empty? == false && right_sort.empty? == false\n if left_sort.first < right_sort.first\n retu_arr << left_sort.shift\n else\n retu_arr << right_sort.shift\n end\n end\n if left_sort.empty? == false\n retu_arr.concat(left_sort)\n elsif right_sort.empty? == false\n retu_arr.concat(right_sort)\n end\n puts \"retu arr is : #{retu_arr}\"\n retu_arr\n\nend", "def bubble_sort1!(array)\n return nil unless array.all?(array[0].class)\n \n to_be_sorted = array.size - 1\n\n loop do\n new_ending = 0\n \n 0.upto(to_be_sorted - 1) do |i|\n if array[i] > array[i + 1]\n array[i], array[i + 1] = array[i + 1], array[i]\n new_ending = i\n end\n end\n to_be_sorted = new_ending - 1\n break if to_be_sorted < 0\n new_ending == nil ? (to_be_sorted -= 1) : to_be_sorted = new_ending\n end\nend", "def bubble_sort(num_array)\n num_array.length.times do\n num_array.each_with_index do |num, i|\n unless num_array[i+1] == nil\n if num > num_array[i+1]\n num_array[i], num_array[i+1] = num_array[i+1], num_array[i]\n end\n end\n end\n end\n num_array\nend", "def sorting(arr)\n#display orig array\n p arr \n p \"**************************************************\"\n # do something to the array\n # compare each value of an array to the value on its left\n # if the value is less than the value on its left, switch places\n # do this by placing the lesser value in a holder and then moving the greater\n # value to the lesser value's former position in the array, then rewrite the\n # greater value's former position, with the holder value.\n # do this until the value is greater than the value on its left for \n # the entire array \n#Here is our brute force attempt at making our own .sort! method\n#we used the .sort! method from the Array class.\narr.length.times do\n |x|\n holder = \"\"\n if arr[x] > arr[x-1]\n holder = arr[x-1]\n arr[x-1] = arr[x]\n arr[x] = holder\n end \n end\nputs \"this is the one we made #{arr} \"\n # if arr[1] > arr[0]\n p arr.sort!\n p \"above is the sorting method\"\n#rerturn the changed array\nend", "def sort some_array # This \"wraps\" rec_sort so you don't have to pass rec_sort an empty array each iteration \n rec_sort some_array, []\nend", "def bitonic_sort(array)\n return array if array.length <= 1\n\n length = array.length\n num = nearest_power_of_2(array.length)\n\n # add place holder values\n array << Float::INFINITY until array.length == num\n\n array = bitonic_recurse(array, 0, array.length, 1)\n\n # remove place holder values\n array.pop until array.length == length\n\n array\nend", "def pancake_sort(arr)\n pancake_sort_helper(arr, arr.size-1)\n arr\nend", "def bar arr\n arr.sort!\nend", "def merge_sort(array)\n return array if array.length <= 1\n mid = array.length / 2\n left = merge_sort(array[0...mid])\n right = merge_sort(array[mid..-1])\n merge(left, right)\nend", "def cmp(x)\r\n x2 = []\r\n x.each {|y|\r\n if y !=nil\r\n x2 << y\r\n end\r\n }\r\n return x2\r\nend", "def sean_sort(numbers)\n\n\nend", "def sort_any arr\n i = 1\n until i >= arr.length\n j = i-1\n val = arr[i]\n\n loop do\n if smaller?(val, arr[j])\n arr[j+1] = arr[j]\n j = j - 1\n break if j < 0\n\n else\n break\n end\n end\n\n arr[j+1] = val\n\n i = i.next\n end\n\n arr\n end", "def my_array_sorting_method(source)\n\tsource.partition{|x| x.is_a? Integer}.map(&:sort)\nend", "def sort(num_array)\n # Your code goes here\n (num_array.length).times do |i|\n while i > 0\n if num_array[i-1] > num_array[i] \n num_array[i-1], num_array[i] = num_array[i], num_array[i-1]\n else\n break\n end\n i-=1\n end\n \n end\n return num_array\n \nend", "def convert_to_sorted(arr_of_arr)\n sorted = []\n arr_of_arr.each {|arr| arr.each {|num| sorted.push(num) if !sorted.include?(num)}}\n sorted.sort\nend" ]
[ "0.79653484", "0.66269785", "0.6622227", "0.6622227", "0.6503862", "0.64985967", "0.64985967", "0.64849895", "0.64233613", "0.64233613", "0.63996476", "0.6398528", "0.6390439", "0.6390439", "0.6390439", "0.6373231", "0.6340254", "0.6340031", "0.63360506", "0.6335004", "0.63138276", "0.6281494", "0.6281494", "0.62318563", "0.623105", "0.6217705", "0.6201818", "0.61959875", "0.6182997", "0.61746687", "0.61613965", "0.61576253", "0.61576253", "0.6156365", "0.61541194", "0.6144581", "0.6124063", "0.61194015", "0.6109242", "0.6104714", "0.6104714", "0.6104714", "0.6104714", "0.6104714", "0.6104714", "0.60965526", "0.6089663", "0.60867137", "0.608348", "0.6074443", "0.6071784", "0.6066416", "0.6064739", "0.60399884", "0.60399884", "0.60358274", "0.60354805", "0.60325575", "0.6030463", "0.6025764", "0.6023796", "0.60110664", "0.60105085", "0.59979236", "0.59916025", "0.5988188", "0.5980796", "0.5977189", "0.5975909", "0.59743303", "0.59688514", "0.5964586", "0.59596634", "0.59593093", "0.59545726", "0.59510714", "0.5946466", "0.5946362", "0.59460527", "0.59411216", "0.5940356", "0.5934663", "0.5934639", "0.5927173", "0.5921171", "0.5908416", "0.59007055", "0.5900468", "0.58924526", "0.5886066", "0.58847016", "0.5884018", "0.5875358", "0.5870887", "0.5870351", "0.5869539", "0.586785", "0.5865867", "0.58540523", "0.58525985" ]
0.7088003
1
No trailing slash for site
def scrape(site) base_url = "#{site}/page/" url_list = Array.new post_links = Array.new # Grabbing all the pages (1..14).each do |i| url_list << base_url + i.to_s puts "Getting page " + i.to_s end # Going through individual pages url_list.each do |page| doc = Nokogiri::HTML(open(page)) # Getting post links, make sure to check the HTML <==================== CHANGE THIS =========================== doc2 = doc.css('h2.entry-title a') doc2.each do |link| puts 'Collecting link ' + post_links.count.to_s post_links << link['href'] end end puts "Finished with getting all the links" CSV.open("derek-halpern-wp.csv", "wb") do |csv| csv << ["Title", "Link", "Date", "Comments", "Likes", "Tweets", "LinkedIn", "Pins", "+ 1's"] post_links.each_with_index do |post, index| share_counts = "http://api.sharedcount.com/?url=#{post}" resp = (Net::HTTP.get_response(URI.parse(share_counts))).body result = JSON.parse(resp, :symbolize_names => true) fb = result[:Facebook][:total_count] tw = result[:Twitter] ln = result[:LinkedIn] pin = result[:Pinterest] gp = result[:GooglePlusOne] post_page = Nokogiri::HTML(open(post)) # Make sure the post headline follows this structure <==================== CHANGE THIS =========================== post_title = post_page.css('h1.entry-title').text # Make sure the comments follow this structure <==================== CHANGE THIS =========================== post_comments = post_page.css('#comments_intro').text.to_i #post_date = post_page.css('.meta .signature').text #find_comments = post_page.xpath('//*[@id="comments"]/comment()').text #convert_to_ng = Nokogiri::HTML.parse(find_comments) #post_comments = convert_to_ng.css('h2').text.to_i puts "Scraping post " + index.to_s + "/" + post_links.length.to_s csv << ["#{post_title}", "#{post}", "#{post_date}","#{post_comments}", "#{fb}", "#{tw}", "#{ln}", "#{pin}", "#{gp}"] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trailing_slash_fix\n '/' unless ENV['PROXIED_IIIF_SERVER_URL'].last == '/'\n end", "def force_no_trailing_slash\n force_slash :noslash\n end", "def without_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end", "def omit_trailing_slash\n end_with?('/') ? Wgit::Url.new(chop) : self\n end", "def omit_leading_slash\n start_with?('/') ? Wgit::Url.new(self[1..-1]) : self\n end", "def slashless_url(url)\n url.chomp('/')\n end", "def without_leading_slash\n start_with?('/') ? Wgit::Url.new(self[1..-1]) : self\n end", "def force_trailing_slash\n force_slash :slash\n end", "def ensure_url_ends_with_slash(url)\n return \"#{url}/\" unless url.end_with?(\"/\")\n\n return url\n end", "def redirect_trailing_slash?\n @redirect_trailing_slash\n end", "def path\n self.slug == '' ? '/' : \"/#{self.slug}\".gsub('//', '/')\n end", "def ignore_trailing_slash?\n @ignore_trailing_slash\n end", "def unslashed(path)\n path.sub! /\\/$/, '' if path.end_with? '/'\n return path\n end", "def omit_base\n base_url = to_base\n omit_base = base_url ? gsub(base_url, '') : self\n\n return self if ['', '/'].include?(omit_base)\n\n Wgit::Url.new(omit_base).omit_slashes\n end", "def web_path\n # 47 char is \"/\"\n return path[0] == 47 ? path : \"/\" + path\n end", "def strip_base(env)\n stripped = nil\n req_path = env['REQUEST_PATH']\n stripped = req_path[@base_path.length..-1]\n end", "def urlpath\n path = cleanpath\n path.blank? ? '/root' : '/' + path\n end", "def normalise_path(url)\n url == :home_page && \"/\" || \"/\" << url.to_s\n end", "def off_site?(url)\n url !~ /^\\// # urls not starting with a /\n end", "def without_base\n base_url = to_base\n without_base = base_url ? gsub(base_url, '') : self\n\n return self if ['', '/'].include?(without_base)\n\n Wgit::Url.new(without_base).without_slashes\n end", "def remove_leading_slash(path); end", "def fix_oneoff url\n begin\n uri = URI.parse url\n return (\"\" == uri.path) ? url + '/' : url\n rescue\n #puts \"Ran into issue processing #{url}\"\n end\n end", "def site_url(full: true)\n full ? root_url : \"#{request.host}:#{request.port}/\"\n end", "def empty_path?\n super || remaining_path == '/'\n end", "def pathWebSite\n \"./website/\"\nend", "def redmine_url\n rootUrl = ActionController::Base.relative_url_root\n\n return rootUrl+'/' if rootUrl != nil\n\n return '/'\n end", "def site_url(path)\n\t\tbase_url = \"http://fullridecentral.com\"\n\t\t\"#{base_url}#{path}\"\n\tend", "def clean_home_url\n redirect_to(home_page) and return if request.path == '/'\n end", "def root_url\n '.'\n end", "def site_sanitized\n if site.nil?\n return nil\n else\n if site.starts_with?('http://') || site.starts_with?('https://')\n return site\n else\n return 'http://' + site\n end\n end\n \n end", "def relative_url_root; end", "def relative_url_root; end", "def relative_url_root; end", "def ensure_leading_slash(path); end", "def root_path; end", "def root_path; end", "def root_path; end", "def strip_slashes\n self.gsub(/(^\\/|\\/$)/,'')\n end", "def url; (page.url rescue ''); end", "def url; (page.url rescue ''); end", "def url\n Config.site.url.chomp('/') + self.path\n end", "def remove_extra_slashes\n self.home = StringConstructor.sanitized_filepath self.home\n end", "def root_url_path\r\n root_url.to_s.gsub(/^:.+:\\d*/, '')\r\n end", "def clean_url url\n return url if url.nil?\n url.gsub('%2F', '/').gsub(/^\\/+/, '').gsub('//', '/')\n end", "def base_uri\n url = URI.parse( @config[\"portal_url\"] )\n if url.path === \"/\"\n return \"\"\n else\n return url.path\n end\n end", "def reverse_proxy_path\n splitter = /(.)/.match(@reverse_proxy_path)[0] == '/' ? '' : '/'\n star_suffix = /(\\*)/.match(@reverse_proxy_path).nil? ? '/*' : ''\n \"#{splitter}#{@reverse_proxy_path}#{star_suffix}\"\n end", "def relative_url_root=(_); end", "def root; resource :path => '/'; end", "def omit_slashes\n omit_leading_slash\n .omit_trailing_slash\n end", "def relative!\n super\n replace '' if self == '.'\n end", "def web_root? path\n path.start_with? SLASH\n end", "def root_url\n url '/'\n end", "def path_without_name_and_ref(path)\n Jekyll.sanitized_path theme.root, path.split(\"/\").drop(1).join(\"/\")\n end", "def base_url_path; end", "def url\n ''\n end", "def normalize_path(url); end", "def normalize_path(url); end", "def default_path\n '/'\n end", "def full_url\n if website.match(/[A-Za-z]:\\/\\//)\n website\n else\n \"http://#{website}\"\n end\n end", "def strip_regex_from(value)\n value.gsub(/^\\/|\\/$/,'')\n end", "def old_url\n \"http://#{site.default_host.hostname}#{path}\"\n end", "def abs_url(site)\n\t\t\turl = site.config['url']\n\t\t\turl = url[0..-2] if site.config['url'].end_with?(\"/\")\n\t\t\turl + fix_path(site.config['git_to_rss_file_path'])\n\t\tend", "def base_path\n # starts out like \"users/index\"\n @view.virtual_path.sub(%r{/[^/]*$}, '')\n end", "def url\n URL(@site.url).join(attributes[\"RootFolder\"]).to_s\n # # Dirty. Used to use RootFolder, but if you get the data from the bulk calls, RootFolder is the empty\n # # string rather than what it should be. That's what you get with web services as an afterthought I guess.\n # view_url = ::File.dirname(attributes[\"DefaultViewUrl\"])\n # result = URL(@site.url).join(view_url).to_s\n # if ::File.basename(result) == \"Forms\" and dir = ::File.dirname(result) and dir.length > @site.url.length\n # result = dir\n # end\n # result\n end", "def site_url(href)\n path_resolver = (@path_resolver ||= PathResolver.new)\n base_dir = path_resolver.posixify(@document.base_dir)\n site_root = path_resolver.posixify(@document.attr('site-root', base_dir))\n unless path_resolver.is_root? site_root\n raise ::ArgumentError, %(site-root must be an absolute path: #{site_root})\n end\n base_dir_to_root = nil\n if (base_dir != site_root) && (base_dir.start_with? site_root)\n comp, root = path_resolver.partition_path(base_dir.slice(site_root.length + 1, base_dir.length))\n base_dir_to_root = '../' * comp.length\n end\n path_resolver.web_path(href, base_dir_to_root)\n end", "def root?; path == '' end", "def nice_url\n\t\t# i want to take thr url and remove http:// and www.\n\t\t# gsub is global subsitution\n\t\turl.gsub(\"http://\", \"\").gsub(\"www.\", \"\")\n\tend", "def canonical_path\n # root_url ends in a slash, request.path starts with one, we need to strip one of them out!\n url = \"#{root_url.gsub(/\\/$/,'')}#{request.path}\"\n\n # rule #1 && rule #2\n if params['page'] && params['page'].to_i != 1\n url = url + \"?page=#{params[:page]}\"\n end\n\n url\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def web_endpoint\n File.join(@web_endpoint, \"\")\n end", "def root_path_match?\n url == '/'\n end", "def home_path\n \"/\"\n end", "def clean_path(path)\n path.sub(/^\\//,'')\n end", "def without_slashes\n self.\n without_leading_slash.\n without_trailing_slash\n end", "def relative_url(url)\n url.gsub(%r{\\Ahttp://[^/]*}, '')\n end", "def strip_locale_uri(path)\n path.to_s.gsub(/\\/(en|da|no|sv)/i, \"\")\n end", "def unmatched_path\n path = unescaped_path\n path[0,0] = '/' if (path[0] != '/' && matched_path[-1] == '/') || path.empty?\n path\n end", "def clean_url\n return # Not yet implemented\n end", "def homepage_url\n if @account.url.blank?\n \"/\"\n else\n @account.url\n end\n end", "def remove_url_anchor url\n url.gsub!(/#.*/, '') if url =~ /#/\n url\nend", "def trailing; end", "def pathWebSitePages\n pathWebSite + \"pages/\"\nend", "def current_path\n return nil if current_url.nil?\n return current_url.gsub(\"http://www.example.com\",\"\")\n end", "def clean_path(directory)\n directory.gsub(/\\/\\//, '/')\n end", "def fixup_url\n unless @view.app.url.starts_with?('http')\n unless @view.app.url.starts_with?('www')\n @view.app.url = 'www.' << @view.app.url\n end\n @view.app.url = 'http://' << @view.app.url\n end\n @view.app.url\n end", "def full_path; end", "def current_path_without_locale(path)\n locale_pattern = /^(\\/)(en|sv)?(\\/)?(.*)$/\n path.gsub(locale_pattern, '\\1\\4')\n end", "def slash_strip identifier\n /\\A\\/(.+)\\/\\Z/ =~ identifier and $1\n end", "def basepath; end", "def sanitize_path\n gsub(/[\\/: ]/,'_')\n end", "def dir\n url.end_with?(\"/\") ? url : url_dir\n end", "def contact_site\n\t\troot_path\n\tend", "def remove_slashes(url)\n return url unless url.present? && url.include?('//')\n parts = url.split('//')\n return parts[0..1].join if parts.length > 2\n url\n end", "def absolutify_url(url)\n url =~ /^\\w*\\:/i ? url : File.join(@url,url)\n end", "def derive_slug_and_path\n if home?\n self.slug = \"\"\n elsif slug? && !persisted?\n self.slug = add_suffix_if_taken(slug, path_base)\n elsif !slug?\n self.slug = add_suffix_if_taken(slug_base, path_base)\n end\n self.path = tidy_slashes([path_base, slug].map(&:presence).compact.join(\"/\"))\n end", "def site_url\n raise StandardError.new \"define method site_url\"\n end", "def clean_destination_url\n if !self.url.blank? and self.url !~ REGEX_LINK_HAS_PROTOCOL\n self.url.insert(0, URL_PROTOCOL_HTTP)\n end\n end", "def path_root\n base_uri ? base_uri : path_to( '/' )\n end", "def parse_proxy_relative_url_root\n request.forwarded_uris.first.gsub(/#{Regexp.escape(request.path)}$/, '')\n end", "def chop_leading_slash filename\n filename.sub %r{^/}, \"\"\n end" ]
[ "0.7262811", "0.7125822", "0.6985909", "0.6970237", "0.6786317", "0.67577666", "0.6754375", "0.6540662", "0.6486175", "0.64744586", "0.6454143", "0.6431418", "0.64066476", "0.6384281", "0.634859", "0.6261555", "0.6249791", "0.6217163", "0.62092334", "0.61844844", "0.61684954", "0.6138877", "0.6137303", "0.61343247", "0.6123729", "0.61064065", "0.6099785", "0.60971296", "0.60404265", "0.5978647", "0.5952573", "0.5952573", "0.5952573", "0.59413326", "0.5912931", "0.5912931", "0.5912931", "0.59086496", "0.5904559", "0.5904559", "0.5897167", "0.58759296", "0.58712596", "0.5869597", "0.5864247", "0.58445394", "0.58415246", "0.58299434", "0.5828055", "0.58168536", "0.5807277", "0.5806543", "0.57822937", "0.576089", "0.57523936", "0.57452685", "0.57452685", "0.5741492", "0.57387483", "0.5736239", "0.5731766", "0.5719269", "0.5684497", "0.567443", "0.5664001", "0.5663262", "0.5655034", "0.56481934", "0.5639788", "0.5639788", "0.5639788", "0.5635516", "0.5633184", "0.56265885", "0.56263906", "0.56225383", "0.56215197", "0.5616973", "0.5610682", "0.56022245", "0.5576833", "0.5576459", "0.5573467", "0.5562687", "0.5552922", "0.5552315", "0.5540255", "0.55366945", "0.55343527", "0.5529513", "0.55216587", "0.5519231", "0.5515945", "0.55129546", "0.55087376", "0.5507055", "0.5505714", "0.5505542", "0.5497644", "0.54975635", "0.54974407" ]
0.0
-1
Sortiert ein Array mit dem MaxSortAlgorithmus.
def max_sort!(a) # Durchlaufe das Array von hinten (a.size - i ist dann immer das # aktuelle Element) for i in 1 .. a.size-1 do # Suche das größte Element zwischen Index 0 und unserem aktuellen Element max_pos = max_pos_until(a, a.size - i) # Tausche das größte Element an unsere aktuelle Stelle swap!(a, a.size - i, max_pos) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort2(array, max_value)\n\nend", "def my_max(arr) #give the method a name and select a variable that will pass through it\n\n\t\tsorted_array = arr.sort #\n\t\tsorted_array.last\n\n\tend", "def sort_array_desc(array)\n\tarray.sort do |a, b|\n\t\tb <=> a\n\tend\nend", "def sort\n limit = array.size - 1\n (0..limit).each do |index|\n min = index\n (index..limit).each do |target|\n min = target if array[min] > array[target]\n end\n array[index], array[min] = array[min], array[index]\n end\n array\n end", "def sort_array_desc(arry)\n arry.sort do |num1, num2|\n num2 <=> num1\n end\nend", "def sort_array_desc(array)\n array.sort do |a,b|\n b <=> a\n end\nend", "def sort_array_desc(array)\n array.sort do |a,b|\n b <=> a\n end\nend", "def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend", "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def sort_array_desc(array)\n return array.sort{ |a, b| b <=> a }\nend", "def sort_array_desc(array)\n array.sort {|x,y| y <=> x}\nend", "def using_sort(array)\n sorted_array=array.sort\nend", "def sort_array_desc(array)\n array.sort {|x,y| y <=>x }\nend", "def sort_array_desc(array)\n desc_array = array.sort {|a, b| b <=> a}\n desc_array\nend", "def sort_array_desc(arr)\n arr.sort{|a,b| b<=>a}\nend", "def sort_array_desc(array)\n array.sort do |a, b|\n b<=>a\n end\nend", "def sort_array_desc(array)\n array.sort {|a,b| b <=> a}\nend", "def arr_max (arr)\n arr.sort! { |x,y| y <=> x}\n arr.first()\nend", "def sort_array_desc(array)\n array.sort do |x,y|\n if x == y\n 0\n elsif x < y\n 1\n elsif x > y\n -1\n end\n end\nend", "def sort\n limit = array.size\n while limit.positive?\n 0.upto(limit).each do |index|\n next if array[index + 1].nil?\n next unless array[index] > array[index + 1]\n\n array[index], array[index + 1] = array[index + 1], array[index]\n end\n limit -= 1\n end\n array\n end", "def my_array_sorting_method(array)\n\t@array=array\n\t@array.sort\n\treturn @array\nend", "def sort_array_desc(any_array)\n any_array.sort { |a, b| b <=> a}\n end", "def sort_array_desc(array)\n array.sort do |a,b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend", "def sort arr \n\trec_sort arr, []\nend", "def sort_array_desc(array)\n array.sort do | left, right|\n right <=> left\n end\nend", "def sort_array_desc(array)\n array.sort do |a, b|\n if a == b\n 0\n elsif a > b\n -1\n elsif a < b\n 1\n end\n end\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array_desc(array)\n array.sort.reverse\nend", "def sort_array\n @data.sorted_by.inject([]) do |memo, (key, value)|\n memo << [@data.columns.index(key), value == 'descending' ? 0 : 1]\n end\n end", "def sort_array_desc(array)\n new = array.sort\n new.reverse\nend", "def sort arr\r\n\trec_sort arr, []\r\nend", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n array.sort\nend", "def using_sort(array)\n array.sort\nend", "def lomuto(array)\n lomuto_sort(array, 0, array.length - 1)\nend", "def maximum(arr)\n bubble_sort(arr).last\nend", "def sort_array_desc(a)\n a.sort {|b, c|c<=>b}\nend", "def max(arr)\n # sort arragnes items in array by ascending order \n # last function returns the last number in the array, which in this case should be the max value\n puts arr.sort.last\n# closing function\nend", "def sort_array_desc(collection)\n i = 0\n result = []\n while i < collection.length\n result = collection.sort { |a, b| b <=> a }\n i += 1\n end\nreturn result.flatten\nend", "def selection_sort\n\n n = @data.length - 1\n\n for i in (n).downto(1) # Start from the end of the array\n\n k = i # k is the biggest element we have seen so far from the remaining unsorted data\n for j in 0..i # Traverse up to, but not including the sorted part of the array\n\n if @data[j] > @data[k]\n\n k = j # This sets the new max if we ever saw one\n end\n\n swap(@data, i, k) # Regardless if k is ever changed, you still swap (Potentially i equals k)\n end\n end\n\n puts(@data)\n end", "def heap_sort(array)\n @array = array\n heap = build_heap(@array)\n sorted = []\n (0..(@array.size - 1)).each do |i|\n sorted << heap.delete_max\n end\n sorted\n end", "def sort_array_desc(integers)\n integers.sort.reverse\nend", "def sort_array_desc(integers)\n integers.sort.reverse\nend", "def sort_array_desc (array)\n array.sort_by do |sort|\n -sort\n end\nend", "def sort(arr)\n\tnew_arr = arr.sort\n\tp new_arr\nend", "def sort_array_desc (integers)\n integers.sort.reverse\nend", "def array_ranked_descending(array)\n\t\treturn array.sort{|x,y| y <=> x} \n\tend", "def sortarray (sort_me)\n counter = sort_me.length\n a = 0\n b = 1\n while a < (counter-1)\n b = a+1\n while b < (counter)\n if sort_me[a] > sort_me[b]\n temp = sort_me[a]\n sort_me[a] = sort_me[b]\n sort_me[b] = temp\n end\n b += 1\n end\n a += 1\n end\n return sort_me\nend", "def del_sort(array)\n end", "def sort\n\n arr_len = @data.length\n start_build_idx = arr_len / 2 - 1 # The last half of the array is just leaves\n\n for i in (start_build_idx).downto(0)\n\n max_heapify(@data, arr_len, i) # Build the heap from the array\n end\n\n for i in (arr_len-1).downto(0)\n\n swap(@data, i, 0) # Move the current root to the end of the array\n max_heapify(@data, i, 0) # Heapify the remaining part of the array excluding the root which was just sorted to the end\n end\n\n puts(@data)\n end", "def manual_sort!(array, sort_column)\n c = sort_column.column\n if sort_column && sort_column.direction == 'desc'\n array.sort! { |x, y| y.send(c) <=> x.send(c) }\n else\n array.sort! { |x, y| x.send(c) <=> y.send(c) }\n end\n end", "def cusmax(array)\r\n return array.sort.max\r\nend", "def sort_array_asc(array)\n\tarray.sort\nend", "def qsort(arr)\nend", "def sort_array array\n sorted=[]\n a=0\n b=0\n until a==(array.length-1)||b==(array.length)\n if array[a] <= array[b]\n b+=1\n else\n a+=1\n b=0\n end\n end\n sorted.push array[a]\n array.delete(array[a])\n \n while true\n if array.length==1\n sorted.push array[0]\n break\n else\n a=0\n b=0\n until a==(array.length-1)||b==(array.length)\n if array[a]<=array[b]\n b+=1\n else\n a+=1\n b=0\n end\n end\n sorted.push array[a]\n array.delete_at(a)\n end\n end\n sorted\nend", "def sort1(array)\n\nend", "def sort_array_desc(integers)\n integers.sort {|a, b| b <=> a}\nend", "def sort_array_by_fields(array, default_order = \"launched_on\")\n sort_by = self.class::SORT_FIELDS[params[:order_by] || default_order]\n array = array.sort(&sort_by)\n\n params[:order_dir] != Sortable::DIRECTION_ASC ? array.reverse : array\n end", "def sortArray(array)\n\tnewArray = []\n\tuntil array.length == 0\n\t\tminNo = array[0]\n\t\tx = 1\n\t until x == array.length\n\t if array[x] <= minNo\n\t minNo = array[x]\n\t x += 1\n\t else\n\t \tx += 1\n\t end\n\t end\n\t newArray << minNo\n\t array[array.index(minNo)] = nil\n\t array.delete(nil)\n\tend\n\treturn newArray\nend", "def sort array\n\t\tarray = array.clone\n\t\tfinished = false\n\t\t##\n\t\t# Ok, should be an easy one. Compare the current and next value\n\t\t##\n\t\twhile !finished\n\t\t\t#Flag to track whether an iteration edited the array\n\t\t\twasSorted\t= false\n\t\t\t# Compare value pairs from input array\n\t\t\t(1...array.length).each{|idx|\n\t\t\t\t# Get the target values\n\t\t\t\tcurrentValue\t\t= array[idx]\n\t\t\t\tpreviousValue\t\t= array[idx - 1]\n\t\t\t\t# Figure out if the previous and current value arein the correct order\n\t\t\t\tcurrentVsPrevious\t= @sorter.predict([previousValue, currentValue]).first.round\n\t\t\t\t# If they aren't (as best we know at least), swap the two values\n\t\t\t\tif currentVsPrevious == 0\n\t\t\t\t\tarray[idx]\t\t= previousValue\n\t\t\t\t\tarray[idx - 1]\t= currentValue\n\t\t\t\t\twasSorted\t\t= true\n\t\t\t\tend\n\t\t\t}\n\t\t\t# If no sort action was taken, the array must be sorted.\n\t\t\tfinished = !wasSorted\n\t\tend\n\t\t# Return to caller\n\t\tarray\n\tend", "def gnome_sort(array)\n count = 0\n\n while count < array.length - 1\n if array[count] > array[count + 1]\n array[count + 1], array[count] = array[count], array[count + 1]\n count -= 2 if count.positive?\n end\n count += 1\n end\n\n array\nend", "def bubble_sort(array=@base)\n array.each_index do |index1|\n index1.upto(array.size-2) do |index2|\n if array[index1] > array[index2+1]\n array[index1], array[index2+1] = array[index2+1], array[index1]\n end\n end\n end\n array\n end", "def sort_array_asc(array)\n array.sort\nend", "def take_array(array)\r\n array.sort\r\nend", "def bubble_sort (array)\n for j in 0..(array.length)\n for i in 0..(array.length - 2)\n if array[i] > array[i+1]\n max = array[i]\n min = array[i+1]\n array[i] = min\n array[i+1] = max\n end\n end\n end\n array\nend", "def sort2(array, max_value)\n counts = [0] * max_value\n array.each do |el|\n counts[el - 1] += 1\n end\n sorted = []\n counts.each_with_index do |count, el|\n sorted += ([el + 1] * count)\n end\n sorted\nend", "def sort arr\n rec_sort arr, []\nend", "def to_sorted_array\n sort.collect(&:last)\n end", "def get_sorted_array\n @ary.sort\n end", "def sort(unsorted_array)\n @sorted_array << unsorted_array.delete_at(unsorted_array.min)\n sort(unsorted_array) until unsorted_array.length == 0\n# This is the RECURSION - latest value of unsorted_array after each iteration\n# is then re-run through the sort method until everything is sorted.\n @sorted_array\nend", "def bubble_sort(&prc)\n prc = prc || Proc.new{|a,b| a <=> b}\n sorted = false\n\n until sorted\n sorted = true\n (0...self.length-1).each do |idx|\n if prc.call(self[idx], self[idx + 1]) > 0\n self[idx], self[idx + 1] = self[idx + 1], self[idx]\n sorted = false\n end\n end\n end\n self # return the sorted array\n end", "def find_max(array)\n max = array.sort.reverse\n puts max[0]\nend", "def bubble_sort(unsorted_array)\n\t# Copy the array (arrays are mutable)\n\tsorted_array = Array.new(unsorted_array)\n\t\n\tarray_length = unsorted_array.length\n\t(array_length - 1).times do |num_sorted|\n\t\t(array_length - num_sorted - 1).times do |idx|\n\t\t\tif sorted_array[idx] > sorted_array[idx + 1]\n\t\t\t\tswap(sorted_array, idx, idx + 1)\n\t\t\tend\n\t\tend\n\tend\n\n\tsorted_array\nend", "def sort(num_array)\n # Your code goes here\n (num_array.length).times do |i|\n while i > 0\n if num_array[i-1] > num_array[i] \n num_array[i-1], num_array[i] = num_array[i], num_array[i-1]\n else\n break\n end\n i-=1\n end\n \n end\n return num_array\n \nend", "def bubble_sort(array)\n is_sorted = false\n counter = 0\n\n while !is_sorted\n is_sorted = false\n\n (0..array.size - 1 - counter).each do |i|\n if array[i] > array[i + 1]\n swap(i, i + 1, array)\n is_sorted = false\n end\n end\n\n # each loop through will set the highest value in the array to the end of the array\n # this will optimize the speed of the algorithm by not having to loop through the whole array everytime\n counter += 1\n end\n\n return array\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort_array_asc(array)\n array.sort\nend", "def sort(array)\n return array if array.length <= 1\n less, more = [], []\n # first element as pivot value\n pivot = array.delete_at(0)\n\n array.each { |el| el < pivot ? less << el : more << el}\n\n sort(less) + [pivot] + sort(more)\n end", "def sort arr\r\n\treturn arr if arr.length <= 1\r\n\r\n\tmiddle = arr.pop\r\n\tless = arr.select{|x| x < middle}\r\n\tmore = arr.select{|x| x >= middle}\r\n\r\n\tsort(less) + [middle] + sort(more)\r\nend", "def sort_rever(array)\n p array.sort.reverse\nend", "def sort(arr)\n return arr if arr.length < 1\n\n pivot = arr.pop\n less = arr.select { |item| item < pivot}\n more = arr.select { |item| item >= pivot}\n\n sort(less) + [pivot] + sort(more)\nend", "def sort some_array\n\tsorted_array = []\n\trecursive_sort some_array, sorted_array\nend", "def selection_sort(array=@base)\n 0.upto(array.size-1) do |index1|\n min_index = index1\n (index1+1).upto(array.size-1) do |index2|\n min_index = index2 if array[index2] < array[min_index]\n end\n array[index1], array[min_index] = array[min_index], array[index1]\n end\n array\n end", "def heap_sort(array)\n heap = Heap.new(array)\n heap.heap_sort\nend", "def bubble_sort(array)\n\n (0..array.size-1).each do |i|\n (i..(array.size-1)).each do |j|\n if array[i] > array[j]\n temp = array[i]\n array[i] = array[j]\n array[j] = temp\n end\n end\n end\n array\nend", "def bubble_sort(arr)\n\tbubble_sort_by(arr) { |a,b| b-a }\nend", "def orderly(array)\n p array.sort\nend", "def bubble_sort array\n\t(0...array.length-1).each do |i|\n\t\t(i+1...array.length).each do |j|\n\t\t\tif array[i]>array[j]\n\t\t\t\tarray[i]=array[i]+array[j]\n\t\t\t\tarray[j]=array[i]-array[j]\n\t\t\t\tarray[i]=array[i]-array[j]\n\t\t\tend\n\t\tend\n\tend\n\tarray\nend", "def heapsort(array)\r\n\t#create a heap from an array\r\n\theap = MaxHeap.new(array)\r\n\theap.buildMaxHeap\r\n\t\r\n\t#puts heap.array\r\n\t#puts \"_____\"\r\n\t#puts \"array size = #{heap.arraysize}\"\r\n\t\r\n\t(heap.arraysize).downto(2) do |i|\r\n\t\t#exchange of largest data point with end of the array\r\n\t\ttemp = heap.array[0]\r\n\t\theap.array[0] = heap.array[i-1]\r\n\t\theap.array[i-1] = temp\r\n\t\t\r\n\t\t#decrement size of the heap so that the last value stays in the array, but does not get sorted\r\n\t\theap.heapsize -=1\r\n\t\theap.maxHeapify(0)\r\n\t\t#puts \"**____**\"\r\n\t\t#puts \"i is equal to #{i}\"\r\n\t\r\n\t\t#puts heap.array\r\n\t\t#puts \"**_~~_**\"\r\n\tend\r\n\tputs heap.array\r\nend", "def mysort(arr)\n # The computational complexity of this algorithm is O(n^^2), and is similar\n # to selection sort. This is not idiomatically ideal Ruby - I've tried to\n # mostly use language constructs common to many languages.\n\n sorted = []\n\n smallest_index = 0\n while (arr.length > 0) do\n for i in (0..(arr.length - 1))\n if arr[i] < arr[smallest_index]\n smallest_index = i\n end\n end\n sorted.push arr.delete_at(smallest_index) \n smallest_index = 0\n end\n\n return sorted \n\nend", "def sort2(num_array)\n n = num_array.length - 1\n for i in 0..n\n for j in 0..(n-i-1)\n if num_array[j] >= num_array[j+1]\n num_array[j], num_array[j+1] = num_array[j+1], num_array[j]\n end\n end\n end\n return num_array\nend", "def pancake_sort(arr)\n pancake_sort_helper(arr, arr.size-1)\n arr\nend" ]
[ "0.7503693", "0.67893755", "0.6760639", "0.6711813", "0.67090034", "0.6658954", "0.6658954", "0.6658617", "0.66463536", "0.66463536", "0.66132593", "0.65927076", "0.6580084", "0.6558103", "0.6551675", "0.6546806", "0.653978", "0.65322345", "0.6501309", "0.64934087", "0.64875835", "0.64741576", "0.6469829", "0.64412445", "0.64403534", "0.64184886", "0.6398352", "0.63598275", "0.63598275", "0.63598275", "0.63598275", "0.63598275", "0.6353214", "0.633449", "0.63115007", "0.6307444", "0.6307444", "0.6307444", "0.6300056", "0.62840176", "0.62802297", "0.62755954", "0.62383807", "0.6237053", "0.62334144", "0.6229295", "0.6228558", "0.62151223", "0.61985797", "0.61942154", "0.61734116", "0.61730796", "0.616025", "0.6140438", "0.6115313", "0.611378", "0.61054134", "0.6088284", "0.60833424", "0.6073662", "0.6065461", "0.60296744", "0.60173124", "0.6009639", "0.5986395", "0.5973364", "0.5972183", "0.5964473", "0.59633994", "0.59591043", "0.5955883", "0.5955451", "0.5953671", "0.59487677", "0.5947426", "0.5946291", "0.5923032", "0.590049", "0.5893444", "0.5885371", "0.5885371", "0.5885371", "0.5885371", "0.5885371", "0.5885371", "0.5879665", "0.58774287", "0.5854924", "0.5851908", "0.58330137", "0.5831504", "0.5823423", "0.581763", "0.58094305", "0.58057964", "0.5775893", "0.57721347", "0.57707244", "0.5768863", "0.57682943" ]
0.66267174
10
GET /regionextras GET /regionextras.json
def index @regionextras = Regionextra.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end", "def region\n @regions = @company.companyregions\n respond_with @regions\n end", "def regions\n client.get_stats('/stats/regions')\n end", "def show\n render json: @region\n end", "def set_regionextra\n @regionextra = Regionextra.find(params[:id])\n end", "def get_regions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_regions ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/universe/regions/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].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 header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 => 'Array<Integer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def region\n @region ||= client.regions.get_from_uri(info[:region])\n end", "def region\n @region ||= client.regions.get_from_uri(info[:region]) unless info[:region].nil?\n end", "def regions\n @attributes[:regions]\n end", "def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end", "def index\n @regiones = Region.all\n\n render json: @regiones\n end", "def region() ; info[:region] ; end", "def region() ; info[:region] ; end", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def regions(for_select = true)\n fetch_array_for $regions, for_select\n end", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def show\n @region = Region.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @region }\n end\n end", "def index\n @especies_regiones = EspecieRegion.all\n end", "def query_tax_region_jurisdictions(options={})\n path = \"/api/v2/compliance/taxregionjurisdictions\"\n get(path, options)\n end", "def regions\n Vultr::Resource::Region.new(@faraday)\n end", "def especies_por_region\n snib = Geoportal::Snib.new\n snib.params = params\n snib.especies\n self.resp = snib.resp\n end", "def get_aws_region\n\n\n begin\n\n url = 'http://169.254.169.254/latest/dynamic/instance-identity/document'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n\n hashOfLookupValues = JSON.parse(response)\n lookupRegion = hashOfLookupValues[\"region\"]\n\n rescue\n logonFailed('Unable to perform region lookup. Is this an EC2 instance? and does it have access to http://169.254.169.254')\n end\n\n return lookupRegion\n\n end", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def query_tax_regions(options={})\n path = \"/api/v2/compliance/taxregions\"\n get(path, options)\n end", "def _region_states(region_id)\n get('region/states', region_id)\n end", "def getVendorsAndRegions\n fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')\n end", "def listRegions\n\t\t\treturn MU::Config.listRegions\n\t\tend", "def get_regions()\n\t\t{\"include_regions\"=>@include_regions,\"exclude_regions\"=>@exclude_regions}\n\tend", "def available_services_regions\n unless @regions\n @regions = []\n service_catalog.each do |service|\n next if service[\"type\"]==\"identity\"\n (service[\"endpoints\"] || []).each do |endpint|\n @regions << endpint['region']\n end\n end\n @regions.uniq!\n end\n @regions\n end", "def find_region_by_service(id)\n self.class.get(\"/services/#{id}/regions.json?apikey=#{apikey}\") \n end", "def vendors_and_regions\n fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')\n end", "def get_tax_region(id)\n path = \"/api/v2/compliance/taxregions/#{id}\"\n get(path)\n end", "def index\n @regionenvironments = Regionenvironment.all\n end", "def regions(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_regions,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/regions\",\n Authorization: auth\n )\n end", "def regions\n AWS.regions.map(&:name)\n end", "def edit\n @region = Region.find_by_given_name(params[:region_name])\n @data = SolarSystem.where(region_id: @region.id).to_json(:except => [:region_id, :created_at, :updated_at])\n end", "def regions_included\n @attributes[:regions_included]\n end", "def index\n @region = Region.find_by_id params[:region_id]\n @locations = @region.locations.select(\"id,name,region_id\")\n\n respond_with @locations #Location.select(\"id,name\")\n end", "def region_opts\n res = $store.select(RegionTable, \n \"reg_affiliate=? order by reg_name\",\n @data_object.aff_id)\n\n regions = { Affiliate::NONE => \"unassigned\" } \n\n res.each {|r| regions[r.reg_id] = r.reg_name}\n \n regions\n end", "def index\n @regions = Region.all\n end", "def index\n @regions = Region.all\n end", "def update\n respond_to do |format|\n if @regionextra.update(regionextra_params)\n format.html { redirect_to @regionextra, notice: 'Regionextra was successfully updated.' }\n format.json { render :show, status: :ok, location: @regionextra }\n else\n format.html { render :edit }\n format.json { render json: @regionextra.errors, status: :unprocessable_entity }\n end\n end\n end", "def find_region\n\t @region = Region.get(params[:region_id])\n\tend", "def find_region\n\t @region = Region.get(params[:region_id])\n\tend", "def regional_capabilities\n query('txt/wxfcs/regionalforecast/json/capabilities')\n end", "def get_regions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_regions ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/stats/regions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HistoricalRegionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_regions\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HistoricalApi#get_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def s3_regions\n @attributes[:s3_regions]\n end", "def show\n @locations_region = Locations::Region.find(params[:id])\n respond_to do |format|\n format.js # show.html.erb\n end\n end", "def regions(aws_final_url)\n\tregion_name = aws_final_url[/pricing.(.*?).amazon/, 1]\n\t\n\t@aws_region = AwsRegion.find_or_create_by(region_name: region_name)\nend", "def index\n @world_regions = WorldRegion.all\n end", "def sales_tax_regions\n @attributes[:sales_tax_regions]\n end", "def index\n @regions = Region.all\n end", "def region_item\n super\n end", "def describe_regions4_location(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions4Location'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def load_regions\n\t\t\tregions = Locations::Regions.const_get(ENV['CURRENT_CITY'])\n\t\tend", "def index\n @user_regions = UserRegion.all\n end", "def create\n @regionextra = Regionextra.new(regionextra_params)\n\n respond_to do |format|\n if @regionextra.save\n format.html { redirect_to @regionextra, notice: 'Regionextra was successfully created.' }\n format.json { render :show, status: :created, location: @regionextra }\n else\n format.html { render :new }\n format.json { render json: @regionextra.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @gce_regions = GceRegion.all\n end", "def getRegions(config, servername)\n connection = HConnectionManager::getConnection(config);\n return ProtobufUtil::getOnlineRegions(connection.getAdmin(ServerName.valueOf(servername)));\nend", "def index\n @regional_data_records = @region.regional_data_records.all\n end", "def index\n if(current_user.customer_id?)\n @resturants = Resturant.where(\"region_id = ?\", current_user.customer.region_id)\n else\n @resturants = Resturant.where(\"region_id = ?\", current_user.driver.region_id)\n end\n \n render json: @resturants, status: 200\n end", "def region\n RightScaleAPI::CLOUD_REGIONS.find{|k,v|v == cloud_id}.first\n end", "def especie_region_params\n params[:especie_region]\n end", "def index\n @region_utilities = RegionUtility.all\n end", "def get_cloud_regions_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.get_cloud_regions_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/Regions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudRegionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.get_cloud_regions_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudApi#get_cloud_regions_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_region()\n status, stdout, stderr = xenstore_command(\"read\", \"vm-data/provider_data/region\")\n if status == 0\n stdout.strip\n else\n Ohai::Log.debug(\"could not read region information for Rackspace cloud from xen-store\")\n nil\n end\nend", "def regionextra_params\n params.require(:regionextra).permit(:RegionID, :Name, :value)\n end", "def determine_region\n `curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | grep -Po \"(us|sa|eu|ap)-(north|south)?(east|west)?-[0-9]+\"`.strip\n rescue\n new_resource.region\n end", "def show\n @region = Region.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @region }\n end\n end", "def show\n @pc_region = PcRegion.find(params[:id])\n @title = @pc_region.name\n @context_menu = {'back' => pc_regions_path, 'new' => new_pc_region_path, 'edit' => edit_pc_region_path}\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pcregion }\n end\n end", "def index\n\n if params[:region_id]\n\n @regions = Region.where(id: params[:region_id])\n render json: @regions, include: [:cities], show_children: true\n\n elsif params[:ip]\n\n @iprange = Iprange.find_by_ip params[:ip]\n\n if @iprange\n\n render json: @iprange.city, include: [:region], show_parent: true\n\n else\n throw ActiveRecord::RecordNotFound\n end\n\n else\n\n @cities = City.all\n\n render json: @cities\n\n end\n end", "def region\n @control_data['region'] | 'National'\n end", "def show\n @sub_region = SubRegion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sub_region }\n end\n end", "def show\n @country = Country.includes(:regions).find(params[:id])\n @tours = Tour.search(params.merge({ region: @country.region_ids}))\n @attractions = @country.regions.map { |i| i.attractions }.flatten\n @hotels = @country.regions.map { |i| i.hotels }.flatten\n @photos = @country.regions.map { |i| i.gallery.photos if i.gallery }.flatten.uniq.compact\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country }\n end\n end", "def destroy\n @regionextra.destroy\n respond_to do |format|\n format.html { redirect_to regionextras_url, notice: 'Regionextra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def locations\n get('locations')\n end", "def get_region_children(options={})\n url_s=@@zillow_webservice_url+'GetRegionChildren.htm?zws-id='+@zwsid\n if options[:city]!=nil then\n url_s=url_s+'&city='+options[:city].to_s\n end\n if options[:state]!=nil then\n url_s=url_s+'&state='+options[:state].to_s\n end\n if options[:country]!=nil then\n url_s=url_s+'&country='+options[:country].to_s\n end\n if options[:rid]!=nil then\n url_s=url_s+'&rid='+options[:rid].to_s\n end\n if options[:childtype]!=nil then\n url_s=url_s+'&childtype='+options[:childtype].to_s\n end\n fetch_result(url_s)\n end", "def get_region\n return @m_region\n end", "def display_resource(region)\n \"#{region.name}\"\n end", "def region(opts = {})\n if opts.is_a?(Hash)\n region_name = opts.first[0]\n else\n region_name = opts\n end\n region = @regions[region_name]\n\n if region\n\n # Confirm that we are on the expected page\n verify_presence \"Cannot navigate to region \\\"#{region_name}\\\" because page presence check failed\"\n\n # Apply the filter method\n if opts.is_a?(Hash)\n region.filter(opts.first[1])\n else\n region.filter(opts)\n end\n\n return region\n else\n raise \"Invalid region name requested: \\\"#{opts.first[0]}\\\"\"\n end\n end", "def all\n # return an array of all the regions\n return NAMES\n end", "def index\n @pc_regions = PcRegion.all\n @title = 'PC Regions'\n @context_menu = {'new' => new_pc_region_path}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pc_regions }\n end\n end", "def index\n @regionais = Regional.all\n end", "def display_with_region\n \"#{name} / #{region.name}\"\n end", "def location\n # Retrieve info for dropdown\n @nationwide = Location.get_nationwide\n #@provinces = Location.provinces.where('id != ?', @nationwide.id).order('denorm_sort').collect {|p| [p.name.capitalize, p.id]}.insert(0, [@nationwide.name.capitalize, @nationwide.id])\n @provinces = Location.provinces.where('id != ?', @nationwide.id).order('denorm_sort')\n\n # Retrieve previously selected locations\n @curr_locations = current_user.present? ? current_user.locations.pluck(:id) : []\n\n # Get all regions for the map display \n @regions = Region.order('region_iso').all\n end", "def create\n @region = Region.new(region_params)\n @regions = Region.where('active_status=? and del_status=?', true, false)\n respond_to do |format|\n if @region.save\n format.js { flash[:success] = \"#{@region.region_desc} added successfully\" }\n format.html { redirect_to @region, notice: \"Region was successfully created.\" }\n format.json { render :show, status: :created, location: @region }\n else\n format.js { render :new }\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @regions = Region.where('active_status=? and del_status=?', true, false)\n end", "def region\n begin\n r=GRegion.find(params[:id])\n @videos=r.v_metadatas.paginate(:page => params[:page], :per_page => @@per_page)\n @query_info=r.name_chs\n\n respond_to do |format|\n format.html { render 'query/show' }\n end\n rescue ActiveRecord::RecordNotFound\n render(:file => \"#{Rails.root}/public/404.html\",\n :status => \"404 Not Found\")\n end\n end", "def load_data\n @regions = Region.find(:all, :order => \"name\")\n end", "def region\n if params[\"region\"] == \"full\"\n params[\"region\"]\n else\n case visibility\n when \"open\", \"rose_high\", \"authenticated\", \"restricted\"\n params[\"region\"]\n when \"low_res\", \"emory_low\"\n low_res_adjusted_region\n end\n end\n rescue\n \"0,0,#{IiifController.min_tile_size_for_low_res},#{IiifController.min_tile_size_for_low_res}\"\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to regions_path, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def region; end", "def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n \n @locations = apply_scopes(@taxonomy_term.locations).uniq().page(params[:page]).per(params[:per_page])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end", "def region\n return @region\n end", "def get_regions(opts = {})\n data, _status_code, _headers = get_regions_with_http_info(opts)\n data\n end", "def calendar_regions\n @regions ||= parse_countries(load_page(@cal_url))\n end", "def region_sales(start_date, end_date, options={})\n options.merge!({:basic_auth => @auth})\n url = \"/sales/regions/#{start_date}/#{end_date}\" \n self.class.get(url, options)\n end", "def index\n @extras = Extra.all\n\n render json: @extras\n end", "def describe_regions(list=[])\n link = generate_request(\"DescribeRegions\",\n amazonize_list('RegionName',list.to_a))\n request_cache_or_info :describe_regions, link, QEc2DescribeRegionsParser, @@bench, list.blank?\n rescue Exception\n on_exception\n end", "def region_slots\n if(current_user.customer_id?)\n @timeslots = Timeslot.where(\"region_id = ?\", current_user.customer.region_id)\n else\n @timeslots = Timeslot.where(\"region_id = ?\", current_user.driver.region_id)\n end\n render json: @timeslot, status: 200\n end" ]
[ "0.71900696", "0.67239195", "0.66143936", "0.6611175", "0.64833874", "0.64386183", "0.6378065", "0.6367327", "0.63036364", "0.6268304", "0.6228991", "0.6211672", "0.6211672", "0.62070656", "0.6194856", "0.61833453", "0.61815906", "0.6171834", "0.61537635", "0.6150054", "0.61448056", "0.60963225", "0.60608184", "0.6008888", "0.6007783", "0.5971935", "0.59665895", "0.5958612", "0.5958567", "0.59136677", "0.5907751", "0.5902949", "0.58951014", "0.58789754", "0.58460826", "0.58446366", "0.5829583", "0.5813322", "0.58018446", "0.57765675", "0.57765675", "0.5771569", "0.5762505", "0.5762505", "0.5762176", "0.57556635", "0.57325387", "0.57234156", "0.5699319", "0.5694905", "0.5691022", "0.5667323", "0.5665833", "0.56283027", "0.5613473", "0.55815965", "0.5576165", "0.5553582", "0.55406755", "0.5532961", "0.5526406", "0.5520278", "0.5510235", "0.55053824", "0.54977876", "0.549302", "0.5489423", "0.5467855", "0.5458693", "0.54527086", "0.5436859", "0.5423087", "0.54141665", "0.5411962", "0.540145", "0.5392986", "0.5379985", "0.536646", "0.5364606", "0.53101796", "0.5310122", "0.53010267", "0.52925754", "0.5292187", "0.5281667", "0.527285", "0.5270634", "0.5257337", "0.5254452", "0.5242844", "0.5232301", "0.5231594", "0.5231563", "0.5230206", "0.52211225", "0.5215406", "0.5213799", "0.51968336", "0.5184265", "0.51675004" ]
0.72709906
0
GET /regionextras/1 GET /regionextras/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end", "def index\n @regionextras = Regionextra.all\n end", "def show\n render json: @region\n end", "def show\n @region = Region.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @region }\n end\n end", "def region\n @regions = @company.companyregions\n respond_with @regions\n end", "def set_regionextra\n @regionextra = Regionextra.find(params[:id])\n end", "def index\n @regiones = Region.all\n\n render json: @regiones\n end", "def get_regions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_regions ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/universe/regions/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].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 header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 => 'Array<Integer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def find_region_by_service(id)\n self.class.get(\"/services/#{id}/regions.json?apikey=#{apikey}\") \n end", "def edit\n @region = Region.find_by_given_name(params[:region_name])\n @data = SolarSystem.where(region_id: @region.id).to_json(:except => [:region_id, :created_at, :updated_at])\n end", "def regions\n client.get_stats('/stats/regions')\n end", "def region\n @region ||= client.regions.get_from_uri(info[:region]) unless info[:region].nil?\n end", "def region\n @region ||= client.regions.get_from_uri(info[:region])\n end", "def find_region\n\t @region = Region.get(params[:region_id])\n\tend", "def find_region\n\t @region = Region.get(params[:region_id])\n\tend", "def especies_por_region\n snib = Geoportal::Snib.new\n snib.params = params\n snib.especies\n self.resp = snib.resp\n end", "def index\n @region = Region.find_by_id params[:region_id]\n @locations = @region.locations.select(\"id,name,region_id\")\n\n respond_with @locations #Location.select(\"id,name\")\n end", "def get_tax_region(id)\n path = \"/api/v2/compliance/taxregions/#{id}\"\n get(path)\n end", "def get_aws_region\n\n\n begin\n\n url = 'http://169.254.169.254/latest/dynamic/instance-identity/document'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n\n hashOfLookupValues = JSON.parse(response)\n lookupRegion = hashOfLookupValues[\"region\"]\n\n rescue\n logonFailed('Unable to perform region lookup. Is this an EC2 instance? and does it have access to http://169.254.169.254')\n end\n\n return lookupRegion\n\n end", "def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end", "def index\n @especies_regiones = EspecieRegion.all\n end", "def show\n @locations_region = Locations::Region.find(params[:id])\n respond_to do |format|\n format.js # show.html.erb\n end\n end", "def update\n respond_to do |format|\n if @regionextra.update(regionextra_params)\n format.html { redirect_to @regionextra, notice: 'Regionextra was successfully updated.' }\n format.json { render :show, status: :ok, location: @regionextra }\n else\n format.html { render :edit }\n format.json { render json: @regionextra.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if(current_user.customer_id?)\n @resturants = Resturant.where(\"region_id = ?\", current_user.customer.region_id)\n else\n @resturants = Resturant.where(\"region_id = ?\", current_user.driver.region_id)\n end\n \n render json: @resturants, status: 200\n end", "def region() ; info[:region] ; end", "def region() ; info[:region] ; end", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @regionenvironments = Regionenvironment.all\n end", "def regions(for_select = true)\n fetch_array_for $regions, for_select\n end", "def show\n @region = Region.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @region }\n end\n end", "def regions\n Vultr::Resource::Region.new(@faraday)\n end", "def index\n @regions = Region.all\n end", "def index\n @regions = Region.all\n end", "def query_tax_region_jurisdictions(options={})\n path = \"/api/v2/compliance/taxregionjurisdictions\"\n get(path, options)\n end", "def show\n @sub_region = SubRegion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sub_region }\n end\n end", "def index\n\n if params[:region_id]\n\n @regions = Region.where(id: params[:region_id])\n render json: @regions, include: [:cities], show_children: true\n\n elsif params[:ip]\n\n @iprange = Iprange.find_by_ip params[:ip]\n\n if @iprange\n\n render json: @iprange.city, include: [:region], show_parent: true\n\n else\n throw ActiveRecord::RecordNotFound\n end\n\n else\n\n @cities = City.all\n\n render json: @cities\n\n end\n end", "def show\n @pc_region = PcRegion.find(params[:id])\n @title = @pc_region.name\n @context_menu = {'back' => pc_regions_path, 'new' => new_pc_region_path, 'edit' => edit_pc_region_path}\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pcregion }\n end\n end", "def get_regions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_regions ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/stats/regions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HistoricalRegionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_regions\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HistoricalApi#get_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @regionextra = Regionextra.new(regionextra_params)\n\n respond_to do |format|\n if @regionextra.save\n format.html { redirect_to @regionextra, notice: 'Regionextra was successfully created.' }\n format.json { render :show, status: :created, location: @regionextra }\n else\n format.html { render :new }\n format.json { render json: @regionextra.errors, status: :unprocessable_entity }\n end\n end\n end", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def _region_states(region_id)\n get('region/states', region_id)\n end", "def getVendorsAndRegions\n fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')\n end", "def regions\n @attributes[:regions]\n end", "def region_item\n super\n end", "def show\n @country = Country.includes(:regions).find(params[:id])\n @tours = Tour.search(params.merge({ region: @country.region_ids}))\n @attractions = @country.regions.map { |i| i.attractions }.flatten\n @hotels = @country.regions.map { |i| i.hotels }.flatten\n @photos = @country.regions.map { |i| i.gallery.photos if i.gallery }.flatten.uniq.compact\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @country }\n end\n end", "def index\n @regional_data_records = @region.regional_data_records.all\n end", "def vendors_and_regions\n fetch(@config[:finance_path], 'Finance.getVendorsAndRegions')\n end", "def index\n @regions = Region.all\n end", "def destroy\n @regionextra.destroy\n respond_to do |format|\n format.html { redirect_to regionextras_url, notice: 'Regionextra was successfully destroyed.' }\n format.json { head :no_content }\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 show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end", "def index\n @world_regions = WorldRegion.all\n end", "def region\n begin\n r=GRegion.find(params[:id])\n @videos=r.v_metadatas.paginate(:page => params[:page], :per_page => @@per_page)\n @query_info=r.name_chs\n\n respond_to do |format|\n format.html { render 'query/show' }\n end\n rescue ActiveRecord::RecordNotFound\n render(:file => \"#{Rails.root}/public/404.html\",\n :status => \"404 Not Found\")\n end\n end", "def regions(aws_final_url)\n\tregion_name = aws_final_url[/pricing.(.*?).amazon/, 1]\n\t\n\t@aws_region = AwsRegion.find_or_create_by(region_name: region_name)\nend", "def query_tax_regions(options={})\n path = \"/api/v2/compliance/taxregions\"\n get(path, options)\n end", "def index\n @extras = Extra.all\n\n render json: @extras\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @pc_regions = PcRegion.all\n @title = 'PC Regions'\n @context_menu = {'new' => new_pc_region_path}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pc_regions }\n end\n end", "def index\n @user_regions = UserRegion.all\n end", "def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end", "def available_services_regions\n unless @regions\n @regions = []\n service_catalog.each do |service|\n next if service[\"type\"]==\"identity\"\n (service[\"endpoints\"] || []).each do |endpint|\n @regions << endpint['region']\n end\n end\n @regions.uniq!\n end\n @regions\n end", "def index\n @region_utilities = RegionUtility.all\n end", "def display_resource(region)\n \"#{region.name}\"\n end", "def region_opts\n res = $store.select(RegionTable, \n \"reg_affiliate=? order by reg_name\",\n @data_object.aff_id)\n\n regions = { Affiliate::NONE => \"unassigned\" } \n\n res.each {|r| regions[r.reg_id] = r.reg_name}\n \n regions\n end", "def create\n @region = Region.new(region_params)\n @regions = Region.where('active_status=? and del_status=?', true, false)\n respond_to do |format|\n if @region.save\n format.js { flash[:success] = \"#{@region.region_desc} added successfully\" }\n format.html { redirect_to @region, notice: \"Region was successfully created.\" }\n format.json { render :show, status: :created, location: @region }\n else\n format.js { render :new }\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @gce_regions = GceRegion.all\n end", "def show\n @taxonomy_term = TaxonomyTerm.find(params[:id])\n \n @locations = apply_scopes(@taxonomy_term.locations).uniq().page(params[:page]).per(params[:per_page])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxonomy_term }\n end\n end", "def listRegions\n\t\t\treturn MU::Config.listRegions\n\t\tend", "def getRegions(config, servername)\n connection = HConnectionManager::getConnection(config);\n return ProtobufUtil::getOnlineRegions(connection.getAdmin(ServerName.valueOf(servername)));\nend", "def regions(auth, server_id)\n MijDiscord::Core::API.request(\n :guilds_sid_regions,\n server_id,\n :get,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/regions\",\n Authorization: auth\n )\n end", "def region\n RightScaleAPI::CLOUD_REGIONS.find{|k,v|v == cloud_id}.first\n end", "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "def get_regions()\n\t\t{\"include_regions\"=>@include_regions,\"exclude_regions\"=>@exclude_regions}\n\tend", "def get_name(region)\n url = 'https://uinames.com/api/'\n uri= URI(url)\n response = Net::HTTP.get(uri)\n result = JSON.parse(response)\n result[\"name\"]\n \nend", "def set_region\n @region = Region.find(params[:id])\n end", "def set_region\n @region = Region.find(params[:id])\n end", "def set_region\n @region = Region.find(params[:id])\n end", "def describe_regions4_location(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions4Location'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def get_region()\n status, stdout, stderr = xenstore_command(\"read\", \"vm-data/provider_data/region\")\n if status == 0\n stdout.strip\n else\n Ohai::Log.debug(\"could not read region information for Rackspace cloud from xen-store\")\n nil\n end\nend", "def especie_region_params\n params[:especie_region]\n end", "def get_cloud_regions_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.get_cloud_regions_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/Regions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudRegionsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.get_cloud_regions_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudApi#get_cloud_regions_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @regions = Region.where('active_status=? and del_status=?', true, false)\n end", "def region_slots\n if(current_user.customer_id?)\n @timeslots = Timeslot.where(\"region_id = ?\", current_user.customer.region_id)\n else\n @timeslots = Timeslot.where(\"region_id = ?\", current_user.driver.region_id)\n end\n render json: @timeslot, status: 200\n end", "def get_cloud_regions_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.get_cloud_regions_by_moid ...'\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 CloudApi.get_cloud_regions_by_moid\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/Regions/{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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudRegions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.get_cloud_regions_by_moid\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudApi#get_cloud_regions_by_moid\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_variant\n @product = Spree::Product.find_by :slug => params[:product_id]\n @variant = @product.find_variant_by_options(params[:ids].split(','))\n if @variant\n respond_to do |format|\n format.json {render json: {variant_id: @variant.id, image_ids: @variant.image_ids}}\n end\n end\n end", "def get_location\n as_json(get_results('/locations.json'))\n end", "def determine_region\n `curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | grep -Po \"(us|sa|eu|ap)-(north|south)?(east|west)?-[0-9]+\"`.strip\n rescue\n new_resource.region\n end", "def regionextra_params\n params.require(:regionextra).permit(:RegionID, :Name, :value)\n end", "def locations\n get('locations')\n end", "def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to regions_path, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def matching_indices\n ids = RegionLethality.get_regions(params[:max])\n @provinces = Province.where(id: ids)\n\n respond_to do |format|\n format.json do\n feature_collection = Province.to_feature_collection @provinces\n render json: RGeo::GeoJSON.encode(feature_collection)\n end\n\n format.html\n end\n end", "def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end", "def asigna_pixi_geojson\n file = File.read(Rails.root.join('public', 'topojson', \"#{tipo.estandariza}.geojson\"))\n json = JSON.parse(file)\n json[region_id.to_s]\n end", "def get_address_json\r\n address = @customer.addresses.find( params[:id] )\r\n render :text => address.attributes.to_json\r\n end", "def regional_capabilities\n query('txt/wxfcs/regionalforecast/json/capabilities')\n end", "def show\n @taxon = Taxon.find(params[:id])\n @layers = @taxon.layers.page(page).per(25)\n @geo_contexts = @taxon.geo_contexts.page(page).per(25)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxon }\n end\n end", "def create\n @region = Region.new(region_params)\n\n if @region.save\n render json: @region, status: :created, location: @region\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end", "def display_with_region\n \"#{name} / #{region.name}\"\n end", "def metadata\n @beacons = Beacon.fetch_metadata(params[:PlaceID])\n @routers = Router.fetch_metadata(params[:PlaceID])\n respond_to do |format|\n format.html # nearby.html.erb\n format.json { render :json => {:beacon => @beacons, :router => @routers } }\n end\n end" ]
[ "0.724429", "0.7072834", "0.6703882", "0.6566322", "0.6507994", "0.6491359", "0.6352008", "0.6310948", "0.6268031", "0.6192416", "0.616218", "0.6153227", "0.61264884", "0.6100031", "0.6100031", "0.60758513", "0.6063183", "0.602515", "0.59884775", "0.598657", "0.595573", "0.5909258", "0.5895997", "0.58494055", "0.58465046", "0.58465046", "0.5822014", "0.57972264", "0.5778798", "0.5767848", "0.5760181", "0.5758356", "0.5754208", "0.5754208", "0.57334465", "0.5706909", "0.56942606", "0.5690814", "0.5677535", "0.5663964", "0.56615096", "0.5644315", "0.56251335", "0.56018656", "0.55734694", "0.556926", "0.55414367", "0.5536566", "0.55352527", "0.5533221", "0.5513219", "0.5502537", "0.54834294", "0.54785216", "0.54784286", "0.5476776", "0.54670453", "0.5463751", "0.5461013", "0.54352415", "0.54302955", "0.54069513", "0.5393256", "0.53920114", "0.5389852", "0.5379506", "0.5378066", "0.5350342", "0.5340682", "0.5340196", "0.53401256", "0.53361636", "0.5331703", "0.5324678", "0.5322119", "0.5308887", "0.5308887", "0.5308887", "0.5306002", "0.52949876", "0.52800906", "0.5272415", "0.52600044", "0.52554864", "0.5253117", "0.5245494", "0.52435243", "0.52424455", "0.52363527", "0.5235984", "0.52321285", "0.5229819", "0.5228306", "0.52203006", "0.5217787", "0.5216126", "0.52133036", "0.5212715", "0.5206696", "0.5202416", "0.5192407" ]
0.0
-1
POST /regionextras POST /regionextras.json
def create @regionextra = Regionextra.new(regionextra_params) respond_to do |format| if @regionextra.save format.html { redirect_to @regionextra, notice: 'Regionextra was successfully created.' } format.json { render :show, status: :created, location: @regionextra } else format.html { render :new } format.json { render json: @regionextra.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regionextra_params\n params.require(:regionextra).permit(:RegionID, :Name, :value)\n end", "def set_regionextra\n @regionextra = Regionextra.find(params[:id])\n end", "def create\n @region = Region.new(region_params)\n\n if @region.save\n render json: @region, status: :created, location: @region\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end", "def create_region\n Region.create!(params[:record])\n render :json => {}\n end", "def update\n respond_to do |format|\n if @regionextra.update(regionextra_params)\n format.html { redirect_to @regionextra, notice: 'Regionextra was successfully updated.' }\n format.json { render :show, status: :ok, location: @regionextra }\n else\n format.html { render :edit }\n format.json { render json: @regionextra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @region = Region.new(region_params)\n @regions = Region.where('active_status=? and del_status=?', true, false)\n respond_to do |format|\n if @region.save\n format.js { flash[:success] = \"#{@region.region_desc} added successfully\" }\n format.html { redirect_to @region, notice: \"Region was successfully created.\" }\n format.json { render :show, status: :created, location: @region }\n else\n format.js { render :new }\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @regionextras = Regionextra.all\n end", "def create_region\n @region = @company.companyregions.new(region_params)\n if @region.save\n render json: @region.as_json, status: :ok\n else\n render json: {region: @region.errors, status: :no_content}\n end\n end", "def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to regions_path, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @region = Region.new(params[:region])\n \n\n respond_to do |format|\n if @region.save\n format.html { redirect_to @region, flash: {success: \"Region was successfully created!\"}}\n format.json { render json: @region, status: :created, location: @region }\n else\n format.html { render action: \"new\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_region\n respond_to do |format|\n format.json{ render :json => { :region => Region.all } }\n end\n end", "def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to @region, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @region = Region.new(region_params)\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to @region, notice: 'Region was successfully created.' }\n format.json { render :show, status: :created, location: @region }\n else\n format.html { render :new }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def especies_por_region\n snib = Geoportal::Snib.new\n snib.params = params\n snib.especies\n self.resp = snib.resp\n end", "def create\n @region = Region.new(params[:region])\n\n respond_to do |format|\n if @region.save\n format.html { redirect_to @region, notice: 'Region was successfully created.' }\n format.json { render json: @region, status: :created, location: @region }\n else\n format.html { render action: \"new\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def region\n @regions = @company.companyregions\n respond_with @regions\n end", "def region_params\n params.require(:region).permit(:name, :website, :info)\n end", "def region_params\n params.require(:region).permit(Region::REGISTRABLE_ATTRIBUTES +\n [region_areas_attributes: RegionArea::REGISTRABLE_ATTRIBUTES])\n end", "def create(attributes = {})\n # Add the region\n @regions << Region.new(attributes)\n \n @regions.last\n end", "def update_region\n Region.find(params[:record][:id]).update_attributes(params[:record])\n render :json => {}\n end", "def destroy\n @regionextra.destroy\n respond_to do |format|\n format.html { redirect_to regionextras_url, notice: 'Regionextra was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def especie_region_params\n params[:especie_region]\n end", "def region_params\n params.require(:region).permit(:name)\n end", "def create\n @regionenvironment = Regionenvironment.new(regionenvironment_params)\n\n respond_to do |format|\n if @regionenvironment.save\n format.html { redirect_to @regionenvironment, notice: 'Regionenvironment was successfully created.' }\n format.json { render :show, status: :created, location: @regionenvironment }\n else\n format.html { render :new }\n format.json { render json: @regionenvironment.errors, status: :unprocessable_entity }\n end\n end\n end", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @world_region = WorldRegion.new(world_region_params)\n\n respond_to do |format|\n if @world_region.save\n format.html { redirect_to @world_region, notice: 'World region was successfully created.' }\n format.json { render :show, status: :created, location: @world_region }\n else\n format.html { render :new }\n format.json { render json: @world_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def create\n @especie_region = EspecieRegion.new(especie_region_params)\n\n respond_to do |format|\n if @especie_region.save\n format.html { redirect_to @especie_region, notice: 'Especie region was successfully created.' }\n format.json { render action: 'show', status: :created, location: @especie_region }\n else\n format.html { render action: 'new' }\n format.json { render json: @especie_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(cnpj, branch, contractId, body)\n self.class.post(\"/aldebaran-carriers/carriers/#{cnpj}/contracts/#{branch}/#{contractId}/regions\", :basic_auth => @auth, :body => body.to_json)\n end", "def create\n \n @regional = Regional.new(regional_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @regional.save\n format.html { redirect_to @regional, notice: 'Regional was successfully created.' }\n format.json { render :show, status: :created, location: @regional }\n else\n format.html { render :new }\n format.json { render json: @regional.errors, status: :unprocessable_entity }\n end\n end\n end", "def regional_params\n params.require(:regional).permit(:cod_regional, :nome)\n end", "def world_region_params\n params.require(:world_region).permit(:name)\n end", "def describe_regions(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :host_id\n\t\t\targs[:query]['HostId'] = optional[:host_id]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tself.run(args)\n\tend", "def create_regions bracket_json\n region_array = bracket_json[\"game_and_pick_list\"][\"regions\"]\n region_array.each do |region|\n Region.create({name: region['name']})\n end\n end", "def region_params\n params.require(:region).permit(:name, :type)\n end", "def show\n render json: @region\n end", "def region_params\n params.require(:region).permit(:region_desc, :comment)\n end", "def regions\n @regions = Region.all\n\n render json: @regions.to_json(:include => :vertices)\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to regions_path, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def region_item\n super\n end", "def region_utility_params\n params.require(:region_utility).permit(:name, :code, :options)\n end", "def create\n @regional = Regional.new(regional_params)\n\n respond_to do |format|\n if @regional.save\n format.html { redirect_to @regional, notice: I18n.t('messages.created') }\n format.json { render :show, status: :created, location: @regional }\n else\n format.html { render :new }\n format.json { render json: @regional.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sub_region = SubRegion.new(params[:sub_region])\n\n respond_to do |format|\n if @sub_region.save\n flash[:notice] = 'SubRegion was successfully created.'\n format.html { redirect_to(@sub_region) }\n format.xml { render :xml => @sub_region, :status => :created, :location => @sub_region }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sub_region.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @region = Region.find_by_given_name(params[:region_name])\n @data = SolarSystem.where(region_id: @region.id).to_json(:except => [:region_id, :created_at, :updated_at])\n end", "def query_tax_region_jurisdictions(options={})\n path = \"/api/v2/compliance/taxregionjurisdictions\"\n get(path, options)\n end", "def update_associated_regions\n Region.transaction(requires_new: true) do\n regions = Region.all\n regions.each do |region|\n region.recipe.ingredients.each do |ingredient|\n if ingredient.model.to_s == LandmarkSet.name && self.name == ingredient.attributes[:name]\n # Re-save the region so its geometry is updated.\n region.save!\n end\n end\n end\n end\n end", "def regions(aws_final_url)\n\tregion_name = aws_final_url[/pricing.(.*?).amazon/, 1]\n\t\n\t@aws_region = AwsRegion.find_or_create_by(region_name: region_name)\nend", "def regions\n @attributes[:regions]\n end", "def create\n @region = Region.new(region_params)\n if @region.save\n redirect_to region_path(@region)\n else\n flash[:notice] = @region.errors.full_messages.to_sentence\n redirect_to regions_new_path\n end\n end", "def update_region_of_service(*args)\n raise ArgumentError.new('The method `update_region_of_service` requires 2 arguments (service-id and region-code).') if args.size != 2\n self.class.put(\"/services/#{args[0]}/regions/#{args[-1]}.json?apikey=#{apikey}\", :body => {})\n end", "def set_regionenvironment\n @regionenvironment = Regionenvironment.find(params[:id])\n end", "def region_master_params\n params.require(:region_master).permit(:country_code, :region_id, :region_code, :name, :capital, :capital_gps, :active_status, :del_status)\n end", "def create\n @region = Region.find(params[:region_id])\n @city = @region.cities.create(city_params)\n\n respond_to do |format|\n if @city.save\n format.js { flash[:success] = \"#{@city.city_desc} added successfully\" }\n else\n format.js { render :new }\n end\n end\n end", "def create\n options = {}\n redirect_url = send(\"#{ parent_type }_regions_url\", parent, options)\n\n if params[:cancel_button]\n redirect_to redirect_url\n else\n @region = parent.regions.build(params[:region])\n respond_to do |format|\n if @region.save\n flash[:notice] = 'Region was successfully created.'\n format.html { redirect_to redirect_url }\n format.xml { render :xml => @region, :status => :created, :location => @region }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @region.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def add_region_variables env\n region = @region\n # This is an awful hack but I can't find the Ruby SDK way of getting the default region....\n region ||= Aws::SSM::Client.new(profile: @profile).config.region\n env << \"AWS_DEFAULT_REGION=#{region}\"\n env << \"AWS_REGION=#{region}\"\n end", "def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end", "def create\n @regions = Region.all\n @location = Location.new(location_params)\n\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.save\n @location.create_stat\n format.html { redirect_to @location, notice: 'Location was successfully created.' }\n format.json { render :show, status: :created, location: @location }\n else\n format.html { render :new }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @region = Region.find(params[:id])\n\n if @region.update(region_params)\n head :no_content\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end", "def region=(value)\n @region = value\n end", "def set_region\n @region = Region.find(params[:id])\n end", "def set_region\n @region = Region.find(params[:id])\n end", "def set_region\n @region = Region.find(params[:id])\n end", "def region() ; info[:region] ; end", "def region() ; info[:region] ; end", "def get_regions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UniverseApi.get_regions ...\"\n end\n if opts[:'datasource'] && !['tranquility', 'singularity'].include?(opts[:'datasource'])\n fail ArgumentError, 'invalid value for \"datasource\", must be one of tranquility, singularity'\n end\n # resource path\n local_var_path = \"/universe/regions/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'datasource'] = opts[:'datasource'] if !opts[:'datasource'].nil?\n query_params[:'user_agent'] = opts[:'user_agent'] if !opts[:'user_agent'].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 header_params[:'X-User-Agent'] = opts[:'x_user_agent'] if !opts[:'x_user_agent'].nil?\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 => 'Array<Integer>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UniverseApi#get_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 patch_cloud_regions_with_http_info(moid, cloud_regions, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.patch_cloud_regions ...'\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 CloudApi.patch_cloud_regions\"\n end\n # verify the required parameter 'cloud_regions' is set\n if @api_client.config.client_side_validation && cloud_regions.nil?\n fail ArgumentError, \"Missing the required parameter 'cloud_regions' when calling CloudApi.patch_cloud_regions\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/Regions/{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(cloud_regions)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudRegions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.patch_cloud_regions\",\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: CloudApi#patch_cloud_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def gce_region_params\n params.require(:gce_region).permit(:name, :address, :description, :default_zones, :is_active)\n end", "def index\n @regiones = Region.all\n\n render json: @regiones\n end", "def setup_region_events\n @region_events = {}\n # Region events from map note-tag\n @map.region_events.each do |region_id, event_id|\n @region_events[region_id] = event_id\n end\n # Region events from events on the map\n @map.events.each do |id, event|\n data = event.region_event\n if data.region_id != -1\n @region_events[data.region_id] = id\n end\n end\n end", "def add_region_item(opts)\n opts = check_params(opts,[:items])\n super(opts)\n end", "def set_region\n @region = Region.find(params[:region_id])\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.js { flash[:success] = \"#{@region.region_desc} updated successfully\" }\n format.html { redirect_to @region, notice: \"Region was successfully updated.\" }\n format.json { render :show, status: :ok, location: @region }\n else\n format.js { render :edit }\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_region_interest_form_params\n params.require(:profile).permit(:region_interest)\n end", "def regions\n Vultr::Resource::Region.new(@faraday)\n end", "def create\n @pc_region = PcRegion.new(params[:pc_region])\n\n respond_to do |format|\n if @pc_region.save\n format.html { redirect_to @pc_region, notice: 'Pc_region was successfully created.' }\n format.json { render json: @pc_region, status: :created, location: @pc_region }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pc_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @region_utility = RegionUtility.new(region_utility_params)\n\n respond_to do |format|\n if @region_utility.save\n format.html { redirect_to @region_utility, notice: 'Region utility was successfully created.' }\n format.json { render :show, status: :created, location: @region_utility }\n else\n format.html { render :new }\n format.json { render json: @region_utility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to @region, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to @region, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @region = parent.regions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @region }\n end\n end", "def set_region\n @region = Region.find(params[:id])\n end", "def set_region\n @region = Region.find(params[:id])\n end", "def set_region\n @region = Region.find(params[:id])\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def regions(for_select = true)\n fetch_array_for $regions, for_select\n end", "def describe_regions4_location(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeRegions4Location'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def user_region_params\n params.require(:user_region).permit(:region_name,:user_id,:region_id,:left,:right)\n end", "def create\n @locations_region = Locations::Region.new(params[:locations_region])\n index\n respond_to do |format|\n if @locations_region.save\n format.js { @notice = 'Registro guardado correctamente.' \n render 'index'\n }\n else\n format.js { @notice = 'Error al guardar el registro.'\n render action: \"new\" }\n end\n end\n end", "def create\n @gce_region = GceRegion.new(gce_region_params)\n\n respond_to do |format|\n if @gce_region.save\n format.html { redirect_to @gce_region, notice: 'Gce region was successfully created.' }\n format.json { render :show, status: :created, location: @gce_region }\n else\n format.html { render :new }\n format.json { render json: @gce_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @locations_region = Locations::Region.new\n respond_to do |format|\n format.js # new.html.erb\n end\n end", "def regions_included\n @attributes[:regions_included]\n end", "def create\n @city = City.new(city_params)\n region = Region.find(params.fetch(:region_id, 0).to_i)\n @city.region = region\n\n if @city.save\n render :show, status: :created\n else\n @message = @city.errors\n render :error, status: :unprocessable_entity\n end\n end", "def get_regions()\n\t\t{\"include_regions\"=>@include_regions,\"exclude_regions\"=>@exclude_regions}\n\tend", "def update\n respond_to do |format|\n if @regionenvironment.update(regionenvironment_params)\n format.html { redirect_to @regionenvironment, notice: 'Regionenvironment was successfully updated.' }\n format.json { render :show, status: :ok, location: @regionenvironment }\n else\n format.html { render :edit }\n format.json { render json: @regionenvironment.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete_region_definition\n super\n end", "def sales_tax_regions\n @attributes[:sales_tax_regions]\n end", "def regional_params\n params.require(:regional).permit(:regional_name, :regional_code, :office_id, contact_attributes:[:landline,:extension,:mobilenumber1,:mobilenumber2,:email],address_attributes:[:address1,:address2,:city,:state,:country])\n end", "def update\n\n @regions = Region.all\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend", "def query_tax_regions(options={})\n path = \"/api/v2/compliance/taxregions\"\n get(path, options)\n end" ]
[ "0.6437806", "0.6351956", "0.6259945", "0.61845803", "0.60703605", "0.60580385", "0.60164356", "0.5906255", "0.58810335", "0.5846377", "0.5806539", "0.5758439", "0.5758439", "0.57405806", "0.5724111", "0.571648", "0.56633353", "0.5647524", "0.5631641", "0.5614036", "0.5608624", "0.5580406", "0.5531731", "0.55294245", "0.5501573", "0.54915833", "0.548991", "0.5465243", "0.5456323", "0.5455803", "0.5432912", "0.5427329", "0.5412793", "0.53882325", "0.53721756", "0.5369628", "0.5368549", "0.5358205", "0.53530926", "0.53529733", "0.53152925", "0.53120476", "0.53091407", "0.52808535", "0.52619636", "0.5248534", "0.5238006", "0.5210376", "0.52101845", "0.52017623", "0.5195861", "0.5194961", "0.5194058", "0.51754934", "0.5168038", "0.5154943", "0.51525927", "0.5148488", "0.51412225", "0.513033", "0.513033", "0.513033", "0.512875", "0.512875", "0.5116353", "0.51112044", "0.50937885", "0.50896055", "0.50771207", "0.5069225", "0.50680894", "0.50630546", "0.5058191", "0.5039209", "0.5028082", "0.5026481", "0.50257206", "0.49917725", "0.49917725", "0.49908143", "0.4987487", "0.4987487", "0.4987487", "0.49810094", "0.49793917", "0.49759296", "0.49727845", "0.49720275", "0.49546984", "0.49535286", "0.49504828", "0.49470517", "0.49463993", "0.49318004", "0.4926801", "0.4921092", "0.49071395", "0.49023867", "0.48932043", "0.48906803" ]
0.67595834
0
PATCH/PUT /regionextras/1 PATCH/PUT /regionextras/1.json
def update respond_to do |format| if @regionextra.update(regionextra_params) format.html { redirect_to @regionextra, notice: 'Regionextra was successfully updated.' } format.json { render :show, status: :ok, location: @regionextra } else format.html { render :edit } format.json { render json: @regionextra.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @region = Region.find(params[:id])\n\n if @region.update(region_params)\n head :no_content\n else\n render json: @region.errors, status: :unprocessable_entity\n end\n end", "def update_region\n Region.find(params[:record][:id]).update_attributes(params[:record])\n render :json => {}\n end", "def update\n @region = Region.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region])\n format.html { redirect_to @region, flash: {success: \"Region was successfully updated!\"}}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @region = Region.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region])\n format.html { redirect_to @region, notice: 'Region was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @especie_region.update(especie_region_params)\n format.html { redirect_to @especie_region, notice: 'Especie region was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @especie_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to regions_path, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n @region_areas = region_areas(@region, false)\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to @region, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.html { redirect_to @region, notice: 'Region was successfully updated.' }\n format.json { render :show, status: :ok, location: @region }\n else\n format.html { render :edit }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @regionenvironment.update(regionenvironment_params)\n format.html { redirect_to @regionenvironment, notice: 'Regionenvironment was successfully updated.' }\n format.json { render :show, status: :ok, location: @regionenvironment }\n else\n format.html { render :edit }\n format.json { render json: @regionenvironment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region.update(region_params)\n format.js { flash[:success] = \"#{@region.region_desc} updated successfully\" }\n format.html { redirect_to @region, notice: \"Region was successfully updated.\" }\n format.json { render :show, status: :ok, location: @region }\n else\n format.js { render :edit }\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @region = args[:region] if args.key?(:region)\n end", "def edit\n @region = Region.find_by_given_name(params[:region_name])\n @data = SolarSystem.where(region_id: @region.id).to_json(:except => [:region_id, :created_at, :updated_at])\n end", "def update!(**args)\n @region_type = args[:region_type] if args.key?(:region_type)\n @regions = args[:regions] if args.key?(:regions)\n end", "def update_region_of_service(*args)\n raise ArgumentError.new('The method `update_region_of_service` requires 2 arguments (service-id and region-code).') if args.size != 2\n self.class.put(\"/services/#{args[0]}/regions/#{args[-1]}.json?apikey=#{apikey}\", :body => {})\n end", "def update\n options = {}\n redirect_url = send(\"#{ parent_type }_regions_url\", parent, options)\n\n if params[:cancel_button]\n redirect_to redirect_url\n else\n @region = Region.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region])\n flash[:notice] = 'Region was successfully updated.'\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @region.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update!(**args)\n @allowed_regions = args[:allowed_regions] if args.key?(:allowed_regions)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n\n @regions = Region.all\n if params[:regions]\n @location_regions = Region.find(params[:regions])\n else\n @location_regions = []\n end\n @location.regions = @location_regions\n\n respond_to do |format|\n if @location.update(location_params)\n format.html { redirect_to @location, notice: 'Location was successfully updated.' }\n format.json { render :show, status: :ok, location: @location }\n else\n format.html { render :edit }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_cloud_regions_with_http_info(moid, cloud_regions, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.patch_cloud_regions ...'\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 CloudApi.patch_cloud_regions\"\n end\n # verify the required parameter 'cloud_regions' is set\n if @api_client.config.client_side_validation && cloud_regions.nil?\n fail ArgumentError, \"Missing the required parameter 'cloud_regions' when calling CloudApi.patch_cloud_regions\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/Regions/{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(cloud_regions)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudRegions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.patch_cloud_regions\",\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: CloudApi#patch_cloud_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @region = Region.find(params[:region_id])\n respond_to do |format|\n if @city.update(city_params)\n format.js\n else\n format.js { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @regional.update(regional_params.keep_if{|p,q| q.class != ActionController::Parameters})\n @regional.address.update(regional_params[:address_attributes]) \n @regional.contact.update(regional_params[:contact_attributes])\n format.html { redirect_to @regional, notice: 'Regional was successfully updated.' }\n format.json { render :show, status: :ok, location: @regional }\n else\n format.html { render :edit }\n format.json { render json: @regional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @world_region.update(world_region_params)\n format.html { redirect_to @world_region, notice: 'World region was successfully updated.' }\n format.json { render :show, status: :ok, location: @world_region }\n else\n format.html { render :edit }\n format.json { render json: @world_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_associated_regions\n Region.transaction(requires_new: true) do\n regions = Region.all\n regions.each do |region|\n region.recipe.ingredients.each do |ingredient|\n if ingredient.model.to_s == LandmarkSet.name && self.name == ingredient.attributes[:name]\n # Re-save the region so its geometry is updated.\n region.save!\n end\n end\n end\n end\n end", "def update\n @pc_region = PcRegion.find(params[:id])\n\n respond_to do |format|\n if @pc_region.update_attributes(params[:pc_region])\n format.html { redirect_to @pc_region, notice: 'Pc_region was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pc_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sub_region = SubRegion.find(params[:id])\n\n respond_to do |format|\n if @sub_region.update_attributes(params[:sub_region])\n flash[:notice] = 'SubRegion was successfully updated.'\n format.html { redirect_to(@sub_region) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sub_region.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_region.update(user_region_params)\n @user_regions = UserRegion.all\n format.js { render :file=> 'user_regions/update_user_region.js.erb', notice: 'region was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_region }\n else\n format.html { render :edit }\n format.json { render json: @user_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_regionextra\n @regionextra = Regionextra.find(params[:id])\n end", "def update!(**args)\n @disallowed_regions = args[:disallowed_regions] if args.key?(:disallowed_regions)\n end", "def update\n respond_to do |format|\n if @regional.update(regional_params)\n format.html { redirect_to @regional, notice: I18n.t('messages.updated') }\n format.json { render :show, status: :ok, location: @regional }\n else\n format.html { render :edit }\n format.json { render json: @regional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @location_region.update(location_region_params)\n format.html { redirect_to(admin_location_regions_url, notice: 'Location region was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @location_region.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gce_region.update(gce_region_params)\n format.html { redirect_to @gce_region, notice: 'Gce region was successfully updated.' }\n format.json { render :show, status: :ok, location: @gce_region }\n else\n format.html { render :edit }\n format.json { render json: @gce_region.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 @locations_region = Locations::Region.find(params[:id])\n index\n respond_to do |format|\n if @locations_region.update_attributes(params[:locations_region])\n format.js { @notice = 'Registro actualizado correctamente.' \n render 'index'\n }\n else\n format.js { \n @notice = \"Error al actualizar el registro\"\n render action: \"edit\" }\n end\n end\n end", "def crud_put(resource_name, service_name, primary_key_name, api_options = {})\n api_options = get_defaults(api_options)\n put '/'+resource_name+'/:'+primary_key_name do\n service = settings.send(service_name)\n\n # Must Exist\n return 404 unless service.exists_by_primary_key?(params[primary_key_name.to_sym])\n\n # Get The Data\n begin\n data = JSON.parse(request.body.read)\n rescue Exception => e\n return 422\n end\n\n # Valid Update?\n return 422 unless service.valid_update?(data)\n\n # Do Update\n record = service.update_by_primary_key(params[primary_key_name.to_sym],data)\n\n # Other Error\n return 500 if record.nil?\n\n # Return new Region\n JSON.fast_generate record\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update\n @location = Location.find(params[:id])\n \n @previousMap = Location.WhereAmI(@location.region_id)\n\n #binding.pry\n respond_to do |format|\n if @location.update_attributes(params[:location])\n format.html { redirect_to @previousMap, notice: 'Location was successfully updated.' }\n format.json { respond_with_bip(@location) }\n else\n format.html { render action: \"edit\" }\n format.json { respond_with_bip(@location) }\n end\n end\n end", "def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end", "def update_array_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/arrays/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @region = RegionTemplate.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region_template])\n format.html { redirect_to(@region, :notice => 'Region was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @region.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update\n rid = params['id']\n name = params['name']\n description = params['description']\n instructions = params['instructions']\n cook_time = params['cook_time']\n quantity = params['quantity']\n serving_size = params['serving_size']\n uid = params['user_id']\n aws_params = Hash.new\n aws_params[:custom_fields] = {\n 'recipe_id' => rid,\n 'name' => name,\n 'description' => description,\n 'instructions' => instructions,\n 'cook_time' => cook_time,\n 'quantity' => quantity,\n 'serving_size' => serving_size,\n 'user_id' => uid\n }\n if Aws.update_recipe(aws_params)\n msg = {:notice => \"Recipe updated!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while save to DynamoDB!\"}\n render :json => msg\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update_cloud_regions_with_http_info(moid, cloud_regions, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudApi.update_cloud_regions ...'\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 CloudApi.update_cloud_regions\"\n end\n # verify the required parameter 'cloud_regions' is set\n if @api_client.config.client_side_validation && cloud_regions.nil?\n fail ArgumentError, \"Missing the required parameter 'cloud_regions' when calling CloudApi.update_cloud_regions\"\n end\n # resource path\n local_var_path = '/api/v1/cloud/Regions/{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(cloud_regions)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CloudRegions'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"CloudApi.update_cloud_regions\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudApi#update_cloud_regions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @territory = current_company.territories.find(params[:id])\n\n # hack to determine new and deleted regions\n adjust_region_ids\n adjust_zipcode_ids\n\n if @territory.update_attributes(params[:territory])\n respond_with(@territory)\n else\n respond_with(@territory, :status => :unprocessable_entity)\n end\n end", "def update!(**args)\n @amount = args[:amount] if args.key?(:amount)\n @region_code = args[:region_code] if args.key?(:region_code)\n end", "def update!(**args)\n @region_code = args[:region_code] if args.key?(:region_code)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update_region(new_region)\n\n #get the old region\n old_region = $drugbank_region\n\n # update key\n $drugbank_region = new_region\n\n # update the local config\n $config[\"region\"] = new_region\n\n # try to write back to config file\n begin\n File.write($config_file, JSON.pretty_generate($config)) \n return 200 \n rescue StandardError => msg \n # in case anything goes wrong, revert changes\n puts msg\n $config[\"region\"] = old_region\n $drugbank_region = old_region\n return 400\n end \n\nend", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @taxirequest = Taxirequest.find(params[:id])\n\n respond_to do |format|\n if @taxirequest.update_attributes(params[:taxirequest])\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxirequest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @region_utility.update(region_utility_params)\n format.html { redirect_to @region_utility, notice: 'Region utility was successfully updated.' }\n format.json { render :show, status: :ok, location: @region_utility }\n else\n format.html { render :edit }\n format.json { render json: @region_utility.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work.extra = process_extra if params[:work][:extra_keys] && params[:work][:extra_keys]!= \"\"\n respond_to do |format|\n if @work.update_attributes(params[:work].except(:extra_keys, :extra_values))\n Work.create_locations(@work) if @work.places#.changed?\n Location.destroy_unused\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work.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 params[:recipe][:ingredient_ids] ||= []\n @recipe = Recipe.find(params[:id])\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_region_textfield_from_province\n @province = Province.find(params[:id])\n @region = Region.find(@province.region)\n @country = Country.find(@region.country)\n @json_data = { \"region_id\" => @region.id, \"country_id\" => @country.id }\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @json_data }\n end\n end", "def update_region_textfield_from_province\n @province = Province.find(params[:id])\n @region = Region.find(@province.region)\n @country = Country.find(@region.country)\n @json_data = { \"region_id\" => @region.id, \"country_id\" => @country.id }\n\n respond_to do |format|\n format.html # update_province_textfield.html.erb does not exist! JSON only\n format.json { render json: @json_data }\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def update\n @erogenous_zone = ErogenousZone.find(params[:id])\n\n respond_to do |format|\n if @erogenous_zone.update_attributes(params[:erogenous_zone])\n format.html { redirect_to @erogenous_zone, :notice => 'Erogenous zone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @erogenous_zone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @join_region_to_place.update(join_region_to_place_params)\n format.html { redirect_to @join_region_to_place, notice: 'Join region to place was successfully updated.' }\n format.json { render :show, status: :ok, location: @join_region_to_place }\n else\n format.html { render :edit }\n format.json { render json: @join_region_to_place.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_and_give_me_a_json(additional_path, entity)\n if self.service_base_path != nil\n \n additional = \"\"\n if additional_path != nil\n additional = \"/#{additional_path}\"\n end\n \n message = self.http_client.put \"#{self.base_url}#{self.service_base_path}#{additional}.json?api_key=#{self.access_token}\", entity.to_hash\n trata_erro(message.content)\n end\n end", "def update_country_textfield_from_region\n @region = Region.find(params[:id])\n @country = Country.find(@region.country)\n\n respond_to do |format|\n format.html # update_country_textfield_from_region.html.erb does not exist! JSON only\n format.json { render json: @country }\n end\n end", "def update\n @countries = CountryMaster.all\n\n respond_to do |format|\n if @region_master.update(region_master_params)\n format.html { redirect_to @region_master, notice: \"Region master was successfully updated.\" }\n format.json { render :show, status: :ok, location: @region_master }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @region_master.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_country_textfield_from_region\n @region = Region.find(params[:id])\n @country = Country.find(@region.country)\n\n respond_to do |format|\n format.html # update_country_textfield_from_region.html.erb does not exist! JSON only\n format.json { render json: @country }\n end\n end", "def update\n if @item.update(item_params)\n render status: 201, :json => @item, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n\n \n end", "def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = [{ 'op' => operation, 'path' => path, 'value' => value }]\n patch_options = { 'If-Match' => @data['eTag'] }\n response = @client.rest_patch(@data['uri'], patch_options.merge('body' => body), @api_version)\n @client.response_handler(response)\n end", "def update!(**args)\n @localized_region_override = args[:localized_region_override] if args.key?(:localized_region_override)\n @policy_type = args[:policy_type] if args.key?(:policy_type)\n @target_region = args[:target_region] if args.key?(:target_region)\n end", "def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update!(**args)\n @localized_region = args[:localized_region] if args.key?(:localized_region)\n @mid = args[:mid] if args.key?(:mid)\n end", "def update\n respond_to do |format|\n begin\n ActiveRecord::Base.transaction do\n @client.update!(client_params)\n @client.address.update!(address_params)\n end\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n rescue\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end", "def put(path_part, payload, additional_headers = {}, &block)\n api_request { @rest.put('/REST/' + path_part, payload.to_json, additional_headers, &block) }\n end", "def update\n respond_to do |format|\n if @reserve_record.cancel_reserve\n format.html { redirect_to '/', notice: 'Reserve record was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserve_record }\n else\n format.html { redirect_to '/', notice: 'Something went wrong.' }\n format.json { render json: @reserve_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n if @region.update(region_params)\n redirect_to regions_path\n else\n flash[:notice] = @region.errors.full_messages.to_sentence\n redirect_to region_path\n end\n end", "def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe = current_user.recipes.find(params[:id])\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n \n unless params[:instructions].nil?\n @recipe.instructions.delete_all\n Instruction.multi_save(params[:instructions], @recipe)\n end\n \n unless params[:ingredients].nil?\n @recipe.ingredients.delete_all\n Ingredient.multi_save(params[:ingredients], @recipe)\n end\n\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render json: {:recipe => @recipe, :tags => @recipe.tag_list} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.find_by_id(params[:id])\n @shipping_address.region = Region.find_by_id(params[:district])\n\n respond_to do |format|\n if @shipping_address\n if @shipping_address.update_attributes(params[:shipping_address])\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to action: \"index\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_resource @ride, ride_params\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!(**args)\n @client_ids_allowed = args[:client_ids_allowed] if args.key?(:client_ids_allowed)\n @is_editorial = args[:is_editorial] if args.key?(:is_editorial)\n @modifications_allowed = args[:modifications_allowed] if args.key?(:modifications_allowed)\n @regions_allowed = args[:regions_allowed] if args.key?(:regions_allowed)\n @regions_disallowed = args[:regions_disallowed] if args.key?(:regions_disallowed)\n @requires_attribution = args[:requires_attribution] if args.key?(:requires_attribution)\n @requires_first_party_only = args[:requires_first_party_only] if args.key?(:requires_first_party_only)\n @requires_linkback = args[:requires_linkback] if args.key?(:requires_linkback)\n @requires_share_alike = args[:requires_share_alike] if args.key?(:requires_share_alike)\n end", "def update\n params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update!(**args)\n @postal_code = args[:postal_code] if args.key?(:postal_code)\n @region_code = args[:region_code] if args.key?(:region_code)\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @partner_permissions = args[:partner_permissions] if args.key?(:partner_permissions)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @client_id = args[:client_id] if args.key?(:client_id)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def put!\n request! :put\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end" ]
[ "0.6586227", "0.6577751", "0.64481485", "0.6431758", "0.6291979", "0.628427", "0.623349", "0.623349", "0.61646736", "0.6111565", "0.60827404", "0.6052583", "0.603586", "0.6031507", "0.5999401", "0.5952492", "0.5939089", "0.5910816", "0.5901486", "0.58903587", "0.585253", "0.5852369", "0.5835801", "0.5813839", "0.5806399", "0.5788464", "0.5770221", "0.57673746", "0.5752853", "0.5750001", "0.5712508", "0.5710823", "0.5703849", "0.5685699", "0.5671566", "0.56445867", "0.5609764", "0.5605774", "0.56007856", "0.55760294", "0.55416375", "0.5532913", "0.5532913", "0.5527904", "0.5522096", "0.5503653", "0.5502806", "0.5496769", "0.5496732", "0.5477088", "0.5436633", "0.5424081", "0.54201496", "0.5411111", "0.5408895", "0.53962636", "0.5396236", "0.5392268", "0.5387032", "0.5387032", "0.5378785", "0.5370136", "0.5367585", "0.5360652", "0.53605205", "0.5358186", "0.535351", "0.5352488", "0.53519434", "0.5347823", "0.53466237", "0.5342456", "0.5337682", "0.5336624", "0.53269124", "0.53250295", "0.5324372", "0.532266", "0.5320989", "0.531643", "0.531573", "0.5307102", "0.5304872", "0.5304313", "0.52946717", "0.52934736", "0.52865744", "0.52865744", "0.52785045", "0.52780163", "0.52722573", "0.52651507", "0.5255834", "0.5254851", "0.5252159", "0.52497286", "0.5240691", "0.5233939", "0.5232489", "0.5228039" ]
0.6898627
0
DELETE /regionextras/1 DELETE /regionextras/1.json
def destroy @regionextra.destroy respond_to do |format| format.html { redirect_to regionextras_url, notice: 'Regionextra was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_region\n Region.find(params[:id]).destroy\n render :json => {}\n end", "def destroy\n @region.destroy\n\n head :no_content\n end", "def destroy\n @region = Region.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @region = Region.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url flash: {success: \"Region was successfully deleted!\"}}\n format.json { head :no_content }\n end\n end", "def destroy\n @region.destroy\n respond_to do |format|\n format.html { redirect_to regions_url, notice: 'Region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @region.destroy\n respond_to do |format|\n format.html { redirect_to regions_url, notice: 'Region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @region.destroy\n respond_to do |format|\n format.html { redirect_to regions_url, notice: 'Region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @especie_region.destroy\n respond_to do |format|\n format.html { redirect_to especies_regiones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sub_region = SubRegion.find(params[:id])\n @sub_region.destroy\n\n respond_to do |format|\n format.html { redirect_to(sub_regions_url) }\n format.xml { head :ok }\n end\n end", "def delete(client, region = 'AWS_REGION')\r\n super\r\n api_id = get_id_for_api(@api_name)\r\n if api_id\r\n options = {\r\n rest_api_id: api_id\r\n }\r\n @client.delete_rest_api(options)\r\n puts \"Deleted API: #{@api_name} ID:#{api_id}\"\r\n else\r\n puts \"API Gateway Object #{@api_name} not found. Nothing to delete.\"\r\n end\r\n true\r\n end", "def destroy\n @gce_region.destroy\n respond_to do |format|\n format.html { redirect_to gce_regions_url, notice: 'Gce region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @region_utility.destroy\n respond_to do |format|\n format.html { redirect_to region_utilities_url, notice: 'Region utility was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pc_region = PcRegion.find(params[:id])\n @pc_region.destroy\n\n respond_to do |format|\n format.html { redirect_to pc_regions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @world_region.destroy\n respond_to do |format|\n format.html { redirect_to world_regions_path, notice: 'World region was successfully destroyed.' }\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 @regionenvironment.destroy\n respond_to do |format|\n format.html { redirect_to regionenvironments_url, notice: 'Regionenvironment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @region = parent.regions.find(params[:id])\n @region.destroy\n \n options = {}\n redirect_url = send(\"#{ parent_type }_regions_url\", parent, options)\n\n respond_to do |format|\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @region_master.destroy\n respond_to do |format|\n format.html { redirect_to region_masters_url, notice: \"Region master was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @region = RegionTemplate.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to(region_templates_url) }\n format.xml { head :ok }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @join_region_to_place.destroy\n respond_to do |format|\n format.html { redirect_to edit_place_path(@place), notice: 'Le région a été retirée.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @regional.destroy\n respond_to do |format|\n format.html { redirect_to regionals_url, notice: 'Regional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_region.destroy\n respond_to do |format|\n format.html { redirect_to user_regions_url, notice: 'User region was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @locations_region = Locations::Region.find(params[:id])\n @locations_region.destroy\n respond_to do |format|\n format.js { \n index\n render 'index'\n }\n end\n end", "def destroy\n @regional.destroy\n respond_to do |format|\n format.html { redirect_to regionais_url, notice: I18n.t('messages.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 @join_region_to_place.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_place_path(@place), notice: 'La région a été retirée.' }\n format.json { head :no_content }\n end\n end", "def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.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", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @vip_global_region.destroy\n respond_to do |format|\n format.html { redirect_to(admin_vip_global_regions_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted an amx vip global region: #{@vip_global_region.name}\")\n end", "def delete(reg_id)\n reg = @data.reg = Region.with_id(reg_id)\n if @data.reg.nil?\n error \"Region disappeared\"\n maintain_regions(@data.aff_id)\n return\n end\n\n klingons = []\n\n klingons << \"RDs\" if reg.has_rds?\n klingons << \"TeamPaks\" if reg.has_teampaks?\n klingons << \"Users\" if reg.has_users?\n klingons << \"news items\" if reg.has_news?\n\n if klingons.empty?\n do_delete(reg)\n else\n targets = Region.options(@data.aff_id)\n targets.delete(reg_id)\n\n if targets.size == 1\n values = {\n \"klingons\" => klingons.join(\", \"),\n \"reg_name\" => reg.reg_name,\n \"form_url\" => url(:maintain_regions, @data.aff_id)\n }\n standard_page(\"Can't Delete\", values, CANT_DELETE)\n else\n values = {\n \"klingons\" => klingons.join(\", \"),\n \"reg_opts\" => targets,\n \"reg_name\" => reg.reg_name,\n \"reg_id\" => -1,\n \"reassign\" => url(:reassign)\n }\n standard_page(\"Reassign Region\", values, REASSIGN_REGION)\n end\n end\n end", "def delete_array_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/arrays/#{args[:arrayId]}\", args)\nend", "def destroy\n @taxirequest = Taxirequest.find(params[:id])\n @taxirequest.destroy\n\n respond_to do |format|\n format.html { redirect_to taxirequests_url }\n format.json { head :no_content }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete(path_part, additional_headers = {}, &block)\n api_request { @rest.delete('/REST/' + path_part, \"\", additional_headers, &block) }\n end", "def delete(*rest) end", "def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend", "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def destroy\n @called_from = params[:called_from] || \"location\"\n @location_region.destroy\n respond_to do |format|\n format.html { redirect_to(admin_location_regions_url) }\n format.xml { head :ok }\n format.js \n end\n add_log(user: current_user, action: \"Removed #{@location_region.region.name} from #{@location_region.location.name}\")\n end", "def delete_elasticsearch_addressbase_data\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Delete.new \"#{$ELASTICSEARCH_ADDRESSBASE}\"\n request['Content-Type'] = 'application/json'\n conn.request(request)\nend", "def destroy\n id = @taxi_image.taxi_sevice_id\n @taxi_image.destroy\n respond_to do |format|\n format.html { redirect_to \"/taxi_sevices/\" + id.to_s, notice: 'Taxi image 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 destroy\n @regional_data_record.destroy\n respond_to do |format|\n format.html { redirect_to region_regional_data_records_url, notice: 'Regional data record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_region_definition\n super\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\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 @erogenous_zone = ErogenousZone.find(params[:id])\n @erogenous_zone.destroy\n\n respond_to do |format|\n format.html { redirect_to erogenous_zones_url }\n format.json { head :no_content }\n end\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete_custom_field(custom_field_id)\n url = \"#{@goseg_base_url}/custom_fields/#{custom_field_id}\"\n puts url\n return RestClient.delete(url){|response, request, result| response }\n end", "def deleteEntityInvoice_address( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/invoice_address\",params)\n end", "def delete(path)\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n date = gmtdate\n headers = {\n 'Host' => @aliyun_upload_host,\n 'Date' => date,\n 'Authorization' => sign('DELETE', bucket_path, '', '', date)\n }\n url = path_to_url(path)\n response = RestClient.delete(url, headers)\n response.code == 204 ? url : nil\n end", "def destroy\n return if @name.nil?\n delete_rest \"extra/#{@name}\"\n end", "def delete\n render json: Location.delete(params[\"id\"])\n end", "def destroy\n @beacon = Beacon.find(params[:id])\n @beacon.destroy\n\n respond_to do |format|\n format.html { redirect_to beacons_url }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @cartridge.destroy\n respond_to do |format|\n format.html { redirect_to cartridges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @region_country.destroy\n respond_to do |format|\n format.html { redirect_to region_countries_url, notice: 'Region country was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n @entry_instrument.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_instruments_url) }\n format.xml { head :ok }\n end\n end", "def 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 do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def delete_all_region_definitions\n super\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @partextra.destroy\n respond_to do |format|\n format.html { redirect_to extras_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def destroy\n @record = Location.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sales_region_country.destroy\n respond_to do |format|\n format.html { redirect_to([:admin, @sales_region_country.sales_region]) }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Unassociated #{@sales_region_country.name} with #{@sales_region_country.sales_region.name}\")\n end", "def destroy\n @beacon.destroy\n respond_to do |format|\n Beacon.gimbal_delete_beacon(@beacon)\n format.html { redirect_to owner_path(@beacon.owner), notice: 'Beacon was successfully deactivated.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxinomy = Taxinomy.find(params[:id])\n @taxinomy.destroy\n\n respond_to do |format|\n format.html { redirect_to taxinomies_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityTag( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/tag\",params)\n end", "def destroy\n authorize @incoming_service_tax\n\n @incoming_service_tax.destroy\n respond_to do |format|\n format.html { redirect_to incoming_service_taxes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fraction = Fraction.find(params[:id])\n @fraction.destroy\n\n respond_to do |format|\n format.html { redirect_to regions_url }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @geographic_item.destroy\n respond_to do |format|\n format.html { redirect_to geographic_items_url }\n format.json { head :no_content }\n end\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def delete_tax(id)\n @client.raw('delete', \"/ecommerce/taxes/#{id}\")\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def delete(resource)\n headers = base_headers.merge('Content-Type' => 'application/json')\n url = \"#{@base_url}/#{resource}\"\n\n @logger.debug(\"DELETE request Url: #{url}\")\n @logger.debug(\"-- Headers: #{headers}\")\n\n x = HTTParty.delete(url, headers: headers)\n puts x.inspect\n x\n end", "def destroy\n @invoice_tax = InvoiceTax.find(params[:id])\n @invoice_tax.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_taxes_url }\n format.json { head :no_content }\n end\n end", "def _delete(type, *args)\n type = type.to_s.camelize\n metadata = args.map { |full_name| {:full_name => full_name} }\n request :delete do |soap|\n soap.body = {\n :metadata => metadata\n }.merge(attributes!(type))\n end\n end", "def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end", "def destroy\n @distrito_origen.destroy\n respond_to do |format|\n format.html { redirect_to distrito_origens_url, notice: 'Distrito origen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\n end", "def destroy\n @aws_datum.destroy\n respond_to do |format|\n format.html { redirect_to aws_data_url, notice: 'Aws datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_data(path, &block)\n url = \"#{host}/api/v#{version}/#{path}\"\n params = Jbuilder.encode(&block) if block_given?\n params ||= {}\n resource = RestClient::Resource.new(\n url, \n headers: {\n \"uid\" => @uid,\n \"client\" => @client,\n \"access-token\" => @access_token\n }\n )\n resource.delete(params) do |response, request, result, &blk|\n case response.code\n when 200\n if response.blank?\n true\n else\n auth_data = {\n uid: response.headers[:uid],\n client: response.headers[:client],\n access_token: response.headers[:access_token]\n }\n JSON.parse(response).merge(auth_data)\n end\n when 404\n nil\n else\n JSON.parse(response)\n end\n end\n end", "def deleteEntityImage( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/image\",params)\n end" ]
[ "0.74677545", "0.7150684", "0.7055704", "0.6934371", "0.6837629", "0.6837629", "0.6837629", "0.67998534", "0.6740191", "0.66453683", "0.662495", "0.6567241", "0.6561294", "0.65553993", "0.6547393", "0.654193", "0.65335745", "0.6477611", "0.6430961", "0.6404991", "0.63848144", "0.63839436", "0.6359358", "0.63361615", "0.6295705", "0.62942946", "0.627642", "0.62465286", "0.62445503", "0.62418735", "0.62415415", "0.62196326", "0.6196528", "0.61788034", "0.61624134", "0.61546946", "0.61498135", "0.6142085", "0.613769", "0.612014", "0.611156", "0.6076207", "0.60745996", "0.6069743", "0.606195", "0.6056246", "0.60502744", "0.60455513", "0.6034225", "0.60309404", "0.6004833", "0.60003746", "0.5994737", "0.5992493", "0.5967131", "0.59647256", "0.5954365", "0.5953544", "0.59526616", "0.5945954", "0.5928197", "0.5919697", "0.5919436", "0.5912521", "0.5907579", "0.59017336", "0.5897661", "0.589761", "0.589761", "0.589761", "0.589761", "0.5889849", "0.58846384", "0.5881308", "0.5867252", "0.5858511", "0.58573276", "0.58565605", "0.58545136", "0.58536243", "0.58503914", "0.58457357", "0.5845475", "0.5837414", "0.583461", "0.58328074", "0.5831871", "0.5828262", "0.58229107", "0.5820095", "0.5817483", "0.58140504", "0.5813556", "0.5808671", "0.580003", "0.5798101", "0.5798095", "0.5798013", "0.579651", "0.578952" ]
0.7439709
1
Use callbacks to share common setup or constraints between actions.
def set_regionextra @regionextra = Regionextra.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 regionextra_params params.require(:regionextra).permit(:RegionID, :Name, :value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def 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 user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def 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 url_whitelist; 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 admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def 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.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.62905645", "0.6289235", "0.6283876", "0.62425834", "0.62410337", "0.6218672", "0.62151134", "0.62096137", "0.6192354", "0.6178057", "0.6177618", "0.61727077", "0.6162073", "0.6152049", "0.61515594", "0.61458135", "0.6122875", "0.61165285", "0.6107696", "0.6104097", "0.6091097", "0.6080201", "0.60699946", "0.6063739", "0.60206395", "0.60169303", "0.60134894", "0.601003", "0.6007347", "0.6007347", "0.6001054", "0.59997267", "0.5997844", "0.5991826", "0.5991213", "0.59911627", "0.5980111", "0.5967009", "0.59597385", "0.5958542", "0.595787", "0.5957425", "0.59522784", "0.5951228", "0.59423685", "0.5939385", "0.5939122", "0.5939122", "0.59325653", "0.5930178", "0.59248054", "0.59243476", "0.59164625", "0.59106", "0.59101933", "0.59084356", "0.5905666", "0.58975077", "0.58974737", "0.5895128", "0.58946574", "0.589308", "0.58916", "0.5885987", "0.58838505", "0.58792", "0.58723736", "0.58684355", "0.58677715", "0.5865701", "0.5865538", "0.5865288", "0.586385", "0.5862139", "0.58614355", "0.58593005", "0.5857459", "0.58541363", "0.58536613", "0.58520085", "0.585011" ]
0.0
-1
no use for show method
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show() end", "def show() end", "def show() end", "def show\n #not needed for our implementation\n end", "def show ; end", "def show\n\t\t end", "def show \r\n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n\t\t#no need b/c we just show all at once\n\tend", "def show\n # No implementation needed\n end", "def show\n # No implementation needed\n end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end" ]
[ "0.85465944", "0.85465944", "0.85465944", "0.84941363", "0.84909403", "0.84804535", "0.84666306", "0.83911175", "0.83911175", "0.83911175", "0.83911175", "0.83911175", "0.83911175", "0.83911175", "0.83911175", "0.83911175", "0.83191246", "0.82566667", "0.82566667", "0.8243141", "0.8243141", "0.8243067", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259", "0.8242259" ]
0.0
-1
code for update your comment
def update @comment = Comment.find(params[:id]) @comment.update(find_params) redirect_to new_post_comment_path(@post) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n # @comment = Comment.find(params[:id])\n end", "def comment\n\t Hookup.where(:user_id => params[:user_id], :challenge_id => params[:challenge_id]).update_attribute(:u,:c)\n end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def update\n json_update_and_sanitize(comment, comment_params, Comment)\n end", "def trigger_comment(comment) end", "def update\n @comment = @commentable_collection.find(params[:id])\n if @comment.update_attributes(params[@comment_symbol])\n redirect_to(@commentable, :notice => \"Thank you for the update in your #{@comment.class.to_s.downcase}.\")\n else\n render :action => \"edit\"\n end\n end", "def update\n use_tinymce(:simple) # in case of errors\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to_commentable(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_comment\n get_comment\n @pcp_item = @pcp_comment.pcp_item\n @pcp_subject = @pcp_item.pcp_subject\n @pcp_step = @pcp_subject.current_step\n if @pcp_step.status_closed?\n render_bad_logic t( 'pcp_items.msg.subj_closed')\n return\n end\n if user_has_permission?( :to_update ) then\n respond_to do |format|\n if @pcp_comment.update( pcp_comment_params )\n format.html { redirect_to @pcp_comment.pcp_item, notice: t( 'pcp_comments.msg.edit_ok' )}\n else\n format.html { render :edit_comment }\n end\n end\n else\n render_no_permission\n end\n end", "def update_comment(id, comment, attachments=[])\n prepare_attachments(attachments)\n record \"/msg/update_comment\", :comment_id => id,\n :comment => comment, :attachments => attachments\n end", "def update\n content = ActiveRecord::Base.sanitize(params[:comment][:content])\n id = ActiveRecord::Base.sanitize(@comment.id)\n execute_statement(\"UPDATE comments SET content = #{content} WHERE id = #{id}\")\n\n #respond_to do |format|\n # if @comment.update(comment_params)\n # format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n # format.json { render :show, status: :ok, location: @comment }\n # else\n # format.html { render :edit }\n #format.json { render json: @comment.errors, status: :unprocessable_entity }\n # end\n #end\n\n redirect_to micropost_path(@comment.micropost)\n end", "def update_comment\n @artifact_answer = ArtifactAnswer.find(params[:artifact_answer][:id])\n @artifact_answer.update_attributes(comment_params)\n end", "def update_comment_for\n begin\n donation = Donation.find(params[:id])\n comments = params[:comments]\n donation.update_attributes!(:comments => comments)\n Txn.add_audit_record(:customer_id => donation.customer_id, :logged_in_id => current_user.id,\n :order_id => donation.order_id,\n :comments => comments,\n :txn_type => \"don_edit\")\n # restore \"save comment\" button to look like a check mark\n render :js => %Q{alert('Comment saved')}\n rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid => e\n error = ActionController::Base.helpers.escape_javascript(e.message)\n render :js => %Q{alert('There was an error saving the donation comment: #{error}')}\n end\n end", "def update_comment\n result = Result.find(params[:result_id])\n result.overall_comment = params[:overall_comment]\n result.save\n render :update\n end", "def comment comment\n end", "def update\n @fbcomment = Fbcomment.find(params[:id])\n\n if @fbcomment.update(fbcomment_params) #private section#\n head :no_content\n else\n render json: @fbcomment.errors, status: :unprocessable_entity\n end\n end", "def update\n @comment = @posting.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n #@comment.create_activity :update, owner: current_user\n format.html { redirect_to postings_path, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_gist_comment(id, comment_id, comment)\n patch \"/gists/#{id}/comments/#{comment_id}\", :body => { :body => comment }\n end", "def update \n commentable = find_commentable_object\n @comment = Comment.find(params[:id])\n \n respond_with do |format|\n if @comment.update_attributes(params[:comment])\n @comment.pending_for_moderation\n @comment_updated = @comment\n @comment = Comment.new\n \n flash.now[:notice] = 'Comment was successfully updated.'\n else\n flash.now[:alert] = 'Comment was not successfully updated.'\n end\n end\n \n # respond_to do |format|\n # if @comment.update_attributes(params[:comment])\n # format.html { redirect_to(@post, :notice => 'Comment was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def update\n @comment = @commentable_collection.find(params[:id])\n authorize! :update, @comment\n if @comment.update_attributes(params[@comment_symbol])\n redirect_to(@commentable, :notice => \"Thank you for the update in your #{@comment.class.to_s.downcase}.\")\n else\n render :action => \"edit\"\n end\n end", "def update!(**args)\n @comment = args[:comment] if args.key?(:comment)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @comment = args[:comment] if args.key?(:comment)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update!(**args)\n @comment = args[:comment] if args.key?(:comment)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update_comment(issue_id_or_key, comment_id, content)\n patch(\"issues/#{issue_id_or_key}/comments/#{comment_id}\", content: content)\n end", "def update_comment(comment, content)\n bucket_id = comment.bucket.id\n\n put(\"/buckets/#{bucket_id}/comments/#{comment.id}\", body: { content: content })\n end", "def update\n return forbidden unless user_owns_comment\n return bad_request(@comment.errors.full_messages) unless @comment.update_attributes(text: comment_params[:text])\n\n render json: {data: {message: 'The comment has been updated'}}, status: :ok\n end", "def edit(comment)\n comment.gsub!(\"\\n\", \" \")\n self.p(:text=>comment).parent.parent.button(:text=>\"Edit\").click\n wait_for_ajax(2) #wait_until { self.textarea(:title=>\"Edit your comment\").present? }\n end", "def update\n @comment = Comment.find(params[:id])\n @comment.user_id = params[:user_id]\n @comment.announcement_id = params[:announcement_id]\n @comment.description = params[:description]\n @comment.save\n render json:@comment\n end", "def update\n @comment = Comment.find(params[:comment_id])\n\n if (@comment.update_attributes(comment_params))\n flash[:success] = \"Seu comentário foi atualizado com sucesso\"\n return redirect_to(Topic.find(session[:topic_id]))\n else\n return redirect_to(edit_post_comment_path(session[:topic_id]))\n end\n\n end", "def _comment db, id, text\n rowid = db.sql_comments_insert id, text\n puts \"Comment #{rowid} created\"\n handle = db.db\n \n commcount = handle.get_first_value( \"select count(id) from comments where id = #{id};\" )\n commcount = commcount.to_i\n db.sql_update \"bugs\", id, \"comment_count\", commcount\n rowid = db.sql_logs_insert id, \"comment\", Cmdapp.truncate(text, 50)\n end", "def update\n # comment ya lo carga la funcion check\n if @comment.update_attributes(:comment => params[:comment])\n redirect_to project_path(@comment.content.project, :tab=>'1'), flash: {project_success: I18n.t('comment.update_success')}\n else\n render 'edit'\n end\n end", "def update_comment\n @comment = Comment.find(params[:id])\n @comment.update(params[:comment])\n redirect \"/comments/#{@comment.id}\"\n end", "def update\n\n respond_to do |format|\n if @comment.update(comment_params)\n suggested_change_change_hash = save_suggested_changes\n save_change_log(current_user,{comment: @comment, suggested_change_changes: suggested_change_change_hash, action_type: 'edit'})\n @filter_querystring = remove_empty_elements(filter_params_all)\n format.html { redirect_to edit_comment_path(@comment,@filter_querystring), notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n set_select_options\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n=begin @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n=end\n create\n end", "def edit_comment user, new_text\n update(\n :lastEditUser => user,\n :lastEditTime => DateTime.now,\n :text => new_text,\n )\n end", "def add_comment(comment); end", "def update\n @comment = Comment.find(params[:id])\n @repbody = Repbody.find(params[:repbody_id])\n @update = Update.new\n @current = Time.now\n @comment.date = @current.strftime('%Y-%m-%d %H:%M:%S')\n respond_to do |format|\n if @comment.update_attributes(comment_params)\n @update.date = @current.strftime('%Y-%m-%d %H:%M:%S')\n @update.comment = \"コメント更新 [#{@current_user.username}] \"\n @update.repbody_id = @repbody.id\n @update.save\n if params[:revised] == '1'\n Repbody.where(:id => @update.repbody_id).update_all(:fix => 'f')\n else\n Repbody.where(:id => @update.repbody_id).update_all(:fix => 't')\n end\n format.html { redirect_to user_repbody_path(@repbody.user_id, @repbody.id), :notice => '【メッセージ】コメントは正しく更新されました.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_comment\n if params[:commit]==\"Save\"\n params[:comment].each { |key, value|\n comment=Comment.find(:all, :conditions=>[\"id=?\", key])\n if !comment.empty?\n comment[0].update_attributes(:title=>value)\n end\n }\n elsif params[:commit]==\"Cancel\"\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n comment.destroy\n end\n }\n end\n redirect_to requirements_path\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n PublicActivity::Activity.create key: 'comment.update', trackable: @comment, company_id: @comment.task.project.company_id, project_id: @comment.task.project_id, task_id: @comment.task_id, owner: current_user\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(@comment) }\n format.xml { head :ok }\n else\n @meta[:title] = \"Comment from #{@comment.author}\"\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n user = cookies[\"user_id\"]\n comment = Comment.find_by(\"id\" => params[\"id\"])\n comment.update(\"summary\" => params[\"summary\"], \"project_id\" => params[\"project_id\"], \"user_id\" => user)\n redirect_to \"/projects\", :notice => \"Comment Updated\"\n end", "def update_pull_request_comment(project_id_or_key, repository_id_or_name, pull_request_number, comment_id, content)\n patch(\"projects/#{project_id_or_key}/git/repositories/#{repository_id_or_name}/pullRequests/#{pull_request_number}/comments/#{comment_id}\", content: content)\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.snippet, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render @comment.snippet }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def comment?; end", "def comment?; end", "def update_last_comment\n if self.call\n self.call.update_attribute(:last_comment, self.body)\n end\n end", "def updateComment\n @comment = Comment.find(params[:id])\n \n\n if @comment.update_attributes(params[:comment])\n flash[:notice] = \"Comment successfully updated\"\n render(\"editComment\")\n else\n flash[:notice] = \"Comment could not be updated\"\n render(\"editComment\")\n end\n\n end", "def update_comment(update_key, comment)\n path = \"/people/~/network/updates/key=#{update_key}/update-comments\"\n body = {'comment' => comment}\n post(path, MultiJson.dump(body), \"Content-Type\" => \"application/json\")\n end", "def edit_comment\n verify_ajax_request\n verify_post_request\n require_parameters :key, :text\n\n text = Api::Utils.read_post_request_param(params[:text])\n comment = Internal.issues.editComment(params[:key], text)\n\n @issue_results = Api.issues.find(comment.issueKey)\n render :partial => 'issue/issue', :locals => {:issue => @issue_results.issues.get(0)}\n end", "def update\n @comment.update(comment_params)\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to post_path(@comment.post, :anchor => \"comment_#{@comment.id}\"), :notice => t(\"messages.comments.updated\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize(comment)\n if comment.update(comment_params)\n render json: { message: \"Feedback successfully updated!\", error: false}\n else\n render json: { message: \"Sorry, feedback could was not updated. Please try again.\", error: true }\n end\n end", "def update\n @comment = find_by_id(Comment)\n @comment.update(comment_params)\n redirect_to recipe_path(@comment.recipe)\n end", "def update_comment(post_num_input)\n puts \"WARNING: This will erase your entire previous comment text.\"\n puts \"Would you still like to update it? 'y' or 'n'\"\n input = gets.chomp\n if input == \"n\"\n puts ''\n puts \"Comment unchanged\"\n puts ''\n elsif input == \"y\"\n numbered_comments(post_num_input)\n puts \"Which comment would you like to update? (Type the corresponding number)\"\n comment_choice = gets.chomp.to_i\n array_number = comment_choice - 1\n puts \"Type in your username.\"\n username = gets.chomp.downcase\n puts \"Go ahead a write an updated comment.\"\n updated_comment = gets.chomp\n BLOG[post_num_input].comments[array_number].username = username\n BLOG[post_num_input].comments[array_number].comment = updated_comment\n puts \"Your comment has been updated!\"\n show_comments(post_num_input)\n else\n puts \"\\n\" + ERROR_MESSAGE\n puts ''\n end\n end", "def update_use_comment\n if params[:commit]==\"Save\"\n params[:comment].each { |key, value|\n comment=Comment.find(:all, :conditions=>[\"id=?\", key])\n if !comment.empty?\n comment[0].update_attributes(:title=>value)\n end\n }\n elsif params[:commit]==\"Cancel\"\n params[:comment].each { |key, value|\n comment=Comment.find(key)\n if !comment.nil?\n comment.destroy\n end\n }\n end\n redirect_to use_cases_path\n end", "def update\n @comment = @task.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(sprint_task_comments_path(@sprint,@task)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to comment_url(@entry,@comment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update\n if @comment.update(comment_params)\n head :no_content\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n end", "def update_gist_comment(gist_id, comment_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n patch \"gists/#{Gist.new gist_id}/comments/#{comment_id}\", opts\n end", "def update\r\n\t\t@comment = Comment.find(obfuscate_decrypt(params[:id], session))\r\n\t\t@commentable = @comment.commentable\r\n\r\n bOK = false\r\n if params[:commit] == \"Cancel\"\r\n # if user clicks \"Cancel\", reload the page with original data\r\n bOK = true\r\n else\r\n # make database updates before reloading the page\r\n bOK = update_options\r\n if bOK\r\n bOK = @comment.update_attributes(params[:comment])\r\n end\r\n end\r\n\r\n\t\trespond_to do |format|\r\n\t\t\tif bOK\r\n flash[:edit_comment_errors] = nil\r\n @comment = Comment.find(obfuscate_decrypt(params[:id], session))\r\n @option_ids = @comment.comment_options.pluck('option_id')\r\n @comment_option_lookups = CommentOptionLookup.order\r\n @this_comment = @comment.comment\r\n format.html { redirect_to flowsheet_user_patient_path(obfuscate_encrypt(@comment.commentable.patient_id, session)), notice: 'Comment was successfully updated.' }\r\n\t\t\t\tformat.json { head :ok }\r\n\t\t\t\tformat.js\r\n else\r\n flash[:edit_comment_errors] = @comment.errors.full_messages\r\n\t\t\t\tformat.html { redirect_to flowsheet_user_patient_path(obfuscate_encrypt(@comment.commentable.patient_id, session)), notice: \"There were problems updating your comment. Please try again:\" }\r\n\t\t\t\tformat.json { render json: @comment.errors, status: :unprocessable_entity }\r\n\t\t\t\tformat.js { render action: 'edit' }\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def update\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment.generic_item, :notice => t('notice.successfully_updated') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@comment = Comment.find( params[:id] )\t\t\n\t\t\n\t\trespond_to do |format|\n\t\t\tif not @comment.commentable.class.comments_extension.can_edit?( @comment.commentable, @comment, current_user_get )\n\t\t\t\tflash[:notice] = 'You cann\\'t edit this comment'\n\t\t\t\tformat.html { redirect_to comment_url(@comment) }\n\t\t\t\tformat.xml { head :err }\n\t\t\t\tformat.js\t{ render :update do |page| page.alert \"You cann't edit this comment\" end }\n\t\t\telsif @comment.update_attributes(params[:comment])\n\t\t\t\tflash[:notice] = 'Comment was successfully updated.'\n\t\t\t\tformat.html { redirect_to comment_url(@comment) }\n\t\t\t\tformat.xml { head :ok }\n\t\t\t\tformat.js\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @comment.errors.to_xml }\n\t\t\t\tformat.js\t\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment.submission }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t respond_to do |format|\n\t if @comment.update(comment_params)\n\t format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n\t format.json { head :no_content }\n\t else\n\t format.html { render action: 'comment' }\n\t format.json { render json: @comment.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\r\n\r\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @issue_path, notice: 'Comment is sucesfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def increment_num_comments\n\n end", "def update ; end", "def update\n @comment = Comment.find_by_permalink(params[:id])\n @post=@comment.post\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @post, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_comment!(session_key, comment_id, body)\n comment = find_comment_by_session_and_id!(session_key, comment_id)\n comment.update!(body: body)\n rescue ActiveRecord::RecordInvalid => ex\n raise Errors::MalformedRequest, ex\n end", "def update!(**args)\n @comment_id = args[:comment_id] if args.key?(:comment_id)\n @like_count = args[:like_count] if args.key?(:like_count)\n @mini_stanza = args[:mini_stanza] if args.key?(:mini_stanza)\n @published_at = args[:published_at] if args.key?(:published_at)\n @text_display = args[:text_display] if args.key?(:text_display)\n @text_original = args[:text_original] if args.key?(:text_original)\n @updated_at = args[:updated_at] if args.key?(:updated_at)\n end", "def update\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to project_sprint_user_story_comments_path, notice: 'Comment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Comment was successfully updated.'\n format.html { redirect_to(admin_comments_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @comment = @post.comments.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n flash[:notice] = 'Post was successfully updated.'\n format.html { redirect_to(edit_admin_post_comment_path(@post, @comment)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @comment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n isadmin\n respond_to do |format|\n if @comment.update(comment_params)\n format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment }\n else\n format.html { render :edit }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash.notice = I18n.t(\"helpers.notices.updated\", model: Comment.model_name.human) if @comment.save\n respond_with @comment, location: @comment.post\n end", "def update\n @comment = Comment.find(params[:id])\n\n respond_to do |format|\n if @comment.update_attributes(params[:comment])\n format.html { redirect_to @comment, notice: t(\"actions.updated\", model: t(\"activerecord.models.#{controller_name.singularize.gsub(\" \", \"\")}\"))}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_pull_request_comment(repo, comment_id, body, options = {})\n options.merge! :body => body\n patch(\"#{Repository.path repo}/pulls/comments/#{comment_id}\", options)\n end", "def update\n redirect_to \"/home/index\"\n #@comment = Comment.find(params[:id])\n #respond_to do |format|\n #if @comment.update_attributes(params[:comment])\n #format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }\n #format.json { head :ok }\n #else\n #format.html { render action: \"edit\" }\n #format.json { render json: @comment.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end" ]
[ "0.7193565", "0.7169703", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.712263", "0.7120408", "0.70499706", "0.7019292", "0.7013999", "0.70117337", "0.7009261", "0.6985837", "0.6968339", "0.69411975", "0.6902055", "0.69006985", "0.68813217", "0.6830944", "0.6826251", "0.6823865", "0.6821961", "0.68207204", "0.68207204", "0.68207204", "0.68203276", "0.6817647", "0.6811278", "0.681015", "0.6804093", "0.6802332", "0.6801822", "0.6797096", "0.67965883", "0.67962354", "0.6794415", "0.6792014", "0.67915666", "0.67628163", "0.67617327", "0.6757816", "0.6757668", "0.67571676", "0.67379826", "0.673281", "0.6730593", "0.6730593", "0.6723622", "0.6722745", "0.672186", "0.6715738", "0.6715146", "0.6711546", "0.67007285", "0.6688695", "0.66834044", "0.66797966", "0.6673296", "0.66553515", "0.6653775", "0.6653775", "0.664524", "0.6631285", "0.66284597", "0.66282123", "0.66232884", "0.6621993", "0.6621557", "0.6613999", "0.6610349", "0.6607875", "0.65999055", "0.65963715", "0.65836066", "0.65781826", "0.65753406", "0.6574668", "0.6571398", "0.65663683", "0.6565904", "0.6563399", "0.6561022", "0.65602374", "0.65602374", "0.65602374", "0.65602374", "0.65602374" ]
0.66451544
75
code for like any comment
def like @post = Post.find(params[:post_id]) @comment = @post.comments.find(params[:id]) if current_user.already_dislikes?(@comment,'Comment') like = current_user.likes.where(likeble_id: @comment.id , user_id: current_user.id ,likeble_type: 'Comment').first like.like_status = true like.save redirect_to new_post_comment_path(@post) else if current_user.already_likes?(@comment ,'Comment') redirect_to new_post_comment_path(@post) else like = @comment.likes.create() like.user_id = current_user.id like.like_status = true like.save redirect_to new_post_comment_path(@post) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment?; end", "def comment?; end", "def comment(string); end", "def comment(string); end", "def comment(string); end", "def comment(string); end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def consume_comments; end", "def comment=(_arg0); end", "def comment=(_arg0); end", "def comment=(_arg0); end", "def comment=(_arg0); end", "def wine_comment\n end", "def comment comment\n end", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def verify_comment(line) \n end", "def comments=(_arg0); end", "def comments=(_arg0); end", "def comments=(_arg0); end", "def comments=(_arg0); end", "def comments=(_arg0); end", "def process_initial_comment(tk); end", "def default_allows_comments?; true; end", "def on_comment(msg)\n end", "def lex_comment line\n # do nothing\n end", "def comment_begins?\n\t\t\n\tend", "def comments_hash_flag; end", "def comments_hash_flag; end", "def comments_hash_flag; end", "def trigger_comment(comment) end", "def comment_line?(line_source); end", "def comment_line?(line_source); end", "def comment _args\n \"comment _args;\" \n end", "def autocorrect_preceding_comments(corrector, comment); end", "def add_comment(comment); end", "def _comment\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"#\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_end_hyphen_of_hyphen_line)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_utf8)\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_comment unless _tmp\n return _tmp\n end", "def comments_range; end", "def comments_range; end", "def _comment\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"#\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_eol)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_eol)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_comment unless _tmp\n return _tmp\n end", "def last_magic_comment(source); end", "def comment_threshold\n 40\n end", "def comment_affirmative?(comment)\n !!(comment =~ /(^lgtm$)|(^:\\+1:\\s+$)|(^:ok:\\s+$)|(^looks\\s+good(?:\\s+to\\s+me)?$)|(^:shipit:\\s+$)|(^:rocket:\\s+$)|(^:100:\\s+$)/i)\n end", "def _comment\n\n _save = self.pos\n begin # sequence\n _tmp = match_string(\"#\")\n break unless _tmp\n while true # kleene\n\n _save1 = self.pos\n begin # sequence\n _save2 = self.pos\n _tmp = apply(:_eol)\n _tmp = !_tmp\n self.pos = _save2\n break unless _tmp\n _tmp = match_dot\n end while false\n unless _tmp\n self.pos = _save1\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true # end kleene\n break unless _tmp\n _tmp = apply(:_eol)\n end while false\n unless _tmp\n self.pos = _save\n end # end sequence\n\n set_failed_rule :_comment unless _tmp\n return _tmp\n end", "def nodoc_comment?(node, require_all: T.unsafe(nil)); end", "def SomeClass explainMore\n p \"no comment\"\n end", "def rude_comment\n @res.write GO_AWAY_COMMENT\n end", "def comment(&block)\n #SWALLOW THE BLOCK\n end", "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n\n\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 228:11: '//' ( . )* ( '\\\\n' | '\\\\r' )\n match( \"//\" )\n\n # at line 228:16: ( . )*\n while true # decision 6\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0 == 0xa || look_6_0 == 0xd )\n alt_6 = 2\n elsif ( look_6_0.between?( 0x0, 0x9 ) || look_6_0.between?( 0xb, 0xc ) || look_6_0.between?( 0xe, 0xffff ) )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 228:16: .\n match_any\n\n else\n break # out of loop for decision 6\n end\n end # loop for decision 6\n\n if @input.peek(1) == 0xa || @input.peek(1) == 0xd\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n # --> action\n channel = HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 49 )\n\n\n end", "def visit_Comment(comment, *rest)\n end", "def comment(*args)\n #:stopdoc:\n args.push(lambda{|*x| yield(*x) }) if block_given?\n args.push GAP if args.empty?\n jig = (Cache[:comment] ||= new(\"<!-- \".freeze, GAP, \" -->\\n\".freeze).freeze)\n jig.plug(GAP, *args)\n #:startdoc:\n end", "def add_comment comment\n \"\\n###### #{comment} ######\\n\" \n end", "def ml_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 40)\n\n type = ML_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 478:4: '/*' ( . )* '*/'\n match(\"/*\")\n # --> action\n if @input.peek(1) == ?* then type = DOC_COMMENT else channel = HIDDEN end \n # <-- action\n # at line 478:88: ( . )*\n loop do #loop 4\n alt_4 = 2\n look_4_0 = @input.peek(1)\n\n if (look_4_0 == ?*) \n look_4_1 = @input.peek(2)\n\n if (look_4_1 == ?/) \n alt_4 = 2\n elsif (look_4_1.between?(0x0000, ?.) || look_4_1.between?(?0, 0xFFFF)) \n alt_4 = 1\n\n end\n elsif (look_4_0.between?(0x0000, ?)) || look_4_0.between?(?+, 0xFFFF)) \n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line 478:88: .\n match_any\n\n else\n break #loop 4\n end\n end\n match(\"*/\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 40)\n\n end", "def preceding_comment?(node1, node2); end", "def show_something?(comment_set)\n\t\tcomment_count = comment_set.count do |line| \n\t\t Regexp.new(\"^[\\s\\t]*#{@options[:literal]}+.*$\") =~ line\n\t\tend\n\t\tputs \"#{comment_count} comment#{comment_count>1 ? 's' : ''} found.\"\n\t\tputs \"#{comment_count.zero?? \"Nothing to change.\" : \"Processing ...\"}\"\n\t end", "def parse_with_comments(source); end", "def _comment\n\n _save = self.pos\n while true # choice\n _tmp = scan(/\\A(?-mix:--.*?$)/)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_multi_comment)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_comment unless _tmp\n return _tmp\n end", "def parse_comments(comments); end", "def comment_liking?(comment)\n comment_liking_comments.include?(comment)\n end", "def load_comment(name)\n Jhead.call(\"-ci\", name.shellescape, @match, @pattern)\n end", "def comment?\n @contents[0] == :comment\n end", "def uses_legacy_comments?\n end", "def comments_hash_flag=(_arg0); end", "def comments_hash_flag=(_arg0); end", "def è_un_commento?\n @contenuto.start_with? \"#\"\n end", "def parse_comment\n s0 = @scanner.pos\n if match_str('*') == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s2 = parse_nonls\n if parse_nl == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = s2.join\n end\n end\n if s0 == :failed\n s0 = @scanner.pos\n s1 = match_str('&')\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n s2 = parse_nonls\n if parse_nl == :failed\n @scanner.pos = s0\n s0 = :failed\n else\n @reported_pos = s0\n s0 = '&' + s2.join\n end\n end\n end\n s0\n end", "def lex_en_line_comment=(_arg0); end", "def lex_en_line_comment=(_arg0); end", "def lex_en_line_comment=(_arg0); end", "def comment(text)\n@out << \"<!-- #{text} -->\"\nnil\nend", "def _Comment\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"//\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_Nl)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Nl)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n _tmp = apply(:_EmptyLine)\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_Comment unless _tmp\n return _tmp\n end", "def extract_magic_comments(processed_source); end", "def comment(text)\n @out << \"<!-- #{text} -->\"\n nil\n end", "def detect_comments\n if @input =~ %r{^\\s*[/]{2}}\n @mode = :comment\n @expression = ''\n end\n end", "def has_comment?(line)\n line =~ /#[^{]/\n end", "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 63:5: '#' (~ ( '\\\\r' | '\\\\n' ) )*\n match( 0x23 )\n # at line 63:9: (~ ( '\\\\r' | '\\\\n' ) )*\n while true # decision 22\n alt_22 = 2\n look_22_0 = @input.peek( 1 )\n\n if ( look_22_0.between?( 0x0, 0x9 ) || look_22_0.between?( 0xb, 0xc ) || look_22_0.between?( 0xe, 0xffff ) )\n alt_22 = 1\n\n end\n case alt_22\n when 1\n # at line 63:11: ~ ( '\\\\r' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 22\n end\n end # loop for decision 22\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 13 )\n\n end", "def comment\n cyc.comment(self.to_sym)\n end", "def test_html_check_comment_text\n ct = CodeTerminator::Html.new\n p \"3 test if text in comment is the same as the text of comment in code\"\n p errors = ct.match(\"exercises/html/check_comment_text.html\",\"<html><head></head><body><!-- This is a comment --></body></html>\")\n assert_equal errors.empty? , true\n end", "def comment?\n [\"text\", \"text_wholepage\"].include?(@type)\n end", "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 15)\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 148:3: ( ( '#' | '//' ) (~ '\\\\n' )* | '/*' ( . )* '*/' )\n alt_10 = 2\n look_10_0 = @input.peek(1)\n\n if (look_10_0 == ?#) \n alt_10 = 1\n elsif (look_10_0 == ?/) \n look_10_2 = @input.peek(2)\n\n if (look_10_2 == ?/) \n alt_10 = 1\n elsif (look_10_2 == ?*) \n alt_10 = 2\n else\n nvae = NoViableAlternative(\"\", 10, 2)\n raise nvae\n end\n else\n nvae = NoViableAlternative(\"\", 10, 0)\n raise nvae\n end\n case alt_10\n when 1\n # at line 148:5: ( '#' | '//' ) (~ '\\\\n' )*\n # at line 148:5: ( '#' | '//' )\n alt_7 = 2\n look_7_0 = @input.peek(1)\n\n if (look_7_0 == ?#) \n alt_7 = 1\n elsif (look_7_0 == ?/) \n alt_7 = 2\n else\n nvae = NoViableAlternative(\"\", 7, 0)\n raise nvae\n end\n case alt_7\n when 1\n # at line 148:7: '#'\n match(?#)\n\n when 2\n # at line 148:13: '//'\n match(\"//\")\n\n end\n # at line 148:20: (~ '\\\\n' )*\n while true # decision 8\n alt_8 = 2\n look_8_0 = @input.peek(1)\n\n if (look_8_0.between?(0x0000, ?\\t) || look_8_0.between?(0x000B, 0xFFFF)) \n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 148:20: ~ '\\\\n'\n if @input.peek(1).between?(0x0000, ?\\t) || @input.peek(1).between?(0x000B, 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 8\n end\n end # loop for decision 8\n\n when 2\n # at line 149:5: '/*' ( . )* '*/'\n match(\"/*\")\n # at line 149:10: ( . )*\n while true # decision 9\n alt_9 = 2\n look_9_0 = @input.peek(1)\n\n if (look_9_0 == ?*) \n look_9_1 = @input.peek(2)\n\n if (look_9_1 == ?/) \n alt_9 = 2\n elsif (look_9_1.between?(0x0000, ?.) || look_9_1.between?(?0, 0xFFFF)) \n alt_9 = 1\n\n end\n elsif (look_9_0.between?(0x0000, ?)) || look_9_0.between?(?+, 0xFFFF)) \n alt_9 = 1\n\n end\n case alt_9\n when 1\n # at line 149:10: .\n match_any\n\n else\n break # out of loop for decision 9\n end\n end # loop for decision 9\n match(\"*/\")\n\n end\n \n @state.type = type\n @state.channel = channel\n # --> action\n skip \n # <-- action\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 15)\n\n end", "def test_html_check_comment_exist\n ct = CodeTerminator::Html.new\n p \"1 test if comment exist in code with comment\"\n p errors = ct.match(\"exercises/html/check_comment_exist.html\",\"<html><head></head><body><!-- This is a comment --></body></html>\")\n assert_equal errors.empty? , true\n end" ]
[ "0.7499248", "0.7499248", "0.73988605", "0.73988605", "0.73988605", "0.73988605", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.72523737", "0.7219178", "0.69719946", "0.69719946", "0.69719946", "0.69719946", "0.6922643", "0.692201", "0.6912717", "0.6912717", "0.6912717", "0.6912717", "0.6912717", "0.6912717", "0.6818873", "0.67880195", "0.67880195", "0.67880195", "0.67880195", "0.67880195", "0.67424315", "0.6707729", "0.6684651", "0.66230077", "0.65931165", "0.6508592", "0.6508592", "0.6508592", "0.6485265", "0.64603996", "0.64603996", "0.64422405", "0.6408293", "0.63623303", "0.6361002", "0.6313028", "0.6313028", "0.6310918", "0.6308831", "0.6294556", "0.6280379", "0.6279178", "0.62758946", "0.6272842", "0.6271542", "0.625415", "0.6250947", "0.62504226", "0.6243604", "0.6233526", "0.6208958", "0.6208546", "0.62079924", "0.6205318", "0.6195854", "0.61929595", "0.6192923", "0.61789155", "0.61694175", "0.61622685", "0.61590296", "0.6157039", "0.61558837", "0.6149656", "0.6146369", "0.6146369", "0.6146369", "0.6142436", "0.6100208", "0.6099303", "0.60976624", "0.6076031", "0.60760146", "0.6065684", "0.60649455", "0.60578537", "0.60566473", "0.6049115", "0.6040595" ]
0.0
-1
code for dislike any comment
def dislike @post = Post.find(params[:post_id]) @comment = @post.comments.find(params[:id]) if current_user.already_likes?(@comment,'Comment') like = current_user.likes.where(likeble_id: @comment.id , user_id: current_user.id,likeble_type: 'Comment').first like.like_status = false like.save redirect_to new_post_comment_path(@post) else if current_user.already_dislikes?(@comment ,'Comment') redirect_to new_post_comment_path(@post) else like = @comment.likes.create() like.user_id = current_user.id like.like_status = false like.save redirect_to new_post_comment_path(@post) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dislike\n @comment.disliked_by current_user\n end", "def comment?; end", "def comment?; end", "def comment(&block)\n #SWALLOW THE BLOCK\n end", "def verb\n \"unlike\"\n end", "def lex_comment line\n # do nothing\n end", "def ignore_comment\n\traise 'Expected #' if gets[ 0 ] != '#'\nend", "def comment(string); end", "def comment(string); end", "def comment(string); end", "def comment(string); end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def comment; end", "def verify_comment(line) \n end", "def comment comment\n end", "def rude_comment\n @res.write GO_AWAY_COMMENT\n end", "def default_allows_comments?; true; end", "def wine_comment\n end", "def rude_comment\n @res.write GO_AWAY_COMMENT\n @res.status = 404\n end", "def consume_comments; end", "def comment_affirmative?(comment)\n !!(comment =~ /(^lgtm$)|(^:\\+1:\\s+$)|(^:ok:\\s+$)|(^looks\\s+good(?:\\s+to\\s+me)?$)|(^:shipit:\\s+$)|(^:rocket:\\s+$)|(^:100:\\s+$)/i)\n end", "def remove_private_comment comment\n # Workaround for gsub encoding for Ruby 1.9.2 and earlier\n empty = ''\n empty = RDoc::Encoding.change_encoding empty, comment.encoding\n\n comment = comment.gsub(%r%^--\\n.*?^\\+\\+\\n?%m, empty)\n comment.sub(%r%^--\\n.*%m, empty)\n end", "def skip_comments?\n @skip_comments\n end", "def skip &block\n annotate block do |c|\n c unless @item_rep.name == :wordcount\n end\nend", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def like_dislike\n begin\n @video.update_no_of_likes_dislikes(params[:mt_action])\n UserVideoHistory.update_like_dislike_history(current_user.id, @video.id, params[:like_dislike_status])\n @success = true\n rescue Exception => e\n @success = false\n log_error(e, \"Error occured in like_dislike action of VideosController\")\n end\n end", "def remove_coding_comment text\n text.sub(/\\A# .*coding[=:].*$/, '')\n end", "def ignores; end", "def ignore *node\n end", "def forbidding(*args, &block)\n\t\t\t\t\tself.instruction.forbidding *args, &block\n\t\t\t\tend", "def comment _args\n \"comment _args;\" \n end", "def dislike\n @opportunity = Opportunity.find(params[:id])\n role = if current_user.developer?\n current_user.role_developer\n elsif current_user.organisation?\n current_user.role_organisation\n else\n raise \"Cannot dislike opportunity - invalid role\"\n end\n raise \"Not allowed to dislike\" unless role.can_like?\n\n role.dislike!(@opportunity)\n flash[:notice] = t(\".success\", {title: @opportunity.title})\n redirect_to :root\n end", "def dislike?\n response[\"dislike\"]\n end", "def strip_comments!\n @content.reject! { |item| item[:type] == :comment }\n end", "def hide!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 108 )\n\n \n # - - - - main rule block - - - -\n # at line 967:5: 'hide' ( IGNORABLE )* '{'\n match( \"hide\" )\n # at line 967:12: ( IGNORABLE )*\n while true # decision 56\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == 0x9 || look_56_0 == 0xc || look_56_0 == 0x20 || look_56_0 == 0x2f || look_56_0 == 0x5c || look_56_0 == 0xa0 )\n alt_56 = 1\n\n end\n case alt_56\n when 1\n # at line 967:12: IGNORABLE\n ignorable!\n\n else\n break # out of loop for decision 56\n end\n end # loop for decision 56\n match( 0x7b )\n # --> action\n quick_balance( LBRACE, RBRACE ) \n # <-- action\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 108 )\n\n end", "def disliked\n dislikes.map {|dislike| dislike.dislikeable}\n end", "def autocorrect_preceding_comments(corrector, comment); end", "def unreviewed_comments\n comments.select {|comment| comment.approved.nil? }\n end", "def disabled?(visitor)\n visitor.is_a?(HamlLint::Linter) &&\n comment_configuration.disabled?(visitor.name)\n end", "def SomeClass explainMore\n p \"no comment\"\n end", "def delete_comment\n Jhead.call(\"-dc\", @match, @pattern)\n end", "def comment=(_arg0); end", "def comment=(_arg0); end", "def comment=(_arg0); end", "def comment=(_arg0); end", "def ignore; end", "def comment_threshold\n 40\n end", "def remove_comments(code_array)\n code_array.select { |line| !(line.match(Parser::COMMENT_REGEXP)) }\n end", "def without_comment_markers(text)\n text.to_s.lines.map do |line|\n line.strip.gsub(/^(\\s*(\\/\\*+|\\/\\/|\\*+\\/|\\*)+\\s?)/m, '')\n end.join(\"\\n\").strip\n end", "def ignore(*args); end", "def comment_liking?(comment)\n comment_liking_comments.include?(comment)\n end", "def escape_comment(text)\n text.gsub(/--/, '')\n end", "def rejected_comments\n comments.select {|comment| comment.approved == false }\n end", "def delete_comment!(permlink); delete_comment(permlink).broadcast!(true); end", "def deny(diagnostic = nil, &block) \n # \"None shall pass!\" --the Black Knight\n # puts reflect(&block) # activate this line and test to see all your denials!\n result = nil\n \n begin\n result = block.call\n rescue => e\n diagnostic = [diagnostic, e.inspect, *e.backtrace].compact.join(\"\\n\\t\")\n _flunk_2_0(\"\\ndeny{ \", diagnostic, block, result)\n end\n \n return unless result\n _flunk_2_0('deny{ ', diagnostic, block, result)\n end", "def set_dislike\n post = Post.find(params[:post_id])\n @dislike = post.dislikes.find(params[:id])\n end", "def unlike(obj)\n return unless likes?(obj)\n\n run_hook(:before_unlike, obj)\n Recommendable.redis.srem(Recommendable::Helpers::RedisKeyMapper.liked_set_for(obj.class, id), obj.id)\n Recommendable.redis.srem(Recommendable::Helpers::RedisKeyMapper.liked_by_set_for(obj.class, obj.id), id)\n run_hook(:after_unlike, obj)\n\n true\n end", "def delete_comments\n end", "def allow_comment?(user) \n # for now, we allow everyone\n return true \n end", "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n\n\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 228:11: '//' ( . )* ( '\\\\n' | '\\\\r' )\n match( \"//\" )\n\n # at line 228:16: ( . )*\n while true # decision 6\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0 == 0xa || look_6_0 == 0xd )\n alt_6 = 2\n elsif ( look_6_0.between?( 0x0, 0x9 ) || look_6_0.between?( 0xb, 0xc ) || look_6_0.between?( 0xe, 0xffff ) )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 228:16: .\n match_any\n\n else\n break # out of loop for decision 6\n end\n end # loop for decision 6\n\n if @input.peek(1) == 0xa || @input.peek(1) == 0xd\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n # --> action\n channel = HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 49 )\n\n\n end", "def should_be_skipped?(word)\n reject?(word) || hashtag?(word) || uri?(word) || mention?(word)\n end", "def remove_commented_out_lines\n @content = @content.gsub(%r%//.*rb_define_%, '//')\n end", "def dislikes?(object)\n dislikes.exists?(:dislikeable_id => object.id, :dislikeable_type => object.class.to_s)\n end", "def is_spam?(args)\n return call_akismet('comment-check', args)\n end", "def ignore_me\nend", "def restore_removed_comments(corrector, offense_range, node, first_child); end", "def è_un_commento?\n @contenuto.start_with? \"#\"\n end", "def dislike\n @comic.disliked_by current_user\n redirect_to :back\n end", "def accept_comments?\n !locked?\n end", "def highlight_blacklisted_words\n params[:comment_text]&.gsub(/(#{Regexp.union(BLACKLISTED_WORDS).source})/i) { |s| \"<<#{s}>>\" }\n end", "def review_hidden(review, message = \"Hidden\")\n unless review.is_public?\n return '<span class=\"quiet small\">(' + message + ')</span>'\n end\n end", "def prevent_commenting?\n prevent_commenting_until? && prevent_commenting_until > Time.current\n end", "def exclude; end", "def remove_comment comment\n return if @comments.empty?\n\n case @comments\n when Array then\n @comments.delete_if do |my_comment|\n my_comment.file == comment.file\n end\n when RDoc::Markup::Document then\n @comments.parts.delete_if do |document|\n document.file == comment.file.name\n end\n else\n raise RDoc::Error, \"BUG: unknown comment class #{@comments.class}\"\n end\n end", "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 350:9: '#' (~ ( '\\\\n' | '\\\\r' ) )*\n match( 0x23 )\n # at line 350:13: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 13\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0.between?( 0x0, 0x9 ) || look_13_0.between?( 0xb, 0xc ) || look_13_0.between?( 0xe, 0xffff ) )\n alt_13 = 1\n\n end\n case alt_13\n when 1\n # at line 350:13: ~ ( '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 13\n end\n end # loop for decision 13\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 35 )\n\n end", "def comments=(_arg0); end", "def comments=(_arg0); end", "def comments=(_arg0); end", "def comments=(_arg0); end", "def comments=(_arg0); end" ]
[ "0.71387863", "0.65847147", "0.65847147", "0.6447941", "0.6389909", "0.63740563", "0.61551577", "0.61255646", "0.61255646", "0.61255646", "0.61255646", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.61033845", "0.6025394", "0.59572476", "0.59373647", "0.59063333", "0.5897637", "0.5897548", "0.58859766", "0.5803906", "0.578419", "0.577162", "0.576843", "0.5763091", "0.5763091", "0.5763091", "0.5763091", "0.5763091", "0.5763091", "0.5738156", "0.57279783", "0.5721254", "0.571637", "0.5699065", "0.5687307", "0.5685738", "0.5682882", "0.56685114", "0.5646504", "0.5645453", "0.5642432", "0.56404483", "0.56304073", "0.5629616", "0.5618731", "0.56185603", "0.56185603", "0.56185603", "0.56185603", "0.56136876", "0.56093407", "0.560737", "0.55998415", "0.559496", "0.55843", "0.55786014", "0.55594456", "0.55577075", "0.55415076", "0.55392814", "0.54954517", "0.5494728", "0.5486602", "0.5485976", "0.54839957", "0.54831", "0.54817545", "0.54793036", "0.547771", "0.5477057", "0.5474267", "0.54678404", "0.54613066", "0.5435018", "0.5418043", "0.5416147", "0.5413652", "0.5410651", "0.5407656", "0.54047465", "0.54047465", "0.54047465", "0.54047465", "0.54047465" ]
0.59034497
32
Complete the gameOfThrones function below.
def gameOfThrones(s) words = s.split('') frequency = Hash.new(0) words.each { |word| frequency[word.downcase] += 1 } odd = 0 even = 0 frequency.each do |k,v| if v.even? even += 1 else odd += 1 end end if odd > 1 "NO" else "YES" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_game\n 52.times do\n round\n end\n output\n rematch\n end", "def run_game\n while @p1.score != @length && @p2.score != @length\n run_round\n end\n @winner = @p1 if @p1.score == @length\n @winner = @p2 if @p2.score == @length\n puts @winner.name + \" wins the game!\"\n puts \"Congratultions!\" if @winner.control == \"HUMAN\"\n @winner\n end", "def game_round\n phrases = @phrasearr.dup\n @difficulty[3].times do\n clear\n phrase = selector(phrases)\n display_to_user(phrase)\n phrases = deleter(phrase, phrases)\n end\n\n clear\n prompt = selector(@promptarr)\n display_to_user(prompt)\n input = timed_input\n print @cursor.hide\n scorer(checker(input, prompt))\n deleter(prompt, @promptarr)\n\n check_score\n end", "def create_board(board, board_checked, width, height, turns_taken, highest_score)\n #clears the terminal contents\n system \"clear\"\n #Sets the top left corner of the board_checked array to true as this block should automatically be completed\n board_checked[0][0] = \"t\"\n \n #Loops through the rows and columns of the board array and prints the contents of each position using the colorize gem\n (0..height-1).each do |row|\n\t(0..width-1).each do |column| \n\t print \" \".colorize(:background => board[row][column])\n end\n\tputs \"\"\n end\n \n #sets the number of completed board positions by looping through all the rows and columns of the board_checked array and incrementing by 1 \n #each time a \"t\" is detected\n completion_count = 0\n (0..height-1).each do |row|\n\t(0..width-1).each do |column|\n\t if board_checked[row][column] == \"t\"\n\t\tcompletion_count +=1 \n\t end\n\tend\n end\n \n #Calculates a percentage of the board completed\n completion_percentage = ((completion_count*100)/(width*height)).to_i\n #Everytime this method is called i run a completion check to see if the game has finished\n if (completion_percentage == 100) then\n #If the highest score has not already been set then it is set as the number of turns taken\n\tif highest_score == 0 then\n\t highest_score = turns_taken\n #however if the high score has been set but it is lower than the current number of turns it is not set\n #as the latest number of turns taken\n\telsif highest_score != 0 && turns_taken < highest_score then\n\t highest_score = turns_taken\n\tend\n #a congratualtions message is dislayed and the main menu method is called after the player presses enter\n\tputs \"You won after #{turns_taken} turns\"\n #the main menu is then displayed after the user presses enter\n gets()\n\tdisplay_main_menu(highest_score, width, height)\n end\n\t\t\n #outouts the turns taken and the completion percentage to the screen\n puts \"Number of Turns: #{turns_taken}\"\n puts \"Game completion: #{completion_percentage}%\"\n print \"choose a colour: \"\n #stores the users colour response\n colour_response = gets.chomp.downcase\n colour_block = \"\"\n \n #sets the value of the variable colourblock to the corresponding colorize value of the user's input\n if colour_response == \"r\" then\n\tcolour_block = :red\n elsif colour_response == \"b\" then\n\tcolour_block = :blue\n elsif colour_response == \"c\" then\n\tcolour_block = :cyan\n elsif colour_response == \"m\" then\n\tcolour_block = :magenta\n elsif colour_response == \"g\" then\n\tcolour_block = :green\n elsif colour_response == \"y\" then\n\tcolour_block = :yellow\n #if the user enters q they will return to the main menu\n elsif colour_response == \"q\" then\n\tdisplay_main_menu(highest_score, width, height)\n else\n #If the user tyes any unaccepted values then this method is recalled and they will be asked to enter a choice again\n create_board(board, board_checked, width, height, turns_taken, highest_score) \n end\n \n #loops through the board checked array to find any positions that are marked as completed\n (0..height-1).each do |row|\n\t(0..width-1).each do |column|\n #if a position is marked as completed then the contents of the board array position above, right, left and below of the completed array position are\n #checked to see if they match the colour the user has chosen as their input.\n #If they do match the users input choice then their board position is set as completed in the boardchecked array.\n\t if board_checked[row][column] == \"t\"\n\t\tif board[row][column+1] == colour_block && column != (width-1) then\n\t\t board_checked[row][column+1] = \"t\"\n\t\tend\n\t\tif board[(row-(height-1))][column] == colour_block && row != (height-1) then\n\t\t board_checked[(row-(height-1))][column] = \"t\"\n\t\tend\n\t\tif board[row][column-1] == colour_block && column != 0 then\n\t\t board_checked[row][column-1] = \"t\"\n\t\tend\n\t\tif board[row-1][column] == colour_block && row != 0 then\n\t\t board_checked[row-1][column] = \"t\"\n\t\tend\n\t end\n\tend\n end \n\n #loops through the board checked array and sets the value of the corresponding board array position where there is a position marked as \n #completed completed in the board checked array \n (0..height-1).each do |row|\n\t(0..width-1).each do |column|\n\t if board_checked[row][column] == \"t\"\n\t board[row][column] = colour_block\n\t end\n\tend\n end \n #increments the run counter and re-calls this method \n turns_taken +=1\n create_board(board, board_checked, width, height, turns_taken, highest_score) \nend", "def run_round\n\t\t\tm, random_end = set_up_round\n\t\t\tactive_players = @players.select { |id, player| player[:food] > 0 }\n\t\t\t\n\t\t\tall_choices = Hash.new\n\t\t\ttotal_hunt_choices = 0\n\t\t\tactive_players.each do |id, player|\n\t\t\t\topponents = active_players.keys.shuffle\n\t\t\t\treps = opponents.map {|opp_id| @players[opp_id][:reputation]}\n\t\t\t\tchoices = player[:player].hunt_choices(@round, player[:food], player[:reputation], m, reps)\n\t\t\t\tall_choices[id] = Hash.new\n\t\t\t\topponents.each_with_index do |opp_id, index|\n\t\t\t\t\tall_choices[id][opp_id] = choices[index]\n\t\t\t\t\tif choices[index] == 'h'\n\t\t\t\t\t\t@players[id][:hunts] += 1\n\t\t\t\t\t\t@players[id][:food] -= 6\n\t\t\t\t\t\ttotal_hunt_choices += 1\n\t\t\t\t\telse\n\t\t\t\t\t\t@players[id][:slacks] += 1\n\t\t\t\t\t\t@players[id][:food] -= 2\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treward_hunt_bounties(all_choices)\n\t\t\treward_extra_bounty(active_players, m, total_hunt_choices)\n\t\t\tset_players_remaining\n\t\t\tupdate_reputations\t\n\n\t\t\t@players_remaining < 2 || random_end\n\t\tend", "def turn(tictactoe)\n moves_avail = @tictactoe.open_squares(p1_moves(@tictactoe),p2_moves(@tictactoe))\n\n return \"Player 1\" if moves_avail.length.odd? && tictactoe.players[0].first_to_act == \"true\"\n return \"Player 2\" if moves_avail.length.even? && tictactoe.players[0].first_to_act == \"true\"\n return \"Player 2\" if moves_avail.length.odd? && tictactoe.players[0].first_to_act == \"false\"\n return \"Player 1\" if moves_avail.length.even? && tictactoe.players[0].first_to_act == \"false\"\n end", "def game_over\n puts \" ██████╗ █████╗ ███╗ ███╗███████╗\"\n sleep(1)\n puts \"██╔════╝ ██╔══██╗████╗ ████║██╔════╝\"\n sleep(1)\n puts \"██║ ███╗███████║██╔████╔██║█████╗ \"\n sleep(1)\n puts \"██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ \"\n sleep(1)\n puts \"╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗\"\n sleep(1)\n puts \"╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n puts \"██████╗ ██╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██╔═══██╗██║ ██║██╔════╝██╔══██╗ \"\n sleep(1)\n puts \"██║ ██║██║ ██║█████╗ ██████╔╝ \"\n sleep(1)\n puts \"██║ ██║╚██╗ ██╔╝██╔══╝ ██╔══██╗ \"\n sleep(1)\n puts \"╚██████╔╝ ╚████╔╝ ███████╗██║ ██║ \"\n sleep(1)\n puts \"╚═════╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ \"\n sleep(1)\n\n\n exit(0)\nend", "def game_turns\n @turn_obj.play_turn(solution, mode, @computer_solve_obj) until @turn_obj.game_over(@turn_obj.results,mode)\n end", "def lengthwin\n puts \"You have six cards, and are under 21. Congratulations, you win.\"\n restart\n end", "def phase_two\n puts \"Phase 2 has been started\"\n\n 3.times do\n immune = @borneo.individual_immunity_challenge\n puts \"#{immune} win the immunity\".blue\n voted_off_contestant = @merge_tribe.tribal_council({immune: immune})\n puts \"#{voted_off_contestant} is OUT!\".red\n end\nend", "def runner\n welcome\n first_hand = initial_round\n until first_hand >= 21\n first_hand = hit?(first_hand)\n display_card_total(first_hand)\n end\n end_game(first_hand)\nend", "def finalize_game(scores)\n if rand(2) == 1\n puts \"team1 caught the snitch!\"\n scores[0] += 30\n else\n puts \"team2 caught the snitch!\"\n scores[1] += 30\n end\n puts \"team1 scored #{scores[0]}\"\n puts \"team2 scored #{scores[1]}\"\n if scores[0] > scores[1]\n puts \"team1 wins!\"\n elsif scores[0] < scores[0]\n puts \"team2 wins!\"\n elsif scores[0] == scores[1]\n puts \"OMFG a tie!\"\n else\n puts \"LJSFAJSKJFDLKFJaljdfjlasfdjklfjlaskfj\"\n end\nend", "def runner\n welcome\n hand = initial_round\n while hand < 21\n updated_hand = hit?(hand)\n display_card_total(updated_hand)\n hand = updated_hand\n end\n end_game(updated_hand)\nend", "def winner\n puts \"██╗ ██╗██╗███╗ ██╗███╗ ██╗███████╗██████╗ \"\n sleep(1)\n puts \"██║ ██║██║████╗ ██║████╗ ██║██╔════╝██╔══██╗\"\n sleep(1)\n puts \"██║ █╗ ██║██║██╔██╗ ██║██╔██╗ ██║█████╗ ██████╔╝\"\n sleep(1)\n puts \"██║███╗██║██║██║╚██╗██║██║╚██╗██║██╔══╝ ██╔══██╗\"\n sleep(1)\n puts \"╚███╔███╔╝██║██║ ╚████║██║ ╚████║███████╗██║ ██║\"\n sleep(1)\n puts \" ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝\"\n sleep(1)\n puts \" \"\n sleep(1)\n restart_game\nend", "def play\n @board.each do|index|\n is_game_over = over?\n is_game_won = won?\n is_game_draw = draw?\n if is_game_over == true\n if is_game_won.is_a?(Array)\n winner_name = winner\n puts \"Congratulations #{winner_name}!\"\n return \" \"\n elsif is_game_draw == true\n puts \"Cat\\'s Game!\"\n return \" \"\n else\n return false\n end\n else\n if is_game_won.is_a?(Array)\n winner_name = winner\n puts \"Congratulations #{winner_name}!\"\n return \" \"\n elsif is_game_draw == true\n puts \"Cat\\'s Game!\"\n return \" \"\n else\n turn\n end\n end\n end\n turn\n end", "def run_game\n start_game\n new_board\n while true\n print_grid\n tour_joueur1\n tour_joueur2\n end\nend", "def runner\n welcome\n hand = initial_round\n until hand > 21\n new_hand = hit?(hand)\n display_card_total(new_hand)\n hand = new_hand\n end\n end_game(hand)\nend", "def runner\n welcome\n total_of_cards = initial_round\n until total_of_cards > 21\n total_of_cards = hit?(total_of_cards)\n display_card_total(total_of_cards)\n end\n end_game(total_of_cards)\nend", "def fight_scene\n\tjason = PowerRanger.new(\"Jason\", \"Red\")\n\ttommy = PowerRanger.new(\"tommy\", \"Green\")\n\tjon = Person.new(\"Jon\")\n\thoward = Person.new(\"Howard\")\n\tevilGuy_a = EvilNinja.new(\"Evil Guy 1\")\n\tevilGuy_b = EvilNinja.new(\"Evil Guy 2\")\n\n\tputs \"Two innocent bystanders are attacked by evil ninjas.\"\n\tjon.scream\n\thoward.scream\n\tjon.run\n\thoward.drink_coffee\n\thoward.run\n\n\tputs \"The Power Rangers arrive!\"\n\tjason.punch(evilGuy_a)\n\ttommy.punch(evilGuy_b)\n\tjason.rest(2)\n\ttommy.drink_coffee\n\n\tputs \"The Evil Ninjas fight back.\"\n\tevilGuy_a.punch(tommy)\n\tevilGuy_b.punch(tommy)\n\tevilGuy_a.cause_mayhem(jason)\n\n\tputs \"The Power Rangers try Megazord\"\n\tjason.use_megazord(evilGuy_a)\n\tevilGuy_a.punch(jason)\n\n\tputs \"Cmon Tommy!\"\n\ttommy.use_megazord(evilGuy_a)\n\ttommy.drink_coffee(10)\n\ttommy.use_megazord(evilGuy_b)\n\n\tputs \"Did the Power Rangers save the day?\"\n\n\tninja_array = [evilGuy_a, evilGuy_b]\n\twin = \"yes\"\n\n\tninja_array.each do |ninja|\n\t\t# p ninja.show_caffeine_level\n\t\tif ninja.caffeine_level > 0\n\t\t\twin = \"no\"\n\t\tend\n\tend\n\n\tif win == \"yes\"\n\t\tputs \"Yes!\"\n\telse\n\t\tputs \"No :(.\"\n\tend\n\nend", "def play_game\n\t\t\n\t\t2.times do \n\t\t\t\n\t\t\tputs to_s\n\t\t\t@players.each do |player|\n\n\t\t\t\tif player.is_fold\n\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\tputs player.to_s\n\t\t\t\todds = @pokeroddsproxy.get_odds(player.get_cards, get_cards, @playernumber)\n\t\t\t\t#puts player.get_cards\n\t\t\t\tif player.get_user\n\t\t\t\t\tinput = get_input\n\t\t\t\t\tamount = 0\n\t\t\t\t\tif input == 1\n\t\t\t\t\t\tamount = 100 + @bet\n\t\t\t\t\telsif input == 2\n\t\t\t\t\t\tamount = @bet\n\t\t\t\t\telse\n\t\t\t\t\t\tamount = 0\n\t\t\t\t\t\tplayer.fold\n\t\t\t\t\tend\n\t\t\t\t\tplayer.removemoney(amount)\n\t\t\t\t\t@pot = @pot + amount \n\t\t\t\telse\n\t\t\t\t\tamount = player.set_move(odds, 200, 200)\n\t\t\t\t\tplayer.removemoney(amount)\n\t\t\t\t\t@pot = @pot + amount \n\t\t\t\tend\n\t\t\t\t#puts get_cards\n\t\t\t\tputs odds\n\t\t\t\tputs\n\t\t\tend\n\t\t\t\n\t\t\tputs \"pot: #{@pot}\"\n\n\t\t\t@board << @deck.deal\n\t\tend\n\n\t\tfind_winner\n\tend", "def win_game\n clear_message_box\n @ui.place_text('THY QUEST IS OVER!'.center(20),1,2)\n (0..36).each do |i|\n hero_direction = POS_TURN.rotate!(i <=> 16)[0]\n @ui.place_text(DungeonOfDoom::CHAR_PLAYER[hero_direction], @cur_x+2, @cur_y+6, DungeonOfDoom::C_WHITE_ON_RED)\n sleep 0.1\n @ui.refresh\n end\n ask_question(\"THY SCORE=#{((@treasure*10)+(@gold_count*@stats[:experience])+@stats[:strength]+\n @stats[:vitality]+@stats[:agility]).round}\",MSG_KEY)\n end", "def end_game\n self.update_attribute(:finished, true)\n\n s1 = 0\n s2 = 0\n for pw in self.playedWords\n if (pw.player == self.players[0])\n s1 += pw.word.length\n else\n s2 += pw.word.length\n end\n end\n if (s1 > s2)\n players[0].addVictory\n elsif (s1 < s2)\n players[1].addVictory\n end\n end", "def turns\n while @board.game_check == false\n player_process(@player1_name,@player1_symbol,@turn)\n break if @board.game_check == true\n\n player_process(@player2_name,@player2_symbol,@turn)\n end\n @board.display\n print \"\\nDone \\n\"\n end", "def runner\n welcome\n hand=initial_round\n until hand>21 do\n hand=hit?(hand)\n display_card_total(hand)\n end\n end_game(hand)\nend", "def runner\n welcome\n tot = initial_round\n until tot > 21\n \t tot = hit?(tot)\n end\nend_game(tot)\n\nend", "def play\n 10.times do |i|\n \n# i is the chance number\n puts \"This is chance #{i+1} of 10\"\n \n# current guess is what player typed in\n current_guess = @player.guess_code\n \n# standing is based on method evaluate guess with paramater current guess from above\n standing = evaluate_guess(current_guess)\n \n# if correct for all 4\n if standing[:exact].length == 4\n# display to user\n puts \"You won!\"\n return\n else\n puts \"#{standing[:exact].length} Exact Matches\"\n puts \"#{standing[:near].length} Near Matches\"\n end\n end\n \n# if reached end of loop, that means guesses out & not all perfectly matched\n\n # If we make it this far, we have used up \n # all of our turns and lost.\n puts \"You lost!\"\n return\n end", "def phase_one\n introduction\n title \"Phase One\"\n losers = 0\n immune_members = []\n 8.times do\n losing_tribe = @borneo.tribes.shuffle.first\n puts \"The losing tribe is #{losing_tribe}\".red\n loser = losing_tribe.tribal_council()#no immune members\n puts \" The loser member is #{loser}\"\n losers += 1\n counting = 0\n @borneo.tribes.each{|tribe| counting += tribe.members.length}\n puts \" #{losers} gone!\"\n puts \" #{counting} remaining players\"\n end\nend", "def play_game\n loop do\n @turn += 1\n puts '########################################'\n puts \"Turn #{@turn}:\"\n puts '########################################'\n @players.each do |p|\n puts ''\n p.turn\n next unless !@is_final_round && p.score >= 3000\n @is_final_round = true\n final_round(p)\n break\n end\n\n break if @is_final_round\n end\n end", "def play(quit_after)\n round = 0\n until @lose\n tet = random_tetrimino\n energies = {}\n (0...@board_width).each do |column|\n begin\n root = reslove_collision(tet, get_unoccupied_index(column))\n energies[root] = energy(tet.indexes(root))\n rescue BoardEdgeError\n next\n rescue BoardTopError\n next\n end\n end\n \n tet.indexes(energies.sort_by { |_key, value| value }[0][0]).each { |index| @board[index] = 1 }\n \n remove_filled_rows\n \n round += 1\n @lose = true if round == quit_after\n end\n print_board\n end", "def end_round\n @hands.each{ |hand| hand.stand }\n end", "def phase_one\n\t#Intro\n\n\t\t@borneo.tribes.each do |tribe|\n\t\tputs \"Welcome #{tribe}\".green\n\t\tend\n\nprint_header(\"For Phase 1, you will now compete in 8 challenges for immunity. Good luck!\")\n\n\t8.times do\n\t\timmunity_challenge_losing_tribe = @borneo.immunity_challenge\n\t\tputs \"#{immunity_challenge_losing_tribe}\".green + \" has lost the immunity challenge and must now vote out 1 member.\"\n\t\tmember_voted_off = immunity_challenge_losing_tribe.tribal_council\n\tend\t\nend", "def runner\n welcome\n sum_cards=initial_round\n until sum_cards >21 do \n sum_cards = hit?(sum_cards)\n end\n end_game(sum_cards)\nend", "def runner\n welcome\n hand = initial_round\n \n until hand > 21\n hand = hit?(hand)\n display_card_total(hand)\n end\n \n end_game(hand)\nend", "def runner\n # code runner here\n welcome\n existinghand = initial_round\n while existinghand <=21 do\n existinghand = hit? (existinghand)\n display_card_total(existinghand)\n end\nend_game (existinghand)\nend", "def runner\n welcome\n hand = initial_round\n until hand > 21 do \n hand = hit?(hand)\n display_card_total(hand)\n end\n end_game(hand)\nend", "def runner\n welcome\n final_hand = initial_round\n until final_hand > 21\n final_hand = hit?(final_hand)\n display_card_total(final_hand)\n end\n end_game(final_hand)\nend", "def finalize_game(scores)\nend", "def after_battle_effect\n case $game_process\n when 0\n framed_narration('After having a quick break in the tent, you felt refreshed.(HP restored)')\n @player[:hp] = 45\n when 1\n framed_narration('You had a BBQ around the campfire and felt energised to move on. (HP restored)')\n @player[:hp] = 45\n when 2\n framed_narration('Donkey Kong fainted, and the illusion of the Jungle was expelled.')\n next_line\n framed_narration('Congrats! you have completed the game!')\n next_line\n framed_narration('Thanks for playing! See you in the future!')\n next_line\n framed_narration('-- Mark Huang')\n exit\n end\n end", "def runner\n players_hand = 0\n welcome \n players_hand = initial_round\n until players_hand > 21 do\n players_hand = hit?(players_hand)\n display_card_total(players_hand)\n end\n return end_game(players_hand)\nend", "def runner\n welcome\n hand = initial_round\n until hand > 21 do\n hand = hit?(hand)\n display_card_total(hand)\n end\n end_game(hand)\nend", "def game_turns\n system(\"clear\")\n until @game.game_over?\n # render both boards\n puts \"COMPUTER BOARD\".center(40, \"=\") # change this to make it dynamic according to board size\n puts @game.computer_board.render\n puts \"PLAYER BOARD\".center(40, \"=\")\n puts @game.player_board.render(true)\n # instruct player to enter coordinate to shoot\n puts \"Enter the coordinate for your shot:\"\n # get user input\n user_input = nil\n loop do\n user_input = gets.chomp.upcase\n if @game.computer_board.valid_coordinate?(user_input) && !@game.computer_board.cell_fired_upon?(user_input)\n @game.computer_board.fire_upon_cell(user_input)\n break\n elsif @game.computer_board.valid_coordinate?(user_input) && @game.computer_board.cell_fired_upon?(user_input)\n puts \"You already fired upon that coordinate. Please try again:\"\n else\n puts \"That was not a valid coordinate. Use the syntax: A1\"\n end\n end\n # computer randomly fires at player board\n if @game.computer_hunting == true\n # randomly select an adjacent coord to previous hit\n chosen_adjacent_shot = @game.player_board.adjacent_coords(@game.most_recent_hit).sample\n @game.player_board.fire_upon_cell(chosen_adjacent_shot)\n @game.player_board.previous_computer_shot = chosen_adjacent_shot\n else\n @game.player_board.fire_upon_random_cell\n end\n # computer checks result of shot to see if it should be hunting nearby\n if @game.player_board.cells[@game.player_board.previous_computer_shot].render == \"H\"\n @game.computer_hunting = true\n @game.most_recent_hit = @game.player_board.previous_computer_shot\n elsif @game.player_board.cells[@game.player_board.previous_computer_shot].render == \"X\"\n @game.computer_hunting = false\n end\n # display results of both players' shots\n puts \"Your shot on #{user_input} #{@game.computer_board.shot_result(user_input)}.\"\n puts \"My shot on #{@game.player_board.previous_computer_shot} #{@game.player_board.shot_result(@game.player_board.previous_computer_shot)}.\"\n end\n end", "def finish_round\n @hands = []\n end", "def runner\r\n welcome\r\n sleep(0.75)\r\n ct = initial_round\r\n until ct > 21\r\n ct = hit?(ct)\r\n display_card_total(ct)\r\n end\r\n end_game(ct)\r\nend", "def runner\n welcome\n hand = hit?(initial_round)\n until hand > 21\n display_card_total(hand)\n hand += hit?(deal_card)\n end\n display_card_total(hand)\n end_game(hand)\nend", "def runner\n welcome\n game = initial_round\n until game > 21 do\n game = hit?(game)\n display_card_total(game)\n end\nend_game(game)\nend", "def phase_one\n puts \"Get ready to start Part 1.\".light_grey\n puts \"Each Tribe will participate in an immunity challenge.\".light_grey\n puts \"The losing Tribe will then vote someone off the island.\".light_grey\n 8.times do \n\t#Sets variable for tribe loser of immunity challege\n\tlosing_tribe = @borneo.immunity_challenge \n\tputs \"#{losing_tribe} \".red + \"has lost the challenge and will vote someone off the island.\"\n\t#Losing tribe holds tribal council and votes off member\n\tmember_voted_off = losing_tribe.tribal_council\n\tputs \"Sadly, \" + \"#{member_voted_off} \".green + \"has been voted off the island.\"\n end\nend", "def ante_up\n @players.each do |player|\n system('clear')\n puts \"#{player}, your bankroll is $#{player.bankroll}\"\n puts \"Are you playing this round? Ante is $#{ANTE}. Y / N\"\n if gets.chomp.upcase.include?('Y')\n take_bet(player, ANTE)\n @current_players << player\n else\n leave_table?(player)\n return 'quit' if game_over?\n end\n sleep(1)\n end\n @turn_counter = @current_players.length\n if @turn_counter < 2\n repay_ante\n raise \"There must be at least 2 players per hand.\".colorize(:red)\n end\n end", "def finish_round!\n raise Exceptions::NoWinner if @players_in_round.nil?\n # The winner is the Player with the highest hand_value.\n @round_winner = @players_in_round.sort_by do |player|\n hand_value(player.hand)\n end.reverse.first\n @round_winner.chips += @pot\n @pot = INITIAL_POT\n end", "def play_night_phase\n increment_phase\n villager_to_kill = @players.reject {|player| player.is_werewolf? }.random\n\n # healer picks someone at random, is ignorant of seer's cleared list\n if @players.any? { |player| player.is_healer? } && villager_to_kill == @players.random\n log \"NIGHT: Wolves kill nobody; the #{villager_to_kill.class} was healed\"\n else\n log \"NIGHT: Wolves kill a #{villager_to_kill.class}\"\n @players.delete villager_to_kill\n end\n end", "def game()\n\t\t@taken = 0\n\n\t\twhile true do\n\n\t\t\tif (@taken > 7) then\n\t\t\t\tsystem \"cls\"\n\t\t\t\tputs (\"<=============PLAYER #{@player}=============>\")\n\t\t\t\tputs ()\n\t\t\t\tshow\n\t\t\t\tputs ()\n\t\t\t\treturn 0\n\t\t\tend\n\n\t\t\t# player 1 is assumed to take X and player 2 assumed to take Y\n\t\t\t# this setting can be changed in the turn() method\n\t\t\t@player = 1\n\t\t\tif turn(@player) then\n\t\t\t\tsystem \"cls\"\n\t\t\t\tputs (\"<=============PLAYER #{@player}=============>\")\n\t\t\t\tputs ()\n\t\t\t\tshow\n\t\t\t\tputs ()\n\t\t\t\treturn 1\n\t\t\tend\n\n\t\t\t@player = 2\n\t\t\tif turn(@player) then\n\t\t\t\tsystem \"cls\"\n\t\t\t\tputs (\"<=============PLAYER #{@player}=============>\")\n\t\t\t\tputs ()\n\t\t\t\tshow\n\t\t\t\tputs ()\n\t\t\t\treturn 2\n\t\t\tend\n\n\t\tend\n\tend", "def finalize_game\n\n end", "def play_round()\n # Deal hand to all players\n for p in @players\n hand = Hand.new\n hand.deal_hand()\n p.hands << hand\n end\n\n # Dealer deals his own hand\n @dealers_hand.deal_hand()\n\n # Gather bets from all players\n for p in @players\n game_state()\n puts \"Player #{p.player}, how much would you like to bet?\"\n bet_amount = gets.chomp.to_i\n while !(p.can_bet(bet_amount))\n game_state()\n puts \"Player #{p.player}, that's an invalid bet! Try again.\"\n bet_amount = gets.chomp.to_i\n end\n p.bet(bet_amount)\n\n for h in p.hands\n p.place_bet(h)\n end\n end\n\n # Allow players to finalize their bet(s) and hand(s)\n for player in @players\n for hand in player.hands\n while !(hand.is_stand())\n valid_moves = ['h']\n if hand.is_split and player.can_bet_double()\n valid_moves += ['s', 'd', 'e']\n elsif player.can_bet_double()\n valid_moves += ['d', 'e']\n else\n valid_moves += ['e']\n end\n\n game_state()\n puts \"Player #{player.player}, what would you like to do for your #{hand} hand? Your valid moves: #{valid_moves}\"\n puts \"Legend: ['h' -> hit, 's' -> split, 'd' -> double down, 'e' -> end turn]\"\n\n move = gets.chomp\n while !(valid_moves.include? move)\n game_state()\n puts \"Player #{player.player}, that is not a valid move! Try again. Your valid moves: #{valid_moves}\"\n puts \"Legend: ['h' -> hit, 's' -> split, 'd' -> double down, 'e' -> end turn]\"\n move = gets.chomp\n end\n\n case move\n when 'h'\n hand.hit()\n when 's'\n new_hand = hand.split()\n player.place_bet(new_hand)\n\n hand.hit()\n new_hand.hit()\n player.hands << new_hand\n when 'd'\n player.place_bet(hand)\n hand.hit()\n hand.stand()\n when 'e'\n hand.stand()\n end\n\n if hand.is_bust()\n puts \"You busted!\"\n hand.stand()\n end\n end\n end\n end\n\n # Determine dealer's ending hand\n while @dealers_hand.value() < 17\n @dealers_hand.hit()\n end\n\n puts \"-=-=-=- Resulting Hands For This Round -=-=-=-\"\n game_state()\n\n # Determine winnings of each player and their hand(s)\n for player in @players\n for hand in player.hands\n if (!hand.is_bust() and @dealers_hand.is_bust()) or (!hand.is_bust() and !@dealers_hand.is_bust and hand.value() > @dealers_hand.value())\n player.win_hand(hand)\n puts \"Player #{player.player}'s #{hand} beat the dealer's #{@dealers_hand} hand!\"\n elsif (hand.is_bust() and @dealers_hand.is_bust()) or (hand.value() == @dealers_hand.value())\n player.tie_hand(hand)\n puts \"Player #{player.player}'s #{hand} tied with the dealer's #{@dealers_hand} hand!\"\n else\n player.lose_hand(hand)\n puts \"Player #{player.player}'s #{hand} lost to the dealer's #{@dealers_hand} hand! :(\"\n end\n end\n end\n\n # Determine who can continue playing\n continuing_players = []\n for player in @players\n if player.money != 0\n continuing_players << player\n else\n puts \"Player #{player.player} has no money and is eliminated!\"\n end\n end\n @players = continuing_players\n\n # Clear all playing hands.\n for player in @players\n player.hands = []\n player.bet = 0\n end\n end", "def winnerChecker2(tictac_array, humanPlayer, computerPlayer)\n \n if tictac_array[0] == \"#{humanPlayer}\" && tictac_array[4] == \"#{humanPlayer}\" && tictac_array[8] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[0] == \"#{humanPlayer}\" && tictac_array[1] == \"#{humanPlayer}\" && tictac_array[2] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n \n elsif tictac_array[0] == \"#{humanPlayer}\" && tictac_array[6] == \"#{humanPlayer}\" && tictac_array[3] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[1] == \"#{humanPlayer}\" && tictac_array[4] == \"#{humanPlayer}\" && tictac_array[7] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n \n elsif tictac_array[2] == \"#{humanPlayer}\" && tictac_array[4] == \"#{humanPlayer}\" && tictac_array[6] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n \n elsif tictac_array[2] == \"#{humanPlayer}\" && tictac_array[5] == \"#{humanPlayer}\" && tictac_array[8] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[3] == \"#{humanPlayer}\" && tictac_array[0] == \"#{humanPlayer}\" && tictac_array[6] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[3] == \"#{humanPlayer}\" && tictac_array[4] == \"#{humanPlayer}\" && tictac_array[5] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[6] == \"#{humanPlayer}\" && tictac_array[7] == \"#{humanPlayer}\" && tictac_array[8] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n \n elsif tictac_array[0] == \"#{computerPlayer}\" && tictac_array[4] == \"#{computerPlayer}\" && tictac_array[8] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[0] == \"#{computerPlayer}\" && tictac_array[1] == \"#{computerPlayer}\" && tictac_array[2] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n \n elsif tictac_array[0] == \"#{computerPlayer}\" && tictac_array[6] == \"#{computerPlayer}\" && tictac_array[3] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[1] == \"#{computerPlayer}\" && tictac_array[4] == \"#{computerPlayer}\" && tictac_array[7] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n \n elsif tictac_array[2] == \"#{computerPlayer}\" && tictac_array[4] == \"#{computerPlayer}\" && tictac_array[6] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n \n elsif tictac_array[2] == \"#{computerPlayer}\" && tictac_array[5] == \"#{computerPlayer}\" && tictac_array[8] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[3] == \"#{computerPlayer}\" && tictac_array[0] == \"#{computerPlayer}\" && tictac_array[6] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[3] == \"#{computerPlayer}\" && tictac_array[4] == \"#{computerPlayer}\" && tictac_array[5] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[6] == \"#{computerPlayer}\" && tictac_array[7] == \"#{computerPlayer}\" && tictac_array[8] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n \n else\n puts \"Cat's Game! Neither #{computerPlayer} nor #{humanPlayer} win this time! Sorry!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n end\n\nend", "def run_full_game()\n set_max_games()\n name_all_players()\n puts play_through_set_of_games()\n set_determine_set_winner()\n puts overall_winner_message()\n end", "def hero_battle_sequence(hero, villain)\n Battle.start_a_battle(hero, villain)\n battle = Battle.all.last\n hero_hp = hero.hp\n villain_hp = villain.hp\n while villain.hp > 0 && hero.hp > 0 do\n attack(hero, villain)\n line\n puts \"The hero's health is #{hero.hp}\"\n puts \"The villain's health is #{villain.hp}\"\n end\n #if villain and hero looses battle, hero dies and villain gets sent to insane asylum\n if villain.hp <= 0 && hero.hp <= 0\n battle.villain_lost(villain)\n line\n puts \"'Today, we lost a great hero. #{hero.name}, or as many of you knew them as #{hero.alter_ego}, was one of the best of us. It is a sad day for #{battle.location}'\"\n line\n battle.hero_lost(hero)\n battle.update(hero_win: false)\n villain.update(hp: villain_hp)\n line\n puts \"'Darn foiled again, but you'll never end me!' said #{villain.name} as they were lead to the asylum.\"\n puts \"GAME OVER\"\n line\n elsif villain.hp <=0 \n battle.villain_lost(villain)\n battle.update(hero_win: true)\n hero.update(hp: hero_hp)\n villain.update(hp: villain_hp)\n line\n puts \"#{hero.alter_ego} has won the battle\"\n puts \"'Darn foiled again, but you'll never end me!' said #{villain.name} as they were lead to the asylum.\"\n line\n battle.destruction\n hero_main_menu(hero)\n #destroys the hero, the hero lost and died \n elsif hero.hp <= 0\n puts \"#{villain.alter_ego} has won the battle\"\n puts \"'Today, we lost a great hero. #{hero.name}, or as many of you knew them as #{hero.alter_ego}, was one of the best of us. It is a sad day for #{battle.location}'\"\n puts \"GAME OVER\"\n line\n battle.hero_lost(hero)\n battle.update(hero_win: false)\n villain.update(hp: villain_hp)\n end\n end", "def runner\n welcome\n total = initial_round\n\n until total >= 21 do\n total = hit?(total)\n end\n end_game(total)\n \n \n \nend", "def winnerChecker1(tictac_array, humanPlayer, computerPlayer)\n \n if tictac_array[0] == \"#{humanPlayer}\" && tictac_array[4] == \"#{humanPlayer}\" && tictac_array[8] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[0] == \"#{humanPlayer}\" && tictac_array[1] == \"#{humanPlayer}\" && tictac_array[2] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n \n elsif tictac_array[0] == \"#{humanPlayer}\" && tictac_array[6] == \"#{humanPlayer}\" && tictac_array[3] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[1] == \"#{humanPlayer}\" && tictac_array[4] == \"#{humanPlayer}\" && tictac_array[7] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n \n elsif tictac_array[2] == \"#{humanPlayer}\" && tictac_array[4] == \"#{humanPlayer}\" && tictac_array[6] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n \n elsif tictac_array[2] == \"#{humanPlayer}\" && tictac_array[5] == \"#{humanPlayer}\" && tictac_array[8] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[3] == \"#{humanPlayer}\" && tictac_array[0] == \"#{humanPlayer}\" && tictac_array[6] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[3] == \"#{humanPlayer}\" && tictac_array[4] == \"#{humanPlayer}\" && tictac_array[5] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n\n elsif tictac_array[6] == \"#{humanPlayer}\" && tictac_array[7] == \"#{humanPlayer}\" && tictac_array[8] == \"#{humanPlayer}\" \n puts \"#{humanPlayer} wins! Congratulations!\"\n exit\n \n elsif tictac_array[0] == \"#{computerPlayer}\" && tictac_array[4] == \"#{computerPlayer}\" && tictac_array[8] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[0] == \"#{computerPlayer}\" && tictac_array[1] == \"#{computerPlayer}\" && tictac_array[2] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n \n elsif tictac_array[0] == \"#{computerPlayer}\" && tictac_array[6] == \"#{computerPlayer}\" && tictac_array[3] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[1] == \"#{computerPlayer}\" && tictac_array[4] == \"#{computerPlayer}\" && tictac_array[7] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n \n elsif tictac_array[2] == \"#{computerPlayer}\" && tictac_array[4] == \"#{computerPlayer}\" && tictac_array[6] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n \n elsif tictac_array[2] == \"#{computerPlayer}\" && tictac_array[5] == \"#{computerPlayer}\" && tictac_array[8] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[3] == \"#{computerPlayer}\" && tictac_array[0] == \"#{computerPlayer}\" && tictac_array[6] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[3] == \"#{computerPlayer}\" && tictac_array[4] == \"#{computerPlayer}\" && tictac_array[5] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n\n elsif tictac_array[6] == \"#{computerPlayer}\" && tictac_array[7] == \"#{computerPlayer}\" && tictac_array[8] == \"#{computerPlayer}\" \n puts \"#{computerPlayer} wins! Congratulations!\"\n puts \"#{tictac_array[0..2]}\"\n puts \"#{tictac_array[3..5]}\"\n puts \"#{tictac_array[6..8]}\" \n exit\n \n end\n\nend", "def runner\nwelcome\ncards=initial_round\ncards=hit?(cards)\ndisplay_card_total(cards)\nwhile cards<21\n cards=hit?(cards)\nend\nend_game(cards)\nend", "def runner\n welcome\n sum = initial_round\n until sum > 21\n sum = hit?(sum)\n end\n end_game(sum)\nend", "def runner\n welcome\n total_cards = initial_round\n until total_cards > 21 do\n total_cards = hit?(total_cards)\n display_card_total(total_cards)\n end\n end_game(total_cards)\nend", "def runner\n welcome\n total = initial_round\n while(total <= 21) do\n total = hit?(total)\n end\n end_game(total)\nend", "def end_round\n\t\tshow_hands unless round_over? \n\t\tremaining_hands = players.reject{ |p| p.folded? }\n\t\t.map{|p| p.hand }\n\t\twinner = Hand.highest_hand(remaining_hands)\n\t\twinner.take_winnings(@pot)\n\t\t\n\t\tputs \"This round's winner is #{winner.name}, with a #{winner.hand.rank}.\".colorize(:light_white).colorize(:background => :magenta)\n\t\t\n\tend", "def runner\n welcome\n n = initial_round\n until n > 21\n n = hit?(n)\n display_card_total(n)\n end\n end_game(n)\nend", "def game_over\n print_board\n if victor?\n puts \"#{self.victor?} is the victor!\"\n elsif @turn_count == 10\n puts \"Game is a draw.\"\n end\n end", "def game\n player = 0\n dices = 5\n winner = -1\n @@scoreTable.displayPoints( @@listPlayer )\n loop do\n dices.times{ @@listPlayer[ player ].arrayV << rollDice }\n @@listPlayer[ player ].arrayV.sort!\n @@scoreTable.displayTurn(@@listPlayer, player)\n dices = updatePlayer( player )\n player+=1 if dices == 0\n dices = 5 if dices == 0\n player = 0 if player >= @@listPlayer.length\n winner = @@scoreTable.winner(@@listPlayer)\n break if winner >= 0\n 2.times { puts \"\\n \" }\n end\n @@scoreTable.celebrate(winner,@@listPlayer)\n system('clear')\n puts \"~~~~~~~~~~~~~~~~ Thanks for playing ~~~~~~~~~~~~~~~~~\"\n puts \"~~~~~~~~~~~~~ Gem created by rubiocanino ~~~~~~~~~~~~~\"\n puts \"\"\n end", "def end_game()\n get_winners()\n end", "def help(game)\n\n game = game.game()\n\n #Algorithm for each columns\n (0...game.nCol).each do |i|\n\n cell = nil #reset\n nbTent = 0\n\n whiteZone = FindWhiteZone.find(game, 0, i)\n whiteZone.each do |zone| #Count the number of possible tent\n if (zone.size % 2 == 0)\n nbTent += (zone.size / 2)\n else\n nbTent += (zone.size / 2) + 1\n cell = zone.first #registered answer\n end\n end\n nbTent += Count.count(game, :tent, 0, i)\n\n if nbTent != game.colClues[i]\n break\n end\n\n if !(cell.nil?) #We find an answer\n return HelpAllPossibilitiesGiveItRow.new(cell, game.correction.cols[i], \"tent\")\n end\n\n end\n\n #Algorithm for each row\n (0...game.nRow).each do |i|\n\n cell = nil #reset\n nbTent = 0\n\n whiteZone = FindWhiteZone.find(game, 1, i)\n whiteZone.each do |zone| #Count the number of possible tents\n if (zone.size % 2 == 0)\n nbTent += (zone.size / 2)\n else\n nbTent += (zone.size / 2) + 1\n cell = zone.first #register answer\n end\n end\n nbTent += Count.count(game, :tent, 1, i)\n\n if nbTent == game.rowClues[i]\n\n if !(cell.nil?) #We find an answer\n return HelpAllPossibilitiesGiveItColumn.new(cell, game.correction.rows[i], \"tent\")\n end\n\n end\n end\n\n return HelpNotFound.new()\n\n end", "def threat_row_for_ai(board)\n defend_spaces = {}\n WINNING_COMBINATIONS.each { |threat| defend_spaces[threat] = 0 }\n WINNING_COMBINATIONS.each do |threat|\n threat.each do |is_x|\n defend_spaces[threat] += 1 if board[is_x] == PLAYER_MARKER\n if board[is_x] == COMPUTER_MARKER\n defend_spaces[threat] = 0\n break\n end\n end\n end\n defend_spaces\nend", "def runner\n welcome\n cards=0\n while cards<21\n cards=initial_round\n cards=hit?(cards)\n display_card_total(cards)\n end\n end_game(cards)\nend", "def runner\n # code runner here\n welcome\n player_hand = initial_round\n until player_hand > 21\n player_hand = hit?(player_hand)\n end\n display_card_total(player_hand)\n end_game(player_hand)\nend", "def playerTurn(a)\n \ninitMatrix (a)\npaintMatrix (a)\nplayer = 1\nstop = false\ncounterTie = 0\n\t\n\twhile (!stop)\n\t\t\tcounterTie = counterTie + 1\n\t\t\tinsertNumber(a,player)\n\t\t\tpaintMatrix(a)\n\n\t\t\tif(player == 1)\n\t\t\t\tif(checker(a, player))\n\t\t\t\tputs \"Player #{player} wins\".yellow\n\t\t\t\tputs\"\"\n\t\t\t\tstop = true\n\t\t\t\tend\n\t\t\t\tplayer = player + 1\n\t\t\telse\n\t\t\t\tif(checker(a, player))\n\t\t\t\tputs \"Player #{player} wins\".yellow\n\t\t\t\tputs\"\"\n\t\t\t\tstop = true\n\t\t\t\tend\n\t\t\t\tplayer = player - 1\n\t\t\tend\n\t\t\t\tif(counterTie == a.length**2)\n\t\t\t\tstop = true\n\t\t\t\tputs \"TIE\".yellow\n\t\t\t\tputs\"\"\n\t\t\t\tend\n\tend \nend", "def run_game\n\n word_game = WordGame.new\n\n\n welcome\n # loops through the steps of the game until user runs out of guesses\n # or they win\n until word_game.max_guesses == 0\n puts \"Wrong guesses: #{word_game.wrong_guesses.join(\" \")}\\n\\n\"\n puts \"Word: #{word_game.progress.join(\" \")}\\n\\n\"\n roses = pruning_roses(word_game.max_guesses)\n puts print_ascii_art(roses)\n winning?(word_game)\n guess = prompt_user(word_game)\n input_evaluation(guess, word_game)\n # clears the terminal screen so that it feels more like a game play\n # to the user (fun fact: doesn't work on Windows computer)\n system(\"clear\")\n\n # conditional statement that prints the empty pot\n # if the user loses\n if word_game.max_guesses == 0\n system(\"clear\")\n roses = pruning_roses(word_game.max_guesses)\n puts print_ascii_art(roses)\n end\n end\n\n puts \"Sorry you lost :(\"\n puts \"The word you were looking for was #{word_game.word.join}\"\nend", "def house_rules\n while get_hand_value(@dealer_hand) < 17\n puts \"HOUSE HITS\".colorize(:red)\n hit(@dealer_hand)\n puts \"HOUSE NOW SITS ON #{get_hand_value(@dealer_hand)}\".colorize(:blue)\n return\n end \nend", "def runner\n welcome\n userHand = initial_round\n until userHand > 21\n userHand = hit?(userHand)\n display_card_total(userHand)\n end\n end_game(userHand)\nend", "def simulateUntilDeath\n @round_num = 0\n starting_elves = @characters.filter { |c| c.type == \"E\"}.length\n until gameOver?\n @round_num += 1\n puts \"round: #{@round_num}\"\n self.round\n # End game if an elf dies\n # puts @characters.filter { |c| c.type == \"E\"}\n if @characters.filter { |c| c.type == \"E\"}.length != starting_elves\n puts \"Elf death @ round #{@round_num} hp #{@elf_attack}\"\n return [@round_num, totalHP, false]\n end\n end\n return [@round_num, totalHP, true ]\n end", "def game_handler\n\t\twhile @guesses_remaining > -1\n\t\t\tdisplay_game\n\t\t\t# Check for win condition here to properly display when we're out of guesses.\n\t\t\tif (game_finished?)\n\t\t\t\tend_game\n\t\t\tend\n\t\t\tmake_turn\n\t\tend\n\tend", "def phase_3(player, bots)\r\n puts \" ----------------------- \"\r\n puts \" -- TOUR ENNEMI -- \"\r\n puts \" ----------------------- \"\r\n puts \"\"\r\n i = 0\r\n bots.each do |bot|\r\n if i > 0 && bot.life_points > 0\r\n bot.attacks(player)\r\n end\r\n i += 1\r\n end\r\nend", "def play\n t0_setup\n row_to_find\n\n for @it in 1..12\n unless @over == true\n iterate_and_check\n big_input_array\n big_result_array\n plot_game\n defeat\n end\n end\n\n end", "def runner\n welcome\n cards = initial_round\n\n until cards > 21\n cards = hit?(cards)\n display_card_total(cards)\n end\n end_game(cards)\nend", "def start_round!\n @players.each { |player| player.empty_hand! }\n @players_in_round.replace(@players)\n @round_winner = nil\n ante_up!\n deal_initial_hands\n end", "def game()\n $match_index_arr = []\n $guessed = []\n $turns = 10\n $index = 0\n $end_game = false\n\n get_word()\n puts $hangman[$index]\n show_word()\n loop do \n get_letter()\n letter_match()\n no_match()\n puts $hangman[$index]\n remaining_guesses()\n dash_to_letter()\n puts \"\"\n show_word()\n puts \"\"\n guessed_wrong_letter()\n game_over()\n if $end_game\n break\n end\n check_guess_count()\n end\n return\n end", "def who_win?\n count_turn = 0\n\n while count_turn <= 0 \n \n if @A1.content == \"O\" && @A2.content == \"O\" && @A3.content == \"O\" && @A1.content == \"X\" && @A2.content == \"X\" && @A3.content == \"X\"\n @winning_game = true \n end\n\n if @B1.content == \"O\" && @B2.content == \"O\" && @B3.content == \"O\" && @B1.content == \"X\" && @B2.content == \"X\" && @B3.content == \"X\"\n @winning_game = true \n end\n\n if @C1.content == \"O\" && @C2.content == \"O\" && @C3.content == \"O\" && @C1.content == \"X\" && @C2.content == \"X\" && @C3.content == \"X\"\n @winning_game = true \n end\n\n if @A1.content == \"O\" && @B1.content == \"O\" && @C1.content == \"O\" && @A1.content == \"X\" && @B1.content == \"X\" && @C1.content == \"X\"\n @winning_game = true \n end\n\n if @A2.content == \"O\" && @B2.content == \"O\" && @C2.content == \"O\" && @A2.content == \"X\" && @B2.content == \"X\" && @C2.content == \"X\"\n @winning_game = true \n end\n\n if @A3.content == \"O\" && @B3.content == \"O\" && @C3.content == \"O\" && @A3.content == \"X\" && @B3.content == \"X\" && @C3.content == \"X\"\n @winning_game = true \n end\n\n if @A1.content == \"O\" && @B2.content == \"O\" && @C3.content == \"O\" && @A1.content == \"X\" && @B2.content == \"X\" && @C3.content == \"X\"\n @winning_game = true \n end\n\n if @A3.content == \"O\" && @B2.content == \"O\" && @C1.content == \"O\" && @A3.content == \"X\" && @B2.content == \"X\" && @C1.content == \"X\"\n @winning_game = true \n end\n\n count_turn += 1\n end\n\n if count_turn == 9 \n equality_game = true\n end\n end", "def wizards_trial()\n\n\t#Initialize hats and gnomes\n\thats = [\"red\", \"white\"]\n\tgnomes = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\", \"ten\"]\n\n\t#Line up gnomes and place hats on them\n\thatted_gnomes = {}\n\tgnomes.each do |gnome|\n\t\thatted_gnomes[gnome] = hats.sample\n\tend\n\n\t#Have gnomes guess which color hats they have on\n\tguesses = gnome_guesses(hatted_gnomes)\n\n\t#Judge the gnomes\n\tjudge_the_gnomes(guesses, hatted_gnomes)\n\nend", "def gameover(game)\n if game.full_board?() #Si el tablero se lleno primero es que hubo un empate\n puts \"GAME OVER\"\n return \"draw\"\n end\n if game.match() #Si se tiene match de fichas\n puts \"TIC TAC TOE\"\n return \"win\"\n end\nend", "def play\n\t\t@current_turn = 0\n\t\t@current_player = @hunter\n\t\tplayers.each{|p| p.write(game_parameters)}\n\t\tuntil is_game_over?\n\t\t\tpre_turn_wall_count = @walls.size\n\t\t\treport_state_to_spectators\n\t\t\t@current_player.take_turn\n\t\t\t# Only print the board every 10 turns or if a wall was added or removed\n\t\t\tprint_minified_board() if @current_turn%10 == 0 || @walls.size != pre_turn_wall_count\n\t\t\tadvance_turn!\n\t\t\tprint \"#{@current_turn} \"\n\t\tend\n\t\tresult = report_winner\n\t\tcleanup_players!\n\t\tcleanup_spectators!\n\t\tresult\t# Returns this so the EvasionServer can save results\n\tend", "def runner # code runner here\nwelcome \nhand = initial_round\nuntil hand>21 do\n hand = hit?(hand)\n display_card_total(hand)\nend\nend_game(hand)\nend", "def settle_round\n @io.prep_round_results\n for player in @players\n for hand in player.hands\n if player.is_dealer\n @io.show_hands(player)\n else\n # This shouldn't happen unless we quit in the middle of a hand\n # or we're playing god.\n if @dealer.hand.total < 17 and not @play_god\n @dealer.hand.play(@shoe)\n end\n \n # Use total_high in case our hand is soft\n if (hand.total_high > @dealer.hand.total and \\\n not hand.is_bust) or (@dealer.hand.is_bust and \\\n not hand.is_bust)\n if hand.is_bj and not hand.is_even_money\n player.win_bet((hand.bet * BLACKJACK_PAYS) + \\\n hand.bet)\n @dealer.pay(hand.bet * BLACKJACK_PAYS)\n else\n player.win_bet(hand.bet * 2)\n @dealer.pay(hand.bet)\n end\n @io.player_wins(player, hand)\n elsif hand.total_high == @dealer.hand.total\n if hand.is_bj and hand.is_even_money\n player.win_bet(hand.bet * 2)\n @dealer.pay(hand.bet)\n @io.player_wins(player, hand)\n else\n player.win_bet(hand.bet)\n @io.player_pushes(player, hand)\n end\n else\n @dealer.win_bet(hand.bet)\n @io.player_loses(player, hand)\n end\n end\n end\n player.finish_round\n end\n\n # Check to see if player is out of money, or doesn't have min_bet\n for player in @players\n unless player.is_dealer\n if player.bankroll == 0 or player.bankroll < @min_bet\n @io.player_out_of_money(player, @min_bet)\n @broke_players[@broke_players.length] = player\n @players.delete(player)\n throw :quit if @players.length == 1\n end\n end\n end\n end", "def phase_one\n puts \"~~~~~PHASE 1~~~~~\".yellow\n 8.times do\n @borneo.immunity_challenge.tribal_council\n puts\n end\nend", "def runner\n welcome\n arg = initial_round\n until arg > 21\n arg = hit?(arg)\n display_card_total(arg)\nend\nend_game(arg)\nend", "def runner\n welcome\n total = initial_round\n until total > 21\n total = hit?(total)\n display_card_total(total)\n end\n end_game(total)\n\t end", "def runner\n welcome \n cards = initial_round\n until cards > 21 do\n cards = hit?(cards)\n display_card_total(cards)\n end\n end_game(cards) \nend", "def game\n puts \"\\nIs your baby (H)ungry, (S)leepy, or (P)oopy?\"\n sleep(1)\n puts \"\\nWAAAAAAAH\"\n puts \"\\nWAH WAH WAH\"\n sleep(1)\n puts \"\\nWAAAAAAAH\"\n\n computer = \"hsp\"[rand(3)].chr\n player = gets.chomp.downcase\n case [player, computer]\n when ['h','h'],['s','s'],['p','p']\n puts \"\\nAwesome! The baby stopped crying. You're doing great.\"\n puts \"\\nThe baby is #{computer}.\"\n roundcount\n again\n when ['s','p'],['p','h'],['h','s']\n puts \"\\nWAAAAH! Something else must be wrong! Try again.\"\n puts \"\\nThe baby is #{computer}.\"\n roundcount\n again\n when ['s','h'],['p','s'],['h','p']\n puts \"\\nDon't just stand there! Help your baby!\"\n puts \"\\nThe baby is #{computer}.\"\n roundcount\n again\n else\n puts \"\\nType the first letter of what the baby needs to stop crying!\"\n game\n end\nend", "def run_game\n\t\tif @player_turn == nil\n\t\t\tputs \"white team name:\"\n\t\t\ta = gets.chomp\n\t\t\tputs \"black team name:\"\n\t\t\tb = gets.chomp\n\t\tend\n\t\t@player1 = Player.new(:white, a)\n\t\t@player2 = Player.new(:black, b)\n\t\t@player_turn == nil ? player_turn = @player1 : player_turn = @player_turn\n\t\t@check == nil ? check = false : check = @check\n\t\t#If there are no possible moves, either checkmate or stalemate\n\t\twhile @board.any_possible_moves?(player_turn.color, check)\n\t\t\t\n\t\t\t@check = check\n\t\t\t@player_turn = player_turn\n\n\t\t\tchoose_move(player_turn, check)\n\t\t\t\n\t\t\tcheck = @check\n\t\t\tplayer_turn = @player_turn\n\t\t\t\n\t\t\tif @viable_move == true\n\t\t\t\tplayer_turn = switch_player(player_turn)\n\t\t\t\t@board.turn_off_en_passant(player_turn.color)\n\t\t\tend\n\t\t\t@board.cause_check(player_turn.color, check) == true ? check = true : check = false\n\t\tend\n\t\t#Decides end of game: checkmate or stalemate\n\t\tif check == true\n\t\t\t@board.display(player_turn, check)\n\t\t\tprint \"#{player_turn.name} can no longer make a move! CHECKMATE! \\n\"\n\t\t\tprint \"#{switch_player(player_turn).name} WINS!!!\"\n\t\telse\n\t\t\tprint \"This contest ends in a stalemate.\"\n\t\tend\n\tend", "def runner\n welcome\n x = initial_round\n y = hit?(x)\n display_card_total(y)\n until y > 21\n y = hit?(y)\n end\nend_game(y)\nend", "def completion(board,width,height,count,finished_game_counter,current_score)\n \n #define individual counters for each colour\n counter_red = 0\n counter_green = 0\n counter_blue = 0\n counter_yellow = 0\n counter_magenta = 0\n counter_cyan = 0\n \n #iterate through array and add 1 to the counter of the colour\n board.each do |row|\n row.each do |column| \n if column == :red\n counter_red += 1\n elsif column == :green\n counter_green += 1\n elsif column == :blue\n counter_blue += 1\n elsif column == :yellow\n counter_yellow += 1\n elsif column == :magenta\n counter_magenta += 1\n elsif column == :cyan\n counter_cyan += 1\n end \n end\n end\n \n #calculates the percentage of the game completed depending on which colour is in the top left element\n if board[0][0] == :red\n percentage = (counter_red*100)/(width*height)\n elsif board[0][0] == :green\n percentage = (counter_green*100)/(width*height)\n elsif board[0][0] == :blue\n percentage = (counter_blue*100)/(width*height)\n elsif board[0][0] == :yellow\n percentage = (counter_yellow*100)/(width*height)\n elsif board[0][0] == :magenta\n percentage = (counter_magenta*100)/(width*height)\n elsif board[0][0] == :cyan\n percentage = (counter_cyan*100)/(width*height)\n end\n puts \"#{percentage}%\"\n \n #the if statement below lets the program know if the user has finished a game yet or not\n if percentage == 100\n finished_game_counter += 1\n if finished_game_counter == 1\n current_score = count\n high_score(current_score,finished_game_counter)\n \n #if the user has finished more than 1 game, then the program will compare its previous score with \n #its current score.\n elsif finished_game_counter > 1\n if count < current_score\n current_score = count\n high_score(current_score,finished_game_counter)\n end\n end\n congratulation(percentage,count,current_score,finished_game_counter,width,height)\n end\nend", "def game\r\n setup_castle\r\n setup_stats\r\n print \"WHAT IS YOUR NAME, EXPLORER? \"\r\n $name = gets.strip\r\n status(\"GREETING\")\r\n activity = \"\"\r\n monster_at_room = 0\r\n while $roomnumber != 0 and $roomnumber != 11 and $strength>0\r\n if (get_room_stuff(6)<0)\r\n monster_at_room = 1\r\n else\r\n monster_at_room = 0\r\n end\r\n\r\n if $roomnumber == 9\r\n room_9\r\n else\r\n if activity == \"ROOM\" or activity == \"I\"\r\n status(activity)\r\n else\r\n status(\"\")\r\n end\r\n\r\n print(\"WHAT DO YOU WANT TO DO? \")\r\n if monster_at_room != 0\r\n f_or_fl = errorHandler(gets.strip.to_s)\r\n if f_or_fl == \"F\" or f_or_fl == \"R\"\r\n activity = send(f_or_fl.to_sym) \r\n else\r\n puts(\"YOU MUST FIGHT OR RUN, NOTHING ELSE\")\r\n end\r\n else\r\n activity = send(errorHandler(gets.strip.to_s).to_sym) \r\n end\r\n puts(\"\\n\")\r\n asterSick\r\n puts(\"\\n\")\r\n end\r\n end\r\n if $strength<=0\r\n puts \"YOU HAVE DIED.........\"\r\n score_method\r\n end\r\n\r\n if $roomnumber == 11\r\n puts (\"YOU'VE DONE IT!!\")\r\n sleep(1)\r\n puts(\"\\nTHAT WAS THE EXIT FROM THE CASTLE\")\r\n sleep(1)\r\n puts(\"\\nYOU HAVE SUCCEEDED,#{$name}!\")\r\n sleep(1)\r\n puts(\"\\nYOU MANAGED TO GET OUT OF THE CASTLE\")\r\n sleep(1)\r\n puts(\"\\nWELL DONE!\\n\")\r\n sleep(1) \r\n score_method\r\n end\r\nend", "def runner\n welcome\n cards_total = initial_round\n until cards_total > 21\n cards_total = hit?(cards_total)\n display_card_total(cards_total)\n end\n end_game(cards_total)\nend", "def turn\n #I always start a turn by show the player the latest values of all the piles by calling my showPiles function\n showPiles()\n\n #Here i set some out-of-bounds defaults so that the until statements start false, allowing the player to make their choice\n take = -1\n pile = -1\n sum = 0\n\n #at the start of the turn I check if the sum of the sticks in all the piles is 0 or less, indicating that there are no more moves to make and this player has won\n $piles.each do |i|\n sum += i.count\n end\n if sum <= 0\n puts $name.to_name + \", You win!!\"\n return #this return is to exit the turn function returning to the rest of the code which is empty, essentially stopping the game now that it has been determined to be won and over.\n end\n\n #this ensures that the pile chosen is a valid number,because until it is it wont stop asking\n until pile.between?(0,2)\n print $name.to_name + \", Choose a pile:\"\n pile = gets.chomp().to_i\n end\n\n #this ensures that the pile chosen isnt already empty by restarting the turn if the chosen piles count is 0 or less\n if $piles[pile].count <= 0\n puts \"That pile is already empty, try again\"\n turn()\n return\n end\n\n #this ensures that the pile chosen has enough sticks in it to complete the users move of taking their defined sticks.\n until take.between?(1,$piles[pile].count)\n print \"How many to remove from pile \" + pile.to_s + \":\"\n take = gets.chomp().to_i\n end\n\n #this will only be ran once everything above it has been determined the move to be a plausible move, and calls the take function for the users decided sticks from their decided pile\n $piles[pile].take(take)\n\n #this inverts the name boolean so that it will show the next players name on the next turn\n $name = !$name\n #this begins the next players turn by calling the turn function, now that this players turn is done\n turn()\nend", "def gameflow\n \n end", "def breaker_rounds(who)\n while @round < 11\n @board.update_total_matches\n return win_screen if win? # check for if the breaker got everything right\n\n round_result\n @board.breaker.create_number if who == 'player'\n @board.breaker.random_number if who == 'computer'\n end\n @board.update_total_matches\n return win_screen if win? # check for if the breaker got everything right\n\n announce_code\n end", "def play_game\n turns = 0\n begin\n hash = WarAPI.play_turn(@player1, @player1.hand.deal_card, @player2, @player2.hand.deal_card)\n cards = hash.flatten\n @player1.hand.add_card(cards[1])\n @player2.hand.add_card(cards[3])\n puts \"#{turns}\"\n turns += 1\n end until (@player1.hand.addhand.length == 0 && @player1.hand.unshuffled_deck[-1] == nil && cards[1].length == 0) || (@player2.hand.addhand.length == 0 && @player2.hand.unshuffled_deck[-1] == nil && cards[3].length == 0)\n puts \"#{@player1.name} wins!\" if @player1.hand.deal_card != nil\n puts \"#{@player2.name} wins!\" if @player2.hand.deal_card != nil\n end" ]
[ "0.6577823", "0.64969766", "0.6422065", "0.6237502", "0.6230929", "0.6229197", "0.62128645", "0.61618423", "0.6157579", "0.6150498", "0.6124498", "0.61214536", "0.61162686", "0.6102308", "0.6099765", "0.60936576", "0.608049", "0.60762095", "0.60744774", "0.6060562", "0.60589075", "0.60585135", "0.6050034", "0.60497576", "0.6049048", "0.60411775", "0.60404104", "0.6039593", "0.6029831", "0.60275525", "0.60163796", "0.60030067", "0.59925133", "0.59906614", "0.59871227", "0.5984672", "0.59836334", "0.59801316", "0.59773695", "0.5975716", "0.5964302", "0.5963956", "0.5963217", "0.5962221", "0.5961591", "0.5955033", "0.5952876", "0.5949942", "0.59486514", "0.59448874", "0.5942669", "0.5939404", "0.59379315", "0.59374756", "0.5933309", "0.59268916", "0.59244215", "0.5923471", "0.59165055", "0.59152657", "0.59073573", "0.59003556", "0.589989", "0.5898635", "0.5894839", "0.5888566", "0.58841914", "0.5884047", "0.5881067", "0.5877573", "0.58726054", "0.58699733", "0.58687913", "0.586423", "0.58559966", "0.58540606", "0.5852454", "0.5851992", "0.58401173", "0.5837386", "0.58357817", "0.5830357", "0.58290917", "0.58262753", "0.58249086", "0.58245313", "0.581378", "0.5812455", "0.5811862", "0.5805161", "0.58047754", "0.5802537", "0.5801399", "0.58008814", "0.58002144", "0.57998455", "0.57997364", "0.57978123", "0.57909924", "0.5787146", "0.5786741" ]
0.0
-1
=begin need function that takes and argument that argument will be an array reference value to check against if the next number is bigger than reference value it becomes the reference value at the end of iterating over each item the reference value the largest number =end
def max_value(our_array) reference = -100000 our_array.each do |number| if number > reference reference = number end end reference end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_max_number(any_array)\n\treference = any_array[1]\n\tany_array.each do |number|\n\t\tif number > reference\n\t\treference = number\n\t\tend\n\tend \n\treference\nend", "def find_greatest(numbers)\n saved_number = numbers[0]\n\n numbers.each do |num|\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n saved_number\nend", "def greatest_number(num_array)\n saved_number = num_array[0]\n\n num_array.each do |num|\n\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n saved_number\nend", "def part6(in_array)\n themax = in_array[2]\n in_array.each do |item|\n if item > themax\n themax = item\n end\n end\n themax\nend", "def max(array)\n result = array.first\n\n array.each do |num|\n if num > result\n result = num\n end\n end\n puts result\nend", "def find_max(some_array)\n max = some_array[0]\n some_array.each do |number|\n if number > max\n max = number\n end\n end\n max\nend", "def largest(array)\n index = 0 #1\n greatest_num = array[index] #5 \n while index < array.length #0 < 5 1 < 5\n if array[index] > greatest_num #if 5 > 5 17 > 5\n greatest_num = array[index] # 17 \n end\n index += 1\n end\n greatest_num\nend", "def find_greatest(numbers)\n saved_number = nil\n\n\n numbers.each do |num|\n saved_number ||= num\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n\nsaved_number\nend", "def find_greatest(numbers)\n saved_number = nil\n\n numbers.each do |num|\n saved_number = numbers[0]\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n p saved_number\nend", "def find_greatest(numbers)\n saved_number = nil\n\n numbers.each do |num|\n saved_number ||= num # assign to first value\n if saved_number >= num\n next\n else\n saved_number = num\n end\n end\n\n saved_number\nend", "def max(arr)\n greatest = array[0]\n arr.each do |num|\n if num > greatest\n greatest = num\n end\n end\n greatest\nend", "def maximum(arr, &prc)\n return nil if arr.empty?\n current_ele = nil\n current_max = nil\n arr.each do |ele|\n value = prc.call(ele)\n if current_max == nil || value >= current_max\n current_max = value\n current_ele = ele\n end\n end\n current_ele\nend", "def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend", "def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend", "def max(numbers)\n current_max = numbers[0]\n numbers.each do |number|\n if number > current_max\n current_max = number\n end\n end\n current_max\nend", "def max_by(array)\n largest_item = nil\n array.each do |elem|\n largest_item ||= elem\n largest_item = elem if yield(elem) > yield(largest_item)\n end\n largest_item\nend", "def maximum( arr, &prc )\n return nil if arr.length == 0\n\n test_case = arr.inject(0) {|x,ele| x = prc.call(ele) if prc.call(ele) > x }\n p test_case\n arr.reverse.each do |ele|\n if prc.call(ele) == test_case\n return ele\n end\n end\n\nend", "def find_max_value(array)\nx = 0 \n array.length.times { |index|\n if array[index] > x \n x = array[index]\n end\n }\n x\n end", "def find_max_num(numbers)\n if numbers.length == 0 \n \tputs \"No numbers were passed.\" \n elsif numbers.length > 0\n max_num = numbers[0]\n \tfor i in 1..numbers.length - 1 # So I don't over-run the array, and start at the 2nd position to compare against max at postion [0]\n if max_num < numbers[i] \n max_num = numbers[i] \n end\n i += 1\n \tend\n puts \"Looked through an array of lenght #{numbers.length}.\"\n puts \"The largest value is #{max_num}\"\n end\nend", "def next_largest_number (array, given_number)\n array.find {|number| number > given_number}\nend", "def largest_integer(list_of_numbers)\n # Return nil if the array doesn't have any element.\n return nil if list_of_numbers.length == 0\n # Define the variable to the first element of the array.\n largest_number = list_of_numbers[0]\n # Take the first number!! and store inside defined variable.\n list_of_numbers.each do |number|\n # Go ahead and take the next one\n # Compare that one with the stored number in the variable.\n if largest_number < number\n # Whichever is larger, keep that number inside the variable.\n largest_number = number\n end\n # Continue this process until the array is empty.\n end\n # Return the largest number.\n largest_number\nend", "def max(arr)\n return nil if arr.empty?\n result = arr[0]\n arr[1...-1].each do |item|\n if item > result\n result = item\n end\n end\n return result\nend", "def find_max_value(array)\n x = array[0]\narray.length.times {|index|\n if array[index] > x\n x = array[index]\n end\n\n}\nx\nend", "def largest_integer(array)\n large = array[0]\n array.each do |n|\n if n > large\n large = n\n end\n end\n large\nend", "def new_max array_of_elements\n\ti = 0\n\tlargest = array_of_elements[0]\n\twhile i < array_of_elements.length do\n\t\tif array_of_elements[i] > largest\n\t\t\tlargest = array_of_elements[i]\n\t\tend\n\t\ti += 1\n\tend\n\tlargest\nend", "def lis(array)\n helper = Array.new(array.length, 1)\n (1..array.length - 1).each do |array_index|\n (0..array_index).each do |inner_value|\n if array[inner_value] < array[array_index]\n helper[array_index] = [helper[inner_value] + 1, helper[array_index]].max\n end\n end\n end\n helper.max\nend", "def largest_integer(list_of_nums) #define method largest_integer with argument list_of_nums\n max = list_of_nums[0] #set the max as the first position of the array\n list_of_nums.each do |num| #iterate over each number of the array\n \tif \n \t\tmax < num # if max is less than a given number\n \t\tnum = max # the number is equal to max\n \tend # close the if statement\nend # close the method definition\n return max #return the max number\nend", "def largest(array)\nend", "def max_in_array_loop(arr)\n max = arr[0]\n arr.each do |x|\n if x > max\n max = x\n end\n end\n max\nend", "def find_max(some_array)\n max = nil\n some_array.each do |val|\n \tif max.nil?\n max=val\n elsif val>max\n max=val\n end\n end\n max\nend", "def max(array)\n\tn = 0\n\tarray.each do |x|\n\t\tif x > n\n\t\t\t n = x\n\t\tend\n\tend\n\t puts n\nend", "def find_max(some_array)\n\tmaximum = some_array[0]\n\n\tsome_array.each do |number|\n\t\tif number > maximum\n\t\t\tmaximum = number\n\t\tend\n\tend\n\tmaximum\nend", "def find_max_value(array)\n array.sort!\n return array[-1]\nend", "def find_max_value(array)\n x = 0\n array.length.times { |index| x = array[index] if array[index] > x }\n x\nend", "def find_next_greater_element(array)\n (0...array.length).each do |i|\n smallest_after = 100000\n (i...array.length).each do |j|\n if array[j] > array[i] && array[j] < smallest_after\n smallest_after = array[j]\n end\n end\n puts \"Next greatest for #{array[i]} is #{smallest_after}\"\n end\n\n\n\nend", "def find_highest(array)\n highest = nil;\n for num in array do\n if highest\n if num > highest\n highest = num\n end\n else\n highest = num\n end\n end\n puts highest\nend", "def maxNumber(array)\n max = 0\n array.each do\n |n|\n max = n if (n > max)\n end\n puts \"Le nombre ayant la plus grande valeur est #{max}.\"\nend", "def largest(*numbers)\n # numbers is an array\n p numbers\n largest = numbers[0]\n\n numbers.each do |number|\n # compare to see if it's the biggest?\n if number > largest\n largest = number\n end\n end\n\n largest\nend", "def find_max\n\tarr = [100,10,-1000,59,03,453,2345,365,-45,266,-345]\n\tarr_new = arr.sort.pop\n\tprint \"this is the higest number in the array #{arr_new}\"\nend", "def lis array\n helper = Array.new(array.count, 1)\n for i in 1..(array.count - 1)\n for j in 0..i\n if array[j] < array[i]\n helper[i] = max((helper[j] + 1), helper[i])\n end\n end\n end \n return helper.max\nend", "def find_max_value(array)\n array.max { |item|\n return array.max\n }\n \nend", "def max_by(arr)\n max = arr.first\n for el in arr\n max = el if yield(el) > yield(max)\n end\n max\nend", "def max_by(array)\n return nil if array.empty?\n\n max_element = array.first\n max_return = yield(array.first)\n\n array[1..-1].each do |element|\n block_return = yield(element)\n if block_return > max_return\n max_element = element \n max_return = block_return\n end\n end\n max_element\nend", "def max_by(arr)\n arr.max { |a, b| yield(a) <=> yield(b) }\nend", "def greater(num_array)\n num = num_array.sort.last\n puts num\nend", "def biggest_number(array_of_integers)\n # TODO\nend", "def largest_integer(list_of_nums)\n largest = nil\n list_of_nums.each do |num|\n if largest == nil\n largest = num\n end\n if num >= largest\n largest = num\n end\n end\n largest\nend", "def biggest_number(num)\n numbers = []\n num.each do |array_num|\n biggest = 0\n array_num.each do |num|\n if num > biggest\n biggest = num\n end\n end\n numbers << biggest\n end\n p numbers\nend", "def maxnumbers(numbers)\n new_numbers = 0\n index = 0\n while index < numbers.length\n if numbers[index] > new_numbers\n new_numbers = numbers[index]\n end\n index += 1\n end \n return new_numbers\nend", "def highestnumber2 arr\n idx = 0 \n idx2 = 0 \n max = arr[0][0]\n\n while idx <= arr.length - 1\n\n if (highestnumber arr[idx]) > max\n max = highestnumber arr[idx]\n idx2 = idx \n end \n idx = idx + 1\n end\n return arr[idx2]\nend", "def largest(array)\n iterator = 0\n saved = 0\n while iterator < array.length\n if array[iterator] > saved \n saved = array[iterator]\n end \n iterator += 1\n end\n saved\nend", "def max_by(arr)\n return nil if arr.empty?\n memo = arr[0]\n 0.upto( arr.size - 1 ) do |idx|\n memo = yield(arr[idx]) > yield(memo) ? arr[idx] : memo\n end\n memo\nend", "def highestnumber arr \n idx = 0 \n max = arr[0]\n while idx <= arr.length - 1\n if max > arr[idx] \n max = max\n else \n max = arr[idx]\n end\n \n idx = idx + 1\n end\n return max\nend", "def largest_integer(list_of_nums)\ninitial = list_of_nums.kind_of?(Array) && list_of_nums[0] != nil ? 0 : nil\n\nreturn initial if initial == nil\n\nfor i in 0...list_of_nums.length\n curr_val = list_of_nums[i] if list_of_nums[i].instance_of? Fixnum\n initial = curr_val if i == 0 || initial < curr_val\nend\n\ninitial\nend", "def find_max_value(array=[])\n some_array=0\n array.each do |value|\n some_array = value = array.max\n\n end\n\n\n some_array\n\n\nend", "def max_by(arr)\n return nil if arr.empty?\n\n highest = yield(arr[0])\n highest_idx = nil\n \n arr.each_with_index do |el, idx| \n if yield(el) >= highest\n highest = yield(el)\n highest_idx = idx\n end\n end\n arr[highest_idx]\nend", "def largest_integer(list_of_nums)\n # Pseudocode\n # return nil if array is empty\n # Otherwise, initialize current maximum as the first element of the array\n # FOR each element of the array\n # IF that element is larger than the current maximum\n # Set the current maximum to that element\n # Return the current maximum\n\n #initial solution\n # return nil if list_of_nums.length == 0\n\n # maximum = list_of_nums[0]\n\n # list_of_nums.each do |el|\n # maximum = el if el > maximum\n # end\n\n # return maximum\n\n #using built-in Ruby enumerables method\n return list_of_nums.max\n\nend", "def next_greater_element(find_nums, nums)\n output = []\n \n find_nums.each do |num|\n next_greatest = -1\n for i in nums.index(num)+1..nums.length-1 do\n if nums[i] > num\n next_greatest = nums[i]\n break\n end\n end\n output << next_greatest\n end\n output\nend", "def max_by(array)\n return nil if array.empty?\n result = []\n array.each { |num| result << yield(num) }\n array.fetch(result.index(result.max))\nend", "def find_max_value(array)\n max_element = 0\n array.length.times { |index|\n if max_element < array[index]\n max_element = array[index]\n end\n }\n return max_element\nend", "def largest_integer(list_of_nums)\n if list_of_nums.length == 0\n return nil\n else\n biggie = list_of_nums[0]\n i = 0\n while i<list_of_nums.length do\n if list_of_nums[i] >= biggie\n biggie = list_of_nums[i]\n end\n i+=1\n end\n return biggie\n end\nend", "def max(arr)\n # sort arragnes items in array by ascending order \n # last function returns the last number in the array, which in this case should be the max value\n puts arr.sort.last\n# closing function\nend", "def largest_integer(list_of_nums)\n if list_of_nums.empty? \n return nil\n else \n big=list_of_nums[0]\n list_of_nums.each { |x| \n if x > big\n big=x\n end \n }\n return big\n end\nend", "def solve(nums)\n sorted = nums.sort\n largest = 0\n (0...sorted.length - 1).each do |i|\n if (sorted[i+1] - sorted[i]) > largest\n largest = (sorted[i+1] - sorted[i])\n end\n end\n return largest\n\nend", "def maximum(arr, &prc)\n\n return nil if arr.length == 0\n max = 0\n max_idx = nil\n arr.each_with_index do |ele, idx|\n if prc.call(ele) >= max\n max = prc.call(ele)\n max_idx = idx\n end\n end\n arr[max_idx]\nend", "def highest_num(list)\n max = list[0]\n i = 0\n until i >= list.length\n max = list[i] if list[i] > max\n i += 1\n end\n max\nend", "def find_max_value(array)\n sorted_array = array.sort\n sorted_array.last\nend", "def find_max_value(array)\n i = 0 \n max = 0 \n \n while i < array.length do\n if max < array[i]\n max = array[i]\n end \n i += 1 \nend \n return max\nend", "def max\r\n temp = @first\r\n maxValue = -99999\r\n\r\n while !temp.nil?\r\n if temp.value > maxValue then\r\n maxValue = temp.value \r\n end \r\n temp = temp.next\r\n end \r\n maxValue\r\nend", "def max_by(array)\n max, element = nil\n array.each do |value|\n block_return = yield(value)\n if max.nil? || block_return > max\n max, element = block_return, value\n end\n end\n element\nend", "def custon_max(arr)\n return nil if arr.empty?\n\n max = arr[0]\n arr.each do |value|\n max = value if value > max\n end\n max\nend", "def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n maxValue\n end", "def largest_integer(list_of_nums)\n\n if list_of_nums.length == 0\n return nil\n end\n#Order the variable\n order_array = []\n greates_num = list_of_nums[0]\n list_of_nums.each do |x|\n greates_num = x if x > greates_num\n end\n p greates_num\nend", "def slow_compare(arr)\n max = arr.first\n arr.each do |el1|\n arr.each do |el2|\n max = (el1 < max ? el1 : max)\n end\n end\n max\n end", "def max # creates function max\n\tnumbers = [2, 750, 83, 71] # sets numbers array and assigns their values\n\tputs numbers.sort.last # sorts the numbers min to max and then displays the last number or index\nend", "def basic_5 (array_iterate)\n array_iterate.max\nend", "def find_max_value (array)\n array.max # Add your solution here\nend", "def establish_high_number(array)\n if array[0] > array[1]\n return array [0]\n else array[0] < array[1]\n return array [1]\n end\nend", "def largest_integer(list_of_nums)\n return nil if list_of_nums.empty?\n largest = list_of_nums.pop\n list_of_nums.each {|x| largest = x if x > largest }\n largest\nend", "def maximum(arr)\n bubble_sort(arr).last\nend", "def max\r\n temp = @first\r\n maxValue = -999999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n maxValue\r\n end", "def largest_int(numbers)\n\tnumbers.sort!\n\tnumbers[-1]\nend", "def max_sub_array(numbers)\n max = numbers[0]\n\n (1...numbers.size).each do |idx|\n current_sum = numbers[idx] + numbers[idx - 1]\n numbers[idx] = current_sum if current_sum > numbers[idx]\n max = numbers[idx] if numbers[idx] > max\n end\n\n max\nend", "def max_sort!(a)\n # Durchlaufe das Array von hinten (a.size - i ist dann immer das\n # aktuelle Element)\n for i in 1 .. a.size-1 do\n # Suche das größte Element zwischen Index 0 und unserem aktuellen Element\n max_pos = max_pos_until(a, a.size - i)\n \n # Tausche das größte Element an unsere aktuelle Stelle\n swap!(a, a.size - i, max_pos)\n end\nend", "def next_greater_element(nums)\n res = []\n nums.each_with_index do |num, idx|\n\n pushed = false\n (nums.length - 1).times do |step|\n current_idx = (idx + step + 1) % nums.length\n\n if nums[current_idx] > num\n res.push(nums[current_idx])\n pushed = true\n break\n end\n\n end\n\n res.push(-1) unless pushed\n end\n\n res\nend", "def max_num(array,max=array[0])\n begin\n if array.count == 1\n array[0] > max ? array[0] : max\n else\n max = array[1] if array[1] > max\n max_num(array[1..-1],max)\n end\n rescue Exception => e\n puts e.message\n end\nend", "def max\n temp = @first\n maxValue = -999999\n while !temp.nil?\n if temp.value > maxValue\n maxValue = temp.value\n end\n temp = temp.next\n end\n return maxValue\n end", "def max\r\n temp = @first\r\n maxValue = -99999\r\n while !temp.nil?\r\n if temp.value > maxValue\r\n maxValue = temp.value\r\n end\r\n temp = temp.next\r\n end\r\n return maxValue\r\n end", "def find_max_value(array)\n array.max \nend", "def largest_integer(list_of_nums)\n largest = list_of_nums[0]\n list_of_nums.each do |thisNum|\n if thisNum > largest\n largest = thisNum\n end\n end\n return largest\nend", "def find_largest(array, length)\r\n i = 0;\r\n big = array[0];\r\n while i < array.length\r\n if array[i] > big\r\n big = array[i];\r\n i++;\r\n end\r\n i++;\r\n end\r\n return big;\r\nend", "def arr_max (arr)\n arr.sort! { |x,y| y <=> x}\n arr.first()\nend", "def find_leader(ary)\n lead = []\n\n # find the length of the array\n ln = ary.count - 1\n\n # split and compare the value\n ary.each_with_index do |v, i|\n \n # index 0 , search the array for max value from next index value till the last element of array i.e from [1..n]\n lead << v if v >= (ary[(i + 1)..ln].max || 0)\n end\n lead\nend", "def solution(digits)\n greatest = 0\n (0..(digits.size - 1)).each do |pos|\n num = digits[pos..pos+5].to_i\n greatest = num if num > greatest\n end\n greatest \nend", "def find_max(array)\n max = 0\n array.each do |subarray|\n subarray.each_cons(4) do |chunk|\n product = quad_product(chunk)\n max = product if product > max\n end\n end\n max\n end", "def maxout(arr)\n max = 0\n location = 0\n\n arr.each_with_index do |n, index|\n if n > max\n max = n\n location = index\n end\n end\n p max\n p location\nend", "def max(&block)\n flag = true # 1st element?\n result = nil\n self.each{|*val|\n val = val.__svalue\n if flag\n # 1st element\n result = val\n flag = false\n else\n if block\n result = val if block.call(val, result) > 0\n else\n result = val if (val <=> result) > 0\n end\n end\n }\n result\n end", "def largest_integer(list_of_nums)\n i = 0\n largest = list_of_nums[0]\n while i < list_of_nums.length\n if list_of_nums[i] > largest\n largest = list_of_nums[i]\n end\n i +=1\n end\n return largest\nend", "def find_max_value(array)\n return array.max\nend", "def find_longest(arr)\n longest_num = 0 # current longest number\n most_digits = 0 # current most digits found in a number in the array\n\n arr.each do |num|\n digits_in_num = num.to_s.length\n if digits_in_num <= most_digits # if length of the current number is <= longest number yet - next\n next\n else # but if length is > than any other number we have seen yet -\n longest_num = num # set this num as new longest_num\n most_digits = digits_in_num # set the length of this num as the new standard to compare against\n end\n end\n longest_num\nend" ]
[ "0.80275106", "0.76950336", "0.7690046", "0.76097184", "0.7540231", "0.7538304", "0.75273305", "0.7512896", "0.75111955", "0.7472626", "0.74536985", "0.74472046", "0.74168944", "0.74168944", "0.74168944", "0.74026215", "0.7386269", "0.73623466", "0.7346802", "0.73148793", "0.7313436", "0.7309608", "0.73079985", "0.72955525", "0.7288448", "0.7282105", "0.72694165", "0.7259465", "0.7237961", "0.7228702", "0.72193575", "0.7207564", "0.7150486", "0.7145821", "0.71433085", "0.70981103", "0.7096904", "0.70837337", "0.70816934", "0.70786464", "0.7073734", "0.7071218", "0.7070103", "0.70536035", "0.705277", "0.7045062", "0.703887", "0.7037536", "0.70359755", "0.7033567", "0.70262426", "0.7023988", "0.70129335", "0.70044327", "0.6992938", "0.69828683", "0.6982304", "0.69703513", "0.69684553", "0.69674826", "0.69579685", "0.69475204", "0.6916261", "0.691519", "0.6913063", "0.69098526", "0.68882906", "0.6884821", "0.68557847", "0.68410194", "0.6812173", "0.68101394", "0.68048286", "0.6802683", "0.6801912", "0.6795629", "0.67932826", "0.6791795", "0.6778252", "0.67689866", "0.6765896", "0.6765664", "0.67556727", "0.6754398", "0.6729811", "0.6713269", "0.6704061", "0.6698826", "0.6698393", "0.6697877", "0.6691082", "0.66777563", "0.66500396", "0.6649773", "0.66430044", "0.6635598", "0.66165686", "0.6615701", "0.66147447", "0.6602132" ]
0.7971969
1
=begin need function that takes two arrays as arguments the arrays have the same amount of items the function combines the arrays into a hash into key=>value pairs items of first array becomes the key items of second array becomes the value the hash is returned as a result of the function =end
def two_array(array_one, array_two) my_hash = {} array_one.each_with_index do |value, index| my_hash[value] = array_two[index] end puts my_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_two_arrays_into_hashes(array_one, array_two)\n\tcombined_hash = {}\n\tcounter = 0\n\tarray_one.each do |array_item|\n\t\tcombined_hash[array_item] = array_two[counter]\n\t\tcounter = counter +\t1\n\tend\n\tcombined_hash\nend", "def put_in_hash(array1, array2, nb=array1.length)\n hash = {}\n nb.times {|a| hash[array1[a]] = array2[a]}\n return hash\nend", "def zipCreateHash arr1,arr2\n Hash[Array(arr1).zip Array(arr2)]\nend", "def hashing_value_from_2_arrays(array1, array2)\n return 'invalid' if array1.count != array2.count\n\n result = []\n\n # the repeat times for the iterator\n repeat = array1.count\n\n repeat.times do\n hash_of_array1 = array1.shift\n hash_of_array2 = array2.shift\n\n result << {\n ratio: hash_of_array1[:ratio],\n volume_alcohol: hash_of_array2[:volume_alcohol]\n }\n end\n\n result\n end", "def merge_data first_array, second_array\n\n output = []\n\n first_array.each_with_index do |element, index|\n new_hash = {}\n\n first_array[index].each do |key, value|\n new_hash[key] = value\n end\n\n second_array[index].each do |key, value|\n new_hash[key] = value\n end\n\n output << new_hash\n end\n output\nend", "def concatena (input_array1, input_array2)\n hash = Hash.new # cria um novo hash\n\n if(input_array1.size > input_array2.size)\n puts \"Caso array de chaves maior!\"\n\n # Logica para colocar os primeiros valores do array de dados\n for elemento in (0..input_array2.size-1)\n hash[input_array1[elemento]] = input_array2[elemento]\n end\n\n # Logica para colocar strings nulas como valores no restante das chaves\n for elemento in (input_array2.size..input_array1.size-1)\n hash[input_array1[elemento]] = \"\"\n end\n\n return hash\n\n elsif(input_array1.size == input_array2.size)\n puts \"Caso array de chaves e dados de mesmo tamanho!\"\n\n for elemento in (0..input_array1.size-1)\n hash[input_array1[elemento]] = input_array2[elemento] # coloca cada elemento de array1 como key e cada elemento de array2 como value\n end\n\n return hash # retorna a hash\n\n else\n puts \"Caso array de dados maior!\"\n array_sobras = []\n\n for elemento in (input_array1.size..input_array2.size-1)\n array_sobras.append(input_array2[elemento])\n end\n\n hash[input_array1] = array_sobras\n\n return hash\n\n end\nend", "def merge_2_array_of_hashes(a_arr, b_arr)\n merge_hash = a_hash = array_of_hashes_2_hash(a_arr) if a_arr\n merge_hash = b_hash = array_of_hashes_2_hash(b_arr) if b_arr\n merge_hash = a_hash.merge!(b_hash) if (a_arr and b_arr)\n merge_hash\nend", "def arrays_to_hash(keys,values)\n hash = {}\n keys.size.times { |i| hash[ keys[i] ] = values[i] }\n hash\n end", "def combArray(a, b)\n\th = Hash[a.zip b]\n\tputs h\nend", "def merge(arr, arr_1)\n new_array = arr + arr_1\n temp_hash = Hash.new(0)\n \n new_array.each {|num| temp_hash[num]+= 1 }\n\n new_array = []\n temp_hash.each { |k, _| new_array << k }\n new_array\nend", "def merge(ar_1, ar_2)\n result = {}\n ar_1.each_with_object(result) { |el, result| result[el] = el}\n ar_2.each_with_object(result) { |el, result| result[el] = el}\n result.values\nend", "def intersection_hash(array1, array2)\n hash = Hash.new()\n intersection = []\n\n array1.each do |el|\n hash[el] = true\n end\n\n array2.uniq.each do |el|\n if hash[el]\n intersection << el\n end\n end\n\n intersection\nend", "def intersection(array1, array2)\n hash_table = {}\n result = []\n if array1 && array2\n i = 0\n while i < array1.length\n hash_table[array1[i]] = 1\n i += 1\n end\n i = 0\n while i < array2.length\n if hash_table[array2[i]]\n result << array2[i]\n end\n i += 1\n end\n end\n return result\nend", "def comb_arrays(keys, values)\n combined = keys.zip(values)\n puts combined\nend", "def array_hash\n array_name = array_crypto_name()\n array_value = array_crypto_value()\n new_array=[]\n array_name.size.times {|i| new_array<<Hash[array_name[i],array_value[i]]}\n puts new_array.inspect\n return new_array\nend\n\narray_hash()", "def merge_hasharray(array1, array2, commonfield)\n xref = {}\n array2.each { |hash| xref[hash[commonfield]] = hash }\n array1.each do |hash|\n next if xref[hash[commonfield]].empty?\n xref[hash[commonfield]].each_pair do |kk, vv|\n next if commonfield == kk\n hash[kk] = vv\n end\n end\nend", "def array_of_hashes_2_hash(arr)\n Hash[*arr.collect{|h| h.to_a}.flatten]\nend", "def intersection(arr1, arr2)\n hsh = {}\n output = []\n arr1.each do |ele|\n hsh[ele] = true\n end\n\n arr2.each do |ele|\n output.push(ele) if hsh[ele] \n end\n\n output\nend", "def arrays_to_hashes\n end", "def Tv(arr_1,arr_2)\n shows={}\n \n i=0\n while i <= arr_1.length - 1\n shows[arr_1[i]] = arr_2[i]\n \n i = i + 1\n end \n \n puts shows\nend", "def intersect(array1, array2)\n hash_table = {}\n mergedArray = []\n\n array1.each do |a1|\n hash_table[a1] = true\n end\n\n array2.each do |a2|\n mergedArray << a2 if hash_table[a2]\n end\n\n return mergedArray\nend", "def intersection(array1, array2)\n intersection = []\n new_hash = {}\n \n array1.each do |number1|\n new_hash[number1] = 1\n end\n\n array2.each do |number2|\n if new_hash[number2] == 1\n intersection << number2\n end\n end\n return intersection\nend", "def add_hash_if_array(a1, b1)\n a1 = a1.enum_for(:each_with_index).collect do |m, index|\n if %w[Array Hash].include?(m.class.name)\n add_hash2_to_hash1(a1[index], b1[index])\n else\n m + b1[index]\n end\n end\n a1\n end", "def intersection(array1, array2)\n return [] if array1 == nil || array2 == nil\n if array1.length < array2.length\n shorter = array1\n longer = array2\n else\n shorter = array2\n longer = array1\n end\n num_hash = Hash.new\n intersection_array = []\n shorter.length.times do |index|\n num_hash[shorter[index]] = 1\n end\n longer.length.times do |index|\n intersection_array << longer[index] if num_hash[longer[index]]\n end\n\n return intersection_array\nend", "def get_array_final(name,value)\n\thash_final = Hash[name.zip(value.map)]\n\treturn hash_final\nend", "def to_hash (keyArr, valArr)\n\t# check same length just to be safe\n\tif keyArr.length != valArr.length\n\t\tnull\n\telse\n\n\t\t# set up new object\n\t\tnewObj = {}\n\t\t# loop through both arrays\n\t\tkeyArr.length.times do |i|\n\t\t\t# add key value pair to new object each time\n\t\t\tnewObj[keyArr[i]] = valArr[i]\n\t\tend\n\n\t\tnewObj\n\tend\nend", "def array_concat(array_1, array_2)\n # create new holder of correct length\n ret = []\n # iterate over first array\n array_1.each do |entry|\n #copy contents into holder\n \tret << entry\n end\n # iterate over second array, append to end\n array_2.each do |entry|\n \tret << entry\n end\n return ret\nend", "def combine(hash1, hash2)\n hash2.each do |k, v|\n if hash1.key?(k)\n hash1[k] = Array(hash1[k])\n hash1[k] = hash1[k] + v\n else\n hash1[k] = v\n end\n end\n hash1\n end", "def merge(*other_hashes, &blk); end", "def process_2arrays(array_1, array_2)\n shared = array_1 & array_2\n shared_count = shared.count\n\n array_1_unshared = array_1 - shared\n array_2_unshared = array_2 - shared\n\n count_1 = array_1_unshared.count\n count_2 = array_2_unshared.count\n unshared = array_1_unshared + array_2_unshared\n unshared_count = unshared.count\n\n [].push(shared_count, unshared_count, count_1, count_2)\nend", "def using_hash(arr1, arr2)\n sum1 = 0; sum2 = 0\n for i in 0...arr1.length\n sum1 += arr1[i]\n end\n \n for i in 0...arr2.length\n sum2 += arr2[i]\n end \n\n # return if not integer \n return false if (sum1 - sum2) % 2 == 0\n\n diff = (sum1 - sum2).abs / 2\n\n hsh = {}\n \n for i in 0...arr2.length\n hsh[arr2[i]] = true\n end\n\n for i in 0...arr1.length\n if hsh[diff + arr1[i]] == true\n return true\n end \n end \n\n return false\n\nend", "def merge(hash_1, hash_2)\n\nend", "def marr2hash(mps)\n mps.map{|e|[e[0], e[1].to_h, e[2]]}\n end", "def arrhash (arg)\n the_hash = {}\n arg.each_with_index do |x,y|\n the_hash[y] = x\n end\n puts the_hash\nend", "def intersection(array1, array2)\n if array1 == nil || array2 == nil || array1.length == 0 || array2.length == 0\n return []\n elsif array1.length < array2.length\n larger = array2\n smaller = array1\n elsif array1.length >= array2.length\n larger = array1\n smaller = array2\n end\n\n hash_table = {}\n smaller.each do |num|\n hash_table[num] = 1\n end\n\n combined = []\n larger.each do |num|\n if hash_table.include? num\n combined << num\n end\n end\n return combined\nend", "def arrhash(arg)\n the_hash = {}\n arg.each_with_index do |x,y|\n the_hash[y] = x\n end\n puts the_hash\nend", "def merge!(*other_hashes, &blk); end", "def create_arr_hashes(arr_arrays)\n\thash_keys = arr_arrays.shift.map { |key| key.to_sym }\n\tarr_index = 0\n\tarr_hashes = []\n\tarr_arrays.each do |student|\n\t\t\tstudent_hash = {}\n\t\t\tstudent.each do |value|\n\t\t\t\tstudent_hash[hash_keys[arr_index]] = value\n\t\t\t\tarr_index += 1\n\t\t\t\tend\n\t\t\tstudent_hash[:cohort] = :March\n\t\t\tarr_hashes << student_hash\n\t\t\tarr_index = 0\n\t\t\tend\n\tarr_hashes\nend", "def merge(hash_1, hash_2)\n new_hash = Hash.new()\n\n hash_1.each {|key, value| new_hash[key] = value}\n\n hash_2.each {|key, value| new_hash[key] = value}\n new_hash\nend", "def merge_data(argu, argu2)\n names = argu[0]\n names2 = argu[1]\n\n argu2.each do |nested_hash|\n nested_hash.each do |name, hash|\n hash.each do |key, value|\n if name == \"blake\"\n names[key] = value\n elsif name == \"ashley\"\n names2[key] = value\n end\n end\n end\n end\n\n new_array = []\n new_array << names\n new_array << names2\n new_array\nend", "def hashify(*args, &block)\n key_value_pairs = args.map {|a| yield(a) }\n\n # if using Ruby 1.9,\n # Hash[ key_value_pairs ]\n # is all that's needed, but for Ruby 1.8 compatability, these must\n # be flattened and the resulting array unpacked. flatten(1) only\n # flattens the arrays constructed in the block, it won't mess up\n # any values (or keys) that are themselves arrays.\n Hash[ *( key_value_pairs.flatten(1) )]\n end", "def merge_data(arg1, arg2)\n result = []\n arg1.each do |arg1_info|\n arg1_info.each do |arg1_key, arg1_value|\n arg2.each do |arg2_info|\n arg2_info.each do |arg2_key, arg2_value|\n if arg1_info[arg1_key] == arg2_key\n result << arg2_value.merge(arg1_info)\n end\n end\n end\n end\n end\n result\nend", "def fast_intersection(array_one, array_two)\n result = []\n hash = {};\n\n array_one.each do |num1|\n hash[num1] = true\n end\n\n array_two.each do |num2|\n if hash[num2]\n result << num2\n end\n end\n\n result\nend", "def concat_merge original\n {}.tap do |result|\n original.each do |element|\n element.each_pair do |key, value|\n if value.is_a?(Array)\n result[key] ||= []\n result[key].concat value\n merge_if_equals(result[key])\n else\n result[key] = value\n end\n end\n end\n end\n end", "def concat_child_arrays( h1, h2, key )\n h_out = {}\n if h1.has_key?( key )\n if h2.has_key?( key )\n h_out = { key => h1[ key ].concat( h2[ key ] ) }\n else\n h_out = { key => h1[ key ] }\n end\n elsif h2.has_key?( key )\n h_out = { key => h2[ key ] }\n end\n return h_out\nend", "def multiply_all_pairs(arr1, arr2)\n output = arr1.each_with_object([]) do |int, arr|\n arr2.each do |int2|\n arr << int * int2\n end\n end\n output.sort\nend", "def array_concat(array_1, array_2)\n # Your code here\n combined_array = []\n\n array_1.each { |i| \n combined_array.push(i)\n }\n\n array_2.each do |j| \n combined_array.push(j)\n end\n\n return combined_array\nend", "def array_concat(array_1, array_2)\n concat_array = []\n array_1.each {|value| concat_array << value}\n array_2.each {|value| concat_array << value}\n concat_array\nend", "def intersection(array1, array2)\n intersection = []\n return intersection if !array1 || !array2\n if array1.length < array2.length\n smaller = array1\n larger = array2\n else\n smaller = array2\n larger = array1\n end\n\n my_hash = {}\n smaller.each do |num|\n my_hash[num] = 1\n end\n\n larger.each do |num|\n intersection << num if my_hash.include?(num)\n end\n return intersection\nend", "def array_fusion\r\n results = Hash[*@citys_list.zip(@citys_mail).flatten]\r\n print results.each_slice(1).map(&:to_h)\r\n \r\nend", "def elements_in_common(subs1,subs2)\n\t si = Hash.new\n\n\t # recupero gli elementi in comune\n\t subs1.each_pair do |item,value|\n\t si[item] = 1 if subs2.include?(item)\n\t end\n \n\t return si\n\tend", "def hash_two_sum(arr,target_sum)\n #creates a new hash with each element that is satisfying the target_sum\n hash = Hash.new(0) #{|h,k| h[k] = []}\n (0...arr.length).each { |i| hash[i] = arr[i]} #O(n)\nend", "def array_concat(array_1, array_2)\n\n\n newArray = Array.new\n counter = 0\n\n (array_1.length).times do |x|\n newArray[counter] = array_1[x]\n counter = counter + 1\n end\n\n (array_2.length).times do |y|\n newArray[counter] = array_2[y]\n counter = counter + 1\n end\n\n newArray\nend", "def hash_maker(array)\n hash = {}\n array.each do |element|\n hash[element] = {:color => [], :gender => [], :lives => []}\n end\n hash\nend", "def intersection(array1, array2)\n if array1 == nil || array2 == nil\n return []\n end\n if array1.length < array2.length\n larger = array2\n smaller = array1\n else\n larger = array1\n smaller = array2\n end\n my_hash = Hash.new()\n smaller.length.times do |num|\n my_hash[smaller[num]] = 1\n end\n common_elements = []\n larger.length.times do |num_1|\n if my_hash.include? larger[num_1]\n common_elements << larger[num_1]\n end\n end\n return common_elements\nend", "def array_concat(array_1, array_2)\n new_array = []\n array_1.each { |value| new_array << value }\n array_2.each { |value| new_array << value }\n return new_array\nend", "def array_concat(array_1, array_2)\n # Your code here\n array_3=[]\n array_1.each{|element| array_3<<element}\n array_2.each{|element| array_3<<element}\n return array_3\nend", "def array_concat(array_1, array_2)\n # Your code here\n #Iterate over the length of array\n array_2.each do |section|\n #add each section of the array to the other\n array_1.push(section)\n end\n # Output the combination of both the array\n return array_1\nend", "def merge_arrays (first, second)\n\nlarge_array = []\n\n 11.times do |i|\n smaller_array = []\n smaller_array << first[i]\n smaller_array << second[i]\n large_array << smaller_array\n end\n return large_array\n\nend", "def array_to_hash(array)\r\n array.map.each_with_index { |x, i| [i, x] }.to_h # For each value and index create array that has the index,value couple as values and convert it to hash.\r\nend", "def array_concat(array_1, array_2)\n new_array = []\n array_1.each {|val| new_array.push (val)}\n array_2.each {|val| new_array.push (val)}\n new_array\nend", "def final_array_def (emails,names)\n\tfinal_array = []\n\temails.length.times do |i|\n\thash = {}\n\thash[names[i]] = emails[i]\n\tfinal_array << hash\n\tend\n\treturn final_array\nend", "def combine(type,os)\n\thash = {}\n\tindex = 0\n\ttype.each do |x|\n\thash[x] = os[index]\n\tindex += 1\nend\nputs hash\nend", "def create_hash_from_array(array, hash)\n result = array << hash\n return result\nend", "def intersection(nums1, nums2)\n hsh = {}\n result = []\n\n nums1.each do |num|\n hsh[num] = true\n end\n\n nums2.each do |num|\n if hsh[num]\n result.push(num) \n hsh[num] = false\n end\n end\n\n result\nend", "def array_concat(array_1, array_2)\n # Your code here\n # Initial solution\n=begin\n array_3 = []\n array_1.each do |n| \n array_3.push n\n end\n array_2.each do |m|\n array_3.push m\n end\n return array_3\nend\n=end\n # Refactored solution\n return array_1.concat array_2\nend", "def array_concat(array_1, array_2)\n concat_arrays = []\n array_1.each do |x|\n \tconcat_arrays << x\n end\n array_2.each do |x|\n \tconcat_arrays << x\n end\n concat_arrays\nend", "def array_flash(n)\nhash = Hash[\n'&','name: Set Intersection---Returns a new array\ncontaining elements common to the two arrays, with no duplicates.\n\n [ 1, 1, 3, 5 ] _____ [ 1, 2, 3 ] #=> [ 1, 3 ]' ,\n'*','name: Repetition---With a String argument, equivalent to\nself.join(str). Otherwise, returns a new array\nbuilt by concatenating the _int_ copies of self.\n[ 1, 2, 3 ] _____ 3 #=> [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ]\n[ 1, 2, 3 ] _____\",\" #=> \"1,2,3\" ',\n'+','name: Concatenation---Returns a new array built by concatenating the\ntwo arrays together to produce a third array.',\n'-','Array Difference---Returns a new array that is a copy of\nthe original array, removing any items that also appear in\nother_ary.\n [ 1, 1, 2, 2, 3, 3, 4, 5 ]____[ 1, 2, 4 ] #=> [ 3, 3, 5 ]',\n'<=>','Comparison---Returns an integer (-1, 0,\nor +1) if this array is less than, equal to, or greater than\nother_ary.\n[ \"a\", \"a\", \"c\" ] _____[ \"a\", \"b\", \"c\" ] #=> -1\n [ 1, 2, 3, 4, 5, 6 ]______[ 1, 2 ] #=> +1',\n 'any?','Passes each element of the collection to the given block. The method\nreturns true if the block ever returns a value other\nthan false or nil. If the block is not\ngiven, Ruby adds an implicit block of {|obj| obj} (that\nis any? will return true if at least one\nof the collection members is not false or\nnil.\n%w{ant bear cat}._____ {|word| word.length >= 3} #=> true\n %w{ant bear cat}._____ {|word| word.length >= 4} #=> true\n [ nil, true, 99 ]._____ #=> true',\n'assoc','Searches through an array whose elements are also arrays\ncomparing _obj_ with the first element of each contained array\nusing obj.==.\nReturns the first contained array that matches (that\nis, the first associated array),\nor nil if no match is found.\n s1 = [ \"colors\", \"red\", \"blue\", \"green\" ]\n s2 = [ \"letters\", \"a\", \"b\", \"c\" ]\n s3 = \"foo\"\n a = [ s1, s2, s3 ]\n a._______ #=> [ \"letters\", \"a\", \"b\", \"c\" ]\n a._______ #=> nil(foo is not an array)',\n'clear','Removes all elements from self\na = [ \"a\", \"b\", \"c\", \"d\", \"e\" ] \n______ #=> [ ]',\n'combination','When invoked with a block, yields all combinations of length n\nof elements from ary and then returns ary itself.\nThe implementation makes no guarantees about the order in which\nthe combinations are yielded.\n\nIf no block is given, an enumerator is returned instead.\n a = [1, 2, 3, 4]\n a.______(1).to_a #=> [[1],[2],[3],[4]]\n a.______(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]\n a.______(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]\n a.______(4).to_a #=> [[1,2,3,4]]\n a.______(0).to_a #=> [[]] # one combination of length 0\n a.______(5).to_a #=> [] # no combinations of length 5',\n'compact','Returns a copy of self with all nil elements removed.\n [ \"a\", nil, \"b\", nil, \"c\", nil ]._________ #=> [ \"a\", \"b\", \"c\" ]',\n'concat','Appends the elements of other_ary to SELF.\n[ \"a\", \"b\" ]._________( [\"c\", \"d\"] ) #=> [ \"a\", \"b\", \"c\", \"d\" ]',\n'','Returns the number of elements. If an argument is given, counts\nthe number of elements which equals to obj. If a block is\ngiven, counts the number of elements yielding a true value.\n \tary = [1, 2, 4, 2]\n ary._______ #=> 4\n ary._______(2) #=> 2\n ary._______{|x|x%2==0} #=> 3',\n'cycle','Calls block for each element repeatedly _n_ times or\nforever if none or nil is given. If a non-positive number is\ngiven or the array is empty, does nothing. Returns nil if the\nloop has finished without getting interrupted.\n\nIf no block is given, an enumerator is returned instead.\n\n\n a = [\"a\", \"b\", \"c\"]\n a.______ {|x| puts x } # print, a, b, c, a, b, c,.. forever.\n a.______(2) {|x| puts x } # print, a, b, c, a, b, c.',\n'delete','\nDeletes items from self that are equal to obj.\nIf any items are found, returns obj. If\nthe item is not found, returns nil. If the optional\ncode block is given, returns the result of block if the item\nis not found. (To remove nil elements and\nget an informative return value, use #compact!)\na = [ \"a\", \"b\", \"b\", \"b\", \"c\" ]\n a.______(\"b\") #=> \"b\"\n a #=> [\"a\", \"c\"]\n a.______(\"z\") #=> nil\n a.______(\"z\") { \"not found\" } #=> \"not found\"',\n'delete_at','Deletes the element at the specified index, returning that element,\nor nil if the index is out of range. See also\nArray#slice!\na = %w( ant bat cat dog )\n a._______(2) #=> \"cat\"\n a #=> [\"ant\", \"bat\", \"dog\"]\n a._______(99) #=> nil',\n'_____','Deletes every element of self for which block evaluates\nto true.\nThe array is changed instantly every time the block is called and\nnot after the iteration is over.\nSee also Array#reject!\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a._____ {|x| x >= \"b\" } #=> [\"a\"]',\n 'dig','Retrieves the value object corresponding to the each key objects \n repeatedly.\n h = { foo: {bar: {baz: 1}}}\nh.________(:foo, :bar, :baz) #=> 1\nh.________(:foo, :zot) #=> nil',\n 'drop','removes first n elements from ary and returns the rest of\nthe elements in an array.\n a = [1, 2, 3, 4, 5, 0]\n a.______(3) #=> [4, 5, 0]',\n 'drop_while','removes first elements until the statement is false then returns\n an array with the remaining.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [1, 2, 3, 4, 5, 0]\n a.drop_while {|i| i < 3 } #=> [3, 4, 5, 0]',\n 'each','passes block once for each element in self, passing that\nelement as a parameter.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.______{|x| print x, \" -- \" } #=> a -- b -- c --',\n 'each_index','passes the index of the element\ninstead of the element itself.\n\nIf no block is given, an enumerator is returned instead.\n\n\n a = [ \"a\", \"b\", \"c\" ]\n a.________ {|x| print x, \" -- \" } #=> 0 -- 1 -- 2 --',\n 'empty?','\nReturns true if self contains no elements.\n\n [].empty? #=> true',\n 'fetch','Tries to return the element at position index. If the index\nlies outside the array, the first form throws an\nIndexError exception, the second form returns\ndefault, and the third form returns the value of invoking\nthe block, passing in the index. Negative values of index\ncount from the end of the array.\n\n a = [ 11, 22, 33, 44 ]\n a.______(1) #=> 22\n a.______(-1) #=> 44\n a.______(4, \"cat\") #=> \"cat\"\n a.______(4) { |i| i*i } #=> 16',\n'fill','The first three forms set the selected elements of self (which\nmay be the entire array) to obj. A start of\nnil is equivalent to zero. A length of\nnil is equivalent to self.length. The last three\nforms fill the array with the value of the block. The block is\npassed the absolute index of each element to be filled.\nNegative values of start count from the end of the array.\n\n a = [ \"a\", \"b\", \"c\", \"d\" ]\n a._____(\"x\") #=> [\"x\", \"x\", \"x\", \"x\"]\n a._____(\"z\", 2, 2) #=> [\"x\", \"x\", \"z\", \"z\"]\n a._____(\"y\", 0..1) #=> [\"y\", \"y\", \"z\", \"z\"]\n a._____ {|i| i*i} #=> [0, 1, 4, 9]\n a._____(-2) {|i| i*i*i} #=> [0, 1, 8, 27]',\n ['index','find_index'],'Returns the index of the first object in self such that the object is\n== to obj. If a block is given instead of an\nargument, returns index of first object for which block is true.\nReturns nil if no match is found.\nSee also Array#rindex.\n\nIf neither block nor argument is given, an enumerator is returned instead.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.index(\"b\") #=> 1\n a.index(\"z\") #=> nil\n a.index{|x|x==\"b\"} #=> 1',\n 'flatten','Returns a new array that is a one-dimensional _______ of this\narray (recursively). That is, for every element that is an array,\nextract its elements into the new array. If the optional\nlevel argument determines the level of recursion to _______.\n\n s = [ 1, 2, 3 ] #=> [1, 2, 3]\n t = [ 4, 5, 6, [7, 8] ] #=> [4, 5, 6, [7, 8]]\n a = [ s, t, 9, 10 ] #=> [[1, 2, 3], [4, 5, 6, [7, 8]], 9, 10]\n a._______ #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n a = [ 1, 2, [3, [4, 5] ] ]\n a._______(1) #=> [1, 2, 3, [4, 5]]',\n 'frozen?','Returns the freeze status of obj.\n\n a = [ \"a\", \"b\", \"c\" ]\n a.freeze #=> [\"a\", \"b\", \"c\"]\n a.frozen? #=> true',\n 'include?','Returns true if the given object is present in\nself (that is, if any object == anObject),\nfalse otherwise.\n\n a = [ \"a\", \"b\", \"c\" ]\n a._______(\"b\") #=> true\n a._______(\"z\") #=> false',\n 'insert','adds the given values before the element with the given index\n(which may be negative).\n\n a = %w{ a b c d }\n a._______(2, 99) #=> [\"a\", \"b\", 99, \"c\", \"d\"]\n a._______(-2, 1, 2, 3) #=> [\"a\", \"b\", 99, \"c\", 1, 2, 3, \"d\"] ',\n \"inspect\",\"Creates a string representation of self. like puts but as a method\",\n \"join\",\"Returns a string created by converting each element of the array to\na string, separated by sep.\n\n [ 'a', 'b', 'c' ].______ #=> 'abc'\n [ 'a', 'b', 'c' ].______('-') #=> 'a-b-c' \",\n \"keep_if\",\"Deletes every element of self for which block evaluates\nto false.\nSee also Array#select!\n\nIf no block is given, an enumerator is returned instead.\n\n a = %w{ a b c d e f }\n a._______ {|v| v =~ /[aeiou]/} #=> ['a', 'e']\",\n \"last\",\"Returns the last element(s) of self. If the array is empty,\nthe first form returns nil.\n\n a = [ 'w', 'x', 'y', 'z' ]\n a.______ #=> 'z'\n a.______(2) #=> ['y', 'z']\",\n [\"collect!\",\"map!\"],\" Invokes the block once for each element of self, replacing the\nelement with the value returned by _block_.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a.______ {|x| x + '!' }\n a #=> [ 'a!', 'b!', 'c!', 'd!' ] \",\n \"permutation\",\"When invoked with a block, yield all permutations of length n\nof the elements of ary, then return the array itself.\nIf n is not specified, yield all permutations of all elements.\nThe implementation makes no guarantees about the order in which\nthe permutations are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2, 3]\n a._______.to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n a._______(1).to_a #=> [[1],[2],[3]]\n a._______(2).to_a #=> [[1,2],[1,3],[2,1],[2,3],[3,1],[3,2]]\n a._______(3).to_a #=> [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]\n a._______(0).to_a #=> [[]] # one _______ of length 0\n a._______(4).to_a #=> [] # no _______s of length 4\",\n \"place\",\" Places values before or after another object (by value) in\nan array. This is used in tandem with the before and after\nmethods of the {Insertion} class.\n\nexample _______ an item before another\n [1, 2, 3].place(4).before(3) # => [1, 2, 4, 3]\nexample _______ an item after another\n [:a, :b, :c].place(:x).after(:a) # => [:a, :x, :b, :c]\nparam [Array] values value to insert\nreturn [Insertion] an insertion object to\",\n \"pop\",\"Removes the last element from self and returns it, or\nnil if the array is empty.\n\nIf a number _n_ is given, returns an array of the last n elements\n(or less) just like array.slice!(-n, n) does.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a.______ #=> 'd'\n a.______(2) #=> ['b', 'c']\n a #=> ['a'] \",\n \"product\",\"Returns an array of all combinations of elements from all arrays.\nThe length of the returned array is the product of the length\nof self and the argument arrays.\nIf given a block, product will yield all combinations\nand return self instead.\n\n\n [1,2,3].______([4,5]) #=> [[1,4],[1,5],[2,4],[2,5],[3,4],[3,5]]\n [1,2].______([1,2]) #=> [[1,1],[1,2],[2,1],[2,2]]\n [1,2].______([3,4],[5,6]) #=> [[1,3,5],[1,3,6],[1,4,5],[1,4,6],\n # [2,3,5],[2,3,6],[2,4,5],[2,4,6]]\n [1,2].______() #=> [[1],[2]]\n [1,2].______([]) #=> [] \",\n \"rassoc\",\" Searches through the array whose elements are also arrays. Compares\n_obj_ with the second element of each contained array using\n==. Returns the first contained array that matches.\n a = [ [ 1, 'one'], [2, 'two'], [3, 'three'], ['ii', 'two'] ]\n a.rassoc('two') #=> [2, 'two']\n a.rassoc('four') #=> nil \",\n [\"reject\",\"delete_if\"], \"Returns a new array containing the items in self\nfor which the block is not true.\nIf no block is given, an enumerator is returned instead.\",\n \"repeated_combination\",\"When invoked with a block, yields all repeated combinations of\nlength n of elements from ary and then returns\nary itself.\nThe implementation makes no guarantees about the order in which\nthe ______________ are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2, 3]\n a.___________(1).to_a #=> [[1], [2], [3]]\n a.___________(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]\n a.___________(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],\n # [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]\n a.___________(4).to_a #=> [[1,1,1,1],[1,1,1,2],[1,1,1,3],[1,1,2,2],[1,1,2,3],\n # [1,1,3,3],[1,2,2,2],[1,2,2,3],[1,2,3,3],[1,3,3,3],\n # [2,2,2,2],[2,2,2,3],[2,2,3,3],[2,3,3,3],[3,3,3,3]]\n a.___________(0).to_a #=> [[]] # one ________ of length 0\",\n \"repeated_permutation\",\"When invoked with a block, yield all repeated permutations of length\nn of the elements of ary, then return the array itself.\nThe implementation makes no guarantees about the order in which\nthe ___________are yielded.\n\nIf no block is given, an enumerator is returned instead.\n\nExamples:\n\n a = [1, 2]\n a._______(1).to_a #=> [[1], [2]]\n a._______(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]\n a._______(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],\n # [2,1,1],[2,1,2],[2,2,1],[2,2,2]]\n a._______(0).to_a #=> [[]] # one ___________of length 0\",\n \"replace\",\" Replaces the contents of self with the contents of\nother_ary, truncating or expanding if necessary.\n\n a = [ 'a', 'b', 'c', 'd', 'e' ]\n a.______([ 'x', 'y', 'z' ]) #=> ['x', 'y', 'z']\n a #=> ['x', 'y', 'z'] #its like reassigning the variable\",\n \"reverse!\",\"\nReverses SELF in place.\n\n a = [ 'a', 'b', 'c' ]\n a._______ #=> ['c', 'b', 'a']\n a #=> ['c', 'b', 'a'] \",\n \"reverse_each\",\"Same as Array#each, but traverses self in reverse\norder.\n\n a = [ 'a', 'b', 'c' ]\n a.______ {|x| print x, ' ' } #=> c b a\",\n \"rindex\",\" Returns the index of the LAST object in self\n== to obj. If a block is given instead of an\nargument, returns index of first object for which block is\ntrue, starting from the last object.\nReturns nil if no match is found.\nSee also Array#index.\n\nIf neither block nor argument is given, an enumerator is returned instead.\n\n a = [ 'a', 'b', 'b', 'b', 'c' ]\n a.______('b') #=> 3\n a.______('z') #=> nil\n a.______ { |x| x == 'b' } #=> 3\",\n \"rotate\",\"Returns new array by rotating self so that the element at\ncnt in self is the first element of the new array. If cnt\nis negative then it rotates in the opposite direction.\n\n a = [ 'a', 'b', 'c', 'd' ]\n a._______ #=> ['b', 'c', 'd', 'a']\n a #=> ['a', 'b', 'c', 'd']\n a._______(2) #=> ['c', 'd', 'a', 'b']\n a._______(-3) #=> ['b', 'c', 'd', 'a'] \",\n \"sample\",\"Choose a random element or n random elements from the array. The elements\nare chosen by using random and unique indices into the array in order to\nensure that an element doesn't repeat itself unless the array already\ncontained duplicate elements. If the array is empty the first form returns\nnil and the second form returns an empty array.\n\nIf rng is given, it will be used as the random number generator.\",\n \"select\",\"Invokes the block passing in successive elements from self,\nreturning an array containing those elements for which the block\nreturns a true value (equivalent to Enumerable#______).\n\nIf no block is given, an enumerator is returned instead.\n\n a = %w{ a b c d e f }\n a.______ {|v| v =~ /[aeiou]/} #=> ['a', 'e'] \",\n \"shift\",\"Returns the first element of self and removes it (shifting all\nother elements down by one). Returns nil if the array\nis empty.\n\nIf a number _n_ is given, returns an array of the first n elements\n(or less) just like array.slice!(0, n) does.\n\n args = [ '-m', '-q', 'filename' ]\n args._______ #=> '-m'\n args #=> ['-q', 'filename']\n\n args = [ '-m', '-q', 'filename' ]\n args._______(2) #=> ['-m', '-q']\n args #=> ['filename'] \",\n \"shuffle\",\"Returns a new array with elements of this array ______.\n\n a = [ 1, 2, 3 ] #=> [1, 2, 3]\n a.______ #=> [2, 3, 1]\n\nIf rng is given, it will be used as the random number generator.\n\n a.______(random: Random.new(1)) #=> [1, 3, 2] \",\n [\"slice\",\"[]\"],\"Element Reference---Returns the element at _index_,\nor returns a subarray starting at _start_ and\ncontinuing for _length_ elements, or returns a subarray\nspecified by _range_.\nNegative indices count backward from the end of the\narray (-1 is the last element). Returns nil if the index\n(or starting index) are out of range.\n\n a = [ 'a', 'b', 'c', 'd', 'e' ]\n a[2] + a[0] + a[1] #=> 'cab'\n a[6] #=> nil\n a[1, 2] #=> [ 'b', 'c' ]\n a[1..3] #=> [ 'b', 'c', 'd' ]\n a[4..7] #=> [ 'e' ]\n a[6..10] #=> nil\n a[-3, 3] #=> [ 'c', 'd', 'e' ]\n # special cases\n a[5] #=> nil\n a[5, 1] #=> []\n a[5..10] #=> []\",\n \"sort\",\"Returns a new array created by organizing self. Comparisons for\nthe _____ will be done using the <=> operator or using\nan optional code block. The block implements a comparison between\na and b, returning -1, 0, or +1. \n\n a = [ 'd', 'a', 'e', 'c', 'b' ]\n a.______ #=> ['a', 'b', 'c', 'd', 'e']\n a.______ {|x,y| y <=> x } #=> ['e', 'd', 'c', 'b', 'a'] \",\n [\"take\",\"first\"] ,\"Returns first n elements from ary.\n\n a = [1, 2, 3, 4, 5, 0]\n a.______(3) #=> [1, 2, 3]\",\n \"take_while\",\"\nPasses elements to the block until the block returns nil or false,\nthen stops iterating and returns an array of all prior elements.\n\nIf no block is given, an enumerator is returned instead.\n\n a = [1, 2, 3, 4, 5, 0]\n a._______{|i| i < 3 } #=> [1, 2] \",\n \"transpose\",\"Assumes that self is an array of arrays and rearranges the\nrows and columns.\n\n a = [[1,2], [3,4], [5,6]]\n a.________ #=> [[1, 3, 5], [2, 4, 6]]\",\n \"uniq\",\"Returns a new array by removing duplicate values in self. If a block\nis given, it will use the return value of the block for comparison.\n\n a = [ 'a', 'a', 'b', 'b', 'c' ]\n a.uniq # => ['a', 'b', 'c']\n\n b = [['student','sam'], ['student','george'], ['teacher','matz']]\n b.uniq { |s| s.first } # => [['student', 'sam'], ['teacher', 'matz']]\",\n \"unshift\",\"Prepends objects to the front of self,\nmoving other elements upwards.\n\n a = [ 'b', 'c', 'd' ]\n a.unshift('a') #=> ['a', 'b', 'c', 'd']\n a.unshift(1, 2) #=> [ 1, 2, 'a', 'b', 'c', 'd']\",\n \"values_at\",\"Returns an array containing the elements in\nself corresponding to the given selector(s). The selectors\nmay be either integer indices or ranges.\nSee also Array#select.\n\n a = %w{ a b c d e f }\n a._______(1, 3, 5)\n a._______(1, 3, 5, 7)\n a._______(-1, -3, -5, -7)\n a._______(1..3, 2...5) \",\n\"zip\",\"Converts any arguments to arrays, then merges elements of\nself with corresponding elements from each argument. This\ngenerates a sequence of self.size n-element\narrays, where n is one more that the count of arguments. If\nthe size of any argument is less than enumObj.size,\nnil values are supplied. If a block is given, it is\ninvoked for each output array, otherwise an array of arrays is\nreturned.\n\n a = [ 4, 5, 6 ]\n b = [ 7, 8, 9 ]\n [1,2,3].zip(a, b) #=> [[1, 4, 7], [2, 5, 8], [3, 6, 9]]\n [1,2].zip(a,b) #=> [[1, 4, 7], [2, 5, 8]]\n a.zip([1,2],[8]) #=> [[4,1,8], [5,2,nil], [6,nil,nil]] \",\n \"|\",\"Set Union---Returns a new array by joining this array with\nother_ary, removing duplicates.\n\n [ 'a', 'b', 'c' ] | [ 'c', 'd', 'a' ]\n #=> [ 'a', 'b', 'c', 'd' ] \",\n]\n\n\n\n\n\n\n\na = 0\n\tuntil a == n\n\tindex = rand(hash.size)\n\tquestion = hash.values[index].split.join(' ')#.gsub(/\\\\n/,' ').gsub(/\\\\\\\\/,' ').gsub(/\\\\/,' ').delete(\"\\n\")\n\t\n\tp \"which Array method is this?\"\n\tp ''\n\tp question.split.join(' ')#.gsub(/\\\\n/, \" \").gsub(/\\\\/,\" \")\n\t\n\tinput = gets.chomp\n\t\tuntil hash.keys[index].include?(input)\n\t\t\tbreak if ['idk', 'i dont know', 'i give up'].include?(input)\n\t\t\tp ''\n\t\t\tp hash.values[index].split.join(' ')#.gsub(/\\\\n/,' ').gsub(/\\\\\\\\/,' ').gsub(/\\\\/,' ').delete(\"\\n\")\n\t\t\tp ''\n\t\t\tp '!!!!!!!!! try again !!!!!!!!!!'\n\t\t\t\n\t\t\tinput = gets.chomp \n\t\tend\n\t\t\n\t\tp \"\"\n\t\tp \"------------- good job it is #{hash.keys[index]}-----------------\"\n\t\t\n\t\thash.delete((hash.keys[index]))\n\t\ta += 1\n\tend\n\np '~~~~~~~~~~ you finished ~~~~~~~~~~~~~~~~~'\n\nend", "def merge(array_1, array_2)\n (array_1 + array_2).uniq\nend", "def merge(array_1, array_2)\n (array_1 + array_2).uniq\nend", "def custom_merge(hash1, hash2)\n fin=hash1.dup\n hash2.each do |ky,val|\n fin[ky]=val\n end\n fin\nend", "def count_elements (array_of_hashes)\n#array_of_hashes = [ {:name=>'blake'}, {:name=>'blake'}, {:name=>'ashley'} ]\ncount_hash=Hash.new(0)\narray_of_hashes.each {|hash|\n count_hash[hash]+=1\n }\n #puts new_hash\n #output: {{:name=>\"blake\"}=>2, {:name=>\"ashley\"}=>1}\n merge_count_hash= count_hash.keys.map { |key| \n \tkey[:count]=count_hash[key] \n \tkey\n }\nend", "def merge_data(keys, data)\n array = data[0].values.map.with_index do |v, i|\n keys[i].merge(v)\n end\n array\nend", "def zip_to_hash(value, *keys)\n Hash[keys.zip([value] * keys.size)]\n end", "def ana_array(arr1, arr2)\n\n if arr_to_hash(arr1) == arr_to_hash(arr2)\n return true\n else\n return false\n end\nend", "def ana_array(arr1, arr2) \n counter1 = Hash.new(0)\n counter2 = Hash.new(0)\n\n arr1.each do |ele|\n counter1[ele] += 1\n end\n\n arr2.each do |ele|\n counter2[ele] += 1\n end\n\n counter1.each_key do |key|\n if counter2.key?(key) \n if counter2[key] != counter1[key]\n return false\n end\n else \n return false\n end \n end\n \n counter2.each_key do |key|\n if counter1.key?(key) \n if counter1[key] != counter2[key]\n return false\n end\n else \n return false\n end \n end\n return true\n \nend", "def grapher(array)\n hash = Hash.new { |hash, key| hash[key] = [] }\n array.each do |pair|\n hash[pair[0]] ||= []\n hash[pair[0]] << pair[1]\n end\n hash\nend", "def intersection(array1, array2)\n common_elements = []\n if array1 == nil || array2 == nil\n return common_elements\n end\n\n if array1.length < array2.length\n small = array1\n big = array2\n else\n small = array2\n big = array1\n end\n\n hash = {}\n small.each do |num|\n hash[num] = 1\n end\n\n big.each do |num1|\n if hash.include?(num1)\n common_elements << num1\n end\n end\n return common_elements\nend", "def merge(array1, array2)\n array1.zip(array2).flatten.uniq.sort\nend", "def array_concat(array_1, array_2)\n # Your code here\n array_3 = []\n\n array_1.each do |x|\n array_3.push(x)\n end\n array_2.each do |y|\n array_3.push(y)\n end\n return array_3\nend", "def combo_Cars(aurg1, aurg2)\n\tnew_object = {}\n\t\tfor i in 0..aurg1.length\n\t\t\tnew_object[aurg1[i]] = aurg2[i]\n\t\tend\nputs new_object\nend", "def combine(a, b)\n\t# create a results array\n\t\n\t# counters pointing to the index of the smallest elements in each array\n\n\t# check that we have elements to compare\n\t\t# push the smaller element onto the result array\n\n\t# if there are elements left over in a, move them to result\n\t# if there are elements left over in b, move them to result\n\nend", "def array_concat(array_1, array_2)\n new_array = []\n array_1.each do |item|\n \tnew_array.push(item)\n end\n array_2.each do |item|\n \tnew_array.push(item)\n end\n new_array\nend", "def merge_array(input_array1, input_array2)\n\toutput_array = []\n\toutput_array = input_array1 + input_array2\n\treturn output_array.uniq\nend", "def merge(ary_1, ary_2)\r\n ary_2.uniq.each_with_object(ary_1.uniq){ |element, merged| merged << element unless merged.include?(element) }\r\nend", "def array_concat(array_1, array_2)\n new_array = []\n array_1.each do |var|\n new_array.push(var)\nend\n array_2.each do |var|\n new_array.push(var)\nend\n return new_array\nend", "def hash_map(array, target)\n hash = {}\n\n (0...array.length).each do |ele|\n\n\n end \n\n\nend", "def merge(arr1, arr2)\n merged = []\n arr1.each { |el| merged << el }\n arr2.each { |el| merged << el }\n merged.uniq\nend", "def colour_association(array)\n array.map{|pair| Hash[pair.first, pair.last]}\nend", "def array_to_hash(array) \n count=0\n\n hash = Hash.new\n (array.length).times do \n hash[count+1] = array[count]\n count += 1\n end\n return hash\n end", "def lecturer_zip(arr1,arr2)\n final = []\n arr1.each_with_index { |value, index| final << [value, arr2[index]] }\n final\nend", "def merge(hash_1, hash_2)\n merged = {}\n hash_1.each { |key, val| merged[key] = val }\n hash_2.each { |key, val| merged[key] = val }\n merged \nend", "def merge(arr_1, arr_2)\n (arr_1 + arr_2).uniq\nend", "def merge(array1, array2)\n (array1 + array2).uniq\nend", "def common_subsets(array_one, array_two)\n\nend", "def merge_data(array1, array2)\n keys.collect do |name|\n name.merge(data[0][name[:first_name]])\n end\nend", "def hash\n lists.inject({}){ |hash, p| hash[p[0]] ||= []; hash[p[0]] << p[1]; hash }\n end", "def intersection(list1, list2) \n # edge case\n return [] if list1.empty? || list2.empty?\n\n hash = {} \n result = []\n\n list1.each do |num| \n hash[num] = true \n end \n\n list2.each do |num| \n result << num if hash[num] \n end \n\n return result\nend", "def poorly_written_ruby(*arrays)\n \n # create an empty combined array\n combined_array = []\n \n # for each array in the arrays object, add it to the combined array\n arrays.each do |array|\n combined_array += array\n end\n\n return combined_array\nend", "def multiply_all_pairs(first_arr, second_arr)\n result = []\n first_arr.each do |item|\n second_arr.each { |multiplyer| result << item * multiplyer }\n end\n result.sort\nend" ]
[ "0.8419549", "0.80064064", "0.7606483", "0.7511787", "0.74850094", "0.7451551", "0.74486953", "0.7266196", "0.7150073", "0.7032303", "0.69592917", "0.69417167", "0.6911692", "0.68912023", "0.6839806", "0.68087274", "0.6769662", "0.67446756", "0.67160004", "0.66876554", "0.665137", "0.66439277", "0.6591244", "0.65602094", "0.6542109", "0.6501514", "0.64436615", "0.641888", "0.64147645", "0.63952893", "0.63663244", "0.63607377", "0.635641", "0.63542783", "0.63447434", "0.6329434", "0.63026017", "0.6282644", "0.62627375", "0.6259045", "0.6256726", "0.62535375", "0.62355477", "0.6230903", "0.62264884", "0.6210241", "0.6207584", "0.62056285", "0.61769503", "0.6159141", "0.6159116", "0.6140956", "0.6136987", "0.6131351", "0.61257124", "0.6121884", "0.61180836", "0.6115971", "0.6105305", "0.6103105", "0.60994095", "0.6097334", "0.6091847", "0.6088164", "0.6073982", "0.60614824", "0.6061393", "0.60539556", "0.6051998", "0.6051998", "0.6050817", "0.6047422", "0.6038078", "0.6030866", "0.6024665", "0.6017089", "0.60142845", "0.6010751", "0.600105", "0.599772", "0.599405", "0.5989214", "0.5987781", "0.59840405", "0.596842", "0.596737", "0.5966386", "0.5961129", "0.5960639", "0.5959315", "0.59574383", "0.5957154", "0.5954867", "0.5952014", "0.5950013", "0.59434944", "0.5941762", "0.5938768", "0.59385556", "0.59318006" ]
0.78371465
2
Overwrites slug_exists? from Slug. We allow duplicate slugs on different published_at dates.
def slug_exists? Article.on(published_at).where(slug: slug).exists? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_slug_needed?\n !slug || slug_text != slug.name\n end", "def should_generate_new_friendly_id?\n slug.blank? || permalink_changed?\n end", "def auto_generate_slug\n return true unless self.slug.nil?\n return true if self.respond_to?(:published?) && !self.published?\n self.slug = self.interpolate_slug\n end", "def stale_slug?\n !((permanent_slug? && slug && !slug.empty?) || (slug_source_value.nil? || slug_source_value.empty?))\n end", "def new_with_slugs?\n if localized?\n # We need to check if slugs are present for the locale without falling back\n # to a default\n new_record? && _slugs_translations.fetch(I18n.locale.to_s, []).any?\n else\n new_record? && _slugs.present?\n end\n end", "def make_slugged_title\n return true unless self.published?\n return true unless self.slug.to_s.blank?\n self.slug = self.title.to_slug\n end", "def should_generate_new_friendly_id?\n slug.blank?\n end", "def should_generate_new_friendly_id?\n slug.blank?\n end", "def new_cache_needed?\n uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id\n end", "def new_cache_needed?\n uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id\n end", "def new_cache_needed?\n uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id\n end", "def should_generate_new_friendly_id?\n slug.blank? || name_changed?\n end", "def should_generate_new_friendly_id?\n title_changed? || custom_slug_changed?\n end", "def should_generate_new_friendly_id?\n slug.blank?\n end", "def should_generate_new_friendly_id?\n slug.blank?\n end", "def pages_slug_validation\n return unless catalog\n\n return unless catalog.pages.exists?(slug: slug)\n\n errors.add :slug, I18n.t(\"validations.item_type.pages_slug\")\n end", "def found_using_outdated_friendly_id?\n finder_slug.id != slug.id\n end", "def should_generate_new_friendly_id?\n\t name_changed?||self.slug.nil?\n\tend", "def should_generate_new_friendly_id?\n\t\tslug.blank?\n\tend", "def slug_unique_in_clinic?\n Department.in_clinic(self).where(slug: slug).count == 0\n end", "def persisted_with_slug_changes?\n if localized?\n changes = _slugs_change\n return (persisted? && false) if changes.nil?\n\n # ensure we check for changes only between the same locale\n original = changes.first.try(:fetch, I18n.locale.to_s, nil)\n compare = changes.last.try(:fetch, I18n.locale.to_s, nil)\n persisted? && original != compare\n else\n persisted? && _slugs_changed?\n end\n end", "def is_most_recent?\n sluggable.slug == self\n end", "def is_most_recent?\n sluggable.slug == self\n end", "def remember_if_slug_has_changed\n @slug_was_changed = slug_changed?\n end", "def slug_uniqueness\n if name? and slug? and Quotum.where(slug: slug).where.not(id: id).exists?\n errors.add(:name, \"is unavailable\")\n end\n end", "def uses_slug_cache?\n friendly_id_config.cache_column?\n end", "def uses_slug_cache?\n friendly_id_config.cache_column?\n end", "def uses_slug_cache?\n friendly_id_config.cache_column?\n end", "def should_generate_new_friendly_id?\n new_record? || self[:slug].blank?\n end", "def bad_slug?(object)\n params[:id] != object.to_param\n end", "def bad_slug?(object)\n params[:id] != object.to_param\n end", "def bad_slug?(object)\n params[:id] != object.to_param\nend", "def is_valid_slug?(slug)\n BSON::ObjectId.legal?(slug) || !(%r(^[a-z0-9-]+$) =~ slug).nil?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || self.slug.nil?\n end", "def slug_unique_in_clinic\n errors.add(:slug, \"Slug: #{slug} already in use\") unless\n slug_unique_in_clinic?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def should_generate_new_friendly_id?\n new_record? || slug.blank?\n end", "def is_sluggable(options = Hash.new)\n # Add class-methods\n extend DataMapper::Is::Sluggable::ClassMethods\n # Add instance-methods\n include DataMapper::Is::Sluggable::InstanceMethods\n end", "def exists?(slug)\n File.exists? table_path(slug)\n end", "def need_slug?\n child?\n end", "def skip_slug_validation?\n true\n end", "def is_slug(options)\n if options.key?(:size)\n warn \"Slug with :size option is deprecated, use :length instead\"\n options[:length] = options.delete(:size)\n end\n\n extend DataMapper::Is::Slug::ClassMethods\n include DataMapper::Is::Slug::InstanceMethods\n extend Chainable\n\n @slug_options = {}\n\n @slug_options[:permanent_slug] = options.delete(:permanent_slug)\n @slug_options[:permanent_slug] = true if @slug_options[:permanent_slug].nil?\n\n @slug_options[:source] = options.delete(:source)\n raise InvalidSlugSourceError, 'You must specify a :source to generate slug.' unless slug_source\n\n\n options[:length] ||= get_slug_length\n options.merge(:unique => true) unless options[:unique] == false\n property(:slug, String, options) unless slug_property\n\n before :valid?, :generate_slug\n before :save, :generate_slug\n \n # add alternate slug names for nested resources\n # e.g. /forums/:forum_slug/topics/:topic_slug/\n class_eval <<-SLUG\n def #{self.new.class.to_s.snake_case}_slug\n slug\n end\n def #{self.new.class.to_s.snake_case}_slug=(str)\n self.slug = str \n end\n SLUG\n end", "def build_slug\n if localized?\n begin\n orig_locale = I18n.locale\n all_locales.each do |target_locale|\n I18n.locale = target_locale\n apply_slug\n end\n ensure\n I18n.locale = orig_locale\n end\n else\n apply_slug\n end\n true\n end", "def should_generate_new_friendly_id?\n\t new_record? || slug.blank?\n\tend", "def should_generate_new_friendly_id?\n\t new_record? || slug.blank?\n\tend", "def protected_slug?\n ['home-page-block', 'footer', 'sidebar', 'between-slide-6-list'].include? self.slug\n end", "def should_generate_new_friendly_id?\n\t new_record? || slug.blank?\n\t \n\tend", "def item_types_slug_validation\n return unless catalog\n\n return unless catalog.item_types.exists?(slug: slug)\n\n errors.add :slug, I18n.t(\"validations.page.item_types_slug\")\n end", "def check_slug(slug)\n return false if slug.nil?\n return false if slug.length > 40\n return true if slug.to_s =~ /^[ -~。-゚]*$/\n end", "def has_slug(attribute, options = {})\n options.assert_valid_keys(VALID_HAS_SLUG_OPTIONS)\n \n options = DEFAULT_HAS_SLUG_OPTIONS.merge(options).merge(:attribute => attribute)\n \n if defined?(has_slug_options)\n Rails.logger.error \"has_slug_options is already defined, you can only call has_slug once. This call has been ignored.\"\n else\n write_inheritable_attribute(:has_slug_options, options)\n class_inheritable_reader(:has_slug_options)\n\n if columns.any? { |column| column.name.to_s == options[:slug_column].to_s }\n require 'has_slug/sluggable_class_methods'\n require 'has_slug/sluggable_instance_methods'\n\n extend SluggableClassMethods\n include SluggableInstanceMethods\n\n before_save :set_slug,\n :if => :new_slug_needed?\n else\n require 'has_slug/not_sluggable_class_methods'\n require 'has_slug/not_sluggable_instance_methods'\n\n extend NotSluggableClassMethods\n include NotSluggableInstanceMethods\n end \n end\n end", "def found_using_friendly_id?\n finder_slug\n end", "def fix_slug\n # If title is present and slug not set\n if title.present? && !slug.present?\n fixed_slug = Article.stripper(self.title)\n end\n if slug.present?\n # Make sure slug matches format\n fixed_slug = Article.stripper(self.slug)\n end\n self.slug = fixed_slug\n end", "def slug?(arg)\n false if Integer(arg)\n rescue ArgumentError, TypeError\n true\n end", "def make_slugs_unique\n slugs.each do |column, (_, scope_column)|\n next unless changes.key?(column.to_s)\n\n current_slug = send(column)\n scope_value = scope_column ? send(scope_column) : nil\n while self.class.slug_taken?(column, current_slug, scope_column, scope_value)\n current_slug = Slug.increment(current_slug)\n send(\"#{column}=\", current_slug)\n end\n end\n end", "def check_and_set_slug\n self.slug ||= self.host&.parameterize\n end", "def post_slug(other); end", "def deprecated?\n self[:slug].nil?\n end", "def build_slug\n if slug.blank? or title_changed?\n self.slug = self.title.blank? ? Time.now.strftime('%s') + id.to_s : ActiveSupport::Inflector.transliterate(title).downcase.gsub(/[^\\w]+/, '-')\n\n\n i = 0\n # Slug must be unique, so we try guess a good one\n loop do\n if Post.where(:slug => slug).count == 0\n break\n end\n i += 1\n if slug == 1\n slug = [slug, sprintf('%03d', i)].join('-')\n else\n orig_slug = slug.scan(/^(.+)-(\\d+)$/).flatten.first\n slug = [orig_slug, sprintf('%03d', i)].join('-')\n end\n end\n end\n end", "def create_slug\n return if self.errors.size > 0\n return if self[source_column].blank?\n\n if self[slug_column].to_s.empty?\n proposed_slug = self[source_column].to_slug\n\n suffix = \"\"\n existing = true\n acts_as_slugable_class.transaction do\n while existing != nil\n # look for records with the same url slug and increment a counter until we find a unique slug\n existing = acts_as_slugable_class.\n where(slug_column => proposed_slug + suffix).\n where(slug_scope_condition).first\n if existing\n suffix = suffix.empty? ? \"-0\" : suffix.succ\n end\n end\n end # end of transaction \n self[slug_column] = proposed_slug + suffix\n end\n end", "def slug_taken?(column, value, scope_column, scope_value)\n conditions = { column => value }\n conditions[scope_column] = scope_value if scope_column\n exists?(conditions)\n end", "def slug_candidates\n [\n :title,\n [:title, :created_at]\n ]\n end", "def has_better_id?\n slug and found_using_numeric_id? || found_using_outdated_friendly_id?\n end", "def should_generate_new_friendly_id?\n title_changed?\n end", "def should_generate_new_friendly_id?\n title_changed?\n end", "def should_generate_new_friendly_id?\n title_changed?\n end", "def slug\n published.nil? ? nil : published.slug\n end", "def build_slug\n return unless new_slug_needed?\n self.slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self)\n end", "def slug=(s)\n if (new_slug = fit_slug_to_length(s, 64)) != slug\n super(new_slug)\n update_path\n end\n end", "def create_slug\n return if self.title.blank?\n tail, int = \"\", 1\n initial = convert_to_slug(self.title)\n while Post.find_by_slug(initial + tail) do \n int += 1\n tail = \"-#{int}\"\n end\n self.slug = initial + tail\n end", "def before_save\n if !new? && (title = fields[title_field_name])\n set_slug_from_title(title)\n end\n fix_generated_slug_conflicts if changed_columns.include?(:slug)\n super\n end", "def find_unique_slug\n UniqueSlug.new(self).find_unique\n end", "def should_generate_new_friendly_id?\n title_changed?\n end", "def should_generate_new_friendly_id?\n title_changed?\n end", "def should_generate_new_friendly_id?\n title_changed?\n end", "def should_generate_new_friendly_id?\n title_changed?\n end", "def exists?(conditions = :none)\n return super if conditions.unfriendly_id?\n return true if exists_by_friendly_id?(conditions)\n super\n end", "def add_slug\n loop do\n initials = user.first_name[0, 2].downcase <<\n user.last_name[0, 2].downcase\n year = Time.current.strftime(\"%y\")\n self.slug = \"#{initials}#{year}-#{rand(100..9999)}\"\n break unless self.class.exists?(slug: slug)\n end\n end", "def dup\n super.tap { |duplicate| duplicate.slug = nil if duplicate.respond_to?(\"slug=\") }\n end", "def slug\n @attributes[:slug] = @attributes[:name] && PublicEarth::Db::Collection.create_slug(@attributes[:name]) unless @attributes[:slug] \n @attributes[:slug]\n end", "def build_a_slug\n return unless new_slug_needed?\n @slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self),\n :sluggable => self\n @new_friendly_id = @slug.to_friendly_id\n end", "def site_exists?\n if Site.exists?(url: url)\n update_attribute(:site_id,\n Site.find_by(url: url).id)\n else\n new_site = Site.create(url: url,\n feed_url: parse_feed_url)\n FetchSiteInformationJob.perform_now(new_site.id)\n FetchNewArticlesJob.perform_later(new_site.id)\n update_attribute(:site_id, new_site.id)\n end\n end", "def slug_candidates\n [:title]\n end", "def custom_slug_or_title\n title.presence\n end", "def create_slug\n var_slug = [title.parameterize].join(\"-\")\n self.slug = BlogPost.generate_slug(var_slug)\n end", "def publish_slug\n @options['slug'] || File.basename(@options['path'], '.*')\n end", "def safe_slug(spliter = '-')\n @slug = self\n if @slug.blank?\n @slug = Time.now.to_i.to_s\n end\n @slug.gsub(/[^a-zA-Z\\-0-9]/,spliter).downcase \n end", "def guid_already_exists?\n return Entry.where(feed_id: self.feed_id, guid: self.guid).exists?\n end", "def create_episode_url(slug)\n (slug ? \"#{$base_url}/episodes/#{slug}\" : false)\n end", "def publication_exists?(repository_client, publication)\n works = published_works(repository_client, publication)\n if works.count.positive?\n publication.update(pub_url: publication_url(repository_client, id: works.first['id']))\n publication.publish_exists!\n true\n else\n false\n end\n end", "def manage_slug\n \tself.slug = self.title.parameterize if self.slug.blank?\n end" ]
[ "0.7531849", "0.70434123", "0.7031356", "0.6907691", "0.69001466", "0.6841139", "0.66248775", "0.6604771", "0.66036475", "0.66036475", "0.66036475", "0.6590974", "0.6581869", "0.6568581", "0.6568581", "0.6549414", "0.65259534", "0.65133417", "0.6489964", "0.64785665", "0.6469195", "0.63282835", "0.63282835", "0.630929", "0.6302727", "0.62969583", "0.62969583", "0.62969583", "0.62864375", "0.6260826", "0.6260826", "0.6254667", "0.62033796", "0.61915696", "0.61915696", "0.61915696", "0.61915696", "0.61915696", "0.61915696", "0.61915696", "0.6166968", "0.61550486", "0.6137912", "0.6137912", "0.6137912", "0.6137912", "0.6132847", "0.61218154", "0.6098623", "0.6093879", "0.60854477", "0.6083886", "0.6051277", "0.6051277", "0.601519", "0.59908736", "0.5979595", "0.5902547", "0.5900538", "0.5898761", "0.58775485", "0.5873374", "0.5818649", "0.58119893", "0.580739", "0.5804609", "0.5795567", "0.5789956", "0.5732624", "0.5689857", "0.56873864", "0.5672101", "0.5671804", "0.5669898", "0.56662416", "0.56646097", "0.564911", "0.5646258", "0.56414044", "0.5628848", "0.5610089", "0.5610089", "0.5610089", "0.5610089", "0.5556864", "0.55369574", "0.5514136", "0.5500926", "0.5499422", "0.5486207", "0.54722226", "0.54633695", "0.5448171", "0.5445229", "0.54303294", "0.5423396", "0.54195184", "0.5417069", "0.54055804" ]
0.8027041
1
TEMP: TODO: move to database column and form field
def lede content.strip.split("\n").first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_field\n case self.column_type\n when \"text\"\n %{<%= :#{self.model_name}.text_area :#{self.column_name}, :label => true %>}\n when \"date\"\n %{<%= :#{self.model_name}.date_select :#{self.column_name}, :label => true %>}\n when \"date_time\"\n %{<%= :#{self.model_name}.date_time_select :#{self.column_name}, :label => true %>}\n else\n case self.column_name.downcase\n when /password/\n %{<%= :#{self.model_name}.password_field :#{self.column_name}, :label => true %>}\n else\n %{<%= :#{self.model_name}.text_field :#{self.column_name}, :label => true %>}\n end\n end\n end", "def after_render_field(record, column); end", "def form_field\n case self.column_type\n when \"text\"\n %{<textarea name=\"#{self.form_element_name}\" id=\"#{self.form_element_id}\" cols=\"60\" rows=\"20\"><%= @#{self.model_name}.#{self.column_name} %></textarea>}\n else\n %{<input type=\"text\" name=\"#{self.form_element_name}\" id=\"#{self.form_element_id}\" size=\"30\" value=\"<%= @#{self.model_name}.#{self.column_name} %>\" />}\n end\n end", "def render_crud_form_field(column, item, locals)\n locals = locals.merge({:item => item, :column => column})\n\n if param(column,:grouped_select)\n return content_tag(\n \"select\",\n tag(\"option\", :value => \"\") + grouped_options_for_select(param(column,:grouped_select), @item.send(column[:name])),\n :id => \"#{@singular.underscore}_#{column[:name]}\",\n :name => \"#{@singular.underscore}[#{column[:name]}]\"\n )\n elsif param(column,:select)\n locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n else\n type = param(column, :type, (item.attributes.include?(column[:name].to_s) ? item.column_for_attribute(column[:name]).type : \"other\")).to_s\n type = 'other_record' if param(column, :type, '') == '' && item.respond_to?(column[:name].to_s+\"_id\") && (attribute_class(column).respond_to?(:find) || column.include?(:find_class))\n locals = locals.merge({:type => type})\n\n if class_exists?('Lico::AutoCrud::Types::' + type.classify)\n return get_class('Lico::AutoCrud::Types::' + type.classify).to_input(item, column[:name], locals[:f], locals[:params])\n end\n \n return case type.to_sym\n when :boolean then locals[:f].check_box(column[:name], :class => 'in_boolean')\n when :country_select then locals[:f].localized_country_select(\n column[:name].to_s,\n [:NL, :BE, :LU, :FR, :DE],\n { :include_blank => '' },\n param(column, :params, { }).merge({ :class => 'in_country_select' })\n )\n when :currency then number_to_currency(0, :format => \"%u\") + \"&nbsp;\".html_safe + locals[:f].text_field(column[:name], :class => 'in_currency', :style => 'text-align: right', :value => number_to_currency(@item.send(column[:name]).to_f, :separator => \".\", :delimiter => \"\", :format => \"%n\"))\n when :custom then send(\"input_for_#{@singular.underscore}_#{column[:name].to_s}\", locals[:f], item)\n when :date then locals[:f].date_select(column[:name], param(column, :options, {}),{ :class => 'in_date' })\n when :time then locals[:f].time_select(column[:name], param(column, :options, {}),{ :class => 'in_time' })\n when :datetime then locals[:f].datetime_select(column[:name], :minute_step => 15, :class => 'in_datetime')\n when :file then locals[:f].file_field(column[:name], :class => 'in_file')\n when :hidden then locals[:f].hidden_field(column[:name], param(column, :params, { }).merge({:class => 'in_hidden'}))\n when :no_input then @item.send(column[:name])\n when :other_record then\n find_class = column.include?(:find_class) ? column[:find_class] : attribute_class(column)\n find_conditions = column[:conditions]\n find_items = find_class.find(:all, :select => param(column, :select, nil), :joins => param(column, :joins, []), :include => param(column, :include, []), :conditions => find_conditions).collect do |element| \n [ element.to_s, element.id ]\n end\n locals[:f].select(\"#{column[:name].to_s}_id\", find_items, { :include_blank => true }.merge(param(column, :options, {})))\n when :paperclip then\n item.send(column[:name].to_s).nil? ? \n # no image\n locals[:f].file_field(column[:name], :class => 'in_paperclip') :\n\n # with image\n image_tag(item.send(column[:name].to_s, param(column, :size))) +\n content_tag(\n \"div\", \n t('paperclip.upload_new') + \" \" + locals[:f].file_field(column[:name], :class => 'in_paperclip') +\n content_tag(\n \"div\",\n locals[:f].check_box(\"#{column[:name]}_delete\") +\n locals[:f].label(\"#{column[:name]}_delete\", t('paperclip.select_unlink'))\n )\n )\n when :password then locals[:f].password_field(column[:name], :class => 'in_password')\n when :select then locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n when :textarea then locals[:f].text_area(column[:name], {:class => 'in_textarea'}.merge(param(column, :params, { })))\n else\n locals[:f].text_field(column[:name], param(column, :params, { }).merge({:class => 'in_' + type}))\n end\n end\n end", "def real_column; end", "def configure_field\n end", "def get_field(field_name)\n\t\tend", "def field_content\n value\n end", "def read_field\n end", "def user_column\n end", "def get_char_field(field_name)\n\t\tend", "def value_field\n \"text\"\n end", "def address_line_1_form_column(record,input_name)\n text_field :record, :address_line_1, :maxlength => '10', :class=>\"address_line_1-input text-input\"\n end", "def get_field_name\n\t\tend", "def query_field; end", "def add_field(field)\n\t\tend", "def configure_field\n end", "def field(name); end", "def form_object_value\n if @field_name.to_s.start_with?('extcol_')\n (@page_config.form_object[:extended_columns] || {})[@field_name.to_s.delete_prefix('extcol_')]\n elsif @field_config[:parent_field]\n parent_hash[@field_name.to_s] || parent_hash[@field_name]\n else\n @page_config.form_object[@field_name]\n end\n end", "def text_field; end", "def relation_by_sql_form\n # Nothing to do here\n end", "def crushyfield(col, o={})\n return '' if (o[:type]==:none || model.schema[col][:type]==:none)\n return crushyinput(col,o) if (o[:input_type]=='hidden' || model.schema[col][:input_type]=='hidden')\n default_field_name = col[/^id_/] ? Kernel.const_get(col.sub(/^id_/, '')).human_name : col.tr('_', ' ').capitalize\n field_name = o[:name] || model.schema[col][:name] || default_field_name\n error_list = errors_on(col).map{|e|\" - #{e}\"} if !errors_on(col).nil?\n \"<p class='crushyfield %s'><label for='%s'>%s</label><span class='crushyfield-error-list'>%s</span><br />\\n%s</p>\\n\" % [error_list&&'crushyfield-error', field_id_for(col), field_name, error_list, crushyinput(col, o)]\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 column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def form_field_name(essence_column = self.essence.ingredient_column)\n \"contents[content_#{self.id}][#{essence_column}]\"\n end", "def process_field(field_name)\n if ['id', 'name', 'first_name', 'node_id'].include?(field_name)\n \"#{table}.#{field_name}\"\n else\n super # raises\n end\n end", "def process_field_value(value)\r\n value\r\n end", "def add_show_field(*) super end", "def text_field?(field_name); end", "def layoutField(fld, idx)\r\n insert_item(idx, fld.name)\r\n set_item(idx, 1, fld.df.desc)\r\n set_item(idx, 2, fld.generator.klass_name)\r\n set_edit_attr(idx, 2, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @value_types)\r\n case fld.generator\r\n when ValueTypeFixed\r\n set_item(idx, 3, fld.generator.value)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_EDIT)\r\n when ValueTypeFromConfig\r\n when ValueTypeVariableCard\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Card.columns)\r\n when ValueTypeVariableAcquirer\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Acquirer.columns)\r\n when ValueTypePreviousOutgoing\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n when ValueTypePreviousIncoming\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n end # end of case\r\n end", "def get_string_field(field_name)\n\t\tend", "def fields; end", "def fields; end", "def fields; end", "def field(method, options = {})\r\n options.stringify_keys\r\n type = options.delete('type') || @object.column_for_attribute(method.to_s).type\r\n \r\n case type\r\n when :string, :integer, :float\r\n text_field(method, options)\r\n when :text\r\n text_area(method, options)\r\n when :datetime\r\n datetime_select(method,options)\r\n when :date\r\n date_select(method,options)\r\n when :time\r\n time_select(method,options)\r\n when :boolean\r\n check_box(method, options)\r\n else \r\n \"Unknown field type #{type.to_s}\"\r\n end\r\n end", "def get_field_type\n\t\tend", "def ing_form; end", "def computed_fields; end", "def input_field(attribute_name, options = T.unsafe(nil)); end", "def form_field_data\n @attributes[:form_field_data]\n end", "def field\n @field ||= quoted_field(field_name)\n end", "def form_fields\n [:description, :status, :magic]\n end", "def form_element_name\n \"#{self.model_name}[#{self.column_name}]\"\n end", "def sf_field(key)\n self.attributes[translate_rails_key(key)] || self.attributes[translate_rails_key(key) + \"__c\"]\n end", "def backend_fields(cols)\n o = ''\n cols.each do |c|\n identifier = \"#{id}-#{self.class}-#{c}\"\n o << \"<label for='#{identifier}'>#{c.to_s.capitalize}</label><br />\\n\"\n o << \"<textarea id='#{identifier}' name='model[#{c}]'>#{self[c]}</textarea><br />\\n\"\n end\n o\n end", "def fe_for(column_name)\n col = @model.column_for_attribute(column_name)\n fe(col.type, col.name)\n end", "def columnName_to_fieldname (name)\n return name.downcase.gsub(' ','-')\nend", "def override_form_field_partial(column)\n partial_for_model(column.active_record_class, \"#{clean_column_name(column.name)}_form_column\")\n end", "def relation_value_form\n case params[:method]\n when \"exists?\"\n @partial = parse_option\n when \"average\", \"count\", \"maximum\", \"minimum\", \"sum\", \"calculate\", \"pluck\"\n # Render the column name field.\n @partial = \"calculate\"\n @sub_method = true, @distinct = true if params[:method] == 'calculate'\n @distinct = true if params[:method] == 'count'\n @column_names = calculate_column_names(params[:method])\n end\n end", "def get_field_edit_js\n # TODO: add JS rendering when generating JS fields class for client side rendering\n '<JS NOT IMPLEMENT YET>'\n end", "def get_field_edit_js\n # TODO: add JS rendering when generating JS fields class for client side rendering\n '<JS NOT IMPLEMENT YET>'\n end", "def get_field_edit_js\n # TODO: add JS rendering when generating JS fields class for client side rendering\n '<JS NOT IMPLEMENT YET>'\n end", "def add_field_to_column_family(*args)\n new_field = self.class.add_field_to_column_family(*args)\n method = \"#{new_field.name}=\"\n send(method, new_field.default) if respond_to? method\n end", "def handles?(field); end", "def form_columns\n columns\n end", "def field(rec, form_drawer)\n form_drawer.draw_field(rec, self)\n end", "def get_field_edit_html\n '<HTML NOT IMPLEMENT YET>'\n end", "def get_binary_field(field_name)\n\t\tend", "def [](field_name); end", "def backend_fields(cols)\n o = ''\n cols.each do |c|\n identifier = \"#{id.to_i}-#{self.class}-#{c}\"\n o << \"<label for='#{identifier}'>#{c.to_s.capitalize}</label><br />\\n\"\n o << \"<textarea id='#{identifier}' name='model[#{c}]'>#{self.send(c)}</textarea><br />\\n\"\n end\n o\n end", "def set_field(field_name, field_value)\n super field_name.to_s, field_value.to_s\n end", "def start_field; end", "def form; end", "def editable_field_html(klass, field_name, value, f, include_nil_selectors = false)\n # When editing a job the values are of the correct type.\n # When editing a dirmon entry values are strings.\n field = klass.fields[field_name.to_s]\n return unless field&.type\n\n placeholder = field.default_val\n placeholder = nil if placeholder.is_a?(Proc)\n\n case field.type.name\n when \"Symbol\", \"String\", \"Integer\"\n options = extract_inclusion_values(klass, field_name)\n str = \"[#{field.type.name}]\\n\".html_safe\n if options\n str + f.select(field_name, options, {include_blank: options.include?(nil) || include_nil_selectors, selected: value}, {class: \"selectize form-control\"})\n else\n if field.type.name == \"Integer\"\n str + f.number_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n else\n str + f.text_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n end\n end\n when \"Hash\"\n \"[JSON Hash]\\n\".html_safe +\n f.text_field(field_name, value: value ? value.to_json : \"\", class: \"form-control\", placeholder: '{\"key1\":\"value1\", \"key2\":\"value2\", \"key3\":\"value3\"}')\n when \"Array\"\n options = Array(value)\n \"[Array]\\n\".html_safe +\n f.select(field_name, options_for_select(options, options), {include_hidden: false}, {class: \"selectize form-control\", multiple: true})\n when \"Mongoid::Boolean\"\n name = \"#{field_name}_true\".to_sym\n value = value.to_s\n str = '<div class=\"radio-buttons\">'.html_safe\n str << f.radio_button(field_name, \"true\", checked: value == \"true\")\n str << \" \".html_safe + f.label(name, \"true\")\n str << \" \".html_safe + f.radio_button(field_name, \"false\", checked: value == \"false\")\n str << \" \".html_safe + f.label(name, \"false\")\n # Allow this field to be unset (nil).\n if include_nil_selectors\n str << \" \".html_safe + f.radio_button(field_name, \"\", checked: value == \"\")\n str << \" \".html_safe + f.label(name, \"nil\")\n end\n\n str << \"</div>\".html_safe\n else\n \"[#{field.type.name}]\".html_safe +\n f.text_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n end\n end", "def set_field_value(name, value)\n\t\tend", "def set_tbl_form_field\n @tbl_form_field = TblFormField.find(params[:id])\n end", "def field_with_unique_id( form, field_type, object, field_name )\n field_id = \"#{object.class.name.downcase}_#{object.id.to_s}_#{field_name.to_s}\"\n form.send( field_type, field_name, :id => field_id )\n end", "def user_choice_of_field(object)\n fields = object.database_field_names\n \n create_menu = Menu.new(\"Which field do you want to update?\")\n fields.each_with_index do |field, x|\n create_menu.add_menu_item({key_user_returns: x + 1, user_message: field, do_if_chosen: \n [field]})\n end\n run_menu(create_menu)[0]\n end", "def html_for_non_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'text' \n name = create_form[#{field}]\n placeholder = 'Type in the #{field}'\n value = '#{object.send(field)}'>\n </input>\n </p>\"\n end", "def build_field(value, index)\n options = build_field_options(value, index)\n cp_service = AuthorityService::CurrentPersonService.new\n options[:value] = cp_service.find_value_string(value)\n if options.delete(:type) == 'textarea'.freeze\n @builder.text_area(attribute_name, options)\n else\n @builder.text_field(attribute_name, options)\n end\n end", "def form_element_id\n \"#{self.model_name}_#{self.column_name}\"\n end", "def on_field_change\n super\n end", "def populate_fields(target,data)\n data.each{|key,value|target.text_field(:name=>key).set value}\nend", "def display_fields\n database_field_names\n end", "def value_field\n \"string\"\n end", "def attributes_tag(f, object, attribute, fckeditor = false)\n type = object.class.columns_hash[attribute.to_s]\n return f.password_field attribute.to_s if attribute.to_s.ends_with? \"password\"\n return f.select(attribute.to_s, MyAdmin.get_related_select_options(attribute.to_s, object), {}, :class => \"relation\" ) if attribute.to_s.ends_with? \"id\"\n return file_column_field(f.object_name.to_s, attribute.to_s) if attribute.to_s.ends_with?(\"file_column\")\n return f.file_field attribute.to_s if attribute.to_s.ends_with?(\"file\") \n case type.type\n when :string\n f.text_field type.name\n when :text\n f.text_area type.name\n when :integer\n f.text_field type.name\n when :datetime\n f.datetime_select type.name\n when :date\n f.date_select type.name \n when :boolean\n f.check_box type.name\n else\n f.text_field attribute\n end \n end", "def form_data?; end", "def formation; end", "def user_choice_of_field(object)\n fields = object.database_field_names\n create_menu = Menu.new(\"Which field do you want to update?\")\n fields.each_with_index do |field, x|\n create_menu.add_menu_item({key_user_returns: x + 1, user_message: field, do_if_chosen: \"#{object.class}/#{object.id}/#{field}\"})\n end\n create_menu\n end", "def contact_field(contact, field_name, label=field_name)\n html=[]\n style=\"edit\"\n html << \"<label>#{label}</label>\"\n val = html_escape(contact.send(field_name))\n if val.blank?\n val = 'Click to edit' \n style << \" subtle-text\"\n end\n html << \"<span id=\\\"#{field_name}\\-#{contact.id}\\\" class=\\\"#{style}\\\">#{val}</span><br>\"\n html.join(\"\").html_safe\n end", "def ar_standard_form_method form, resource, attribute\n # I use instance_variable_get to avoid deprecation of \"type\" warning\n case resource.column_for_attribute(attribute).instance_variable_get(\"@type\")\n when :text\n form.text_area(attribute) \n when :binary, :boolean\n form.check_box(attribute)\n else\n #when :string, :integer, :float, :decimal\n #when :datetime, :timestamp, :time, :date\n form.text_field(attribute)\n end\n end", "def d_usrlbl; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'drLabel'); end", "def get_field(field, collection)\n if field.is_a?(Hash) # rubocop:disable Style/ConditionalAssignment\n field = \"#{field[:table]}.#{field[:field]}\"\n else\n field = \"#{collection.table_name}.#{field}\"\n end\n field_base.gsub(Placeholder::FIELD, field)\n end", "def form_field_order\n %w{\n\n }\n end", "def form_field_order\n %w{\n\n }\n end", "def field?\n false \n end", "def update_dorm_selection; update_field(\"dorm_selection\"); end", "def form_input(fieldtype, modelname, fieldname)\n case fieldtype\n when \"text\"\n text_field modelname, fieldname\n when \"password\"\n password_field modelname, fieldname\n when \"textarea\"\n text_area modelname, fieldname, \"rows\" => 5, \"cols\" => 30\n when \"submit\"\n submit modelname, fieldname\n end\n end", "def textfields\n find_2_eles_attr :textfield, :secure, :text\n end", "def releaf_fields_to_display action\n column_names - %w[id created_at updated_at]\n end", "def set_form_col col1=@curpos\n @curpos = col1 || 0 # 2010-01-14 21:02 \n #@form.col = @col + @col_offset + @curpos\n c = @col + @col_offset + @curpos\n #$log.warn \" #{@name} empty set_form_col #{c}, curpos #{@curpos} , #{@col} + #{@col_offset} #{@form} \"\n setrowcol nil, c\n end", "def set_form_col col1=@curpos\n @curpos = col1 || 0 # 2010-01-14 21:02 \n #@form.col = @col + @col_offset + @curpos\n c = @col + @col_offset + @curpos\n #$log.warn \" #{@name} empty set_form_col #{c}, curpos #{@curpos} , #{@col} + #{@col_offset} #{@form} \"\n setrowcol nil, c\n end", "def show_field_value(column_name, column_value)\n content_tag(:tr) do \n content_tag(:td, t(\"#{column_name}\")) +\n content_tag(:td, column_value)\n end \n end" ]
[ "0.7489837", "0.7062744", "0.70053643", "0.6874576", "0.63838303", "0.6380619", "0.6375783", "0.627334", "0.6266773", "0.6247424", "0.62397593", "0.6224619", "0.62219936", "0.6209436", "0.6208398", "0.620448", "0.6151702", "0.61351883", "0.6098411", "0.6089803", "0.60852605", "0.6045924", "0.6032492", "0.6032492", "0.6032492", "0.60293806", "0.60293806", "0.60293806", "0.60293806", "0.60293806", "0.60293806", "0.60293806", "0.60050744", "0.6003658", "0.59849775", "0.5937325", "0.588657", "0.58653486", "0.58622146", "0.5850002", "0.5850002", "0.5850002", "0.5847426", "0.5846385", "0.58376426", "0.58012795", "0.57806003", "0.5770915", "0.57688624", "0.5767592", "0.5756757", "0.5742302", "0.5736449", "0.57294893", "0.57280606", "0.57156503", "0.5707835", "0.5704472", "0.5704472", "0.5704472", "0.57007873", "0.5697535", "0.5691793", "0.56817377", "0.5681328", "0.56782264", "0.56687707", "0.5666191", "0.5665335", "0.5658784", "0.56521636", "0.5650683", "0.5648286", "0.56432617", "0.56406665", "0.56183535", "0.56138414", "0.5612224", "0.5609501", "0.5596479", "0.5592042", "0.5578086", "0.55630434", "0.55443954", "0.5538069", "0.5537009", "0.55325335", "0.55140007", "0.55082923", "0.5500054", "0.54960793", "0.54927456", "0.54927456", "0.5488121", "0.54830945", "0.5480429", "0.5480068", "0.54767054", "0.5476272", "0.5475941", "0.5475309" ]
0.0
-1
accepts only if the given token is the current_token
def soft_accept(token=current_token) (token == current_token).tap do |result| accept if result end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token?(token)\n return false\n end", "def token?\n @token && !@token.empty?\n end", "def current_token\n @current_token\n end", "def token?\n (@token.respond_to?(:empty?) && !@token.empty?)\n end", "def valid_token?(token)\n exists?(:token => token)\n end", "def is_token_valid? token\n @browser_token_db.has_token? token\n end", "def match_token(token)\n return true\n end", "def check_token\n end", "def current_token\n @tokens[@token_index]\n end", "def valid_new_token?(token)\n unique_token?(token) && token_looks_safe?(token)\n end", "def authenticate_token\n @is_authenticated = false\n if request.headers[\"TOKEN\"]\n if request.headers[\"TOKEN\"] == \"AppDipre\"\n @is_authenticated = true\n end\n end\n end", "def authenticate_token\n @is_authenticated = false\n if request.headers[\"TOKEN\"]\n if request.headers[\"TOKEN\"] == \"AppDipre\"\n @is_authenticated = true\n end\n end\n end", "def is_token?\n !@card_token.nil?\n end", "def valid_token?(token, method = :any)\n tokens = settings.subaru_config[:global][:auth_tokens][method]\n return true if tokens.nil?\n tokens.include?(token)\n end", "def find_valid_token(name, token)\n token = find_token(name, token)\n return unless token\n !token.expired? && token\n end", "def valid_token?(token)\n return false unless !token.nil? && token_looks_safe?(token)\n result = ApiToken.find_by(token: token)\n !result.nil? && result[:active]\n end", "def valid_token?\n env['HTTP_TOKEN']\n end", "def valid_token?\r\n token = ::AuthToken.where(user_id: decoded_auth_token[:user_id]).newer.first\r\n token&.token == auth_token && token.expire_at >= Time.now if token.present?\r\n end", "def token\n end", "def token_valid?\n raise 'To be implemented in child classes'\n end", "def check_token\n input_token = request.headers['X-Auth-Token'] || params[:token]\n return unless input_token\n\n token = AuthenticationToken.find_by(token: input_token)\n return unless token\n\n # Count token usage\n token.inc(number_of_use: 1)\n # Update the updated_at because inc doesn't do it\n token.set(updated_at: Time.now.getlocal)\n\n # Sign in\n sign_in token.user\n end", "def check_current_user(id, token)\n @user != nil && @user.token.to_s() == token && @user.id.to_s() == id\n end", "def valid_token?\n # we check against a copy invitation object\n match = Invitation.find_by_token(self.token)\n \n if !match\n errors.add :token, 'not found'\n return false\n elsif User.registered.find_by_invitation_id(match)\n errors.add :token, 'already used'\n return false\n end\n \n true\n end", "def token\n @token ||= @context[\"value\"]\n end", "def has_token?\n api.has_token?\n end", "def has_token?( token )\n return self.corpus.data.has_key?( token )\n end", "def current_token\n @stream.current_token\n end", "def token?\n @session_token\n end", "def token\n @token.present? ? @token : token_hash\n end", "def correct_login_token?(given_token)\n false\n end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def match_token (exp, token)\n\tputs \"Leaf token received: #{token.value}\"\n\tputs \"\\tExpecting token of type: #{exp}\"\n\n\tif exp == token.type\n\t\tputs \"\\t\\tShiny. Got #{token.type}!\"\n\t\t$cst.add_leaf(token.value, token)\n\t\t\n\t\t# To try to make this auto-managed\n\t\t$index = $index + 1\n\t\t\n\telse\n\t\traise FaultyTokenError.new(exp, token)\n\tend\nend", "def token\n @token\n end", "def token\n @token\n end", "def verify_token\n associate = Associate.where(id: params[:associate_id])[0] if params[:associate_id]\n #checking signed_in user\n if user_signed_in?\n #checking token is nil or not.\n if params[:token].nil?\n #response in json format\n render :json=> { success: false, message: \"Token is required to proceed further.\" },:status=> 203\n return\n elsif associate && associate.associate_user == true\n return true\n #checking token with the current_user\n elsif current_user.authentication_token != params[:token]\n render :json=> { success: false, message: \"Problem with the authentication token.please check token.\" },:status=> 203\n return\n else\n end\n end\n end", "def valid_token?\n return false unless token\n begin\n # We use rate limit as its a fast and free way to\n # test the GitHub token.\n octokit.rate_limit\n rescue Octokit::ClientError\n return false\n end\n true\n end", "def validate_token(provided_token)\n clear_expired_tokens\n token_object = access_tokens.find_by_token(provided_token)\n return false if !token_object\n token_object.update_attribute(:token_expire, Time.now + DEFAULT_TOKEN_EXPIRE)\n true\n end", "def authenticate_token\n render_401 if @token.blank? || !@token.active?\n end", "def current_user\n authenticate_token\n end", "def token_valid?\n @session_token and @toodle_token_death > Time.now\n end", "def valid_authentication_token?(incoming_auth_token)\n incoming_auth_token == self.authentication_token\n end", "def is_app_token?\n case\n when params['token_type'] == 'app' || token.to_s[/^xoxa/]\n true\n when token.to_s[/^xoxp/]\n false\n else\n nil\n end\n end", "def require_token\n valid = params[:token].present? && current_user.confirmation_token.present?\n valid = valid && ActiveSupport::SecurityUtils.secure_compare(params[:token], current_user.confirmation_token)\n valid = valid && !current_user.confirmation_token_expired?\n deny_user(\"Invalid token\", root_path) unless valid\n end", "def authenticate?(token)\n data = DB[:Token].where(Token: token).first\n unless data.nil?\n if data[:Token] == token && data[:Timestamp] >= Time.now.to_i\n return true\n end\n end\n false\n end", "def valid?\n @token.valid?\n end", "def token_based?\n @userId && @authToken && !@authToken.empty?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def token\n authenticated\n end", "def has_valid_token?\n !Slack::Config.token.nil? && Slack::Config.token == \"authorized\"\n end", "def is_token? m\n return false if m == nil\n m = m.to_s\n (m =~ /^([a-zA-Z0-9\\-\\.\\_\\~]|\\%[0-9a-fA-F]{2}|[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=\\@])+$/) != nil\n end", "def is_token? m\n return false if m == nil\n m = m.to_s\n (m =~ /^([a-zA-Z0-9\\-\\.\\_\\~]|\\%[0-9a-fA-F]{2}|[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=\\@])+$/) != nil\n end", "def valid_autosignin_token?(incoming_autosignin_token)\n incoming_autosignin_token == self.autosignin_token\n end", "def valid_authentication_token?(incoming_auth_token)\n incoming_auth_token.present? && incoming_auth_token == self.authentication_token\n end", "def check_token(chat_token)\n sender = @handle_keys[chat_token]\n return !sender.nil?\n end", "def accept_limitable_token?(token_or_object)\n extract_object_from_options(token_or_object).present?\n end", "def valid_for_token_auth?\n token_authenticatable? && auth_token.present? && with_authentication_hash(:token_auth, token_auth_hash)\n end", "def current_token_still_valid?\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.about.get)\n rescue\n return false\n end\n \n if result.status == 200\n true\n else\n false\n end\n end", "def validate_token\n return true if @current_username\n token = get_token\n token.force_encoding('utf-8') if token\n token_object = AccessToken.find_by_token(token)\n if token_object && token_object.validated?\n @current_username = token_object.username\n return true\n else\n return false\n end\n end", "def has_next_token\n\t\t@input.has_next\n\tend", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next?\n !token.nil?\n end", "def next_token\n @current_token = @lexer.next_token\n end", "def if?(token_class = nil, &block)\n block ||= lambda do |token|\n token.class == token_class\n end\n if block.call(@token)\n @token = @lexer.next\n end\n end", "def valid_token?(token)\n return token == 'TEST_ENV_VALID_TOKEN' if Rails.env.test?\n\n valid_token = config['security_token']\n raise 'Security token is not set! Please set it as soon as possible!' if valid_token.blank?\n\n token == valid_token\n end", "def get_current_token\n if request.headers['Authorization'].present?\n return request.headers['Authorization'].split(' ').last\n end\n raise(ExceptionHandler::MissingToken, Message.missing_token)\n end", "def auth_token\n return token if token.present?\n\n false\n # raise(CustomException::MissingToken, 'token is missing')\n end", "def process_token(token)\n # Create a ProcessedToken to make sure we don't process the same thing twice\n processed_token = ProcessedToken.new(token.name, token.parent)\n \n unless @processed_tokens.include?(processed_token)\n # Add to the right array of tokens\n tokens[token.classifier] << token\n @processed_tokens << processed_token\n \n # WTF!? :)\n raise token.method_list[0].singleton.inspect unless token.method_list[0].singleton rescue true\n \n # Process the tokens inside of this one accordingly\n [:method_list, :classes, :modules].each do |meth, type|\n token.send(meth).each do |item|\n process_token item\n end if token.respond_to?(meth)\n end\n end\n end", "def getCurrentToken\n\t\t\tif !@accessToken\n\t\t\t\treturn false\n\t\t\tend\n\n\t\t\t@accessToken\n\t\tend", "def valid_token?\n five_minutes_ago = DateTime.now - 5.minutes\n params[:timestamp].to_i > five_minutes_ago.to_i &&\n params[:token] == Scalingo::SsoController.generate_authentication_token(params[:id], params[:timestamp])\n end", "def require_token\n today = Time.now\n today_string = today.to_date.to_s\n yesterday_string = today.yesterday.to_date.to_s\n return false unless [today_string, yesterday_string].include?(params[:salt])\n params[:token] == token_with_salt(params[:salt])\n end", "def current_type\n @token_type[@current_tok]\n end", "def pass_token\n next_remote_node = @calendar_network.get_next_remote_node\n puts \"Passing token to #{next_remote_node}\"\n if !@calendar_network.has_token || next_remote_node == @calendar_network.local_node || @calendar_network.need_token\n return true\n end\n puts \"Passing token to: \" + next_remote_node.to_s\n remote_server = xml_rpc_client(next_remote_node.address, @calendar_network.config[\"path\"], next_remote_node.port)\n remote_server.call(\"calendar_network.take_token\")\n\n @calendar_network.has_token = false\n true\n end", "def token!\n raise \"#{username} is not signed in, (token is set to nil).\" unless token\n\n token\n end", "def is_app_token?\n auth['token_type'].to_s == 'app'\n end", "def user_authorizes_token?\n params[:authorize] == '1'\n end", "def user_authorizes_token?\n params[:authorize] == '1'\n end", "def user_authorizes_token?\n params[:authorize] == '1'\n end", "def has?(token)\n store.key? token\n end", "def validate_token(token)\n object_from_response(Code42::TokenValidation, :get, \"authToken/#{token.to_s}\")\n end", "def current_user\n @_current_user ||= authenticate_token\n end", "def current_user\n @_current_user ||= authenticate_token\n end", "def check_weixin_token_valid?\n if token_string.blank?\n if token_model_instance.blank?\n render text: \"Forbidden\", status: 403\n return false\n end\n else\n if current_weixin_token != token_string\n render text: \"Forbidden\", status: 403\n return false\n end\n end\n true\n end", "def process_token(tk); end", "def scan_for_on(token); end", "def token=(token)\n Thread.current[:token] = token\n end", "def token_is_for_master?\n token_account['name'] == 'master'\n end", "def authorize_token(auth_token)\n cache_token(auth_token)\n info(true) # force a refresh\n\n authorized?\n end", "def check_token(token)\n params = \"token=#{token}&md5=#{Ivona::GetMd5.formula(token)}\"\n HTTParty.get(\"#{BASE_URL}/tokens?#{params}\")\n end", "def user_authorizes_token?\n return true if params[:authorize]\n\n end", "def is_token_valid?(token, options={})\n response = els_http_request(\"/isTokenValid\",\"tokenid=#{token}\",options)\n if response.code.eql? \"200\"\n true\n else\n false\n end\n end" ]
[ "0.7259626", "0.7152087", "0.7083958", "0.67953897", "0.67651135", "0.66602886", "0.6647488", "0.66294855", "0.6554703", "0.65303826", "0.65189224", "0.65189224", "0.6482159", "0.64300936", "0.642276", "0.6422299", "0.639008", "0.6312649", "0.63045424", "0.6296064", "0.62910295", "0.62785745", "0.62755275", "0.625963", "0.62514013", "0.6225437", "0.62185985", "0.6216834", "0.62089974", "0.620217", "0.6189972", "0.6189972", "0.6189972", "0.6189972", "0.6189972", "0.6189972", "0.6168965", "0.6160582", "0.614298", "0.61396724", "0.6121221", "0.6110312", "0.6107651", "0.60847944", "0.60834", "0.6081318", "0.6077698", "0.6068139", "0.6027325", "0.60265684", "0.6023128", "0.600902", "0.600902", "0.600902", "0.600902", "0.600902", "0.60085285", "0.597673", "0.5964874", "0.5964874", "0.5964267", "0.5963259", "0.59608537", "0.5954498", "0.5950143", "0.59421915", "0.5932114", "0.59270704", "0.59224856", "0.59224856", "0.59224856", "0.59110177", "0.58944374", "0.5889428", "0.58767307", "0.5876366", "0.58712345", "0.5863259", "0.5858751", "0.5856983", "0.5855213", "0.58521706", "0.58498365", "0.58490986", "0.5848253", "0.5848253", "0.5848253", "0.58463323", "0.5841038", "0.58378845", "0.58378845", "0.58351856", "0.58337724", "0.58253676", "0.58251464", "0.58107895", "0.5805752", "0.5799673", "0.5797271", "0.5791839" ]
0.67911273
4
accepts a method and prints the method we are transitioning to
def goto(method, args=nil) print(method) if args send(method, args) else send(method) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_method(*) end", "def display_method_info\n end", "def display_method name\n found = load_methods_matching name\n\n raise NotFoundError, name if found.empty?\n\n filtered = filter_methods found, name\n\n out = method_document name, filtered\n\n @history.go name, out, nil\n\n display out\n end", "def print_method(context)\n m = method(eval(\"__method__\", context)) \n params = m.parameters.map { |param| param[1] }\n param_list = params.map { |param| \"#{param} = #{eval(param.to_s, context)}\" }.join(', ')\n puts \"#{m.name.to_s}(#{param_list})\"\nend", "def print\n\t\tputs name + ' ' + className + \" just \" + move + \" and said \" + call\n\tend", "def add_method(method)\n @display.print_method method\n end", "def function2method(method)\n \"#{Indentation.get}this.#{method.to_s[4 + Indentation.size..-1]}\"\n end", "def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend", "def callee\n @method\n end", "def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend", "def display_method(method)\n @display.display_method_info method\n end", "def method\n puts \"inside method\"\nend", "def print\r\n puts name + \" \" + className + \" says \" + \"\\\"\" + call + \"\\\"\"\r\n end", "def yet_another_method\n puts \"I'm a method\"\nend", "def print_me()\n \"I'm printing within the method!\"\nend", "def print\n puts \"#{name} #{class_name} just #{movement} and said, \\\"#{call}\\\"\"\n end", "def method_that_says(stuff)\n\tputs (stuff)\nend", "def method\n @method\n end", "def method_missing(method, *args)\n puts \"You called: #{method}(#{args.join(', ')})\"\n puts \"(You also passed it a block)\" if block_given?\n end", "def print_me\n \"I'm printing within the method!\"\nend", "def print_me\n puts \"I'm printing within the method!\" \nend", "def print_me\n puts \"I'm printing within the method!!!\"\nend", "def display_method_list\n end", "def print_me\n puts \"I'm printing within the method!\"\nend", "def print_me\n puts \"I'm printing within the method!\"\nend", "def print_me\n puts \"I'm printing within the method!\"\nend", "def print_me\n puts \"I'm printing within the method!\"\nend", "def print_me\n puts \"I'm printing within the method!\"\nend", "def print_me\n puts \"I'm printing within the method!\"\nend", "def print_me\n puts \"I'm printing within the method!\"\nend", "def dump_method(method_symbol, clz = nil, is_class_method = false)\n if clz.nil?\n method_variable = method(method_symbol)\n else\n if is_class_method\n method_variable = clz.method(method_symbol)\n else\n method_variable = clz.instance_method(method_symbol)\n end\n end\n\n if not method_variable.nil?\n puts \"[Debug] `#{method_symbol}` at #{method_variable.source_location ? method_variable.source_location.join(':') : 'unknown source location'} (original_name = `#{method_variable.original_name}`)\"\n else\n puts \"[Debug] not find `#{method_symbol}` method!\"\n end\nend", "def simple_method\n puts \"I am a simple method!\"\nend", "def my_method\n\tputs \"Enter into my_method...\"\nend", "def some_method_two\n puts \"Some more details.\"\n end", "def method\n @method\n end", "def method\n @method\n end", "def method\r\nend", "def log_dispatch(method, args=[])\n\t\t\tmeth_str = self.class.to_s + \"#\" + method.to_s\n\t\t\tmeth_str += \" #{args.inspect}\" unless args.empty?\n\t\t\tlog \"Dispatching to: #{meth_str}\"\n\t\tend", "def display_method name\n out = RDoc::Markup::Document.new\n\n add_method out, name\n\n display out\n end", "def meth\n\tp 'Hello'\nend", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def print\n end", "def test\n puts \"This is a Method........................................\"\nend", "def print\n end", "def print\n end", "def print\n end", "def show_object(args)\n class_name = args[0]\n next_method_to_call = args[1]\n puts class_name.all\n call_method(next_method_to_call)\n end", "def print\n\n end", "def method_symbol; end", "def example_method\n puts \"example\" \nend", "def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"\n end\n end", "def print_call ( i )\n\tname = @call.call_lookup i.target.hex\n\tif name\n\t w = i.line.split\n\t print w[0] + \"\\t\" + w[1] + \"\\t\\t\" + w[2]\n\t print \"\\t\" + name + \"\\t\\t; \" + w[3] + \"\\n\"\n\t #puts i.line + \"\\t; \" + name\n\telse\n\t # should never happen\n\t puts i.line + \"\\t; \" + \"????\"\n\tend\n end", "def method_shark es, method_name\n es.select {|e| e.method_name == method_name }\n .map {|e| \"\\n\\n\\n#{e.date}\\n\\n#{e.method_body}\" }\nend", "def foo\r\n puts \"The foo method has been called!\"\r\n end", "def method_missing(meth, *args, &block)\n if meth.to_s =~ /^print_(.+)$/\n send(\"#{$1.downcase}_presentation\")\n else\n super # You *must* call super if you don't handle the method,\n # otherwise you'll mess up Ruby's method lookup.\n end\n end", "def firstMethod()\n p \"hey this is first method ok\"\n p \"here i show how can create method in ruby\"\n p \" know time end \"\nend", "def method_help(method)\n call(\"System.methodHelp\", method)\n end", "def print_stuff\n puts \"#{private_method_hello} annnnnd buh-#{private_method_bye}\"\n end", "def defined_method()\n p \"success\"\nend", "def print\n raise NotImplementedError, \"Subclasses must implement a call method.\"\n end", "def trace_method(klass, method)\n wrap_method klass, method, \"apm_tracer\" do |&block|\n Datadog.tracer.trace(\"#{klass}###{method}\", &block)\n end\n end", "def method_name\n m = @method_stack.first || @@no_method\n m = \"##{m}\" unless m =~ /::/\n m\n end", "def method_name\n m = @method_stack.first || @@no_method\n m = \"##{m}\" unless m =~ /::/\n m\n end", "def type\n 'Method'\n end", "def my_method2 argument1, argument2\n print argument1, \" \", argument2, \"\\n\" \n end", "def report_method_stuff(requested_method_name, methods)\n entries = methods.find_all {|m| m.name == requested_method_name and (\n !@onlyLoadedClasses or \n Object.class_eval \"defined? #{m.nameSpace.full_name}\" ) }\n case entries.size\n when 1\n method = @ri_reader.get_method(entries.first)\n @display.display_method_info(method)\n when 0\n puts \"No loaded methods matched your request\"\n else\n @display.display_method_list(entries)\n end\n end", "def method_information(bound_method); end", "def foo\n puts \"You called 'say_foo' which ran 'foo'\"\nend", "def src\n \"#{@cur_method.first.first} | #{@cur_method.map(&:first)[1..-1].join('.')}\"\n end", "def describeMethod(cname, type, mname)\n \n # If the class name part is ambiguous, then we have a join to\n # do\n \n method_list = methods_matching(cname, type, mname)\n\n case method_list.size\n \n when 0\n @op.error(\"Cannot find method `#{cname}#{type}#{mname}'\")\n throw :exit, 3\n \n when 1\n meth = method_list[0]\n @op.putMethodDescription do\n @op.putMethodHeader(meth.class_name, meth.typeAsSeparator, meth.name, meth.callseq)\n printFragments(meth) unless @synopsis\n end\n \n else\n\n @op.putListOfMethodsMatchingName(mname) do\n @op.putMethodList(method_list.collect { |m| \n \"#{m.class_name}#{m.typeAsSeparator}#{m.name}\" \n })\n end\n end\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n\n end", "def walk_method(name); end", "def ri(method = nil)\n\t unless method && method =~ /^[A-Z]/ # if class isn't specified\n\t klass = self.kind_of?(Class) ? name : self.class.name\n\t method = [klass, method].compact.join('#')\n\t end\n\t puts `ri '#{method}'`\n\tend", "def print\n puts \">> Command to be executed: #{command}\"\n end", "def puts\n end", "def apply_method(method, zodiac)\n puts \"\\n#{method_to_string(method)}\".magenta.bold + \" for \".blue.bold + \"#{zodiac.name}\".magenta.bold + \" is/are:\".blue.bold\n method_output = zodiac.send(method)\n puts \"\\n\\n#{output_array_to_string(method_output)}\\n\\n \".magenta\n what_now(@zodiac)\n end", "def method a=\r\n\tputs \r\nend", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def ri(method = nil)\n unless method && method =~ /^[A-Z]/ # if class isn't specified\n klass = self.kind_of?(Class) ? name : self.class.name\n method = [klass, method].compact.join('#')\n end\n puts `ri '#{method}'`\n end", "def method_name; end" ]
[ "0.77771485", "0.7030891", "0.69917643", "0.69671017", "0.69439274", "0.6941891", "0.6916332", "0.6786635", "0.6786246", "0.6780767", "0.67077804", "0.67069995", "0.6652047", "0.65738153", "0.6466491", "0.6465187", "0.64076453", "0.6402894", "0.63928515", "0.63910687", "0.63754994", "0.63665557", "0.6351777", "0.63413495", "0.63413495", "0.63413495", "0.63413495", "0.63413495", "0.63413495", "0.63413495", "0.6339951", "0.63014835", "0.62644035", "0.6234303", "0.62263197", "0.62263197", "0.6197466", "0.6167485", "0.61578655", "0.61175984", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61098474", "0.61039525", "0.60940844", "0.609188", "0.609188", "0.609188", "0.6089971", "0.60872287", "0.6068716", "0.60674536", "0.60393995", "0.60353994", "0.6029684", "0.60287446", "0.60256046", "0.6014178", "0.5984754", "0.5960351", "0.59531635", "0.5944994", "0.59408146", "0.5939524", "0.5939524", "0.5935926", "0.59185547", "0.59092647", "0.59087324", "0.5905042", "0.59016216", "0.5896225", "0.5876746", "0.5876237", "0.5870018", "0.5864152", "0.58558875", "0.58402306", "0.5839914", "0.5835932", "0.5835932", "0.5835932", "0.5835932", "0.5835932", "0.5835932", "0.5835932", "0.5835932", "0.5835932", "0.5835932", "0.5835932", "0.5830358" ]
0.64357305
16
this makes use of elastic search query syntax
def elasticsearch_params(page, per_page = 20) page ||= 1 offset = (page.to_i - 1) * per_page.to_i { body: { sort: order_params, query: elasticsearch_query, aggs: aggregates, post_filter: { bool: { filter: [{ in: { portal_ids: current_portal.self_and_descendants.pluck(:id) } }] } }, size: per_page, from: offset }, page: page, per_page: per_page } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters, we need to parse them\n if params['filters'].present?\n filters = []\n # For each of the filters format them and stuff them into an array\n params['filters'].each do |key, filter|\n\n if [\n 'properties.educationalAlignment.properties.targetName',\n 'properties.inLanguage',\n 'properties.isBasedOnUrl',\n 'properties.thumbnailUrl',\n 'properties.timeRequired',\n 'properties.typicalAgeRange',\n 'properties.url',\n 'properties.useRightsUrl'\n ].include?(key)\n searchKey = \"schema-org.#{key}.original\"\n matchTerm = 'term'\n else\n searchKey = \"schema-org.#{key}\"\n matchTerm = 'match'\n end\n\n if filter.keys.count > 1\n # This is more complex because this filter type needs the keys or'd together\n orFilters = []\n filter.keys.each do |f|\n orFilters << { 'query' => { matchTerm => { searchKey => f.to_s } } }\n end\n filters << { 'or' => orFilters }\n else\n # This should be simple, there is only one of this filter key\n filters << { 'query' => { matchTerm => { searchKey => filter.keys.first.to_s } } }\n end\n end\n\n # If the query is present we need to match it\n if params['query'].present?\n query = { 'match' => { '_all' => params['query'] } }\n filter = { 'and' => filters }\n # If no query is present then we can wildcard against anything\n else\n query = { 'match_all' => { } }\n filter = { 'and' => filters }\n end\n # if not filter is present then just match against query\n else\n query = { 'match' => { '_all' => params['query'] } }\n end\n\n # Build the payload from the various parts\n payload = {\n 'size' => limit,\n 'from' => offset,\n 'query' => {\n 'filtered' => {\n 'query' => query,\n 'filter' => filter\n }\n },\n \"facets\" => {\n \"intendedEndUserRole\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.intendedEndUserRole.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"typicalAgeRange\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.typicalAgeRange.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"educationalUse\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.educationalUse.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"interactivityType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.interactivityType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"learningResourceType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.learningResourceType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n },\n \"mediaType\" => {\n \"terms\" => {\n \"field\" => \"schema-org.properties.mediaType.original\",\n \"global\" => true,\n \"all_terms\" => true\n }\n }\n }\n }\n\n#puts \"PAYLOAD\"; puts Rails.configuration.elastic_search_url; puts payload.to_json\n\n # Okay after all that mess, lets make the request\n request = RestClient::Request.new( :method => :get, :url => Rails.configuration.elastic_search_url, :payload => payload.to_json )\n # Since this can error lets catch it\n begin\n searchResults = request.execute\n results = JSON.parse(searchResults)\n results[:hack] = hack\n\n#puts \"RESPONSE\"; puts results.to_json\n\n respond_to do |format|\n format.json { render json: results }\n end\n rescue => e\n # @TODO Need to return the correct error type and then an error message to be shown to user.\n respond_to do |format|\n format.json { render json: searchResults }\n end\n#puts \"ERROR!\"; puts e.response\n end\n\n end", "def search(query); end", "def aggregate(query)\n client.search(\n index: name,\n body: query\n )\n end", "def build_query\n Jbuilder.encode do |j|\n j.track_total_hits true\n j.query do\n j.bool do\n # Query\n if @multi_queries.any?\n j.must do\n @multi_queries.each do |query|\n j.child! do\n if query[:term].kind_of?(String)\n # https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-match-query.html\n j.simple_query_string do\n j.query sanitize(query[:term])\n j.default_operator \"OR\"\n j.flags \"PHRASE\"\n j.lenient true\n j.quote_field_suffix RegisteredElement::EXACT_FIELD_SUFFIX\n j.fields [query[:field]]\n end\n else\n j.range do\n j.set! query[:field] do\n term = query[:term]\n if term[:from_year].present? || term[:to_year].present? # date range\n if term[:from_year].present?\n from_date = Time.new(term[:from_year].to_i,\n term[:from_month].present? ? term[:from_month].to_i : nil,\n term[:from_day].present? ? term[:from_day].to_i : nil)\n j.gte from_date.strftime(\"%Y-%m-%d\")\n end\n if term[:to_year].present?\n to_date = Time.new(term[:to_year].to_i,\n term[:to_month].present? ? term[:to_month].to_i : nil,\n term[:to_day].present? ? term[:to_day].to_i : nil)\n j.lte to_date.strftime(\"%Y-%m-%d\")\n end\n else # exact date (maybe excluding month or day)\n from_date = Time.new(term[:year].present? ? term[:year].to_i : nil,\n term[:month].present? ? term[:month].to_i : nil,\n term[:day].present? ? term[:day].to_i : nil)\n to_date = from_date.dup\n if term[:day].present?\n to_date = to_date + 1.day\n elsif term[:month].present?\n to_date = to_date + 1.month\n else\n to_date = to_date + 1.year\n end\n j.gte from_date.strftime(\"%Y-%m-%d\")\n j.lt to_date.strftime(\"%Y-%m-%d\")\n end\n end\n end\n end\n end\n end\n end\n elsif @query\n j.must do\n if @query[:term].kind_of?(String)\n # https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple-query-string-query.html\n j.simple_query_string do\n j.query sanitize(@query[:term])\n j.default_operator \"AND\"\n j.flags \"PHRASE\"\n j.lenient true\n j.quote_field_suffix RegisteredElement::EXACT_FIELD_SUFFIX\n j.fields @query[:fields]\n end\n elsif @query[:term].respond_to?(:keys) && (@query[:term][:year] || @query[:term][:from_year])\n date_range_from_query(j, @query)\n end\n end\n end\n\n j.filter do\n j.bool do\n j.must do\n j.child! do\n j.term do\n j.set! OpenSearchIndex::StandardFields::CLASS, get_class.to_s\n end\n end\n if @exists_field\n j.child! do\n j.exists do\n j.field @exists_field\n end\n end\n end\n @filters.each do |key_value|\n if key_value[1].respond_to?(:each)\n j.child! do\n j.bool do\n j.should do\n key_value[1].each do |term|\n j.child! do\n j.term do\n j.set! key_value[0], term\n end\n end\n end\n end\n end\n end\n elsif !key_value[1].nil?\n j.child! do\n j.term do\n j.set! key_value[0], key_value[1]\n end\n end\n end\n end\n @filter_ranges.each do |range|\n j.child! do\n j.range do\n j.set! range[:field] do\n j.set! range[:op], range[:value]\n end\n end\n end\n end\n end\n if @must_nots.any? || @must_not_ranges.any?\n j.must_not do\n @must_nots.each do |key_value|\n unless key_value[1].nil?\n j.child! do\n if key_value[0].respond_to?(:each)\n j.terms do\n j.set! key_value[0], key_value[1]\n end\n else\n j.term do\n j.set! key_value[0], key_value[1]\n end\n end\n end\n end\n end\n @must_not_ranges.each do |range|\n j.child! do\n j.range do\n j.set! range[:field] do\n j.set! range[:op], range[:value]\n end\n end\n end\n end\n end\n end\n end\n end\n end\n end\n\n # Aggregations\n j.aggregations do\n if @aggregations\n facet_elements.each do |element|\n j.set! element[:keyword_field] do\n j.terms do\n j.field element[:keyword_field]\n j.size @bucket_limit\n end\n end\n end\n end\n end\n\n # Ordering\n # Order by explicit orders, if provided; otherwise sort by the metadata\n # profile's default order, if @orders is set to true; otherwise don't\n # sort.\n if @orders.respond_to?(:any?) && @orders.any?\n j.sort do\n @orders.each do |order|\n j.child! do\n j.set! order[:field] do\n j.order order[:direction]\n j.unmapped_type \"keyword\" unless order[:field] == OpenSearchIndex::StandardFields::SCORE\n end\n end\n end\n end\n elsif @orders\n end\n\n # search_after\n if @search_after\n j.search_after @search_after\n end\n\n # Start\n if @start.present?\n j.from @start\n end\n\n # Limit\n if @limit.present?\n j.size @limit\n end\n end\n end", "def queryCSV(query)\n#\turi = URI.parse(\"http://127.0.0.1:9200/vccpe/_search?pretty\")\n#\trequest = Net::HTTP::Get.new(uri)\n#\trequest.basic_auth(\"logserver\", \"logserver\")\n#\trequest.body = JSON.dump({\n# \t\"size\" => 1,\n#\t\"sort\" => [\n#\t{\n#\t\"@timestamp\" => {\n#\t\"order\" => \"desc\"\n#\t}\n#\t}\n#\t],\n# \t\"query\" => {\n# \t\"filtered\" => {\n# \t\"query\" => {\n# \"query_string\" => {\n# \t\"query\" => \"#{query}\",\n# \"analyze_wildcard\" => true\n# }\n# \t},\n# \t\"filter\" => {\n# \"bool\" => {\n# \t\"must\" => [\n#\t{\n#\t\"range\" => {\n#\t\"@timestamp\" => {\n#\t\"lte\" => \"#{timestamp_id}\",\n#\t\"gt\" => \"#{timestamp_id_minus6m}\"\n#\t}\n#\t}\n#\t}\n#\t],\n# \t\"must_not\" => []\n# \t}\n# \t}\n# \t}\n# \t},\n# \t\"aggs\" => {\n# \t\"index\" => {\n# \t\"terms\" => {\n# \"field\" => \"_index\",\n# \"size\" => 1\n# \t}\n# \t},\n# \t\"uid\" => {\n# \t\"terms\" => {\n# \"field\" => \"_uid\",\n# \"size\" => 1\n# \t}\n# \t}\n# \t}\n#\t})\n\n\turi = URI.parse(\"http://127.0.0.1:9200/vccpe/_search?pretty\")\n\trequest = Net::HTTP::Get.new(uri)\n\trequest.basic_auth(\"logserver\", \"logserver\")\n\trequest.body = JSON.dump({\n \t\"size\" => 0,\n \t\"query\" => {\n \t\"filtered\" => {\n \t\"query\" => {\n \"query_string\" => {\n \t\"query\" => \"#{query}\",\n \"analyze_wildcard\" => true\n }\n \t},\n \t\"filter\" => {\n \"bool\" => {\n \t\"must\" => [],\n \t\"must_not\" => []\n \t}\n \t}\n \t}\n \t},\n \t\"aggs\" => {\n \t\"index\" => {\n \t\"terms\" => {\n \"field\" => \"_index\",\n \"size\" => 0\n \t}\n \t},\n \t\"uid\" => {\n \t\"terms\" => {\n \"field\" => \"_uid\",\n \"size\" => 0\n \t}\n \t}\n \t}\n\t})\n\n\treq_options = {\n\t\tuse_ssl: uri.scheme == \"https\",\n\t}\n\n\tresponse = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n\t\thttp.request(request)\n\tend\n\n\t#puts response.body\n\t#jsonResponse = JSON.parse(response.body)\n\t#return jsonResponse[\"hits\"][\"hits\"][0][\"_source\"][\"status\"]\n\n\n\t#puts response.body\n\tjsonResponse = JSON.parse(response.body)\n\t#puts jsonResponse\n\t#information about index\n\tindex = jsonResponse[\"aggregations\"][\"index\"][\"buckets\"][0][\"key\"]\n\t#information about number of documents in index\n\tdoc_count = jsonResponse[\"aggregations\"][\"index\"][\"buckets\"][0][\"doc_count\"]\n\t#puts doc_count\n\t#concatenated messages from multiple documents\n\tmessageResponse = []\n\t#messageResponse = \"\"\n\tfor i in 0...doc_count\n\t\t#information about documents in index\n\t\ttypeAndId = jsonResponse[\"aggregations\"][\"uid\"][\"buckets\"][i][\"key\"].split('#')\n\n\t\turi = URI.parse(\"http://127.0.0.1:9200/#{index}/#{typeAndId[0]}/#{typeAndId[1]}?pretty\")\n\t\trequest = Net::HTTP::Get.new(uri)\n\t\trequest.basic_auth(\"logserver\", \"logserver\")\n\t\treq_options = {\n\t\t\tuse_ssl: uri.scheme == \"https\",\n\t\t}\n\n\t\tresponse = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n\t\t\thttp.request(request)\n\t\tend\n\n\t\t#puts JSON.parse(response.body)[\"_source\"][\"message\"]\n\t\tmessageResponse.push(JSON.parse(response.body)[\"_source\"][\"message\"])\n\t\t#messageResponse << JSON.parse(response.body)[\"_source\"][\"message\"]\n\tend\n\n\treturn messageResponse\nend", "def index\n @search = Order.search do\n # fulltext '\"84CYd601Dh0slEeJ ankur saini\"' do\n # with(:average_rating, 3..5)\n # field_list [:tracker_hash,:system_id]\n fulltext(params[:search])\n facet(:average_rating) do\n row(1.0..2.0) do\n with(:average_rating, 1.0..2.0)\n end\n row(2.0..3.0) do\n with(:average_rating, 2.0..3.0)\n end\n row(3.0..4.0) do\n with(:average_rating, 3.0..4.0)\n end\n row(4.0..5.0) do\n with(:average_rating, 4.0..5.0)\n end\n end\n # fulltext params[:search] do\n # boost_fields :system_id => 2.0\n # boost(2.0) { with(:response, true) }\n # fields(:tracker_hash)\n # fields(:system_id, :tracker_hash => 2.0)\n # query_phrase_slop 1\n # end\n # with(:published_at).less_than(Time.zone.now)\n # facet(:publish_month)\n # with(:publish_month, params[:month]) if params[:month].present?\n # with(:response, false)\n\n end\n # @orders = @search.results\n ids = @search.hits.map(&:primary_key)\n # debugger\n if ids.present?\n @orders = Order.where(:id => ids).order(\"field(id, #{ids.join(',')})\").paginate(page: params[:page], per_page: 4)\n else\n @orders = Order.where(:id => ids).paginate(page: params[:page], per_page: 4)\n end\n end", "def index\n @query = params[:q] || '*:*'\n query = Jbuilder.encode do |json|\n json.filter do\n json.missing do\n json.field \"parent_id\"\n end\n end\n json.query do\n json.query_string do\n json.query @query\n end\n end\n json.sort do\n json.node \"asc\"\n end\n end\n @themata = Thema.__elasticsearch__.search(query).page(params[:page]).records\n end", "def multi_index_elastic_search(params={})\n params = format_params(params)\n \n search = Tire.search params[:indexes], :load => false, :from => params[:offset] do \n query do\n boolean do\n should { match :name, \"#{params[:q]}*\", :type => :phrase_prefix }\n should { match :content, params[:q], :type => :phrase}\n end\n end\n facet \"item_type\" do terms :_type end\n highlight :content, :title\n sort { by \"_score\"}\n\n end\n end", "def lookup_payload\n {\n query: {\n bool: {\n should: [\n { match: { exact_query: @query } },\n { match: { stemmed_query: @query } },\n ],\n },\n },\n post_filter: {\n bool: { must: { match: { document_type: \"best_bet\" } } },\n },\n size: 1000,\n _source: {\n includes: %i[details stemmed_query_as_term],\n },\n }\n end", "def get_search_query\n {\n '_id' => \"#{resource[:name]}\"\n }\n end", "def query_for_index(query, index)\n search_url = \"http://ajax.googleapis.com/ajax/services/search/#{index}?v=1.0&q=#{URI.escape(query)}\"\n @res[search_url] = ''\n \n @multi.add(Curl::Easy.new(search_url) do|cfg|\n cfg.headers['Referer'] = @referer\n cfg.on_body{|data| @res[cfg.url] << data; data.size }\n cfg.on_success {|easy| yield(JSON.parse(@res[easy.url])) }\n end)\n end", "def Search query\n \n APICall(path: \"search.json?query=#{query}\",method: 'GET')\n \n end", "def search(args = {})\n query = self::Query.new(args)\n args[:body] = query.to_hash\n\n args[:index] = configuration.index\n args[:type] = type\n\n result = client.search args\n\n result_list = result[\"hits\"][\"hits\"].map do |item|\n model = new(item[\"_source\"])\n model.id = item[\"_id\"]\n model.version = item[\"_version\"]\n model\n end\n\n ResultList.new(result_list, Integer(args.fetch(:from, 0)), result[\"hits\"][\"total\"])\n end", "def search(query, options = {}); end", "def query\n sanitize search_params['query']\n end", "def index\n authorize! :read, Recipe\n @query = params[:query]\n @search_result = Recipe.search do\n fulltext params[:query]\n if params[:course_type_ids].present?\n all_of do\n params[:course_type_ids].each do |filter|\n with(:course_type_ids, filter)\n end\n end\n end\n if params[:exclu_course_type_ids].present?\n all_of do\n params[:exclu_course_type_ids].each do |filter|\n without(:course_type_ids, filter)\n end\n end\n end\n if params[:difficulty].present?\n all_of do\n params[:difficulty].each do |filter|\n with(:difficulty, filter)\n end\n end\n end\n if params[:exclu_difficulty].present?\n all_of do\n params[:exclu_difficulty].each do |filter|\n without(:difficulty, filter)\n end\n end\n end\n if params[:cost].present?\n all_of do\n params[:cost].each do |filter|\n with(:cost, filter)\n end\n end\n end\n if params[:exclu_cost].present?\n all_of do\n params[:exclu_cost].each do |filter|\n without(:cost, filter)\n end\n end\n end\n if params[:category_ids].present?\n all_of do\n params[:category_ids].each do |filter|\n with(:category_ids, filter)\n end\n end\n end\n if params[:exclu_category_ids].present?\n all_of do\n params[:exclu_category_ids].each do |filter|\n without(:category_ids, filter)\n end\n end\n end\n if params[:main_ingredient_ids].present?\n all_of do\n params[:main_ingredient_ids].each do |filter|\n with(:main_ingredient_ids, filter)\n end\n end\n end\n if params[:exclu_main_ingredient_ids].present?\n all_of do\n params[:exclu_main_ingredient_ids].each do |filter|\n without(:main_ingredient_ids, filter)\n end\n end\n end\n if params[:source_ids].present?\n all_of do\n params[:source_ids].each do |filter|\n with(:source_ids, filter)\n end\n end\n end\n if params[:exclu_source_ids].present?\n all_of do\n params[:exclu_source_ids].each do |filter|\n without(:source_ids, filter)\n end\n end\n end\n facet :course_type_ids\n facet :category_ids\n facet :main_ingredient_ids\n facet :source_ids\n facet :difficulty, :sort => :index\n facet :cost, :sort => :index\n paginate :page => params[:page] || 1, :per_page => 10\n order_by(:score, :desc)\n order_by(:created_at, :desc)\n end\n @query_params = params.except( :page )\n \n filters = [\n :course_type_ids, \n :exclu_course_type_ids, \n :difficulty, \n :exclu_difficulty, \n :cost, \n :exclu_cost, \n :category_ids, \n :exclu_category_ids, \n :main_ingredient_ids, \n :exclu_main_ingredient_ids, \n :source_ids, \n :exclu_source_ids\n ]\n filters.each do |filter|\n if params[filter].present?\n params[filter].map!{ |x| x.to_i }\n end\n end\n \n # @search_result.facet(:main_ingredient_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:course_type_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:category_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n # @search_result.facet(:source_ids).rows.sort!{|a,b| (a.count <=> b.count) == 0 ? (a.instance.name <=> b.instance.name) : (a.count <=> b.count)*(-1) }\n \n sort_alphabetical(@search_result.facet(:main_ingredient_ids).rows)\n sort_alphabetical(@search_result.facet(:course_type_ids).rows)\n sort_alphabetical(@search_result.facet(:category_ids).rows)\n sort_alphabetical(@search_result.facet(:source_ids).rows)\n end", "def search(index, body)\n handler.search index: index, body: body\n end", "def index\n # @entries = Entry.all\n @search.sorts = ['term desc', 'created_at desc'] if @search.sorts.empty?\n @search_term = params[:q]\n @entries = @search\n .result(distinct: true)\n .includes(:definitions)\n .page(params[:page])\n .per(params[:per_page])\n\n\n 1\n end", "def search(index_path, query)\n results = Connection.post(\n [index_path, \"_search\"].join(\"/\"),\n :body => MultiJson.encode(query.body)\n )\n results_body = MultiJson.decode(results.body)\n if results.success?\n ElasticSearch::Results.new query, results_body, @conversions\n else\n raise QueryError.new(results_body[\"error\"], results_body[\"status\"])\n end\n end", "def query\n { \"page\" => page,\n \"page_size\" => page_size,\n \"phrase\" => phrase }\n end", "def get_elk_data(query)\n index = \"logstash-\" + Time.now.strftime(\"%Y.%m.%d\")\n url = \"/#{index}/#{@type}/_search\"\n\n req = Net::HTTP::Post.new( url, initheader = {'Content-Type' =>'application/json'} )\n req.body = query\n\n response = Net::HTTP.new(@host, @port).start {|http| http.request(req) }\n hits = JSON.parse(response.body)['hits']\n\n if hits.nil?\n puts response.body\n end\n\n return hits\n end", "def simple_search(query)\n search({:query => query})\n end", "def parse_search(q)\n # TODO continue\n end", "def search_request(user_id, keywords)\n keyword_queries = keywords.map do |keyword|\n {\n bool: {\n should: [\n { term: { title: keyword.downcase } },\n { term: { content: keyword.downcase } }\n ]\n }\n }\n end\n\n __elasticsearch__.search(\n query: {\n bool: {\n must: keyword_queries\n }\n },\n filter: {\n term: {\n user_id: user_id\n }\n },\n sort: [\n {\n created_at: {\n order: 'desc'\n }\n }\n ],\n size: ES_LIMIT_SIZE\n )\n end", "def query; end", "def query_string\n _f = @params.fields.include?(:full_text) ? [:full_text] : fields\n # byebug\n a = query.gsub('/', '').scan( /\"[^\"]+\"|[^ ]+/ ).map do |word|\n if word[0] === '\"'\n m = word.match( /^\"(.*)\"$/ );\n word = m ? m[1] : word;\n end\n Unicode.downcase(word.gsub('\"', ''))\n end\n _q = '(' + a.join('* AND ') + '*)'\n # _q = '/(?=.*?'+a.join( ')(?=.*?' )+').*/';\n #byebug\n index.filter{ ~q(query_string: {fields: _f, query: \"#{_q}\", default_operator: 'or'}) } if _q.present? && _f.present?\n\n #index.query(multi_match: {query: \"#{_q}*\", fields: _f}) if _q.present? && _f.present\n end", "def autocomplete\n render json: Post.search(params[:query],operator: \"or\", autocomplete: true,limit: 10,boost_by_distance: {field: :location, origin: [current_user.lat, current_user.lon]}).map {|post| {title: post.title, value: post.id}}\n end", "def search_for(*args, &block)\n __elasticsearch__.search(*args, &block)\n end", "def execute(index)\n matches = index.hashes_for @search_term, restrict_type: @object_type, restrict_field: @field_name\n return matches.map do |matched_object|\n # Polymorphism of some kind would probably be cleaner than this, but this is literally the\n # only part of the codebase that cares, so... ¯\\_(ツ)_/¯\n case @object_type\n when 'organization'\n ticket_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'organization_id'\n end\n user_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'user', restrict_field: 'organization_id'\n end\n next {\n '_tickets' => ticket_matches&.map { |t| t.slice('_id', 'subject')},\n '_users' => user_matches&.map { |t| t.slice('_id', 'name')},\n }.merge(matched_object)\n when 'ticket'\n asignee_matches = if matched_object['assignee_id']\n index.hashes_for matched_object['assignee_id'], restrict_type: 'user', restrict_field: '_id'\n end\n submitter_matches = if matched_object['submitter_id']\n index.hashes_for matched_object['submitter_id'], restrict_type: 'user', restrict_field: '_id'\n end\n organization_matches = if matched_object['organization_id']\n index.hashes_for matched_object['organization_id'], restrict_type: 'organization', restrict_field: '_id'\n end\n next {\n '_assignee' => asignee_matches&.map { |t| t.slice('_id', 'name') },\n '_submitter' => submitter_matches&.map { |t| t.slice('_id', 'name') },\n '_organization' => organization_matches&.map { |t| t.slice('_id', 'name') },\n }.merge(matched_object)\n when 'user'\n asignee_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'assignee_id'\n end\n submitter_matches = if matched_object['_id']\n index.hashes_for matched_object['_id'], restrict_type: 'ticket', restrict_field: 'submitter_id'\n end\n organization_matches = if matched_object['organization_id']\n index.hashes_for matched_object['organization_id'], restrict_type: 'organization', restrict_field: '_id'\n end\n next {\n '_assigned_tickets' => asignee_matches&.map { |t| t.slice('_id', 'subject') },\n '_submitted_tickets' => submitter_matches&.map { |t| t.slice('_id', 'subject') },\n '_organization' => organization_matches&.map { |t| t.slice('_id', 'name') },\n }.merge(matched_object)\n\n end \n end\n end", "def search\n @query = params[:q]\n @ads = Ad.within(@city, 30)\n @ads = @ads.fulltext_search(@query).group_by { |x| x.created_at.to_date }\n end", "def search(from = 0, size = self.count)\n @request[:from] = from\n @request[:size] = size\n @request[:body][:script_fields]= { \"ids\": { \"script\": { inline: \"doc['_id']\", lang: \"groovy\" } } }\n ids = request.raw_response[\"hits\"][\"hits\"].map{|result| result[\"_id\"]}\n Contract.any_in(id: ids)\n rescue => e\n return e\n end", "def add_general_query\n fields = [\n \"creators.name^5\",\n \"title^7\",\n \"endnotes\",\n \"notes\",\n \"summary\",\n \"tags.name\",\n \"series.title\"\n ]\n query_string = options[:q]\n return if query_string.blank?\n body.must(\n :query_string,\n fields: fields,\n query: query_string\n )\n end", "def search_with_index query\n docs = []\n return docs if query.terms.empty?\n load if @content.nil?\n return docs if @content.nil?\n index = {}\n query.terms.each do |term|\n if term.operator == :eq && term.value.class != Regexp\n set = @attribute_storage[term.field][term.value]\n else\n set = @content.select do |doc|\n term.compare(doc.send(term.field))\n end\n end\n\n if !set.nil? && !set.empty?\n if docs.empty?\n docs = set\n if query.relation == :and\n docs.each do |value|\n index[value] = nil\n end\n end\n else\n if query.relation == :or\n docs += set\n else\n set.each do |value|\n if !index.has_key? value\n docs << value\n index[value] = nil\n end\n end\n end\n end\n end\n end\n docs\n end", "def match_query(query); end", "def search(query, idx, type = 'document')\n response = request(\n :search,\n index: idx,\n type: type,\n body: query\n ) || (return {})\n parse_response(response)\n end", "def search(query)\n @search_svc.search query\n end", "def search(args = {})\n search_args = {}\n search_args[:body] = self::ElasticsearchQuery.new(args).to_hash\n search_args[:index] = configuration.index\n search_args[:type] = type\n\n result = client.search search_args\n ids = result[\"hits\"][\"hits\"].map {|item| item[\"_source\"][\"id\"] } # use to get the records and sort them in that order\n result_list = includes(:translations, [:master => [:prices, :images]]).where(id: ids).index_by(&:id).slice(*ids).values\n\n # Convert all facets to facet objects\n facet_list = result[\"facets\"].map do |tuple|\n name = tuple[0]\n hash = tuple[1]\n type = hash[\"_type\"]\n body = hash.except!(\"_type\")\n Spree::Search::Elasticsearch::Facet.new(name: name, search_name: name, type: type, body: body)\n end\n\n ResultList.new(\n results: result_list,\n from: Integer(args.fetch(:from, 0)),\n total: result[\"hits\"][\"total\"],\n facets: facet_list\n )\n end", "def search_by_keyword(query, o={})\n #debugger\n #debug \"[search_by_keyword] query = #{query}\"\n result = Sunspot.search(Item) do\n keywords query\n if o[:doc_only]\n without :itype_str, Item::ITYPE_CONCEPT#['query','concept','tag']\n end\n #debugger\n o.find_all{|k,v|k.to_s =~ /^facet\\_/}.each do |e|\n #debugger\n with (e[0].to_s.split('_')[1..-1].join('_')).to_sym, e[1] if [e[1]].flatten.first != '-1'\n end\n #debugger\n order_by(:basetime, :desc) if o[:order] == \"recency\" || query == TEXT_DUMMY\n paginate(:page => o[:page], :per_page => o[:per_page]) if o[:page]\n facet(o[:facet]) if o[:facet]\n without :hidden_flag, '1'\n end\n #debugger\n if o[:facet]\n result.facet(o[:facet]).rows\n elsif o[:raw]\n result\n else\n result_items = result.hits.map_with_index{|e,i|{:id=>e.instance.id, :rank=>(i+1), :score=>e.score}}\n @cv.add(:type=>'kwd', :query=>query, :created_at=>(o[:created_at] || Time.now), :history_id=>o[:history_id], :result=>result_items) if o[:add_context]\n result_items\n end\n end", "def search\n \n search = params[:search]\n miniresume = params[:miniresume]\n location = params[:location]\n\n #thinking_sphinx conditions - \n @adviceposts = Advicepost.search(search,miniresume,location,page: 1, per_page: 25)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @adviceposts }\n end\n end", "def find(query); end", "def find(query); end", "def query\n @query ||= search.query\n end", "def index\n\n # search query\n if params[:q].nil?\n @shops = Shop.all\n else\n @shops = Shop.search_with_elasticsearch(params[:q]).records\n end\n\n if params[:filter].present?\n if params[:filter] == 'name'\n @shops = @shops.order('title ASC')\n elsif params[:filter] == 'date'\n @shops = @shops.order('updated_at DESC')\n elsif params[:filter] == 'location'\n define_location\n @shops = @shops.near([@latitude, @longitude], 8_000_000, order: 'distance')\n end\n else\n @shops = @shops.order('updated_at DESC')\n end\n\n @shops = @shops.page(params[:page]).per(20)\n\n end", "def run_query(terms)\n return Book.run_search(terms)\nend", "def query\n end", "def query\n @query = Riddle::Query.escape params[:search]\n end", "def query\n @query = Riddle::Query.escape params[:search]\n end", "def parse_search; end", "def specific_search(**args)\n params = parameters(args) do\n required_params :term, :field_type, :field_key\n optional_params :term, :exact_match, :field_type, :field_key, :return_field_key, :return_item_ids, :start, :limit\n end\n request(:get, 'searchResults/field', params)\n end", "def search index:, query_string: nil, query: nil, sort: nil\n if query_string\n log.info \"Searching elastic search for #{query_string} on #{index}\"\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_search?q=#{query_string}&sort=#{sort}\")\n req = Net::HTTP::Post.new(uri)\n else\n log.debug \"Searching elastic search index #{index} for body #{query}\"\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_search\")\n req = Net::HTTP::Post.new(uri)\n req.body = query.is_a?(String) ? query : query.to_json\n end\n\n run(uri, req)\n end", "def solr_resp_ids_from_query(query)\n solr_resp_doc_ids_only({'q'=> query})\nend", "def index\n if params[:search].present? || params[:date_filter].present?\n # @ingoing = Document.search(\n # params[:search], \n # where: {\n # outgoing: false,\n # date: {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day, \n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # } \n # }, \n # order: {created_at: :desc} )\n # @outgoing = Document.search(\n # params[:search], \n # where: {\n # outgoing: true,\n # date: {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day, \n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # } \n # }, \n # order: {created_at: :desc} )\n\n search = params[:search].present? ? params[:search] : \"*\"\n where = {}\n\n # if params[:date_filter].present?\n # where[:date] = {\n # gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day,\n # lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n # }\n # end\n\n # @ingoing = Document.search(search, where.merge(outgoing: false))\n # @outgoing = Document.search(search, where.merge(outgoing: true))\n\n # search = params[:search].present? ? params[:search] : \"*\"\n # where = {misspellings: false}\n\n if params[:date_filter].present?\n where[:date] = {\n gte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').beginning_of_day,\n lte: DateTime.strptime(params[:date_filter], '%m/%d/%Y %l:%M %p').end_of_day\n }\n end\n\n @ingoing = Document.search( search, where: where.merge(:outgoing => false), order: {created_at: :desc}, misspellings: false )\n @outgoing = Document.search( search, where: where.merge(:outgoing => true), order: {created_at: :desc}, misspellings: false )\n\n else\n @documents = Document.where(archival: false)\n @ingoing = @documents.where(outgoing: false).order('created_at desc')\n @outgoing = @documents.where(outgoing: true).order('created_at desc')\n end\n\n respond_to do |format|\n format.html\n format.xlsx {\n render xlsx: \"index\", filename: \"documents_spreadsheet.xlsx\"\n }\n end\n end", "def search(user, query, collection, wiki)\n end", "def query(query)\n result = queries([query])\n return result[query]\n end", "def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = Supplier.ransack(params[:q]) \n @query.num_doc_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @suppliers = @results \n end", "def index\n @search_name = params[:search_name]\n\n # INICIO RANSACK\n @query = TypeClient.ransack(params[:q]) \n @query.name_cont = @search_name if @search_name.present?\n\n # PAGINACION Y ORDEN\n @results = @query.result(distinct: true).paginate(:page => params[:page] )\n \n # RESULTADO FINAL\n @type_clients = @results \n end", "def search\n\n end", "def search_books(name = nil, author = nil, price_start = nil, price_end = nil, page_size = nil, page_no = nil)\n query_string = <<QUERY_STRING\n {\n books(name: \\\"#{name}\\\", author: \\\"#{author}\\\"#{', priceStart: ' + price_start.to_s if price_start}#{', priceEed: ' + price_end.to_s if price_end}#{', pageSize: ' + page_size.to_s if page_size}#{', pageNo: ' + page_no.to_s if page_no}) {\n id\n name\n author\n price\n }\n }\nQUERY_STRING\nputs query_string.inspect\n # books(name: \\\"\\\", author: \\\"\\\", priceStart: , priceEnd: 33)\n# byebug\n result_hash = GplTestSchema.execute(query_string)\n puts result_hash.inspect\nend", "def index\n @search = params[\"search\"]\n if @search.present?\n client = Client.new(@search)\n response = client.call\n\n new_results = StoreSearch.new(@search, response).run\n if new_results\n scope_to_use = client.find_search_key || \"random\"\n\n if scope_to_use == \"category\"\n searches = Search.with_category(@search[\"category\"])\n @searches = Search.paginate(page: params[:page], per_page: 5).where(id: searches.map(&:id))\n # TODO recover former sintax\n # @searches = Search.paginate(page: params[:page], per_page: 5)\n # .with_category(@search[\"category\"])\n elsif scope_to_use == \"text\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .with_text(@search[\"text\"])\n elsif scope_to_use == \"random\"\n @searches = Search.paginate(page: params[:page], per_page: 5)\n .created_randomly\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n else\n @searches = Search.paginate(page: params[:page], per_page: 5)\n end\n end\n \n @searches ||= Search.paginate(page: params[:page], per_page: 5)\n @search = Search.new()\n end", "def search(query, enterprise_filter)\r\n # wrap query in a enterprise_id filter\r\n query = self.get_query.filter_agg(field: enterprise_filter[:field],\r\n value: enterprise_filter[:value]) { |_| query }.build\r\n\r\n begin\r\n response = (self.__elasticsearch__.search query).response\r\n\r\n if response.aggregations\r\n # get list of buckets at deepest level of aggregation\r\n (get_deepest_agg response.aggregations.agg).buckets\r\n else\r\n return response\r\n end\r\n rescue => e\r\n raise BadRequestException.new e.message\r\n end\r\n end", "def query_search(query, options={})\n run_query query, options\n end", "def search(query)\n # need to handle invalid data\n q = query.blank? ? DEFAULT_SEARCH_QUERY : query\n @client.search(q, lang: 'en', result_type: 'recent').take(20)\n end", "def search\n\t\t@search = Elasticsearch::Model.search(params[:q], [Majorpost, Campaign, User]).page(params[:page]).per_page(10).records\n\t\tif user_signed_in?\n\t\t\tshow_contacts\n\t\t\tshow_followed\n\t\t\tshow_liked\n\t\tend\n\t\t@site_activity = PublicActivity::Activity.order(\"created_at desc\").where(owner_type: \"User\", :published => true,:abandoned => nil,trackable_type: [\"Subscription\",\"LikedUser\"]).page(params[:page]).per_page(5)\n\trescue\n\t \tflash[:error] = t('errors.messages.not_saved')\n\t \tredirect_to(:back)\t\t\n\tend", "def AddQuery(query, index = '*', comment = '')\n # build request\n \n # mode and limits\n request = Request.new\n request.put_int @offset, @limit, @mode, @ranker\n # process the 'expr' ranker\n if @ranker == SPH_RANK_EXPR\n request.put_string @rankexpr\n end\n\n request.put_int @sort\n\n request.put_string @sortby\n # query itself\n request.put_string query\n # weights\n request.put_int_array @weights\n # indexes\n request.put_string index\n # id64 range marker\n request.put_int 1\n # id64 range\n request.put_int64 @min_id.to_i, @max_id.to_i \n \n # filters\n request.put_int @filters.length\n @filters.each do |filter|\n request.put_string filter['attr']\n request.put_int filter['type']\n\n case filter['type']\n when SPH_FILTER_VALUES\n request.put_int64_array filter['values']\n when SPH_FILTER_RANGE\n request.put_int64 filter['min'], filter['max']\n when SPH_FILTER_FLOATRANGE\n request.put_float filter['min'], filter['max']\n else\n raise SphinxInternalError, 'Internal error: unhandled filter type'\n end\n request.put_int filter['exclude'] ? 1 : 0\n end\n \n # group-by clause, max-matches count, group-sort clause, cutoff count\n request.put_int @groupfunc\n request.put_string @groupby\n request.put_int @maxmatches\n request.put_string @groupsort\n request.put_int @cutoff, @retrycount, @retrydelay\n request.put_string @groupdistinct\n \n # anchor point\n if @anchor.empty?\n request.put_int 0\n else\n request.put_int 1\n request.put_string @anchor['attrlat'], @anchor['attrlong']\n request.put_float @anchor['lat'], @anchor['long']\n end\n \n # per-index weights\n request.put_int @indexweights.length\n @indexweights.each do |idx, weight|\n request.put_string idx\n request.put_int weight\n end\n \n # max query time\n request.put_int @maxquerytime\n \n # per-field weights\n request.put_int @fieldweights.length\n @fieldweights.each do |field, weight|\n request.put_string field\n request.put_int weight\n end\n \n # comment\n request.put_string comment\n \n # attribute overrides\n request.put_int @overrides.length\n for entry in @overrides do\n request.put_string entry['attr']\n request.put_int entry['type'], entry['values'].size\n entry['values'].each do |id, val|\n assert { id.instance_of?(Fixnum) || id.instance_of?(Bignum) }\n assert { val.instance_of?(Fixnum) || val.instance_of?(Bignum) || val.instance_of?(Float) }\n \n request.put_int64 id\n case entry['type']\n when SPH_ATTR_FLOAT\n request.put_float val\n when SPH_ATTR_BIGINT\n request.put_int64 val\n else\n request.put_int val\n end\n end\n end\n \n # select-list\n request.put_string @select\n \n # store request to requests array\n @reqs << request.to_s;\n return @reqs.length - 1\n end", "def merms\n response = Merm.__elasticsearch__.search(\n query: {\n bool: {\n must: [\n {\n term: {owner_id: current_user.id}\n },\n {\n term: {expired: false}\n }\n ]\n }\n },\n _source: [\"id\", \"name\"],\n sort: { last_accessed: {order: \"desc\"}},\n size: 1000\n ).results\n\n render json: {\n results: response.results,\n total: response.total\n }\n end", "def query_for_self\n query = Ferret::Search::TermQuery.new(:id, self.id.to_s)\n if self.class.configuration[:single_index]\n bq = Ferret::Search::BooleanQuery.new\n bq.add_query(query, :must)\n bq.add_query(Ferret::Search::TermQuery.new(:class_name, self.class.name), :must)\n return bq\n end\n return query\n end", "def read options = {}\n opt = {}\n opt[:index] = options[:index] || @index\n if options[:type]\n unless options[:type].empty?\n opt[:type] = options[:type]\n end\n else\n options[:type] = TYPE\n end\n begin\n if options[:id]\n opt[:id] = options[:id]\n obj = @client.get opt\n # puts \"Read: #{obj.inspect}\"\n obj['_source']\n elsif options[:where]\n k, v = options[:where].first\n opt[:q] = \"#{k}:#{v}\"\n _search opt\n elsif options[:body]\n opt[:body] = options[:body]\n res = _search opt\n STDERR.puts \"Elasticsearch.read.body #{res.inspect}\"\n res\n else\n _search opt\n end\n rescue Elasticsearch::Transport::Transport::Errors::NotFound\n nil\n end\n end", "def index\n if params[:search]\n @tutorials = Tutorial.search(params[:search]).order(\"created_at DESC\")\n else\n @tutorials = Tutorial.all.order('created_at DESC')\n end\n=begin\n #for sunspot\n @search = Tutorial.search do\n fulltext params[:search]\n end\n @tutorials = @search.results\n=end\n end", "def filter_single(param, field)\n {\n 'term': { \"#{field}.keyword\": param }\n }\n end", "def doc_request(query)\n endpoint = \"http://doc-#{search_domain}.#{aws_region}.cloudsearch.amazonaws.com/#{api_version}/documents/batch\"\n\n options = { :body => [query].to_json, :headers => { \"Content-Type\" => \"application/json\"} }\n\n begin\n response = HTTParty.post(endpoint, options)\n rescue Exception => e\n ae = Asari::DocumentUpdateException.new(\"#{e.class}: #{e.message}\")\n ae.set_backtrace e.backtrace\n raise ae\n end\n\n unless response.response.code == \"200\"\n raise Asari::DocumentUpdateException.new(\"#{response.response.code}: #{response.response.msg}\")\n end\n\n nil\n end", "def query(params = nil, filters = nil)\n builder = ::Elastic::Query.new(params)\n builder.filter(filters) if filters\n builder\n end", "def getResultsFromSearch(query, type, guts, ppOverride)\n request('getResultsFromSearch', {'query' => query, 'type' => type, 'guts' => guts, 'ppOverride' => ppOverride})\nend", "def query\n Riddle::Query.escape params[:search_txt]\n end", "def index\n @animals = Animal.search(params[:term])\n # @tasks = Task.search(params[:term])\n # @my_input = params['my_input']\n end", "def index\n @query = params[:q].to_s\n if @query.to_s != ''\n str = \"%\" + @query + \"%\"\n @products = Product.full.where([\"products.name LIKE ? OR products.drawing LIKE ? OR products.inventory_number LIKE ? OR products.amount_sections LIKE ?\", str,str,str,str])\n .page(params[:page]).per(12)\n else\n @products = Product.full.page(params[:page]).per(12)\n end\n end", "def search_any_term\n render json: Article.with_any_terms(params[:query]).map(&:title)\n end", "def index\n # @search = Shelter.search do\n # fulltext params[:search]\n # end\n # @shelters = @search.results\n @shelters = Shelter.all\nend", "def search\n @documents = api.form(\"everything\")\n .query(%([[:d = fulltext(document, \"#{params[:q]}\")]]))\n .page(params[:page] ? params[:page] : \"1\")\n .page_size(params[:page_size] ? params[:page_size] : \"20\")\n .submit(ref)\n end", "def index\n @search = Sunspot.search Generator do\n fulltext params[:query_generator]\n end\n @generators = @search.results\n respond_to do |format|\n format.html\n format.json {render :json => @generators.map(&:attributes) }\n end\nend", "def search\n if params[:query]\n respond_with Event\n .fulltext_search(params[:query])\n .includes(:categories, :organization, :location)\n else\n Event\n .order(\"updated_at DESC\")\n .includes(:categories, :organization, :location)\n end\n end", "def search(query)\n @form['query'] = query\n end", "def search\n\n end", "def more_like_this_query_hash\n docs = content_index_names.reduce([]) do |documents, index_name|\n documents << {\n _id: search_params.similar_to,\n _index: index_name,\n }\n end\n\n {\n more_like_this: {\n like: docs,\n min_doc_freq: 0, # Revert to the ES 1.7 default\n },\n }\n end", "def index\n @docs = SearchController.search(params[:query]) if params[:query].present?\n end", "def search\n terms = params[:query].split\n query = terms.map { |term| \"title like '%#{term}%' OR body like '%#{term}%' OR tags like '%#{term}%'\" }.join(\" OR \")\n \n @posts = Post.where(query).order(\"created_at DESC\").first(10)\n end", "def search(query)\n @client.get('/BikePoint/Search', { query: query })\n end", "def build_bulk_query(index_name, type, id, attributes, parent = nil)\n attrs_to_json = ActiveSupport::JSON.encode(attributes).gsub(/\\n/, \" \")\n <<-eos\n { \"index\" : { \"_index\" : \"#{index_name}\", \"_type\" : \"#{type}\", \"_id\" : \"#{id}\"#{\", \\\"_parent\\\" : \\\"#{parent}\\\"\" if parent}, \"refresh\" : \"true\"} } \n #{attrs_to_json}\n eos\n end", "def index\n @range = params[:q][:range_selector_cont] if params[:q]\n params[:q] = Tagging.fix_params(params[:q]) if params[:q]\n @q = Tagging.page(params[:page]).search(params[:q])\n @taggings = @q.result\n if params[:q].present? && params[:q][:tag_tag_group_id_eq].present?\n @tags = TagGroup.where(id: params[:q][:tag_tag_group_id_eq]).first.tags\n @form = SimpleForm::FormBuilder.new(:q, @q, view_context, {}, proc{})\n end\n @search_params = params[:q] if params[:q].present? && params[:q][:tag_tag_group_id_eq].present?\n end", "def query(query, args = {})\n args[:q] = query\n args[:qt] = 'standard'\n conn = ActiveFedora::SolrService.instance.conn\n result = conn.post('select', data: args)\n result.fetch('response').fetch('docs')\n end", "def solr_params\n {\n fq: \"collection_code:#{collection_code}\",\n rows: 100\n }\n end", "def solr_resp_ids_titles_from_query(query)\n solr_resp_ids_titles({'q'=> query})\nend", "def to_query\n \"(#{(@values.uniq.map { |value| \"#{name_as_search_key}:\\\"#{value}\\\"#{boost_as_string}\" }).join(operation_as_join)})\"\n end", "def index\n @users = if params[:q].blank?\n User.order(:email).page params[:page]\n else\n elastic_search_results(User)\n end\n end", "def search_query_for(group)\n { q: \"uid:(#{group.map { |e| \"\\\"#{e.uid}\\\"\" }.join(' OR ')})\",\n def_type: 'lucene',\n facet: false,\n fl: @options[:fl] ? @options[:fl] :\n (@options[:fulltext] ?\n RLetters::Solr::Connection::DEFAULT_FIELDS_FULLTEXT :\n RLetters::Solr::Connection::DEFAULT_FIELDS),\n tv: @options[:term_vectors] || false,\n rows: group.size }\n end", "def get_query\n \n # Get query parameters passed\n query_params = request.query_parameters\n \n # Initialize query with country from route\n query = {'country' => params[:country]}\n \n # Allowed search terms, only these keys are searchable \n search_keys = ['name', 'a_id', 'pub_id', 'device', 'min_price', 'max_price',\n 'pub_name', 'min_app_rating', 'max_app_rating',\n 'category', 'sub_category', 'interests_only']\n \n # Iterate through the keys, determine if the params match the key and if so \n # add a condition to the query\n search_keys.each do |key|\n param = query_params[key]\n \n # Make sure the parameter is defined \n next unless param\n \n #logger.info('key %s, param %s' % [key, param])\n \n # handlers for different keys\n case key\n when 'a_id', 'pub_id'\n # IDs are floats so convert\n query[key] = query_params[key].to_f\n when 'name', 'pub_name'\n # Do regex match on names so you can match substring\n query[key] = /#{query_params[key]}/\n when 'min_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$gte] = param.to_f\n when 'max_price'\n query['amount'] = {} unless query['amount']\n query['amount'][:$lte] = param.to_f\n when 'min_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$gte] = param.to_f\n when 'max_app_rating'\n query['total_average_rating'] = {} unless query['total_average_rating']\n query['total_average_rating'][:$lte] = param.to_f\n when 'interests_only'\n interest_query = []\n param.split(',').each do |interest|\n interest_query << {:interests => interest}\n end\n # And filter only the apps that have either one of the interests\n query[:$and] = [{:$or => interest_query}]\n else\n # Deals with all the parameters that are specified and match with\n # the model attributes\n query[key] = param\n end\n end\n \n return query\n end", "def parse_query(query); end", "def parse_query(query); end", "def search_body\n process_input unless processed?\n Search::Pseuds::Query.new(attributes).to_hash\n end", "def search; end", "def index\n @search = Restaurant.search do\n fulltext params[:search]\n end\n \n # @restaurants = Restaurant.all\n @restaurants = @search.results\n #@restaurants = Restaurant.order('id desc').limit(5)\n end", "def nxql_search_params\n fields = %w(brand_id brand_name item_id item_name nf_serving_size_qty nf_serving_size_unit)\n fields << %w(nf_calories nf_total_carbohydrate nf_sodium nf_dietary_fiber nf_protein)\n default_fields = fields.flatten\n\n {\n offset: 0,\n limit: 50,\n fields: default_fields,\n\n filters:{\n item_type:2 #filter by boxed goods?\n }\n\n }\n end" ]
[ "0.7372549", "0.6931692", "0.68112725", "0.67871773", "0.6763451", "0.672785", "0.66661924", "0.6661354", "0.65298903", "0.65002483", "0.64560133", "0.64094776", "0.6371175", "0.63626313", "0.6361925", "0.6361177", "0.6356271", "0.6320093", "0.6319738", "0.63006824", "0.62943214", "0.62565255", "0.62365407", "0.62289906", "0.6225763", "0.6193633", "0.6183407", "0.6169363", "0.61609393", "0.61569196", "0.6154543", "0.6147474", "0.6145974", "0.6142991", "0.6136026", "0.6125937", "0.61216253", "0.6100007", "0.6097845", "0.6091314", "0.6091314", "0.60858846", "0.6074311", "0.60695285", "0.6060847", "0.60393333", "0.6037387", "0.60351", "0.6032493", "0.60290974", "0.6022103", "0.6016193", "0.6009738", "0.6009456", "0.6005573", "0.5994621", "0.59880906", "0.5985712", "0.5985376", "0.5984857", "0.59832984", "0.5974605", "0.5972406", "0.59724", "0.59714735", "0.5966276", "0.59609455", "0.5942433", "0.5938927", "0.59331906", "0.5928367", "0.59283006", "0.592811", "0.5924344", "0.5921844", "0.59175926", "0.5916306", "0.5905941", "0.5899576", "0.5896197", "0.5889335", "0.58864504", "0.588561", "0.58831257", "0.5882427", "0.58768123", "0.5876506", "0.5875408", "0.5872461", "0.58660144", "0.5862384", "0.5858828", "0.5857806", "0.58466446", "0.5840577", "0.5835333", "0.5835333", "0.58287424", "0.5823174", "0.58224297", "0.581762" ]
0.0
-1
Finds the template to render the content
def find_template(name) # Search in theme path template_path = Themes::ThemeManager.instance.selected_theme.resource_path("#{name}.erb",'template','ui') # Search in the project if not template_path path = app.get_path(name) #File.expand_path(File.join(File.dirname(__FILE__), '..', 'views', "#{name}-fieldset-render.erb")) template_path = path if File.exist?(path) end template_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_template(template); end", "def locate_template(document)\n view_prefix = 'cms'\n\n return File.join(view_prefix, document.template) unless document.template.blank?\n return File.join(view_prefix, document.node.get(:template)) unless document.node.get(:template).blank?\n\n paths = [document.title.parameterize('_'), \n document.permalink.gsub('/', '.')[1..-1], \n document.permalink, \n document.node.ancestry.gsub('/root', ''),\n document.node.ancestry.gsub('/root', '').gsub('/', '.')[1..-1], \n 'default', \n 'show']\n paths.uniq.each do | path |\n view_paths.each do | view_path |\n rel_path = File.join(view_prefix, path) + '.html.erb'\n full_path = File.join(view_path.to_s, rel_path)\n if File.exists? full_path\n logger.debug \"Found: #{full_path}\"\n return rel_path\n else\n logger.debug \"Not Found: #{full_path}\"\n end\n end\n logger.debug ''\n end\n raise NoTemplateFound\n end", "def find_template(template_path, format = nil, html_fallback = true)\n super\n rescue ::ActionView::MissingTemplate\n find_parent_template(template_path, format)\n end", "def template\n possible_templates.find {|t| File.exists? \"#{t}.html\"}\n end", "def find_template\n \n template_name = \"render-activity\"\n template_name << \"-#{display}\" unless display.nil?\n\n # Search in theme path\n activity_template_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{template_name}.erb\",'template','activity') \n \n # Search in the project\n if not activity_template_path\n path = context.get_path(template_name) \n activity_template_path = path if not path.nil? and File.exist?(path)\n end\n \n return activity_template_path\n \n end", "def the_template(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.template\n else\n \"<strong>Error:</strong> No template information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end", "def find_template\n self.class.ancestor_renderables.each do |klass|\n return \"kaminari/#{klass.template_filename}\" if @renderer.partial_exists? klass.template_filename\n end\n \"kaminari/#{self.class.template_filename}\"\n end", "def find_template(opts={})\n if template = opts[:template]\n path = _template_root / template\n elsif action = opts[:action]\n segment = self.class.name.snake_case.split('::').join('/')\n path = _template_root / segment / action\n elsif _layout = opts[:layout]\n path = _template_root / 'layout' / _layout\n else\n raise \"called find_template without an :action or :layout\" \n end \n glob_template(path, opts)\n end", "def find_template(path, locals)\n path_count = @lookup_context.view_paths.size\n @lookup_context.view_paths.unshift Frails.components_path\n old_paths = @lookup_context.view_paths.pop(path_count)\n\n prefixes = path.include?('/') ? [] : @lookup_context.prefixes\n result = @lookup_context.find_template(path, prefixes, false, locals, @details)\n\n @lookup_context.view_paths.unshift(*old_paths)\n @lookup_context.view_paths.pop\n\n result\n end", "def find_template(state)\n view.find_template expanded_view_templates_for(state)\n end", "def template_content(name)\n templates.select { |t| t[:name] = name || 'index' }.first[:template]\n end", "def find_view_render_template(view)\n \n view_template_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{frontend_skin_preffix}render-view-#{view.render}.erb\",'template','cms')\n \n if not view_template_path\n path = context.get_path(\"#{frontend_skin_preffix}render-view-#{view.model_name}-#{view.render}\")\n view_template_path = path if not path.nil? and File.exist?(path)\n end\n\n return view_template_path \n \n end", "def template\n @template.content\n end", "def find_script_template\n return unless request.xhr?\n script = script_type(params[:id])\n render :text => script.content\n end", "def find_partial(content)\n return content if content.is_a? String\n begin\n File.open(Dir[\"views/#{content}\\.*\"][0]).read\n rescue\n raise MissingPartialTemplate.new(content)\n end\n end", "def find_view_holder\n\n view_holder_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{frontend_skin_preffix}render-viewholder-#{view.render}.erb\",'template','cms') \n \n if not view_holder_path\n path = context.get_path(\"#{frontend_skin_preffix}render-viewholder-#{view.model_name}-#{view.render}\")\n view_holder_path = path if not path.nil? and File.exists?(path)\n end\n\n return view_holder_path\n\n end", "def find_template(views, name, engine, &block)\n\t\t \t#normal\n\t\t super(views, name, engine, &block)\n\t\t #_layout folder\n\t\t super(Paths.layout_path, name.to_s, engine, &block)\n\t\t end", "def find_matching_template(context_node)\n @templates.find {|tpl| tpl===context_node}\n end", "def search_template(env_hash)\n env = OpenStruct.new env_hash\n html = render_template TEMPLATE, env\n refute_empty html\n Nokogiri::HTML html\n end", "def determine_template(options); end", "def template_content\n if respond_to? :contents and contents\n contents.elements.map do |item|\n if item.content.respond_to? :template\n item.content.template.renderable.template.render\n else\n ::Alongslide::render item.text_value, plain: true\n end\n end\n end\n end", "def template\n @template\n end", "def get_template\n @template\n end", "def template\n @template || nil\n end", "def render_content(format)\n begin\n ERB.new( File.open( template_path_for(format) ).read, nil, '%<>' ).result(self.get_binding)\n rescue TemplateUndefined\n ''\n end\n end", "def try_picking_template_for_path(template_path)\n self.view_paths.find_template(template_path, template_format)\n end", "def try_picking_template_for_path(template_path)\n self.view_paths.find_template(template_path, template_format)\n end", "def template\n @_renderer.current_template\n end", "def find_template(views, name, engine)\n filename = ::File.join(views, \"#{name}.#{engine}\")\n File.exist?(filename) ? filename : nil\n end", "def find_template(template=XAPI_TEMP_REGEX)\n # if we got a string then try to find that template exact \n # if no exact template matches, search\n if template.is_a?(String)\n found = get_template(template)\n return found if found\n end\n\n # make sure our nil template gets set to default\n if template.nil?\n template = XAPI_TEMP_REGEX\n end \n\n Chef::Log.debug \"Name: #{template.class}\"\n # quick and dirty string to regex\n unless template.is_a?(Regexp)\n template = /#{template}/ \n end\n\n # loop over all vm's and find the template \n # Wish there was a better API method for this, and there might be\n # but i couldn't find it\n Chef::Log.debug \"Using regex: #{template}\"\n xapi.VM.get_all_records().each_value do |vm|\n if vm[\"is_a_template\"] and vm[\"name_label\"] =~ template\n Chef::Log.debug \"Matched: #{h.color(vm[\"name_label\"], :yellow )}\"\n found = vm # we're gonna go with the last found \n end\n end\n\n # ensure return values\n if found\n puts \"Using Template: #{h.color(found[\"name_label\"], :cyan)}\"\n return get_template(found[\"name_label\"]) # get the ref to this one\n end\n return nil\n end", "def template\n return @template\n end", "def find_template(views, name, engine)\n filename = ::File.join(views, \"#{name}.#{engine}\")\n File.exists?(filename) ? filename : nil\n end", "def render\n template_body = Tilt.new(@template).render(self)\n if @layout\n layout = Dir[File.join(File.dirname(@template), @layout) + '*'].first\n raise \"#{Guinness::EMOJI} Guinness : Unable to locate layout at: '#{@layout}'\" unless layout\n @body = Tilt.new(layout).render(self) { template_body }\n end\n @body || template_body\n end", "def template_page(site); end", "def show_template\n self.template\n end", "def show_template\n self.template\n end", "def render(template_name)\n #Use controller and template names to construct paths to template files.\n\n\n #Use File.read to read the template file.\n\n #Create a new ERB template from the contents.\n \n #Evaluate the ERB template, using binding to capture the controller's instance variables.\n\n #Pass the result to #render_content with a content_type of text/html.\n\n \n end", "def template\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n @template\n end", "def get_template\r\n template.nil? ? self.template_body : template.body\r\n end", "def find_template_sub(t)\n for path in [File.join(juli_repo, Juli::REPO), Juli::TEMPLATE_PATH] do\n template = File.join(path, t)\n return template if File.exist?(template)\n end\n raise Errno::ENOENT, \"no #{t} found\"\n end", "def rendered_content\n ERB.new(template).result(binding)\n end", "def find_template(template)\n template = locate_config_value(:template_regex) if template.nil?\n # if we got a string then try to find that template exact\n # if no exact template matches, search\n if template.is_a?(String)\n found = get_template(template)\n return found if found\n end\n\n # make sure our nil template gets set to default\n if template.nil?\n template = locate_config_value(:template_regex)\n end\n\n Chef::Log.debug \"Name: #{template.class}\"\n # quick and dirty string to regex\n unless template.is_a?(Regexp)\n template = /#{template}/\n end\n\n # loop over all vm's and find the template\n # Wish there was a better API method for this, and there might be\n # but i couldn't find it\n Chef::Log.debug \"Using regex: #{template}\"\n xapi.VM.get_all_records.each_value do |vm|\n if vm['is_a_template'] && vm['name_label'] =~ template\n Chef::Log.debug \"Matched: #{h.color(vm['name_label'], :yellow)}\"\n found = vm # we're gonna go with the last found\n end\n end\n\n # ensure return values\n if found\n ui.msg \"Using Template: #{h.color(found['name_label'], :cyan)}\"\n return get_template(found['name_label']) # get the ref to this one\n end\n nil\n end", "def _template\n @template\n end", "def find_template(views, name, engine, &block)\n paths = views.map { |d| Sinarey.root + '/app/views/' + d }\n Array(paths).each { |v| super(v, name, engine, &block) }\n end", "def template\n @__template\n end", "def main_content\n do_include(@template)\n end", "def rendered_templates; end", "def find_template(views, name, engine, &block)\n Array(views).each {|v|super(v, name, engine, &block) }\n end", "def render_plain\n template_content\n end", "def render\n case File.extname(@template_file)\n when '.erb'\n render_erb\n else\n render_plain\n end\n end", "def find(name)\n Template.find(name)\n end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template\n @template ||= self.class.template\n end", "def render(template_name)\n if already_built_response? \n raise \"DoubleRenderError\"\n else \n controller_name = self.class.to_s.underscore \n dir = File.join(\"views\",controller_name, \"#{template_name}.html.erb\")\n # debugger\n content = File.read(dir).split(\"\\n\")\n content.map! do | statement | \n start_point = /<%/ =~ statement\n # debugger\n if start_point.nil? \n statement\n else \n front_part = statement[0...start_point]\n # returning = \n # start_point += statement[start_point+2] == \"=\" ? 2 : 1\n end_point = /%>/ =~ statement \n end_point += 1\n rear_part = statement[end_point+2..-1]\n front_part.to_s + ERB.new(statement[start_point..end_point]).result(binding) + rear_part.to_s\n end \n end \n render_content(content)\n end \n end", "def lookup_template(name)\n @templates.fetch(name.to_s) { |k| @parent ? @parent.lookup_template(k) : nil }\n end", "def template\n Liquid::Template.parse(template_content(template_name))\n end", "def find(match)\n hits = search(match)\n raise(MissingTemplate, \"No matching templates.\") if hits.size == 0\n if hits.size > 1\n message = \"More than one match:\\n \" + hits.map{|name, dir| name}.join(\"\\n \")\n raise(DuplicateTemplate, message)\n end\n hits.first\n end", "def h\n @template\n end", "def render(template_name)\n controller_name = self.class.to_s.underscore\n\n string = File.read(\"./views/#{controller_name}/#{template_name}.html.erb\")\n #\"./\" for project root dir\n\n template = ERB.new(string)\n capture = template.result(binding) #evaluate and bind\n\n render_content(capture, \"text/html\")\n end", "def template\n @part.content\n end", "def render_template(template, env)\n templates_dir = \"lib/search_engine/views\"\n template = \"#{template}.slim\" unless template.end_with? \".slim\"\n template_path = \"#{templates_dir}/#{template}\"\n content = File.read(template_path)\n Slim::Template.new { content }.render(env)\nend", "def find_template(name)\n TEMPLATES.find do |fn, _|\n fn == name || fn.split('.').first == name\n end\n end", "def template_path\n exact_path = File.join(root, request.path)\n with_erb = File.join(root, \"#{request.path}.html.erb\")\n with_index = File.join(root, File.dirname(request.path), 'index.html.erb')\n\n [ exact_path, with_erb, with_index ].find { |f| File.file?(f) }\n end", "def _render_template(options); end", "def _render_template(options); 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( args )\n template_name\n end", "def render_template(view, template, layout_name, locals); end", "def templates; end", "def content_template\n Admin::MessageTemplate.active.content_templates.named content_template_name, type: message_type\n end", "def render_content_element(content_element)\n return \"\" unless content_element.template\n parsed_template = Liquid::Template.parse(content_element.template.code)\n parsed_template.render('content_element' => Kernel.const_get(content_element.element_type).find_by_content_element_id(content_element.id))\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def find_parent_template(template_path, format = nil, html_fallback = true)\n # first, we grab the inherit view paths that are 'above' the given template_path\n if inherit_view_paths.present? && (starting_path = inherit_view_paths.detect {|path| template_path.starts_with?(\"#{path}/\")})\n parent_paths = inherit_view_paths.slice(inherit_view_paths.index(starting_path)+1..-1)\n # then, search through each path, substituting the inherit view path, returning the first found\n parent_paths.each do |path|\n begin\n return orig_find_template(template_path.sub(/^#{starting_path}/, path), format, html_fallback)\n rescue ::ActionView::MissingTemplate\n next\n end\n end\n end\n raise ::ActionView::MissingTemplate.new(self, template_path, format)\n end", "def find_template(options)\n if options[:template] && (template_opts, meth = opts[:named_templates][template_name(options)]; meth)\n if template_opts\n options = template_opts.merge(options)\n else\n options = Hash[options]\n end\n\n options[:inline] = send(meth)\n\n super(options)\n else\n super\n end\n end", "def template\n if object.respond_to?(:template)\n object.template\n else\n @template\n end\n end", "def render\n ERB.new(File.read(TEMPLATE), 0, \">\").result(binding)\n end", "def h\n @template\n end", "def search_inherited_template\n # Get full ancestry path for current page\n parent_slugs = object.ancestry_path\n\n # Iterate over all parents:\n # 1. Generate template path:\n # ['grandparent', 'parent', 'current_page'] => 'grandparent/parent'\n # 2. Check if template for children exists:\n # 'app/views/pages/templates/grandparent/parent/_children_template.html.slim'\n # 3. Return it's name if exist or iterate again without closest parent\n while (template_dir = parent_slugs.tap(&:pop).join('/')).present?\n if File.exist?(\"#{TEMPLATE_DIR}/#{template_dir}/_#{CHILDREN_TEMPLATE_NAME}.html.slim\")\n inherited_template = \"templates/#{template_dir}/#{CHILDREN_TEMPLATE_NAME}\"\n break\n end\n end\n\n inherited_template\n end", "def process_default_render exp\n process_layout\n process_template template_name, nil\n end", "def getTemplate (pathTemplate, binding)\r\n fileTemplate = File.new( pathTemplate )\r\n filehtml = fileTemplate.read\r\n erb = ERB.new filehtml\r\n return erb.result(binding)\r\n end", "def render_template(path)\n render(path)\n exit\n end", "def get_content_template(id)\n @client.raw('get', \"/content/templates/#{id}\")\n end", "def find(name_or_path=nil)\n name_or_path ||= MB::Application.config.bootstrap.default_template\n return unless name_or_path\n installed = MB::FileSystem.templates.join(\"#{name_or_path}.erb\").to_s\n if File.exists?(installed)\n return installed\n end\n if File.exists?(name_or_path)\n return name_or_path\n else\n raise MB::BootstrapTemplateNotFound\n end\n end", "def render_with_layout_and_partials(format)\n # looking for system mail.\n template = MailEngine::MailTemplate.where(:path => \"#{controller_path}/#{action_name}\", :format => format, :locale => I18n.locale, :partial => false, :for_marketing => false).first\n # looking for marketing mail.\n template = MailEngine::MailTemplate.where(:path => action_name, :format => format, :locale => I18n.locale, :partial => false, :for_marketing => true).first if template.blank?\n\n # if found db template set the layout and partial for it.\n if template\n related_partial_paths = {}\n # set @footer or @header\n template.template_partials.each do |tmp|\n related_partial_paths[\"#{tmp.placeholder_name}_path\".to_sym] = tmp.partial.path\n end\n\n # set layout\n render :template => \"#{controller_path}/#{action_name}\", :layout => \"layouts/mail_engine/mail_template_layouts/#{template.layout}\", :locals => related_partial_paths\n else\n # if not found db template should render file template\n render(action_name)\n end\n end", "def renderer\n Cms::RenderTemplate.new\n end", "def find_template(views, name, engine, &block)\n I18n.fallbacks[I18n.locale].each { |locale|\n super(views, \"#{name}.#{locale}\", engine, &block) }\n super(views, name, engine, &block)\n end", "def render(template_name)\n #Open template, put content into string-content\n cntrl_name = self.class.to_s.underscore\n\n erb_temp = File.read(\"views/#{cntrl_name}/#{template_name}.html.erb\")\n content = ERB.new(erb_temp).result(binding)\n\n render_content(content , 'text/html')\n end", "def find\n \"#{content_path}#{clean_path}\"\n end", "def render\n template = ERB.new File.new(@template_path).read, nil, \"%\"\n template.result(binding)\n end", "def find_templates( name, prefix, partial, details )\n Rails.logger.debug \"Called RedisTemplateResolver\"\n\n return [] unless name.start_with?( \"redis:\" ) \n if respond_to?( :resolver_guard, true )\n return [] unless resolver_guard( name, prefix, partial, details )\n end\n\n\n _, @template_name = name.split(':', 2 )\n Rails.logger.debug \"RedisTemplateResolver fetching template with name: #{@template_name}\"\n\n template_body = fetch_template\n\n path = ActionView::Resolver::Path.build( name, prefix, nil )\n handler = ActionView::Template.handler_for_extension( self.template_handler_name )\n \n template = ActionView::Template.new( template_body, path, handler,\n :virtual_path => path.virtual,\n :format => [ :html ],\n :updated_at => Time.now )\n return [ template ]\n end", "def template\n Kernel.const_get(template_name.upcase << '_TEMPLATE')\n end", "def get_template_text(path, base_path)\n [path, \"#{base_path}/#{path}\"].each do |p|\n begin\n t = self.view_paths.find_template(p, 'html') # FIXME: format ?\n rescue ActionView::MissingTemplate\n t = nil\n end\n return [t.source, t.path, t.base_path] if t\n end\n nil\n end", "def template\n @template ||= File.read(template_full_path)\n end", "def fetch_template_from_url\n layout_url = lookup_template_url\n return nil if layout_url == nil\n\n Rails.logger.info \"Fetching remote template from #{layout_url.inspect}\"\n\n response = Curl.get( layout_url ) do |curl| \n curl.timeout = self.http_timeout\n end\n response_body = response.body_str\n\n Rails.logger.info \"Got remote template response code #{response.response_code} with body #{response_body.inspect}\"\n\n return nil if response.response_code == 404\n \n response_body = postprocess_template( response_body ) if respond_to?( :postprocess_template, true )\n\n return response_body\n \n rescue SocketError, Curl::Err::TimeoutError, Errno::ECONNREFUSED, TemplateRejectedError => e\n Rails.logger.error e.message\n return nil\n end" ]
[ "0.7369887", "0.7349709", "0.72721857", "0.7160781", "0.7143418", "0.71336544", "0.7121636", "0.7096915", "0.70212525", "0.7001296", "0.696039", "0.689798", "0.68595356", "0.6771585", "0.67584056", "0.6751749", "0.67020124", "0.669099", "0.66570884", "0.6651949", "0.66484994", "0.662462", "0.66174984", "0.6617283", "0.66037124", "0.65543926", "0.65543926", "0.6518447", "0.65021306", "0.6500848", "0.64776033", "0.6464936", "0.6458047", "0.6447523", "0.6441437", "0.6441437", "0.6439251", "0.64249927", "0.6402161", "0.6394247", "0.638359", "0.63691896", "0.6363004", "0.63585263", "0.63537633", "0.6343218", "0.6338569", "0.6335494", "0.63277125", "0.6321712", "0.632018", "0.6311356", "0.6311356", "0.6311356", "0.6311356", "0.6311356", "0.6311356", "0.6311356", "0.6305925", "0.63003415", "0.6292147", "0.6286004", "0.6281889", "0.6254082", "0.6251553", "0.62492025", "0.62453127", "0.62437457", "0.62423295", "0.62368643", "0.62368643", "0.6226532", "0.6212407", "0.61969435", "0.61957085", "0.61934435", "0.6181603", "0.61768275", "0.617428", "0.6167935", "0.6161934", "0.61397034", "0.61376333", "0.6134536", "0.6127974", "0.6117283", "0.6114969", "0.6109647", "0.6104535", "0.61028177", "0.60972154", "0.6080572", "0.6078215", "0.6066432", "0.60616416", "0.60589725", "0.6051457", "0.60441923", "0.6040449", "0.6039933" ]
0.7288165
2
Chapter Loops & Iterators Exercises
def result(answer) puts answer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def for_iterator\n\tfor item in 1..3 do\n\t puts \"The current item is #{item}.\"\n\tend\nend", "def basic_4 (array_iterate)\n array_iterate.each { |n| puts \"Item: #{n}\"}\n puts\nend", "def times_iterator(number_of_times)\n number_of_times.times do\n puts \"Welcome to Flatiron School's Web Development Course!\"\n end\nend", "def times_iterator(number_of_times)\n 7.times do\n puts \"Welcome to Flatiron School's Web Development Course!\"\n end\nend", "def looper\n for i in 1..10\n puts i #needs an indent\n end\n # needs to return the final result of the loop to fulfil the test.\nend", "def each\n while true do\n yield\n break if ! advance\n end\n end", "def test_next_statement\n i = 0\n result = []\n while i < 10\n i += 1\n next if (i % 2) == 0\n result << i\n end\n assert_equal (1..10).step(2).to_a, result\n end", "def i_love_each_of( albums )\n i = 0\n until i == albums.count \n puts \"I <3 #{albums[ i ]}!\" \n i += 1\n end\nend", "def loop_iterator(number_of_times)\n number_of_times = 1\n loop do \n puts \"Welcome to Flatiron School's Web Development Course!\"\n number_of_times +=1\n break if number_of_times > 7\n # rspec specifies printing out the Welcome message 7 times...\n end\nend", "def loop_iterator(number_of_times)\n # Code your solution here using the \"loop\" keyword\n # to puts out the below phrase\n phrase = \"Welcome to Flatiron School's Web Development Course!\"\n # Maybe we should keep count of the number of times\n # we've puts out the phrase and break when the\n # counter hits the appropriate number...\n times = 1\n\n loop do\n puts phrase\n # How can we make sure the loop breaks once it\n # has puts out the phrase the correct number of\n # times?\n break if times == number_of_times\n times += 1\n end\nend", "def loop_iterator(number_of_times)\n phrase = \"Welcome to Flatiron School's Web Development Course!\"\n counter = 0\n \n loop do \n counter += 1\n puts phrase\n if counter >= number_of_times \n break\n end\n end\n \nend", "def looper\n for i in 1..10\n puts i\n end\nend", "def iterator?() end", "def next() end", "def next() end", "def number_loop_two(x)\n i = [1,2,3,4,5,6]\n\n for x in i\n puts \"number #{x}!\"\n end\nend", "def each\n\n rewind\n\n n,f,q,c=next_seq\n\n while (!n.nil?)\n yield(n,f,q,c)\n n,f,q,c=next_seq\n end\n\n rewind\n\n end", "def kelp(a,b)\n for i in a..b \n puts i\n end\n \"done\"\n end", "def each a\n\ti = 0\n\tuntil i == a.size\n\t\tyield a[i]\n\t\ti += 1\n\tend\n\ta\nend", "def looper \r\n for i in 1..10\r\n puts i\r\n end\r\nend", "def yielder(number)\n\tputs \"_________\"\n\t(1..number).each do |x|\n\t\twhile x<5 do \n\t\t\t\n\t\t\tputs x\n\t\t\tx=x+1\n\t\t\t\n\t\tend\n\tend\n\tyield\nend", "def my_custom_while_with_range_op(the_max, the_increment)\n numbers = []\n (0..the_max).step(the_increment).each do |i|\n puts \"At the top i is #{i}\"\n numbers.push(i)\n i += the_increment\n puts \"Numbers now: \", numbers\n puts \"At the bottom i is #{i}\"\n end\n return numbers\nend", "def loop_with_next\n numbers = []\n counter = 0\n\n while counter < 20\n counter += 1\n next if counter.even?\n numbers << counter\n end\n\n numbers\nend", "def fizz_buzz_to(limit)\n #from 1 to the limit number, for each number, take the number \n 1.upto(limit).each do |num|\n #print out result of calling fizzbuzz with the number.\n puts fizzbuzz(num)\n #ends the each do \n end\n#ends the function definition. \nend", "def my_find (collection) # collection is the array described above, passed to the method my_find\n i = 0 # setting up a counter\n while i < collection.length #while the counter is less than the length of the array do something\n return collection[i] if yield(collection[i]) #this is the \"do something\": send an ellement ([i]) to a block and if\n # it is returned to the method as 'true' then make it the return value of the method\n i+=1 # if the condition above is not met then add one to the counter and cycle through the next element in collection\n end #ends the while statement\nend", "def through; end", "def each_with_iterator\n\n iterator = get_iterator_fast\n while (iterator.has_next?)\n yield iterator.get_next, iterator if block_given?\n end\n \n end", "def my_each(words)\n i = 0\n while i < words.length\n yield(words[i])\n i = i + 1\n end\n words \nend", "def iterate(iterator)\n\tloop do\n\t\tyield iterator.next\n\tend\nend", "def elefantes(num)\n for i in 1..num\n p \"#{i} elefante se columpiaba sobre la tela de una araña, como veía que resistía fueron a llamar a otro elefante.\"\n end\nend", "def step_test\n 3.upto(6) do |x|\n puts \" \"\n x.upto(x + 2) do |i|\n print \"#{i}\\t\"\n end\n end\nend", "def iter\n f1,f2,k = 1,1,2\n f1,f2,k = f2,f1+f2,k+1 while f2.to_s.size < 1000\n puts k\nend", "def two(a, b)\n for i in a..b\n puts i if a.even?\n a += 1\n end\nend", "def each_number_to( number )\r\n\r\n index = 0\r\n while index < number\r\n yield(index)\r\n index += 1\r\n end\r\n\r\nend", "def next()\n \n end", "def next()\n \n end", "def iterate seed, &block\n Enumerator.new do |e|\n current = seed\n loop do\n e << current\n current = yield current\n end\n end\nend", "def counter_2(x)\n (1..x).each { |n| puts n }\nend", "def each(collection)\n\ti = collection.count\n\twhile i > 0\n\t\tyield collection\n\t\ti -= 1\n\tend\nend", "def my_each(words)\n i = 0\n while i < words.length\n yield(words[i])\n i+=1\n end\n words\nend", "def each()\n i = 0\n while i < @total\n yield at(i)\n i += 1\n end\n self\n end", "def looper\n for i in 1..10\n return i\n end\nend", "def iterArr\r\n arr = [1, 3, 5, 7, 9]\r\n arr.each{|i| puts i}\r\nend", "def puts_1_to_10\n (1..10).each { |i| puts i }\nend", "def puts_1_to_10\n (1..10).each { |i| puts i }\nend", "def iterArr\n arr = [1, 3, 5, 7, 9]\n arr.each{|i| puts i}\nend", "def each\n yield \"pizza\"\n yield \"spaghetti\"\n yield \"salad\"\n yield \"bread\"\n yield \"water\"\n end", "def fizzbuzz(start, triggers)\n Enumerator.new do |yielder|\n i = start\n loop do\n parts = triggers.select{ |(_, predicate)| predicate.call(i) }\n i_result = parts.size > 0 ? parts.map(&:first).join : i \n yielder.yield(i_result)\n i += 1 \n end\n end\nend", "def each\n # Include every to be inside enumerable:\n yield \"pizza\"\n yield \"spaghetti\"\n yield \"salad\"\n yield \"water\"\n yield \"bread\"\n end", "def run_block_with_next\n numbers = []\n\n (1..20).each do |number|\n next if number.odd?\n numbers << number\n end\n\n numbers\nend", "def next!() end", "def test_all_iteration_methods_work_on_any_collection_not_just_arrays\n # Ranges act like a collection\n result = (1..3).map { |item| item + 10 }\n assert_equal [11, 12, 13], result\n\n # Files act like a collection of lines. Mix-ins? Or does it just quack like\n # a collection-duck?\n File.open(\"example_file.txt\") do |file|\n upcase_lines = file.map { |line| line.strip.upcase }\n assert_equal ['THIS', 'IS', 'A', 'TEST'], upcase_lines\n end\n\n # NOTE: You can create your own collections that work with each,\n # map, select, etc.\n end", "def each_cons(arr, num_cons_elems)\n num_yields = arr.size - num_cons_elems + 1\n puts \"arr.size = #{arr.size} num_cons_elems = #{num_cons_elems} num_yields = #{num_yields}\"\n num_yields.times do |index|\n p *arr[index..(index + num_cons_elems - 1)]\n yield(*arr[index..(index + num_cons_elems - 1)])\n index += 1\n end\n nil\nend", "def each(&prc)\n link = first\n until link == self.tail\n prc.call(link)\n link = link.next\n end\n\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 print_list(array, first = 1)\n counter = first\n array.each do |item|\n puts \"#{yield counter} #{item}\"\n counter = counter.next\n end\nend", "def iterate_all\r\n\tcount = 0\r\n\twhile count < @num_prospectors\r\n\t puts 'Prospector ' + String(count + 1) + ' starting at Sutter Creek.'\r\n\t prospectors[count].iterate\r\n\t puts ' '\r\n\t count += 1\r\n\tend\r\n end", "def my_each(words)\n x = 0\n while words[x] != nil\n yield(words[x])\n x += 1\n end\n words\nend", "def each\n yield \"pizza\"\n yield \"spagetti\"\n yield \"salad\"\n yield \"bread\"\n yield \"water\"\n end", "def each\n \n nodo = @head\n while nodo != nil\n \n yield nodo.value\n nodo = nodo.next\n \n end\n \n end", "def each # And define each on top of next\n loop {yield self.next }\n end", "def looper\n i = 0\n while i < 20\n i += 1\n # break if i == 9\n # next if i.even?\n # return if i == 9\n puts i\n end\n puts \"done with the loop\"\nend", "def generateLoop2\n for i in 1...10 do #do optional\n puts i\n end\n end", "def test_0010_each\n @@log.debug \"test_0010_each starts\" if @@log.debug?\n count = 0\n @list.each do |elt|\n count += 1\n end\n assert_equal(4, count)\n @@log.debug \"test_0010_each ends\" if @@log.debug?\n end", "def number_loop_three(i)\n (0..i).each do |num|\n puts \"The number now is #{num}\" \n end \nend", "def each\n loop do\n @next += (@next % 10 == 3) ? 4 : 2\n yield @next\n end\n end", "def block_examples\n\n # calls each method on range ands passes it block\n # |i| is Ruby syntax for block variable\n # {} one way to indicate a clock\n (1..5).each { |i| puts 2 * i} # outputs 2 4 6 8 10\n\n # blocks can be more than one line using do..end syntax\n (1..5).each do |number|\n puts 2 * number\n puts '--'\n end\n\n # more block examples\n\n # 3.times takes a block with no variables\n 3.times { puts \"Betelgeuse!\" } # outputs \"Betelgeuse!\" three times\n\n # the map method returns the result of applying the given block to each element in the array or range\n # the ** notation is for 'power'\n (1..5).map { |i| i**2 } # => [1, 4, 9, 16, 25]\n\n # recall that %w makes string arrays\n %w[a b c] # => [\"a\", \"b\", \"c\"]\n %w[a b c].map { |char| char.upcase } # => [\"A\", \"B\", \"C\"]\n\n # array of alaphabet, shuffled then return first eight elements and join them\n ('a'..'z').to_a.shuffle[0..7].join # => \"mznpybuj\"\n end", "def each\n nodo1 = @lista_alimentos.head\n nodo2 = @gramos.head\n while (nodo1 != nil && nodo2 != nil)\n yield nodo1.value\n nodo1 = nodo1.next\n nodo2 = nodo2.next\n end\n end", "def \n \n list_dwarves(array)\n\n number_for_list = 1\n # X | 0 !!\n # *** Can still later/another time -|-1)\n \n array.each do |name| # <- More Appropriate |element| \n #\n # (1-|- number_for_list += 1\n #\n puts \"#{number_for_list}. #{name}!\" \n \n number_for_list += 1\n end\n \nend", "def each\n# And define each on top of next\nloop { yield self.next }\nend", "def each\n# And define each on top of next\nloop { yield self.next }\nend", "def take_number_iterate_array_print(number_input)\n # I have to set these up in here otherwise the method can't access them\n # Assign the starting number i.e. \"number_current\" to 0\n # Assign an empty array to \"numbers\"\n number_current = 0\n numbers = []\n while number_current < number_input \n puts \"Number top: #{number_current}\"\n numbers.push(number_current)\n\n # Take whatever number_current currently is and add 1 to it and save that back to number_current\n # If number_current is 0 we add 1 making it 1 and save that to number_current instead\n number_current += 1\n puts \"Array: #{numbers}\"\n puts \"Number bottom: #{number_current}\"\n end\n\n\tputs \"The numbers: \"\n\n # Iterate over each item in the array \"numbers\"\n # Pass each item to the \"num\" paramemter, or argument, in the anonymous function\n # puts \"num\", the currently iterated item from the array\n\tnumbers.each do |num|\n\t puts num\n\tend\nend", "def each # And define each on top of next\n loop { yield self.next }\n end", "def list(songs)\n i = 1\n songs.each do |song|\n puts \"#{i} #{song}\"\n i = i+1\n end\nend", "def nextLooping(number)\n for i in 1..10\n if i * number % 5 == 0\n next\n else\n puts i * number\n end\n end\n end", "def the_interview\n (1..100).each{ |n| puts n % 15 == 0 ? \"fizzbuzz\" : n % 3 == 0 ? \"fizz\" : n % 5 == 0 ? \"buzz\" : n }\n (0..99).reverse_each{|n| puts \"I have #{n} bottles.\"}\nend", "def iterate(itr)\n @left.iterate(itr)\n @right.iterate(itr)\n end", "def iterate\n raise \"You should implement this\"\n end", "def every_other\n i = 1\n numbers = []\n 50.times do\n numbers << i\n i+= 2\n end\n return numbers\nend", "def iterator()\n raise NotImplementedError\n end", "def while_loop_function(start)\n i = start\n numbers = []\n loop_limit = 6\n increment = 1\n\n while i < loop_limit\n puts \"At the top i is #{i}\"\n numbers.push(i)\n \n i += increment\n puts \"Numbers now: \", numbers\n puts \"At the bottom i is #{i}\"\n end\n \n puts \"The numbers: \"\n\n numbers.each {|num| puts num }\nend", "def test_each\n # codecite examples\n evens = Sequence.new(5, 2) {|a| a.last + 2} \n odds = Sequence.new(5, 1) {|a| a.last + 2}\n fibs = Sequence.new(5, 1, 1) {|a| a[-2] + a[-1]}\n # codecite examples\n \n assert_equal [2,4,6,8,10], evens.to_a\n assert_equal [1,3,5,7,9], odds.to_a\n assert_equal [1,1,2,3,5], fibs.to_a\n end", "def for_loop_counter\n numbers = (0 .. 6)\n numbers.each do |num|\n puts \"At the top num is #{num}\"\n if num > 0\n puts \"Numbers: now: \", numbers\n end\n end\nend", "def looper(stop_point)\n numbers = []\n # i = 0\n (0 ... stop_point).each do |i|\n puts \"at the top of i is #{i}\"\n numbers << i\n\n # i+= incrementer\n\n puts \"numbers is now: \", numbers\n puts \" at the bottom i is now #{i}\"\n end\n\n puts \"The numbers in the array: #{numbers} \"\n\n numbers.each do |num|\n puts \"in and .each #{num}\"\n end\n\nend", "def loop(limit, step)\n i = 0\n numbers = []\n\n while i < limit\n puts \"At the top i is #{i}\"\n numbers.push(i)\n\n i += step\n puts \"Numbers now: \", numbers\n puts \"At the bottom i is #{i}\"\n\n puts \"The numbers: \"\n numbers.each {|num| puts num }\n end\nend", "def each\n current_result = self\n begin \n last_result = current_result\n current_result.elements[:results].each do |result|\n\t# The collection of refs we are holding onto could grow without bounds, so dup\n\t# the ref\n\tyield result.dup\n end\n current_result = current_result.next_page if current_result.more_pages?\n end while !last_result.equal? current_result\n end", "def fizzbuzz(num)\n collection = (1..num).to_a\n collection.each do |num|\n if (num % 3 == 0) && (num % 5 != 0)\n puts \"Fizz #{num}\"\n elsif (num % 5 == 0) && (num % 3 != 0)\n puts \"Buzz #{num}\"\n elsif (num % 3 == 0) && (num % 5 == 0)\n puts \"FizzBuzz #{num}\"\n end\n end\nend", "def fizzbuzz\n (1..100).each do |num|\n puts fizz_buzz(num)\n end\nend", "def print_list\n\n # using 'each_with_index'\n #names.each_with_index do |name, index|\n # print_name(name, index)\n #end\n\n # using 'while'\n i = 0\n while i < @students.length do\n print_name(@students[i], i)\n i += 1\n end\nend", "def func(list)\n\n puts list[0]\n\n midpoint = list.length / 2\n\n array[0..midpoint-1].each do |element|\n puts element\n end\n\n 10.times do\n puts 'hello world'\n end\nend", "def printNums\r\n i = 1\r\n while i <= 5\r\n puts i\r\n\r\n i -= 1\r\n end\r\nend", "def each(*) end", "def print_items(electives)\n electives.each_with_index do |course, index| #each with index number\n puts \"#{index + 1}. #{course}\" #+1 b/c counting starts at 0\n end\nend", "def hello(array)\n i = 0\n collection = []\n while i < array.length\n collection << yield(array[i])\n i += 1\n end\n collection\nend", "def hello(array)\n i = 0\n collection = []\n while i < array.length\n collection << yield(array[i])\n i += 1\n end\n collection\nend", "def hello(array)\n i = 0\n collection = []\n while i < array.length\n collection << yield(array[i])\n i += 1\n end\n collection\nend" ]
[ "0.709693", "0.6446762", "0.6397178", "0.63688", "0.62057644", "0.61793727", "0.6155058", "0.6117979", "0.61143005", "0.60810184", "0.6020928", "0.59537506", "0.59340626", "0.59307384", "0.59307384", "0.58895665", "0.5867867", "0.5862016", "0.5822476", "0.5815044", "0.5811704", "0.58035547", "0.57948333", "0.57906926", "0.57707244", "0.57641286", "0.5759264", "0.5758986", "0.57571185", "0.5755713", "0.5749461", "0.57430786", "0.5735976", "0.5735877", "0.57337135", "0.57337135", "0.5713215", "0.57123977", "0.5704364", "0.56963605", "0.5690309", "0.56888777", "0.5688026", "0.56796354", "0.56796354", "0.5674132", "0.56731474", "0.56724685", "0.5671032", "0.5670063", "0.5669674", "0.5666376", "0.5664081", "0.5657055", "0.5652024", "0.5652024", "0.5652024", "0.5652024", "0.5652024", "0.5652024", "0.5650748", "0.56430316", "0.56384873", "0.56377846", "0.5636185", "0.5634243", "0.5629904", "0.5620808", "0.56139606", "0.5605441", "0.56030643", "0.56030184", "0.5590423", "0.5580758", "0.55803406", "0.55803406", "0.5580095", "0.5574853", "0.55700153", "0.55694014", "0.55662376", "0.5564101", "0.5557138", "0.5556644", "0.55547506", "0.5553596", "0.55503154", "0.55493677", "0.55386007", "0.5538045", "0.55288094", "0.5520425", "0.5520382", "0.5514393", "0.55142725", "0.5513253", "0.5499685", "0.5491686", "0.54899496", "0.54899496", "0.54899496" ]
0.0
-1